From 238bb2f23c74af4d17568a8c1cb95f3b7809ad48 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 16 Nov 2021 13:03:15 +0100 Subject: [PATCH 1/3] Conan integration in CMake --- .cproject | 20 +++++++++-- .settings/language.settings.xml | 8 ++--- CMakeLists.txt | 61 +++++++++++++++++++++++++++++---- conanfile.txt | 15 -------- scc | 2 +- 5 files changed, 77 insertions(+), 29 deletions(-) delete mode 100644 conanfile.txt diff --git a/.cproject b/.cproject index d31d49e..e2f7de7 100644 --- a/.cproject +++ b/.cproject @@ -19,7 +19,7 @@ - + @@ -273,6 +273,22 @@ true true + + CMAKE_BUILD_TOOL + $<cmake4eclipse_dyn> + all + true + true + true + + + make + + VERBOSE=1 + true + false + true + - + \ No newline at end of file diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 57bac22..40620f1 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -43,7 +43,7 @@ - + diff --git a/CMakeLists.txt b/CMakeLists.txt index 01d06c6..9a7a315 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.12) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/scc/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) project(SCC_Test) @@ -16,20 +18,16 @@ get_info_from_git() ### set the directory names of the submodules set(GIT_SUBMODULES scc) set(GIT_SUBMODULE_DIR_sc-components .) -### set each submodules's commit or tag that is to be checked out -### (leave empty if you want master) -#set(GIT_SUBMODULE_VERSION_sc-components 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd) +## set each submodules's commit or tag that is to be checked out +## (leave empty if you want master) set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH}) include(GNUInstallDirs) if(NOT NO_SUBMODULE_CHECK) include(Submodules) endif() -include(Conan) include(BuildType) -#enable_testing() - set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -75,7 +73,56 @@ else() endif() endif() -setup_conan(TARGETS) +########################################################## +## get conan packages +########################################################## +include(ConanInline) + +set(CONAN_BOOST_OPTIONS +boost:fPIC=True +boost:shared=True +boost:header_only=False +boost:without_context=True +boost:without_contract=True +boost:without_coroutine=True +boost:without_fiber=True +boost:without_graph=True +boost:without_graph_parallel=True +boost:without_iostreams=True +boost:without_json=True +boost:without_locale=True +boost:without_log=True +boost:without_math=True +boost:without_mpi=True +boost:without_nowide=True +boost:without_python=True +boost:without_random=True +boost:without_regex=True +boost:without_stacktrace=True +boost:without_test=True +boost:without_timer=True +boost:without_type_erasure=True +boost:without_wave=True +) +set(CONAN_PACKAGE_LIST fmt/6.1.2 boost/1.75.0 gsl-lite/0.37.0) +set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS}) +if(NOT DEFINED ENV{SYSTEMC_HOME}) + set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 systemc-cci/1.0.0) + set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc-cci:shared=False) +endif() +conan_check() +conan_add_remote(NAME minres URL https://artifactory.minres.com/artifactory/api/conan/oss) +conan_cmake_configure(REQUIRES ${CONAN_PACKAGE_LIST} + GENERATORS cmake_find_package + OPTIONS ${CONAN_PACKAGE_OPTIONS} + ) + +conan_install() +find_package(fmt) +find_package(gsl-lite) +find_package(SystemCLanguage) +find_package(systemc-cci) +######################################################################################## # This line finds the boost lib and headers. set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install. diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 368105a..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,15 +0,0 @@ -[requires] - fmt/6.1.2 - boost/1.75.0 - gsl-lite/0.37.0 - systemc/2.3.3 - #systemc-scv/2.0.1 - systemc-cci/1.0.0 - -[generators] - cmake - -[options] - fmt:header_only=True - systemc:shared=True - systemc-cci:shared=True \ No newline at end of file diff --git a/scc b/scc index 2a11251..6d816e1 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 2a11251ae63f3470245e13f4f576e4c93d2f243c +Subproject commit 6d816e1c9a2adc0e0b74a6473e6ecdb4392de13a From 8895fa0c26aa8522f3d5ea8c01aaca744056adb6 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 16 Nov 2021 13:40:35 +0100 Subject: [PATCH 2/3] Check if SystemC_INCLUDE_DIR is already set --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index 6d816e1..e266bcb 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 6d816e1c9a2adc0e0b74a6473e6ecdb4392de13a +Subproject commit e266bcbeea7153136c689170ab9f466f13e96571 From 95faedd3d0e44b99e5177abfaa5146de87aded24 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 16 Nov 2021 16:15:51 +0100 Subject: [PATCH 3/3] b2 and ZLIB libs from conan for CentOS7 --- .cproject | 10 +++++++++- CMakeLists.txt | 20 +++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.cproject b/.cproject index e2f7de7..95e64ad 100644 --- a/.cproject +++ b/.cproject @@ -58,6 +58,7 @@ + @@ -283,12 +284,19 @@ make - VERBOSE=1 true false true + + CMAKE_BUILD_TOOL + $<cmake4eclipse_dyn> + clean + true + true + true + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a7a315..16659c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,21 @@ endif() ## get conan packages ########################################################## include(ConanInline) +conan_check() +conan_add_remote(NAME minres URL https://artifactory.minres.com/artifactory/api/conan/oss) + +# Boost on CentOS 7 quirks: the b2 of conan-center is build against a newer libstdc++ and therefore does not run +# with the oooooold libs on CentOS 7. Therefore we build our own version of b2 if it is not there +set(B2_META $ENV{HOME}/.conan/data/b2/4.5.0/_/_/metadata.json) +if(DEFINED ENV{CONAN_USER_HOME}) + set(B2_META $ENV{CONAN_USER_HOME}/.conan/data/b2/4.5.0/_/_/metadata.json) +endif() +if(NOT EXISTS ${B2_META}) + conan_cmake_configure(REQUIRES b2/4.5.0) + conan_cmake_autodetect(settings) + conan_cmake_install(PATH_OR_REFERENCE . BUILD b2 SETTINGS ${settings}) +endif() +# Boost on CentOS 7 quirks end set(CONAN_BOOST_OPTIONS boost:fPIC=True @@ -104,14 +119,12 @@ boost:without_timer=True boost:without_type_erasure=True boost:without_wave=True ) -set(CONAN_PACKAGE_LIST fmt/6.1.2 boost/1.75.0 gsl-lite/0.37.0) +set(CONAN_PACKAGE_LIST fmt/6.1.2 zlib/1.2.11 boost/1.75.0 gsl-lite/0.37.0) set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS}) if(NOT DEFINED ENV{SYSTEMC_HOME}) set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 systemc-cci/1.0.0) set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc-cci:shared=False) endif() -conan_check() -conan_add_remote(NAME minres URL https://artifactory.minres.com/artifactory/api/conan/oss) conan_cmake_configure(REQUIRES ${CONAN_PACKAGE_LIST} GENERATORS cmake_find_package OPTIONS ${CONAN_PACKAGE_OPTIONS} @@ -119,6 +132,7 @@ conan_cmake_configure(REQUIRES ${CONAN_PACKAGE_LIST} conan_install() find_package(fmt) +find_package(ZLIB) find_package(gsl-lite) find_package(SystemCLanguage) find_package(systemc-cci)