Skip to content

Commit

Permalink
Compatibility with conan 2 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Expander authored Jan 12, 2024
1 parent 240cfb3 commit 521f397
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 112 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest]

env:
BUILD_TYPE: Release

steps:
- uses: actions/checkout@v1
- name: Set up Python
Expand All @@ -19,16 +22,17 @@ jobs:
python-version: '3.x'
- name: install conan
run: pip install conan
- name: detect conan profile
run: conan profile detect --force
- name: install dependencies
run: conan install .
run: conan install . --build=missing -s build_type=${{ env.BUILD_TYPE }}
- name: cmake
run: cmake . -DCMAKE_TOOLCHAIN_FILE=./conan_paths.cmake
run: cmake . -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
env:
CXX: g++-10
FC: gfortran-10
FC: gfortran-13
- name: cmake build
run: cmake --build .
run: cmake --build . --config ${{ env.BUILD_TYPE }}
- name: ctest
run: ctest
run: ctest -C ${{ env.BUILD_TYPE }}
env:
CTEST_OUTPUT_ON_FAILURE: 1
26 changes: 18 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.5)
project(Himalaya LANGUAGES CXX Fortran)

option(BUILD_EXAMPLES "Build Himalaya examples" ON)
Expand All @@ -9,7 +9,7 @@ include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

# require an Eigen installation
find_package(Eigen3 3.0 REQUIRED)
find_package(Eigen3 3.0 REQUIRED NO_MODULE)

# search for Mathematica
if(ENABLE_MATHEMATICA)
Expand Down Expand Up @@ -83,22 +83,26 @@ set(DSZ_LIBSOURCES
add_library(DSZ_static STATIC ${DSZ_LIBSOURCES})
set_target_properties(DSZ_static PROPERTIES OUTPUT_NAME DSZ)
target_include_directories(DSZ_static
PUBLIC
${EIGEN3_INCLUDE_DIR}
PRIVATE
${PRIVATE_HEADERS}
)
target_link_libraries(DSZ_static
PUBLIC
Eigen3::Eigen
)
add_library(Himalaya::DSZ::static ALIAS DSZ_static)

# DSZ shared library
add_library(DSZ_shared SHARED ${DSZ_LIBSOURCES})
set_target_properties(DSZ_shared PROPERTIES OUTPUT_NAME DSZ)
target_include_directories(DSZ_shared
PUBLIC
${EIGEN3_INCLUDE_DIR}
PRIVATE
${PRIVATE_HEADERS}
)
target_link_libraries(DSZ_shared
PUBLIC
Eigen3::Eigen
)
add_library(Himalaya::DSZ::shared ALIAS DSZ_shared)

# Himalaya static library
Expand All @@ -107,10 +111,13 @@ set_target_properties(Himalaya_static PROPERTIES OUTPUT_NAME Himalaya)
target_include_directories(Himalaya_static
PUBLIC
${PUBLIC_HEADERS}
${EIGEN3_INCLUDE_DIR}
PRIVATE
${PRIVATE_HEADERS}
)
target_link_libraries(Himalaya_static
PUBLIC
Eigen3::Eigen
)
add_library(Himalaya::Himalaya::static ALIAS Himalaya_static)

# Himalaya shared library
Expand All @@ -120,10 +127,13 @@ target_link_libraries(Himalaya_shared PUBLIC DSZ_shared)
target_include_directories(Himalaya_shared
PUBLIC
${PUBLIC_HEADERS}
${EIGEN3_INCLUDE_DIR}
PRIVATE
${PRIVATE_HEADERS}
)
target_link_libraries(Himalaya_shared
PUBLIC
Eigen3::Eigen
)
add_library(Himalaya::Himalaya::shared ALIAS Himalaya_shared)

# generic targets
Expand Down
97 changes: 0 additions & 97 deletions cmake/FindEigen3.cmake

This file was deleted.

3 changes: 2 additions & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
eigen/[>=3.1]

[generators]
cmake_paths
CMakeDeps
CMakeToolchain

0 comments on commit 521f397

Please # to comment.