diff --git a/CMakeLists.txt b/CMakeLists.txt index a4403eb54544815a280ca8782eee23501c6027ce..1ed52bb5a5e162e9783d5c956266ba5a9ad46eda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,30 @@ else (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif () message (STATUS "Build type is: ${CMAKE_BUILD_TYPE}") endif (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) +# +#+++++++++++++++++++++++++++++ +# Setup external dependencies. + +# +# the version of the cmake-conan project we use for build. +set (CMAKE_CONAN_VERSION "v0.13") + +# download the cmake-conan integration +if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") + message (STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") + file (DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/${CMAKE_CONAN_VERSION}/conan.cmake" + "${CMAKE_BINARY_DIR}/conan.cmake" + TLS_VERIFY ON) +endif () + +# add the cmake-conan integration +include (${CMAKE_BINARY_DIR}/conan.cmake) + +# download and build all dependencies +conan_cmake_run (CONANFILE conanfile.txt + BASIC_SETUP CMAKE_TARGETS + BUILD missing) + # #+++++++++++++++++++++++++++++ # Coverage @@ -176,26 +200,6 @@ set (Python_ADDITIONAL_VERSIONS 3) find_package (PythonInterp 3 REQUIRED) # #+++++++++++++++++++++++++++++ -# get Eigen3 -# -find_package (Eigen3 3.3.4 REQUIRED) -# -#+++++++++++++++++++++++++++++ -# get catch2 -# -find_package (Catch2 2.13.2 REQUIRED) -# -#+++++++++++++++++++++++++++++ -# use spdlog -# -add_subdirectory (externals/spdlog) -# -#+++++++++++++++++++++++++++++ -# use zlib -# -find_package (ZLIB REQUIRED) -# -#+++++++++++++++++++++++++++++ # get phys_units # find_package (PhysUnits REQUIRED) @@ -216,8 +220,8 @@ target_link_libraries ( CORSIKA8 INTERFACE PhysUnits - Eigen3::Eigen - spdlog::spdlog + CONAN_PKG::eigen + CONAN_PKG::spdlog ) # those are needed, since some headers (namely GeneratedParticleProperties.inc) are produced by python script from ParticleData.xml add_subdirectory (src) diff --git a/cmake/CorsikaUtilities.cmake b/cmake/CorsikaUtilities.cmake index dc2728b53fa26fa130a681dd8b047223a51bcdaf..919aa819f3b69de30d5f42ac522b0482169a13ec 100644 --- a/cmake/CorsikaUtilities.cmake +++ b/cmake/CorsikaUtilities.cmake @@ -57,8 +57,8 @@ function (CORSIKA_ADD_TEST) endif () add_executable (${name} ${sources}) - target_link_libraries (${name} CORSIKA8 Catch2 CorsikaTesting) - target_compile_options (${name} PRIVATE -g) # do not skip asserts + target_link_libraries (${name} CORSIKA8 CONAN_PKG::catch2) + target_compile_options (${name} PRIVATE -g) # do not skip asserts target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/) if (CORSIKA_SANITIZERS_ENABLED) diff --git a/cmake/FindCatch2.cmake b/cmake/FindCatch2.cmake deleted file mode 100644 index 19bd4387611896390fafce1d1c6b533f1bd7bb02..0000000000000000000000000000000000000000 --- a/cmake/FindCatch2.cmake +++ /dev/null @@ -1,8 +0,0 @@ -add_library (Catch2 INTERFACE) - -target_compile_options (Catch2 - INTERFACE - -I${CMAKE_SOURCE_DIR}/externals/catch2 - ) - -set (Catch2_FOUND True) diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000000000000000000000000000000000000..85c1238b40b290ca181660b0a8bda665b1c88c5b --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,9 @@ +[requires] +spdlog/1.8.0 +catch2/2.13.3 +eigen/3.3.8 +boost/1.74.0 +zlib/1.2.11 + +[generators] +cmake diff --git a/externals/cnpy/CMakeLists.txt b/externals/cnpy/CMakeLists.txt index 4a115728d660361d0159c1c309efdabb332b51c3..8fbd839c725b9e42d256dec93d0ccdd7cf7e525e 100644 --- a/externals/cnpy/CMakeLists.txt +++ b/externals/cnpy/CMakeLists.txt @@ -27,7 +27,7 @@ set_target_properties ( target_link_libraries ( cnpy PUBLIC - ZLIB::ZLIB + CONAN_PKG::zlib ) target_include_directories (