Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get CI healthy on all three platforms ✅ #54

Merged
merged 24 commits into from
Apr 16, 2024
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
46 changes: 26 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,46 @@ on:

jobs:
base:
name: ${{ matrix.platform }} with OpenMP ${{ matrix.openmp }}
name: FGT ${{ matrix.platform }} with OpenMP ${{ matrix.openmp }}
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
platform: ['ubuntu-latest', 'macos-latest']
platform: ['ubuntu-latest', 'macos-14', 'windows-latest']
openmp: ['ON','OFF']
exclude:
- platform: 'macos-latest'
- platform: 'macos-14'
openmp: 'ON'
- platform: 'windows-latest'
openmp: 'ON'
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.platform == 'windows-latest'

- uses: mamba-org/setup-micromamba@v1
with:
channels: conda-forge
auto-update-conda: true
- name: Setup
init-shell: bash
environment-file: scripts/${{ matrix.platform }}-environment.yml
environment-name: "fgt-build"
cache-environment: true
cache-downloads: true
- name: Create Build Directory
shell: bash -l {0}
run: |
conda update -n base -c defaults conda -y
conda install ninja cmake ninja eigen compilers jsoncpp openmp -y
mkdir build
- name: CMake
shell: bash -l {0}
env:
WITH_OPENMP: ${{ matrix.openmp }}
working-directory: ./build
run: |
mkdir build
cd build
cmake .. \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DWITH_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_OPENMP=${{ matrix.openmp }} \
-DBUILD_SHARED_LIBS=ON
source ../scripts/cmake/${{ matrix.platform }}.sh
- name: Build
shell: bash -l {0}
working-directory: ./build
Expand All @@ -53,4 +58,5 @@ jobs:
- name: Test
shell: bash -l {0}
working-directory: ./build
run: ctest
run: |
source ../scripts/test/${{ matrix.platform }}.sh
22 changes: 7 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.13)
set(PROJECT_VERSION 0.4.10)
set(PROJECT_SOVERSION 0)
set(CMAKE_CXX_STANDARD 17)

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW) # Project version
project(fgt LANGUAGES CXX C VERSION ${PROJECT_VERSION})
else()
project(fgt CXX C)
endif()
project(fgt LANGUAGES CXX C VERSION ${PROJECT_VERSION})

if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) # Quoted variable in if statements
endif()
Expand Down Expand Up @@ -38,8 +34,8 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) # Quotes variables in IF statments
endif()

find_package(Eigen3 3.1 REQUIRED)
message(STATUS "[fgt] Eigen3 version: ${EIGEN3_VERSION}")
find_package(Eigen3 3.1 REQUIRED CONFIG)
message(STATUS "[fgt] Eigen3 version: ${EIGEN3_VERSION_STRING}")

set(GTEST_SOURCE_DIR ${PROJECT_SOURCE_DIR}/vendor/googletest-release-1.10.0)
set(NANOFLANN_SOURCE_DIR ${PROJECT_SOURCE_DIR}/vendor/nanoflann-1.1.9)
Expand All @@ -54,7 +50,7 @@ endif()

if(WIN32)
add_library(Library-C++
STATIC
STATIC
src/cluster.cpp
src/direct.cpp
src/direct_tree.cpp
Expand All @@ -66,6 +62,7 @@ if(WIN32)
)
else()
add_library(Library-C++
SHARED
src/cluster.cpp
src/direct.cpp
src/direct_tree.cpp
Expand Down Expand Up @@ -149,11 +146,6 @@ if(WITH_TESTS)
set(GOOGLETEST_VERSION 1.10.0)
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/googletest-release-1.10.0/googletest")

set_target_properties(gtest PROPERTIES MACOSX_RPATH ON)
target_compile_options(gtest PUBLIC -std=c++11)
set_target_properties(gtest_main PROPERTIES MACOSX_RPATH ON)
target_compile_options(gtest_main PUBLIC -std=c++11)

add_subdirectory(test)
endif()

Expand Down
81 changes: 0 additions & 81 deletions cmake/FindEigen3.cmake

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/cmake/macos-14.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cmake .. \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DWITH_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON
9 changes: 9 additions & 0 deletions scripts/cmake/ubuntu-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

cmake .. \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DWITH_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_OPENMP=$WITH_OPENMP \
-DBUILD_SHARED_LIBS=ON
12 changes: 12 additions & 0 deletions scripts/cmake/windows-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

pwd
where cl.exe
export CC=cl.exe
export CXX=cl.exe
cmake .. \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DWITH_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-Dgtest_force_shared_crt=ON
10 changes: 10 additions & 0 deletions scripts/macos-14-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: fgt-build
channels:
- conda-forge
dependencies:
- eigen
- cmake
- ninja
- compilers
- jsoncpp

3 changes: 3 additions & 0 deletions scripts/test/macos-14.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

ctest -VV --output-on-failure
3 changes: 3 additions & 0 deletions scripts/test/ubuntu-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

ctest -VV --output-on-failure
3 changes: 3 additions & 0 deletions scripts/test/windows-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

ctest -VV --output-on-failure
11 changes: 11 additions & 0 deletions scripts/ubuntu-latest-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: fgt-build
channels:
- conda-forge
dependencies:
- eigen
- cmake
- ninja
- compilers
- jsoncpp
- openmp

10 changes: 10 additions & 0 deletions scripts/windows-latest-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: fgt-build
channels:
- conda-forge
dependencies:
- eigen
- cmake
- ninja
- jsoncpp
- compilers

5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ function(fgt_test target)
-Wno-unknown-pragmas
)
endif()
add_test(NAME ${target} COMMAND ${target})
add_test(NAME ${target}
COMMAND ${target}
WORKING_DIRECTORY
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/..")
endfunction()

configure_file(
Expand Down