Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,37 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Configure trx-cpp
- name: Configure trx-cpp (macOS)
if: runner.os == 'macOS'
run: |
BREW_PREFIX="$(brew --prefix)"
cmake -S . -B build \
-G Ninja \
-DTRX_USE_CONAN=OFF \
-DTRX_BUILD_TESTS=ON \
-DTRX_BUILD_EXAMPLES=ON \
-DTRX_BUILD_TESTS=OFF \
-DTRX_BUILD_EXAMPLES=OFF \
-DTRX_ENABLE_NIFTI=ON \
-DCMAKE_BUILD_TYPE=Release \
${{ runner.os == 'Windows' && format('-DCMAKE_TOOLCHAIN_FILE={0}/vcpkg/scripts/buildsystems/vcpkg.cmake', github.workspace) || '' }}
-DCMAKE_PREFIX_PATH="${BREW_PREFIX}" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/install"

- name: Configure trx-cpp (Windows)
if: runner.os == 'Windows'
run: >
cmake -S . -B build
-G Ninja
-DTRX_USE_CONAN=OFF
-DTRX_BUILD_TESTS=OFF
-DTRX_BUILD_EXAMPLES=OFF
-DTRX_ENABLE_NIFTI=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install

- name: Build and install trx-cpp
run: cmake --build build --config Release --target install

- name: Configure downstream consumer
- name: Generate downstream consumer project
shell: bash
run: |
consumer="${GITHUB_WORKSPACE}/ci-consumer"
Expand All @@ -311,10 +327,23 @@ jobs:
}
EOF

cmake -S "$consumer" -B "$consumer/build" \
- name: Configure downstream consumer (macOS)
if: runner.os == 'macOS'
run: |
BREW_PREFIX="$(brew --prefix)"
cmake -S ci-consumer -B ci-consumer/build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/build"
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/install;${BREW_PREFIX}"

- name: Configure downstream consumer (Windows)
if: runner.os == 'Windows'
run: >
cmake -S ci-consumer -B ci-consumer/build
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Build downstream consumer
run: cmake --build ci-consumer/build --config Release
run: cmake --build ci-consumer/build --config Release
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ endif()
# ── Core library ────────────────────────────────────────────────────────────
add_library(trx
src/trx.cpp
src/legacy_io.cpp
src/detail/dtype_helpers.cpp
include/trx/trx.h
include/trx/trx.tpp
Expand All @@ -202,6 +203,12 @@ target_include_directories(trx
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
if(WIN32)
target_compile_definitions(trx PUBLIC NOMINMAX)
if(MSVC)
target_compile_definitions(trx PUBLIC _CRT_SECURE_NO_WARNINGS)
endif()
endif()
# Fallback for system libzip packages that don't expose include dirs via
# their CMake targets. Only needed for distro packages with broken configs.
get_target_property(_trx_libzip_includes ${TRX_LIBZIP_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
Expand All @@ -223,6 +230,16 @@ if(TRX_BUILD_TESTS)
if(NOT GTest_FOUND)
find_package(GTest QUIET)
endif()
if(NOT GTest_FOUND)
message(STATUS "GTest not found; fetching v1.14.0")
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
FetchContent_MakeAvailable(googletest)
set(GTest_FOUND TRUE)
endif()
if(GTest_FOUND)
enable_testing()
add_subdirectory(tests)
Expand Down Expand Up @@ -272,6 +289,12 @@ if(TRX_ENABLE_NIFTI)
${TRX_EIGEN3_TARGET}
${TRX_ZLIB_TARGET}
)
if(WIN32)
target_compile_definitions(trx-nifti PUBLIC NOMINMAX)
if(MSVC)
target_compile_definitions(trx-nifti PUBLIC _CRT_SECURE_NO_WARNINGS)
endif()
endif()
endif()

# ── Examples ────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ else()
endif()

add_executable(bench_trx_realdata bench_trx_realdata.cpp)
target_link_libraries(bench_trx_realdata PRIVATE trx benchmark::benchmark)
target_link_libraries(bench_trx_realdata PRIVATE trx ${TRX_LIBZIP_TARGET} benchmark::benchmark)
target_compile_features(bench_trx_realdata PRIVATE cxx_std_17)
Loading
Loading