diff --git a/.github/workflows/ctest.yml b/.github/workflows/ctest.yml index db4ec2a..0ada805 100644 --- a/.github/workflows/ctest.yml +++ b/.github/workflows/ctest.yml @@ -8,17 +8,32 @@ on: branches: ["main", "dev"] workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + # Define the matrix for different operating systems jobs: build-and-test: - name: ${{ matrix.os }} / CMake ${{ matrix.cmakeVersion }} + name: ${{ matrix.os }} / ${{ matrix.architecture }} / CMake ${{ matrix.cmakeVersion }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - # CMake >= 3.21 is required to use "--preset " and discover generators - cmakeVersion: ["3.21", latest] - + os: + - ubuntu-latest + - macos-latest + - windows-latest + architecture: [arm64, x64, x86] + cmakeVersion: ["3.21", latest] # CMake >= 3.21 is required to use "--preset " and discover generators + exclude: + - os: macos-latest + architecture: x86 + - os: windows-latest + architecture: arm64 + - os: ubuntu-latest + architecture: arm64 + - os: ubuntu-latest + architecture: x86 steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 347d0ef..d7fbda4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,20 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: + - ubuntu-latest + - macos-latest + - windows-latest + - windows-2019 # Used for Windows 32-bit builds + architecture: [arm64, x64] + cmakeVersion: ["3.21", latest] # CMake >= 3.21 is required to use "--preset " and discover generators + exclude: # Only use x64 strategies for Linux and Windows + - os: windows-latest + architecture: arm64 + - os: windows-2019 + architecture: arm64 + - os: ubuntu-latest + architecture: arm64 steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/CITATION.cff b/CITATION.cff index 549da1c..a5b765e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -27,8 +27,9 @@ authors: Institute for Telecommunication Sciences address: 325 Broadway city: Boulder - country: CO + country: US post-code: '80305' + region: Colorado alias: NTIA/ITS email: code@ntia.gov website: 'https://its.ntia.gov' diff --git a/CMakeLists.txt b/CMakeLists.txt index 632a364..df754bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,28 @@ # >=3.14 required for GoogleTest v1.12.x cmake_minimum_required(VERSION 3.14 FATAL_ERROR) +# If on macOS, handle arm64/x86_64 architectures (must be done before project()) +if (APPLE) + # Get the current platform's native architecture + execute_process( + COMMAND uname -m + RESULT_VARIABLE result + OUTPUT_VARIABLE MACOS_NATIVE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + message(STATUS "Current macOS architecture is " ${MACOS_NATIVE_ARCHITECTURE}) + + # If running on Apple silicon, try a universal build. Otherwise, a native build. + if ((CMAKE_GENERATOR STREQUAL "Xcode") AND (MACOS_NATIVE_ARCHITECTURE STREQUAL "arm64")) + set(CMAKE_OSX_ARCHITECTURE "arm64;x86_64" CACHE STRING "") + set(PROPLIB_ARCHITECTURE "macOS_universal") + message(STATUS "Configured for universal macOS build") + else () + set(PROPLIB_ARCHITECTURE MACOS_NATIVE_ARCHITECTURE) + message(STATUS "Configured for native macOS build") + endif () +endif () + ########################################### ## PROJECT METADATA ########################################### @@ -49,15 +71,25 @@ target_compile_features(proplib_compiler_flags INTERFACE cxx_std_11) set(gcc_like_cxx "$") set(msvc_cxx "$") target_compile_options(proplib_compiler_flags INTERFACE - "$<${gcc_like_cxx}:$>" - "$<${msvc_cxx}:$>" + # For GCC-like compilers in any configuration + "$<${gcc_like_cxx}:$>" + # For GCC-like compilers in Release configurations + "$<${gcc_like_cxx}:$<$:-O3;-DNDEBUG>>" + # For GCC-like compilers in Debug configurations + "$<${gcc_like_cxx}:$<$:-g;-O0>>" + # For MSVC compiler in any configuration + "$<${msvc_cxx}:$>" + # For MSVC compiler in Release configurations + "$<${msvc_cxx}:$<$:/O2;/DNDEBUG>>" + # For MSVC compiler in Debug configurations + "$<${msvc_cxx}:$<$:/Od;/Zi>>" ) # Enable Hot Reload for MSVC compilers if supported. if (POLICY CMP0141) cmake_policy(SET CMP0141 NEW) set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$,$>,$<$:EditAndContinue>,$<$:ProgramDatabase>>") -endif() +endif () # control where the static and shared libraries are built set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" CACHE STRING "Set the CMAKE Archive Output Directory") diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index 75b6390..f9011fe 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -20,7 +20,7 @@ std::string getDataDirectory() { appendDirectorySep(dataDir); dataDir += "extern"; appendDirectorySep(dataDir); - dataDir += "p2108-test-data"; + dataDir += "p2108-test-data"; // Name of data directory as cloned in the `extern` directory appendDirectorySep(dataDir); return dataDir; }