Skip to content

Commit

Permalink
Merge remote-tracking branch 'proplib-template/main' into cross-platf…
Browse files Browse the repository at this point in the history
…orm-cli-driver
  • Loading branch information
aromanielloNTIA committed Nov 26, 2024
2 parents 1e609df + bcb09a2 commit f2104af
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 11 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/ctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <presetName>" 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 <presetName>" 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
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <presetName>" 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
Expand Down
3 changes: 2 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
website: 'https://its.ntia.gov'
Expand Down
38 changes: 35 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
###########################################
Expand Down Expand Up @@ -49,15 +71,25 @@ target_compile_features(proplib_compiler_flags INTERFACE cxx_std_11)
set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
target_compile_options(proplib_compiler_flags INTERFACE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
"$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>"
# For GCC-like compilers in any configuration
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
# For GCC-like compilers in Release configurations
"$<${gcc_like_cxx}:$<$<CONFIG:Release>:-O3;-DNDEBUG>>"
# For GCC-like compilers in Debug configurations
"$<${gcc_like_cxx}:$<$<CONFIG:Debug>:-g;-O0>>"
# For MSVC compiler in any configuration
"$<${msvc_cxx}:$<BUILD_INTERFACE:/W3;/Gz>>"
# For MSVC compiler in Release configurations
"$<${msvc_cxx}:$<$<CONFIG:Release>:/O2;/DNDEBUG>>"
# For MSVC compiler in Debug configurations
"$<${msvc_cxx}:$<$<CONFIG:Debug>:/Od;/Zi>>"
)

# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>: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")
Expand Down
2 changes: 1 addition & 1 deletion tests/TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f2104af

Please sign in to comment.