From ddf1e2ab18eea1dc7130e84baf14c92a7c54ff30 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 13:37:17 +0100 Subject: [PATCH 1/8] Removed FindNetCDF.cmake. --- scripts/cmake/FindNetCDF.cmake | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 scripts/cmake/FindNetCDF.cmake diff --git a/scripts/cmake/FindNetCDF.cmake b/scripts/cmake/FindNetCDF.cmake deleted file mode 100644 index c0358fee1db..00000000000 --- a/scripts/cmake/FindNetCDF.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# * Find NetCDF Find the native NetCDF includes and library - -# TODO: - Check for system netcdf - Make CXX a component - -# C -find_path( - NETCDF_INCLUDES_C - NAMES netcdf.h - HINTS ${NETCDF_ROOT} - PATH_SUFFIXES include -) -find_library( - NETCDF_LIBRARIES_C - NAMES netcdf - HINTS ${NETCDF_ROOT} - PATH_SUFFIXES lib -) - -# CXX -find_path( - NETCDF_INCLUDES_CXX - NAMES netcdf - HINTS ${NETCDF_CXX_ROOT} - PATH_SUFFIXES include -) -find_library( - NETCDF_LIBRARIES_CXX - NAMES netcdf_c++4 netcdf-cxx4 - HINTS ${NETCDF_CXX_ROOT} - PATH_SUFFIXES lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - NetCDF DEFAULT_MSG NETCDF_LIBRARIES_C NETCDF_LIBRARIES_CXX - NETCDF_INCLUDES_C NETCDF_INCLUDES_CXX -) From ae42b612feb7c6d1fe72cdb970ef04ddf6c3778c Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 13:38:12 +0100 Subject: [PATCH 2/8] [cmake] Disabled Conan for the moment. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24725b38481..b3343021d9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,16 +76,16 @@ include(PythonSetup) include(ProcessesSetup) include(ProjectSetup) include(Functions) -include(ConanSetup) +# include(ConanSetup) include(CompilerSetup) include(JobPools) include(Find) include(DependenciesExternalProject) include(Dependencies) # Hack for Conan (msvc) gui build. Also linking to ${CONAN_LIBS} globally -if(OGS_USE_CONAN AND OGS_USE_NETCDF) - link_libraries($<$:zlib.lib> ${CONAN_LIBS}) -endif() +#if(OGS_USE_CONAN AND OGS_USE_NETCDF) +# link_libraries($<$:zlib.lib> ${CONAN_LIBS}) +#endif() include(DocumentationSetup) include(test/Test) include(Coverage) From 693651473aeb008ca2c0131e8a0995d65015024e Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 13:40:31 +0100 Subject: [PATCH 3/8] [cmake] Use config mode for netcdf, add netcdf-cxx4 via CPM. --- scripts/cmake/Dependencies.cmake | 28 ++++++++++++++++++++++++++++ scripts/cmake/Find.cmake | 6 ------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index 7d0fd120818..5fc291c50b2 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -443,6 +443,34 @@ if(OGS_BUILD_UTILS) endif() endif() +if(OGS_USE_NETCDF) + find_package(netCDF CONFIG REQUIRED) + find_library( + NETCDF_LIBRARIES_CXX + NAMES netcdf_c++4 netcdf-cxx4 + ) + if(NOT ${NETCDF_LIBRARIES_CXX}) + CPMAddPackage( + NAME netcdf-cxx4 + GIT_REPOSITORY https://github.com/Unidata/netcdf-cxx4 + VERSION 4.3.1 + EXCLUDE_FROM_ALL YES + SOURCE_SUBDIR cxx4 + OPTIONS "NCXX_ENABLE_TESTS OFF" + ) + set_target_properties(netCDF::netcdf PROPERTIES INTERFACE_LINK_LIBRARIES "") # fix win installed config + target_link_libraries(netcdf-cxx4 PUBLIC netCDF::netcdf) + else() + find_path( + NETCDF_INCLUDES_CXX + NAMES netcdf + ) + add_library(netcdf-cxx4 INTERFACE IMPORTED) + target_include_directories(netcdf-cxx4 INTERFACE ${NETCDF_INCLUDES_CXX}) + target_link_libraries(netcdf-cxx4 INTERFACE ${NETCDF_LIBRARIES_CXX} netCDF::netcdf) + endif() +endif() + # Disable warnings if(WIN32 AND VTK_ADDED) list(APPEND DISABLE_WARNINGS_TARGETS vtksys) diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index f692ad304fc..3439386c7cb 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -61,12 +61,6 @@ if(OGS_BUILD_GUI) list(APPEND CMAKE_BUILD_RPATH ${Qt5_DIR}/../..) endif() -if(OGS_USE_NETCDF) - set(NETCDF_ROOT ${CONAN_NETCDF-C_ROOT}) - set(NETCDF_CXX_ROOT ${CONAN_NETCDF-CXX_ROOT}) - find_package(NetCDF REQUIRED) -endif() - # geotiff ## find_package(GEOTIFF) From 8c05cc7766075f1b646f49b63cbbfc3009139908 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 13:42:43 +0100 Subject: [PATCH 4/8] [cmake] Link to netcdf-cxx4. --- Applications/DataExplorer/VtkVis/CMakeLists.txt | 12 +----------- Applications/Utils/FileConverter/CMakeLists.txt | 5 +---- GeoLib/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index 6413386d71c..ce48d92411a 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -53,17 +53,7 @@ target_link_libraries( ) if(OGS_USE_NETCDF) - target_link_libraries( - VtkVisFilter PUBLIC ${NETCDF_LIBRARIES_CXX} ${NETCDF_LIBRARIES_C} - ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} - ) - # Workaround for system installed VTK (tested on arch) - if(NOT OGS_USE_CONAN) - target_include_directories( - VtkVisFilter SYSTEM PUBLIC ${NETCDF_INCLUDES_C} - ${NETCDF_INCLUDES_CXX} - ) - endif() + target_link_libraries(VtkVisFilter PUBLIC netcdf-cxx4) add_autogen_include(VtkVisFilter) endif() diff --git a/Applications/Utils/FileConverter/CMakeLists.txt b/Applications/Utils/FileConverter/CMakeLists.txt index 1050fcbe834..15a80eb11d7 100644 --- a/Applications/Utils/FileConverter/CMakeLists.txt +++ b/Applications/Utils/FileConverter/CMakeLists.txt @@ -36,8 +36,5 @@ if(TARGET ConvertSHPToGLI) endif() if(TARGET NetCdfConverter) - target_link_libraries( - NetCdfConverter ${NETCDF_LIBRARIES_CXX} ${NETCDF_LIBRARIES_C} - ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} - ) + target_link_libraries(NetCdfConverter netcdf-cxx4) endif() diff --git a/GeoLib/CMakeLists.txt b/GeoLib/CMakeLists.txt index 2c45df07e50..886db753017 100644 --- a/GeoLib/CMakeLists.txt +++ b/GeoLib/CMakeLists.txt @@ -23,7 +23,7 @@ target_link_libraries( if(OGS_USE_NETCDF) target_link_libraries( GeoLib - PRIVATE ${NETCDF_LIBRARIES_CXX} ${NETCDF_LIBRARIES_C} + PRIVATE netcdf-cxx4 ) target_compile_definitions(GeoLib PRIVATE OGS_USE_NETCDF) endif() From b5605fd5301cc6fc1a57e5224e0c97a69064d5db Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 14:58:00 +0100 Subject: [PATCH 5/8] Removed Conan. --- .gitignore | 5 - .pre-commit-config.yaml | 4 +- CMakeLists.txt | 9 - scripts/ci/extends/template-build-linux.yml | 1 - scripts/ci/jobs/build-gui-linux.yml | 2 - scripts/ci/jobs/build-gui-mac.yml | 2 - scripts/cmake/CMakeSetup.cmake | 2 +- scripts/cmake/ConanSetup.cmake | 124 --- scripts/cmake/Dependencies.cmake | 44 +- scripts/cmake/ProjectSetup.cmake | 14 - scripts/cmake/conan/conan.cmake | 909 ------------------ scripts/cmake/conan/config/settings.yml | 92 -- scripts/cmake/packaging/Pack.cmake | 9 +- .../redistributable-builds/index.md | 2 - .../getting-started/prerequisites/index.md | 24 - .../packages/conan-package-manager/index.md | 49 - .../devguide/troubleshooting/cmake/index.md | 2 - .../devguide/troubleshooting/conan/index.md | 59 -- .../devguide/troubleshooting/run/index.md | 2 - .../troubleshooting/get-support/index.md | 3 +- web/data/versions.json | 1 - 21 files changed, 28 insertions(+), 1331 deletions(-) delete mode 100644 scripts/cmake/ConanSetup.cmake delete mode 100644 scripts/cmake/conan/conan.cmake delete mode 100644 scripts/cmake/conan/config/settings.yml delete mode 100644 web/content/docs/devguide/packages/conan-package-manager/index.md delete mode 100644 web/content/docs/devguide/troubleshooting/conan/index.md diff --git a/.gitignore b/.gitignore index 1d72e76ad66..bc89e16a442 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,6 @@ tags # Visual Studio Code project files .vscode -# Conan package manager -conanbuildinfo.cmake -conaninfo.txt -CMakeLists.txt.user* - *.pyc .venv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2d43e046750..0c84939d44b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,10 +42,10 @@ repos: - id: cmake-format additional_dependencies: ["cmakelang[YAML]"] args: [--config=.cmake-format.yaml] - exclude: "scripts/cmake/jedbrown/.*|conan.cmake|CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|ConanSetup.cmake|Tests.cmake" + exclude: "scripts/cmake/jedbrown/.*|CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|Tests.cmake" - id: cmake-lint additional_dependencies: ["cmakelang[YAML]"] - exclude: "scripts/cmake/jedbrown/.*|conan.cmake|CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|ConanSetup.cmake|BuildExternalProject.cmake" + exclude: "scripts/cmake/jedbrown/.*|CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|BuildExternalProject.cmake" - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.33.0 hooks: diff --git a/CMakeLists.txt b/CMakeLists.txt index b3343021d9d..8b8882053dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,10 +30,6 @@ set(CMAKE_LIBRARY_SEARCH_PATH "" set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, \ defaults to native (*nix) / blend (MSVC)." ) -option(OGS_USE_CONAN "Should Conan package manager be used?" ON) -set(OGS_CONAN_BUILD "missing" CACHE STRING "Possible values: all, missing, \ - never or list of libs to build" -) option(OGS_DISABLE_COMPILER_CACHE "Disables compiler cache." OFF) option(OGS_USE_UNITY_BUILDS "Enables Unity builds for faster compilation." ON) option(OGS_USE_PIP "Enables automatic Python virtual environment handling." OFF) @@ -76,16 +72,11 @@ include(PythonSetup) include(ProcessesSetup) include(ProjectSetup) include(Functions) -# include(ConanSetup) include(CompilerSetup) include(JobPools) include(Find) include(DependenciesExternalProject) include(Dependencies) -# Hack for Conan (msvc) gui build. Also linking to ${CONAN_LIBS} globally -#if(OGS_USE_CONAN AND OGS_USE_NETCDF) -# link_libraries($<$:zlib.lib> ${CONAN_LIBS}) -#endif() include(DocumentationSetup) include(test/Test) include(Coverage) diff --git a/scripts/ci/extends/template-build-linux.yml b/scripts/ci/extends/template-build-linux.yml index a535a375b0d..e05b9378c3f 100644 --- a/scripts/ci/extends/template-build-linux.yml +++ b/scripts/ci/extends/template-build-linux.yml @@ -12,7 +12,6 @@ - mkdir -p $build_dir_full build - if [[ "$OSTYPE" == "darwin"* ]] ; then readlink_cmd=greadlink; else readlink_cmd=readlink; fi - ln -s `$readlink_cmd -f $build_dir_full` build/${CMAKE_PRESET} - - ([ "${CONAN_USER_HOME}" == "${CI_PROJECT_DIR}/.conan" ]) && conan remove --system-reqs '*' - ([[ $BUILD_CTEST_LARGE_ON_MASTER && "${CI_COMMIT_BRANCH}" == "master" ]]) && export BUILD_CTEST_LARGE=true - cmake --preset=$CMAKE_PRESET --log-level=VERBOSE -Wno-dev $CMAKE_ARGS # Activate .venv diff --git a/scripts/ci/jobs/build-gui-linux.yml b/scripts/ci/jobs/build-gui-linux.yml index df818ab428b..fd2c38c620b 100644 --- a/scripts/ci/jobs/build-gui-linux.yml +++ b/scripts/ci/jobs/build-gui-linux.yml @@ -14,5 +14,3 @@ build gui linux: allow_failure: true variables: CMAKE_PRESET: release-gui - CMAKE_ARGS: >- - -DOGS_USE_CONAN=OFF diff --git a/scripts/ci/jobs/build-gui-mac.yml b/scripts/ci/jobs/build-gui-mac.yml index 905a9598ac7..015a47cc34b 100644 --- a/scripts/ci/jobs/build-gui-mac.yml +++ b/scripts/ci/jobs/build-gui-mac.yml @@ -15,8 +15,6 @@ build gui mac: allow_failure: true variables: CMAKE_PRESET: release-gui - CMAKE_ARGS: >- - -DOGS_USE_CONAN=auto parallel: matrix: - ARCHITECTURE: ["amd64"] # "arm64" not supported yet diff --git a/scripts/cmake/CMakeSetup.cmake b/scripts/cmake/CMakeSetup.cmake index e58baff7c26..7787fbeb035 100644 --- a/scripts/cmake/CMakeSetup.cmake +++ b/scripts/cmake/CMakeSetup.cmake @@ -39,7 +39,7 @@ if(NOT PROJECT_IS_TOP_LEVEL) endif() if((NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - OR (NOT CMAKE_BUILD_TYPE AND MSVC AND OGS_USE_CONAN) + OR (NOT CMAKE_BUILD_TYPE AND MSVC) ) message(STATUS "Setting build type to 'Debug' as none was specified.") set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) diff --git a/scripts/cmake/ConanSetup.cmake b/scripts/cmake/ConanSetup.cmake deleted file mode 100644 index c2ca69a7c06..00000000000 --- a/scripts/cmake/ConanSetup.cmake +++ /dev/null @@ -1,124 +0,0 @@ -if(NOT OGS_USE_CONAN OR NOT OGS_USE_NETCDF) - return() -endif() -find_program(CONAN_CMD conan) -if(NOT CONAN_CMD AND OGS_USE_NETCDF) - message( - WARNING - "conan executable not found. Specify CMake option " - "OGS_USE_CONAN=auto for automatic installation in the build directory " - "OR install it system-wide (https://www.opengeosys.org/docs/devguide/" - "getting-started/prerequisites/#step-install-conan-package-manager) " - "OR disable this warning with OGS_USE_CONAN=OFF." - ) - return() -endif() - -if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - message( - FATAL_ERROR - "Multi-config generators are not yet supported when " - "using Conan. Specify CMAKE_BUILD_TYPE, e.g. via cmd line: " - "cmake . -DCMAKE_BUILD_TYPE=Release!" - ) -endif() - -# Treat Conan includes as system includes to suppress warnings -set(CONAN_SYSTEM_INCLUDES ON) - -include(${PROJECT_SOURCE_DIR}/scripts/cmake/conan/conan.cmake) - -if(OGS_USE_NETCDF) - list( - APPEND - CONAN_REQUIRES - "netcdf/4.7.4#3af05a96c74c5ec03320790eb6aa8d2b" - "netcdf-cxx/4.3.1-3@bilke/testing#ca3ccf6c9a33aebdcaff7c5b8f493770" - "zlib/1.2.12#a30750797caa71bd61bd0a18189caa28" - "hdf5/1.12.1#71171442d15f19773a1c0cd7abe95988" - ) - set(CONAN_OPTIONS netcdf:dap=False) -endif() - -if(NOT DEFINED CONAN_REQUIRES) - return() -endif() - -conan_check(VERSION ${ogs.minimum_version.conan}) -conan_config_install(ITEM ${PROJECT_SOURCE_DIR}/scripts/cmake/conan/config) - -set(CONAN_IMPORTS "") -if(APPLE) - set(CONAN_IMPORTS ${CONAN_IMPORTS} "lib, *.dylib* -> ./lib") -endif() -if(MSVC) - set(CONAN_IMPORTS ${CONAN_IMPORTS} "bin, *.dll* -> ./bin") -endif() -if(UNIX AND NOT APPLE) - set(CONAN_IMPORTS ${CONAN_IMPORTS} "lib, *.so* -> ./lib") - set(CONAN_IMPORTS ${CONAN_IMPORTS} - "plugins/platforms, *.so* -> ./bin/platforms" - ) -endif() - -file(TIMESTAMP ${PROJECT_BINARY_DIR}/conan_install_timestamp.txt file_timestamp - "%Y.%m.%d" -) -string(TIMESTAMP timestamp "%Y.%m.%d") - -# Run conan install update only once a day -if("${file_timestamp}" VERSION_LESS ${timestamp} OR DEFINED ENV{CI}) - file(WRITE ${PROJECT_BINARY_DIR}/conan_install_timestamp.txt - "${timestamp}\n" - ) - set(CONAN_UPDATE UPDATE) - # Speed up conan_add_remote - set(CONAN_COMMAND ${CONAN_CMD} CACHE INTERNAL "") - conan_add_remote( - NAME ogs INDEX 0 URL https://ogs.jfrog.io/artifactory/api/conan/conan - ) - conan_add_remote( - NAME bincrafters INDEX 1 URL - https://bincrafters.jfrog.io/artifactory/api/conan/public-conan - ) - execute_process( - COMMAND ${CONAN_COMMAND} config set general.revisions_enabled=1 - ) -else() - message(STATUS "Conan: Skipping update step.") -endif() - -if(DEFINED OGS_CONAN_BUILD_TYPE) - set(CONAN_BUILD_TYPE ${OGS_CONAN_BUILD_TYPE}) -else() - set(CONAN_BUILD_TYPE ${CMAKE_BUILD_TYPE}) -endif() - -# speed up conan_cmake_run -set(ARGUMENTS_CONAN_COMMAND ${CONAN_CMD} CACHE INTERNAL "") -conan_cmake_run( - BASIC_SETUP - ${CONAN_UPDATE} - KEEP_RPATHS - REQUIRES - ${CONAN_REQUIRES} - OPTIONS - ${CONAN_OPTIONS} - BUILD - ${OGS_CONAN_BUILD} - IMPORTS - ${CONAN_IMPORTS} - GENERATORS - virtualrunenv - cmake_find_package - BUILD_TYPE - ${CONAN_BUILD_TYPE} -) - -if(NOT ${OGS_CONAN_BUILD} MATCHES "never|always|missing|outdated") - message( - STATUS - "Warning: Resetting CMake variable OGS_CONAN_BUILD to its default value of 'missing'" - ) - set(OGS_CONAN_BUILD "missing" CACHE INTERNAL "") -endif() diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index 5fc291c50b2..75358413ac5 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -101,7 +101,9 @@ if(_build_chemistry_lib) ) list(APPEND DISABLE_WARNINGS_TARGETS IPhreeqc) if(BUILD_SHARED_LIBS) - install(TARGETS IPhreeqc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS IPhreeqc + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif() endif() endif() @@ -415,8 +417,7 @@ if(OGS_BUILD_UTILS) NAME metis GIT_REPOSITORY https://github.com/KarypisLab/METIS VERSION 5.2.1 - EXCLUDE_FROM_ALL YES - UPDATE_DISCONNECTED ON + EXCLUDE_FROM_ALL YES UPDATE_DISCONNECTED ON PATCH_COMMAND git apply ${PROJECT_SOURCE_DIR}/scripts/cmake/metis.patch OPTIONS ${_metis_options} @@ -445,29 +446,26 @@ endif() if(OGS_USE_NETCDF) find_package(netCDF CONFIG REQUIRED) - find_library( - NETCDF_LIBRARIES_CXX - NAMES netcdf_c++4 netcdf-cxx4 - ) + find_library(NETCDF_LIBRARIES_CXX NAMES netcdf_c++4 netcdf-cxx4) if(NOT ${NETCDF_LIBRARIES_CXX}) - CPMAddPackage( - NAME netcdf-cxx4 - GIT_REPOSITORY https://github.com/Unidata/netcdf-cxx4 - VERSION 4.3.1 - EXCLUDE_FROM_ALL YES - SOURCE_SUBDIR cxx4 - OPTIONS "NCXX_ENABLE_TESTS OFF" - ) - set_target_properties(netCDF::netcdf PROPERTIES INTERFACE_LINK_LIBRARIES "") # fix win installed config - target_link_libraries(netcdf-cxx4 PUBLIC netCDF::netcdf) - else() - find_path( - NETCDF_INCLUDES_CXX - NAMES netcdf + CPMAddPackage( + NAME netcdf-cxx4 + GIT_REPOSITORY https://github.com/Unidata/netcdf-cxx4 + VERSION 4.3.1 + EXCLUDE_FROM_ALL YES SOURCE_SUBDIR cxx4 + OPTIONS "NCXX_ENABLE_TESTS OFF" ) + set_target_properties( + netCDF::netcdf PROPERTIES INTERFACE_LINK_LIBRARIES "" + ) # fix win installed config + target_link_libraries(netcdf-cxx4 PUBLIC netCDF::netcdf) + else() + find_path(NETCDF_INCLUDES_CXX NAMES netcdf) add_library(netcdf-cxx4 INTERFACE IMPORTED) target_include_directories(netcdf-cxx4 INTERFACE ${NETCDF_INCLUDES_CXX}) - target_link_libraries(netcdf-cxx4 INTERFACE ${NETCDF_LIBRARIES_CXX} netCDF::netcdf) + target_link_libraries( + netcdf-cxx4 INTERFACE ${NETCDF_LIBRARIES_CXX} netCDF::netcdf + ) endif() endif() @@ -501,7 +499,7 @@ if(CLANG_FORMAT_PROGRAM OR CMAKE_FORMAT_PROGRAM) GITHUB_REPOSITORY TheLartians/Format.cmake OPTIONS ${_skip_cmake} - "CMAKE_FORMAT_EXCLUDE scripts/cmake/CPM.cmake|.*/Tests.cmake|scripts/cmake/jedbrown/.*|scripts/cmake/conan/conan.cmake|scripts/cmake/vector-of-bool/.*" + "CMAKE_FORMAT_EXCLUDE scripts/cmake/CPM.cmake|.*/Tests.cmake|scripts/cmake/jedbrown/.*|scripts/cmake/vector-of-bool/.*" ) endif() diff --git a/scripts/cmake/ProjectSetup.cmake b/scripts/cmake/ProjectSetup.cmake index 16bd5894c4d..48a8de63789 100644 --- a/scripts/cmake/ProjectSetup.cmake +++ b/scripts/cmake/ProjectSetup.cmake @@ -9,20 +9,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} ) -if(OGS_USE_CONAN AND MSVC) - foreach(outputconfig ${CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER ${outputconfig} outputconfig) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${outputconfig} - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${outputconfig} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${outputconfig} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ) - endforeach() -endif() # cmake-lint: disable=C0103 set(Data_SOURCE_DIR ${PROJECT_SOURCE_DIR}/Tests/Data CACHE INTERNAL "") diff --git a/scripts/cmake/conan/conan.cmake b/scripts/cmake/conan/conan.cmake deleted file mode 100644 index 349b22227e5..00000000000 --- a/scripts/cmake/conan/conan.cmake +++ /dev/null @@ -1,909 +0,0 @@ -# The MIT License (MIT) - -# Copyright (c) 2018 JFrog - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - - -# This file comes from: https://github.com/conan-io/cmake-conan. Please refer -# to this repository for issues and documentation. - -# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. -# It will take CMake current settings (os, compiler, compiler version, architecture) -# and translate them to conan settings for installing and retrieving dependencies. - -# It is intended to facilitate developers building projects that have conan dependencies, -# but it is only necessary on the end-user side. It is not necessary to create conan -# packages, in fact it shouldn't be use for that. Check the project documentation. - -# version: 0.18.0-dev - -include(CMakeParseArguments) - -function(_get_msvc_ide_version result) - set(${result} "" PARENT_SCOPE) - if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) - set(${result} 8 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) - set(${result} 9 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) - set(${result} 10 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) - set(${result} 11 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) - set(${result} 12 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) - set(${result} 14 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) - set(${result} 15 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) - set(${result} 16 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) - set(${result} 17 PARENT_SCOPE) - else() - message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") - endif() -endfunction() - -macro(_conan_detect_build_type) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) - elseif(CMAKE_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) - if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") - set(_CONAN_SETTING_BUILD_TYPE "Debug") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") - set(_CONAN_SETTING_BUILD_TYPE "Release") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") - set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") - set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") - endif() -endmacro() - -macro(_conan_check_system_name) - #handle -s os setting - if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") - #use default conan os setting if CMAKE_SYSTEM_NAME is not defined - set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CONAN_SYSTEM_NAME Macos) - endif() - if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") - set(CONAN_SYSTEM_NAME Neutrino) - endif() - set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) - list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) - if (${_index} GREATER -1) - #check if the cmake system is a conan supported one - set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) - else() - message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") - endif() - endif() -endmacro() - -macro(_conan_check_language) - get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) - if (";${_languages};" MATCHES ";CXX;") - set(LANGUAGE CXX) - set(USING_CXX 1) - elseif (";${_languages};" MATCHES ";C;") - set(LANGUAGE C) - set(USING_CXX 0) - else () - message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") - endif() -endmacro() - -macro(_conan_detect_compiler) - - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_ARCH) - set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) - endif() - - if(USING_CXX) - set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) - endif() - - if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) - # using GCC - # TODO: Handle other params - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - if(${MAJOR} GREATER 4) - set(COMPILER_VERSION ${MAJOR}) - endif() - set(_CONAN_SETTING_COMPILER gcc) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - set(_CONAN_SETTING_COMPILER intel) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) - # using AppleClang - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER apple-clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang) - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if(APPLE) - cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) - if(NOT APPLE_CLANG_POLICY STREQUAL NEW) - message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") - set(_CONAN_SETTING_COMPILER apple-clang) - endif() - endif() - if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) - endif() - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC) - set(_VISUAL "Visual Studio") - _get_msvc_ide_version(_VISUAL_VERSION) - if("${_VISUAL_VERSION}" STREQUAL "") - message(FATAL_ERROR "Conan: Visual Studio not recognized") - else() - set(_CONAN_SETTING_COMPILER ${_VISUAL}) - set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) - endif() - - if(NOT _CONAN_SETTING_ARCH) - if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") - set(_CONAN_SETTING_ARCH x86_64) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") - message(STATUS "Conan: Using default ARM architecture from MSVC") - set(_CONAN_SETTING_ARCH armv6) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") - set(_CONAN_SETTING_ARCH x86) - else () - message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") - endif() - endif() - - conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) - message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") - set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) - - if (CMAKE_GENERATOR_TOOLSET) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - endif() - else() - message(FATAL_ERROR "Conan: compiler setup not recognized") - endif() - -endmacro() - -function(conan_cmake_settings result) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) - #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) - #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) - #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) - #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) - #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) - #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) - - message(STATUS "Conan: Automatic detection of conan settings from cmake") - - conan_parse_arguments(${ARGV}) - - _conan_detect_build_type(${ARGV}) - - _conan_check_system_name() - - _conan_check_language() - - _conan_detect_compiler(${ARGV}) - - # If profile is defined it is used - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) - elseif(ARGUMENTS_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) - endif() - - foreach(ARG ${_APPLIED_PROFILES}) - set(_SETTINGS ${_SETTINGS} -pr=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) - conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) - set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) - endforeach() - - if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset) - endif() - - # remove any manually specified settings from the autodetected settings - foreach(ARG ${ARGUMENTS_SETTINGS}) - string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") - message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") - list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") - endforeach() - - # Automatic from CMake - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - - foreach(ARG ${ARGUMENTS_SETTINGS}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}) - endforeach() - - message(STATUS "Conan: Settings= ${_SETTINGS}") - - set(${result} ${_SETTINGS} PARENT_SCOPE) -endfunction() - - -function(conan_cmake_detect_unix_libcxx result) - # Take into account any -stdlib in compile options - get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) - string(GENEX_STRIP "${compile_options}" compile_options) - - # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions - get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) - string(GENEX_STRIP "${defines}" defines) - - foreach(define ${defines}) - if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") - if(define MATCHES "^-D") - set(compile_options ${compile_options} "${define}") - else() - set(compile_options ${compile_options} "-D${define}") - endif() - endif() - endforeach() - - # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable - set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) - if(CMAKE_CXX_COMPILER_ARG1) - # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" - # without this, ccache, winegcc, or other wrappers might lose all their arguments - separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) - list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) - # without --target= we may be calling the wrong underlying GCC - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) - # without --sysroot= we may find the wrong #include - if(CMAKE_SYSROOT_COMPILE) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") - elseif(CMAKE_SYSROOT) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") - endif() - endif() - - separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) - - if(CMAKE_OSX_SYSROOT) - set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") - endif() - - execute_process( - COMMAND ${CMAKE_COMMAND} -E echo "#include " - COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - - OUTPUT_VARIABLE string_defines - ) - - if(string_defines MATCHES "#define __GLIBCXX__") - # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake - if(DEFINED _GLIBCXX_USE_CXX11_ABI) - if(_GLIBCXX_USE_CXX11_ABI) - set(${result} libstdc++11 PARENT_SCOPE) - return() - else() - set(${result} libstdc++ PARENT_SCOPE) - return() - endif() - endif() - - if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") - set(${result} libstdc++11 PARENT_SCOPE) - else() - # Either the compiler is missing the define because it is old, and so - # it can't use the new abi, or the compiler was configured to use the - # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) - set(${result} libstdc++ PARENT_SCOPE) - endif() - else() - set(${result} libc++ PARENT_SCOPE) - endif() -endfunction() - -function(conan_cmake_detect_vs_runtime result) - - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_BUILD_TYPE) - set(build_type "${ARGUMENTS_BUILD_TYPE}") - elseif(CMAKE_BUILD_TYPE) - set(build_type "${CMAKE_BUILD_TYPE}") - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - if(build_type) - string(TOUPPER "${build_type}" build_type) - endif() - set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) - foreach(variable ${variables}) - if(NOT "${${variable}}" STREQUAL "") - string(REPLACE " " ";" flags "${${variable}}") - foreach (flag ${flags}) - if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") - string(SUBSTRING "${flag}" 1 -1 runtime) - set(${result} "${runtime}" PARENT_SCOPE) - return() - endif() - endforeach() - endif() - endforeach() - if("${build_type}" STREQUAL "DEBUG") - set(${result} "MDd" PARENT_SCOPE) - else() - set(${result} "MD" PARENT_SCOPE) - endif() -endfunction() - -function(_collect_settings result) - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset - compiler.cppstd) - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - set(${result} ${detected_setings} PARENT_SCOPE) -endfunction() - -function(conan_cmake_autodetect detected_settings) - _conan_detect_build_type(${ARGV}) - _conan_check_system_name() - _conan_check_language() - _conan_detect_compiler(${ARGV}) - _collect_settings(collected_settings) - set(${detected_settings} ${collected_settings} PARENT_SCOPE) -endfunction() - -macro(conan_parse_arguments) - set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) - set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND) - set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE - PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO - INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) - cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) -endmacro() - -function(old_conan_cmake_install) - # Calls "conan install" - # Argument BUILD is equivalent to --build={missing, PkgName,...} or - # --build when argument is 'BUILD all' (which builds all packages from source) - # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source - # cmake does not identify conan as command, even if it is +x and it is in the path - conan_parse_arguments(${ARGV}) - - if(CONAN_CMAKE_MULTI) - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) - else() - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) - endif() - - set(CONAN_BUILD_POLICY "") - foreach(ARG ${ARGUMENTS_BUILD}) - if(${ARG} STREQUAL "all") - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) - break() - else() - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) - endif() - endforeach() - if(ARGUMENTS_CONAN_COMMAND) - set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - set(CONAN_OPTIONS "") - if(ARGUMENTS_CONANFILE) - if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) - set(CONANFILE ${ARGUMENTS_CONANFILE}) - else() - set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) - endif() - else() - set(CONANFILE ".") - endif() - foreach(ARG ${ARGUMENTS_OPTIONS}) - set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) - endforeach() - if(ARGUMENTS_UPDATE) - set(CONAN_INSTALL_UPDATE --update) - endif() - if(ARGUMENTS_NO_IMPORTS) - set(CONAN_INSTALL_NO_IMPORTS --no-imports) - endif() - set(CONAN_INSTALL_FOLDER "") - if(ARGUMENTS_INSTALL_FOLDER) - set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) - endif() - foreach(ARG ${ARGUMENTS_GENERATORS}) - set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_ENV}) - set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) - endforeach() - set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) - - string (REPLACE ";" " " _conan_args "${conan_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") - - if(ARGUMENTS_OUTPUT_QUIET) - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - OUTPUT_VARIABLE conan_output - ERROR_VARIABLE conan_output - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - else() - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - -endfunction() - -function(conan_cmake_install) - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - - set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) - set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER) - set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE - PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) - cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) - foreach(arg ${installOptions}) - if(ARGS_${arg}) - set(${arg} ${${arg}} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installOneValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "REMOTE") - set(flag "--remote") - elseif("${arg}" STREQUAL "LOCKFILE") - set(flag "--lockfile") - elseif("${arg}" STREQUAL "LOCKFILE_OUT") - set(flag "--lockfile-out") - elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") - set(flag "--lockfile-node-id") - elseif("${arg}" STREQUAL "INSTALL_FOLDER") - set(flag "--install-folder") - endif() - set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installMultiValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "GENERATOR") - set(flag "--generator") - elseif("${arg}" STREQUAL "BUILD") - set(flag "--build") - elseif("${arg}" STREQUAL "ENV") - set(flag "--env") - elseif("${arg}" STREQUAL "ENV_HOST") - set(flag "--env:host") - elseif("${arg}" STREQUAL "ENV_BUILD") - set(flag "--env:build") - elseif("${arg}" STREQUAL "OPTIONS") - set(flag "--options") - elseif("${arg}" STREQUAL "OPTIONS_HOST") - set(flag "--options:host") - elseif("${arg}" STREQUAL "OPTIONS_BUILD") - set(flag "--options:build") - elseif("${arg}" STREQUAL "PROFILE") - set(flag "--profile") - elseif("${arg}" STREQUAL "PROFILE_HOST") - set(flag "--profile:host") - elseif("${arg}" STREQUAL "PROFILE_BUILD") - set(flag "--profile:build") - elseif("${arg}" STREQUAL "SETTINGS") - set(flag "--settings") - elseif("${arg}" STREQUAL "SETTINGS_HOST") - set(flag "--settings:host") - elseif("${arg}" STREQUAL "SETTINGS_BUILD") - set(flag "--settings:build") - endif() - list(LENGTH ARGS_${arg} numargs) - foreach(item ${ARGS_${arg}}) - if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") - set(${arg} "--build") - break() - endif() - set(${arg} ${${arg}} ${flag} ${item}) - endforeach() - endif() - endforeach() - if(DEFINED UPDATE) - set(UPDATE --update) - endif() - if(DEFINED NO_IMPORTS) - set(NO_IMPORTS --no-imports) - endif() - set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} - ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} - ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) - - string(REPLACE ";" " " _install_args "${install_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") - - if(ARGS_OUTPUT_QUIET) - set(OUTPUT_OPT OUTPUT_QUIET) - endif() - if(ARGS_ERROR_QUIET) - set(ERROR_OPT ERROR_QUIET) - endif() - - execute_process(COMMAND ${CONAN_CMD} ${install_args} - RESULT_VARIABLE return_code - ${OUTPUT_OPT} - ${ERROR_OPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - if(NOT "${return_code}" STREQUAL "0") - if (ARGS_ERROR_QUIET) - message(WARNING "Conan install failed='${return_code}'") - else() - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - endif() - -endfunction() - -function(conan_cmake_setup_conanfile) - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_CONANFILE) - get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) - # configure_file will make sure cmake re-runs when conanfile is updated - configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) - else() - conan_cmake_generate_conanfile(ON ${ARGV}) - endif() -endfunction() - -function(conan_cmake_configure) - conan_cmake_generate_conanfile(OFF ${ARGV}) -endfunction() - -# Generate, writing in disk a conanfile.txt with the requires, options, and imports -# specified as arguments -# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) -function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) - - conan_parse_arguments(${ARGV}) - - set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") - file(WRITE ${_FN} "") - - if(DEFINED ARGUMENTS_REQUIRES) - file(APPEND ${_FN} "[requires]\n") - foreach(REQUIRE ${ARGUMENTS_REQUIRES}) - file(APPEND ${_FN} ${REQUIRE} "\n") - endforeach() - endif() - - if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) - file(APPEND ${_FN} "[generators]\n") - if (DEFAULT_GENERATOR) - file(APPEND ${_FN} "cmake\n") - endif() - if (DEFINED ARGUMENTS_GENERATORS) - foreach(GENERATOR ${ARGUMENTS_GENERATORS}) - file(APPEND ${_FN} ${GENERATOR} "\n") - endforeach() - endif() - endif() - - if(DEFINED ARGUMENTS_BUILD_REQUIRES) - file(APPEND ${_FN} "[build_requires]\n") - foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) - file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_IMPORTS) - file(APPEND ${_FN} "[imports]\n") - foreach(IMPORTS ${ARGUMENTS_IMPORTS}) - file(APPEND ${_FN} ${IMPORTS} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_OPTIONS) - file(APPEND ${_FN} "[options]\n") - foreach(OPTION ${ARGUMENTS_OPTIONS}) - file(APPEND ${_FN} ${OPTION} "\n") - endforeach() - endif() - -endfunction() - - -macro(conan_load_buildinfo) - if(CONAN_CMAKE_MULTI) - set(_CONANBUILDINFO conanbuildinfo_multi.cmake) - else() - set(_CONANBUILDINFO conanbuildinfo.cmake) - endif() - if(ARGUMENTS_INSTALL_FOLDER) - set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) - else() - set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) - endif() - # Checks for the existence of conanbuildinfo.cmake, and loads it - # important that it is macro, so variables defined at parent scope - if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") - message(STATUS "Conan: Loading ${_CONANBUILDINFO}") - include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) - else() - message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") - endif() -endmacro() - - -macro(conan_cmake_run) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) - message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") - elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) - message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") - endif() - - if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED - AND NOT ARGUMENTS_BUILD_TYPE) - set(CONAN_CMAKE_MULTI ON) - if (NOT ARGUMENTS_CONFIGURATION_TYPES) - set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") - endif() - message(STATUS "Conan: Using cmake-multi generator") - else() - set(CONAN_CMAKE_MULTI OFF) - endif() - - if(NOT CONAN_EXPORTED) - conan_cmake_setup_conanfile(${ARGV}) - if(CONAN_CMAKE_MULTI) - foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) - set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endforeach() - set(CMAKE_BUILD_TYPE) - else() - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endif() - endif() - - if (NOT ARGUMENTS_NO_LOAD) - conan_load_buildinfo() - endif() - - if(ARGUMENTS_BASIC_SETUP) - foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) - if(ARGUMENTS_${_option}) - if(${_option} STREQUAL "CMAKE_TARGETS") - list(APPEND _setup_options "TARGETS") - else() - list(APPEND _setup_options ${_option}) - endif() - endif() - endforeach() - conan_basic_setup(${_setup_options}) - endif() -endmacro() - -macro(conan_check) - # Checks conan availability in PATH - # Arguments REQUIRED, DETECT_QUIET and VERSION are optional - # Example usage: - # conan_check(VERSION 1.0.0 REQUIRED) - set(options REQUIRED DETECT_QUIET) - set(oneValueArgs VERSION) - cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: checking conan executable") - endif() - - find_program(CONAN_CMD conan) - if(NOT CONAN_CMD AND CONAN_REQUIRED) - message(FATAL_ERROR "Conan executable not found! Please install conan.") - endif() - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: Found program ${CONAN_CMD}") - endif() - execute_process(COMMAND ${CONAN_CMD} --version - RESULT_VARIABLE return_code - OUTPUT_VARIABLE CONAN_VERSION_OUTPUT - ERROR_VARIABLE CONAN_VERSION_OUTPUT) - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan --version failed='${return_code}'") - endif() - - if(NOT CONAN_DETECT_QUIET) - string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) - message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") - endif() - - if(DEFINED CONAN_VERSION) - string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO - "${CONAN_VERSION_OUTPUT}") - if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) - message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ - required: ${CONAN_VERSION}. Consider updating via 'pip \ - install conan==${CONAN_VERSION}'.") - endif() - endif() -endmacro() - -function(conan_add_remote) - # Adds a remote - # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional - # Example usage: - # conan_add_remote(NAME bincrafters INDEX 1 - # URL https://api.bintray.com/conan/bincrafters/public-conan - # VERIFY_SSL True) - set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) - - if(DEFINED CONAN_INDEX) - set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") - endif() - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED DETECT_QUIET) - endif() - set(CONAN_VERIFY_SSL_ARG "True") - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) - endif() - message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") - execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan remote failed='${return_code}'") - endif() -endfunction() - -macro(conan_config_install) - # install a full configuration from a local or remote zip file - # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional - # Example usage: - # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git - # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) - set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) - set(multiValueArgs ARGS) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - find_program(CONAN_CMD conan) - if(NOT CONAN_CMD AND CONAN_REQUIRED) - message(FATAL_ERROR "Conan executable not found!") - endif() - - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") - endif() - - if(DEFINED CONAN_TYPE) - set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") - endif() - - if(DEFINED CONAN_ARGS) - set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") - endif() - - if(DEFINED CONAN_SOURCE) - set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") - endif() - - if(DEFINED CONAN_TARGET) - set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") - endif() - - set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} - ${CONAN_TYPE_ARG} - ${CONAN_ARGS_ARGS} - ${CONAN_SOURCE_ARGS} - ${CONAN_TARGET_ARGS}) - - message(STATUS "Conan: Installing config from ${CONAN_ITEM}") - execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan config failed='${return_code}'") - endif() -endmacro() diff --git a/scripts/cmake/conan/config/settings.yml b/scripts/cmake/conan/config/settings.yml deleted file mode 100644 index 4f29064765e..00000000000 --- a/scripts/cmake/conan/config/settings.yml +++ /dev/null @@ -1,92 +0,0 @@ - -# Only for cross building, 'os_build/arch_build' is the system that runs Conan -os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX] -arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le] - -# Only for building cross compilation tools, 'os_target/arch_target' is the system for -# which the tools generate code -os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino] -arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le] - -# Rest of the settings are "host" settings: -# - For native building/cross building: Where the library/program will run. -# - For building cross compilation tools: Where the cross compiler will run. -os: - Windows: - subsystem: [None, cygwin, msys, msys2, wsl] - WindowsStore: - version: ["8.1", "10.0"] - WindowsCE: - platform: ANY - version: ["5.0", "6.0", "7.0", "8.0"] - Linux: - Macos: - version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15"] - Android: - api_level: ANY - iOS: - version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0", "13.1"] - watchOS: - version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1"] - tvOS: - version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0"] - FreeBSD: - SunOS: - AIX: - Arduino: - board: ANY - Emscripten: - Neutrino: - version: ["6.4", "6.5", "6.6", "7.0"] -arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le] -compiler: - sun-cc: - version: ["5.10", "5.11", "5.12", "5.13", "5.14"] - threads: [None, posix] - libcxx: [libCstd, libstdcxx, libstlport, libstdc++] - gcc: &gcc - version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", - "5", "5.1", "5.2", "5.3", "5.4", "5.5", - "6", "6.1", "6.2", "6.3", "6.4", - "7", "7.1", "7.2", "7.3", "7.4", - "8", "8.1", "8.2", "8.3", - "9", "9.1", "9.2", "9.3", - "10", "10.1", "11", "12"] - libcxx: [libstdc++, libstdc++11] - threads: [None, posix, win32] # Windows MinGW - exception: [None, dwarf2, sjlj, seh] # Windows MinGW - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] - Visual Studio: &visual_studio - runtime: [MD, MT, MTd, MDd] - version: ["8", "9", "10", "11", "12", "14", "15", "16"] - toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp, - v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp, - LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp, - LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142] - cppstd: [None, 14, 17, 20] - clang: - version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", - "5.0", "6.0", "7.0", "7.1", - "8", "8.0", - "9", "10"] - libcxx: [libstdc++, libstdc++11, libc++, c++_shared, c++_static] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] - apple-clang: - version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13.0", "13.1", "14.0"] - libcxx: [libstdc++, libc++] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] - intel: - version: ["11", "12", "13", "14", "15", "16", "17", "18", "19"] - base: - gcc: - <<: *gcc - threads: [None] - exception: [None] - Visual Studio: - <<: *visual_studio - qcc: - version: ["4.4", "5.4"] - libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne] - -build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel] -cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] # Deprecated, use compiler.cppstd diff --git a/scripts/cmake/packaging/Pack.cmake b/scripts/cmake/packaging/Pack.cmake index e1038a05169..df2dfd61a62 100644 --- a/scripts/cmake/packaging/Pack.cmake +++ b/scripts/cmake/packaging/Pack.cmake @@ -64,12 +64,9 @@ include(packaging/PackagingDependencies) include(CPack) -if(OGS_USE_CONAN) - # Install Qt platform shared libraries - install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/platforms - DESTINATION bin OPTIONAL - ) -endif() +install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/platforms DESTINATION bin + OPTIONAL +) if(WIN32) file(GLOB PYTHON_RUNTIME_LIBS "${Python_RUNTIME_LIBRARY_DIRS}/*.dll") diff --git a/web/content/docs/devguide/environments/redistributable-builds/index.md b/web/content/docs/devguide/environments/redistributable-builds/index.md index d730b3fd663..e9341dbdb72 100644 --- a/web/content/docs/devguide/environments/redistributable-builds/index.md +++ b/web/content/docs/devguide/environments/redistributable-builds/index.md @@ -56,8 +56,6 @@ See Linux-tab! Try to use static libraries as much as possible. For OGS itself use `BUILD_SHARED_LIBS=OFF`, which already defaults to `OFF`. - package manager are often provided as shared libraries. You may want to use [Conan]({{< ref "conan-package-manager.md" >}}) which provides lots of libraries (e.g. VTK) as static libraries. - ## Package the build Use the `package`-target which tries to gather all dependencies and fixes up shared library paths: diff --git a/web/content/docs/devguide/getting-started/prerequisites/index.md b/web/content/docs/devguide/getting-started/prerequisites/index.md index 34371ce0f32..e37ffe324ad 100644 --- a/web/content/docs/devguide/getting-started/prerequisites/index.md +++ b/web/content/docs/devguide/getting-started/prerequisites/index.md @@ -19,7 +19,6 @@ The minimum prerequisites to build OGS are: - A compiler with [C++20](http://en.wikipedia.org/wiki/C%2B%2B20)-support - Python interpreter and libraries - *Optional (but recommended)*: [Ninja](https://ninja-build.org) build tool -- *Optional*: [Conan package manager](https://www.conan.io/) (at least version {{< dataFile "versions.minimum_version.conan" >}}) for some optional dependencies.
@@ -307,29 +306,6 @@ This will install Qt to `[your-directory]/qt/{{< dataFile "versions.tested_versi To finish add `[your-directory]/qt/{{< dataFile "versions.tested_version.qt" >}}/msvc2019_64/bin` bin to the `PATH` environment variable. -## Optional: Install Conan package manager (for NetCDF) - -Install Conan (>= {{< dataFile "versions.minimum_version.conan" >}}) with Python's pip: - -```bash -pip3 install --user conan -``` - -This installed `conan` to `C:\Users\[username]\AppData\Roaming\Python\Python310\Scripts` in your home directory. Make sure to have this directory in your `PATH`! - -Check on a newly opened command line if Conan was installed successfully: - -```bash -$ conan --version -Conan version {{< dataFile "versions.minimum_version.conan" >}} -``` - -
- -**Advanced usage:** You can also have Conan auto-installed when using the CMake-option `OGS_USE_CONAN=auto`. See the page on [Python environment]({{% ref "python-env.md" %}}) for details. - -
-
diff --git a/web/content/docs/devguide/packages/conan-package-manager/index.md b/web/content/docs/devguide/packages/conan-package-manager/index.md deleted file mode 100644 index 9b41081f4eb..00000000000 --- a/web/content/docs/devguide/packages/conan-package-manager/index.md +++ /dev/null @@ -1,49 +0,0 @@ -+++ -date = "2018-02-26T11:00:13+01:00" -title = "Conan package manager" -author = "Lars Bilke" -weight = 1042 - -aliases = ["/docs/devguide/advanced/conan-package-manager"] - -[menu] - [menu.devguide] - parent = "packages" -+++ - -
- -### Conan {{< dataFile "versions.minimum_version.conan" >}} required - -A recent version ({{< dataFile "versions.minimum_version.conan" >}}) of Conan is required! Please update Conan by running `pip install --upgrade conan` or by downloading the Windows installer. -
- -The [Conan package manager](https://www.conan.io) helps to install all required libraries in a convenient way on every platform. See [Setup pre-requisites](../../getting-started/prerequisites/) for installation instructions. If the Conan executable is found Conan is used for third-party library handling. Set the CMake option `OGS_USE_CONAN=OFF` to disable Conan. - -## Advanced usage - -### Build packages locally - -Per default when Conan is enabled it will try to fetch prebuilt binaries from the [OGS Conan repository](https://ogs.jfrog.io/ogs/conan/). With the CMake option `OGS_CONAN_BUILD` you define what gets build locally. This option can be set to: - -- `missing` - Default, only builds packages which are not available as a prebuilt binary for the current configuration -- `all` - Builds all packages locally -- `never` - Builds no package locally -- `[a list of libraries to build]`, e.g. `"petsc;tfel"`. For names see [`ConanSetup.cmake`](https://gitlab.opengeosys.org/ogs/ogs/-/blob/master/scripts/cmake/ConanSetup.cmake). Make sure to set this back to 'never' after the libraries have been built. Otherwise it would rebuild the libraries on the next CMake run. - -### Conan environment - -Conan creates a [runtime environment](https://docs.conan.io/en/latest/mastering/virtualenv.html#virtualrunenv-generator) automatically. When activated this sets environment variables such as `PATH` or `LD_LIBRARY_PATH` to point to the used Conan packages. Can be activated in your build directory after CMake ran: - -```bash -source activate_run.sh -... -source deactivate_run.sh -``` - -## Further information - -- [Conan Blog](https://blog.conan.io) -- [Conan Documentation](https://docs.conan.io/en/latest/) -- [Bincrafters Blog](https://bincrafters.github.io/tag/conan/), a blog from a group of active Conan package developers -- [Bincrafters Documentation](https://bincrafters.readthedocs.io/en/latest/introduction_to_conan.html) diff --git a/web/content/docs/devguide/troubleshooting/cmake/index.md b/web/content/docs/devguide/troubleshooting/cmake/index.md index b69f2e1b95a..c2a7e802cbf 100644 --- a/web/content/docs/devguide/troubleshooting/cmake/index.md +++ b/web/content/docs/devguide/troubleshooting/cmake/index.md @@ -39,5 +39,3 @@ The following options are affected by this behavior and **should not be changed* - `OGS_USE_PETSC` - `CMAKE_BUILD_TYPE` - `BUILD_SHARED_LIBS` - -Check also [Conans troubleshooting page]({{< ref "conan.md" >}}) if you use Conan for dependencies. diff --git a/web/content/docs/devguide/troubleshooting/conan/index.md b/web/content/docs/devguide/troubleshooting/conan/index.md deleted file mode 100644 index fba3cbb6c7c..00000000000 --- a/web/content/docs/devguide/troubleshooting/conan/index.md +++ /dev/null @@ -1,59 +0,0 @@ -+++ -date = "2018-02-26T11:00:13+01:00" -title = "Conan" -author = "Lars Bilke" -weight = 1071 - -[menu] - [menu.devguide] - parent = "troubleshooting" -+++ - -## Something went wrong during CMake run - -When CMake is run Conan will download library packages. You can see under `Requirements` in the CMake output from where the packages will be downloaded. Most packages will come `from ogs`: - -```bash -$ cmake ../ogs -... --- Conan executing: conan install . -g cmake -s build_type=Release -s os=Macos -s compiler=apple-clang -s compiler.version=9.0 -s compiler.libcxx=libc++ --build=missing --update -PROJECT: Installing /Users/bilke/code/ogs6/build-n/conanfile.txt -Requirements - Boost/1.64.0@conan/stable from conan-community - Eigen3/3.2.9@bilke/stable from ogs - Qt/5.9.2@osechet/stable from ogs - Shapelib/1.3.0@bilke/stable from ogs - VTK/7.1.0@bilke/stable from ogs - libgeotiff/1.4.2@bilke/stable from ogs - libtiff/4.0.6@bilke/stable from ogs - proj/4.9.2@bilke/stable from ogs - zlib/1.2.11@conan/stable from conan-center -``` - -You can always delete the Conan cache directory in `$HOME/.conan` to start fresh. This can fix errors. - -### ERROR: Invalid setting 'X' is not a valid 'settings.compiler.version' value - -In `~/.conan/settings.yml` it is defined which compiler versions are supported by Conan on your machine. Unfortunately (and this is also a bit inconvenient) this file is not updated automatically when upgrading Conan. Three possible ways to fix it: - -- add the missing value to the file by yourself -- simply delete the file, Conan will re-create it on the next run (easiest method) -- when upgrading Conan it creates a file `~/.conan/settings.new.yml` or similar which you can just rename to `~/.conan/settings.yml` - -See also: - -### ERROR: Error in system requirements - -When your `cmake`-run output looks similar to this: - -```bash -$ cmake .. -... -Running: sudo -A yum update -y -sudo: no askpass program specified, try setting SUDO_ASKPASS -... -ERROR: Error in system requirements -... -``` - -Please run `sudo -v` before your `cmake`-command. This will ask you for your password to let Conan install some system packages during the `cmake`-run. diff --git a/web/content/docs/devguide/troubleshooting/run/index.md b/web/content/docs/devguide/troubleshooting/run/index.md index 530d38e2ce9..303d0a7ec4b 100644 --- a/web/content/docs/devguide/troubleshooting/run/index.md +++ b/web/content/docs/devguide/troubleshooting/run/index.md @@ -34,8 +34,6 @@ More information can be found here: - - -If you use Conan you want to activate its [runtime environment]({{< relref "conan-package-manager.md#conan-environment" >}}). - One can see with the `ldd` (macOS: `otool -L`) tool which dynamic libraries will be loaded at runtime. ### Windows diff --git a/web/content/docs/userguide/troubleshooting/get-support/index.md b/web/content/docs/userguide/troubleshooting/get-support/index.md index a9cee0658c5..496cc26310c 100644 --- a/web/content/docs/userguide/troubleshooting/get-support/index.md +++ b/web/content/docs/userguide/troubleshooting/get-support/index.md @@ -19,8 +19,7 @@ the following information: - **Full log output** as plain text (-file) (e.g., full compiler output including CMake run or output of a simulation run of OGS)! Please **do not** send screenshots of error messages! Instead copy and paste from your terminal application into the report! - - Information about your environment (e.g., did you used Conan for third-party dependencies or did you install them by - yourself, which library versions) + - Information about your environment (e.g. did you installed any OGS dependencies as system packages) - Information about the OGS configuration (e.g., debug or release, serial or parallel, MFront?, ...) Feel free to skip things from the list if you think they are not related to the issue but in general: the more information the diff --git a/web/data/versions.json b/web/data/versions.json index 52bcd1b3583..83ae1cb558d 100644 --- a/web/data/versions.json +++ b/web/data/versions.json @@ -9,7 +9,6 @@ "toolset": "142", "compiler": "19.24" }, - "conan": "1.45.0", "git": "2.14", "cmake": "3.22", "hugo": "0.64.1", From 8697cd137d0e3ddd767cc8f913ff8e1dd7534dff Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 15:48:25 +0100 Subject: [PATCH 6/8] [cmake] Config mode fix. --- scripts/cmake/Dependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index 75358413ac5..db1dd9e1882 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -447,7 +447,7 @@ endif() if(OGS_USE_NETCDF) find_package(netCDF CONFIG REQUIRED) find_library(NETCDF_LIBRARIES_CXX NAMES netcdf_c++4 netcdf-cxx4) - if(NOT ${NETCDF_LIBRARIES_CXX}) + if(NOT NETCDF_LIBRARIES_CXX) CPMAddPackage( NAME netcdf-cxx4 GIT_REPOSITORY https://github.com/Unidata/netcdf-cxx4 From 9857c0f8450c16902031682cdabafb54d617fb89 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Mon, 11 Dec 2023 12:01:01 +0100 Subject: [PATCH 7/8] [web] Added note on Windows NetCDF installation. --- .../docs/devguide/getting-started/prerequisites/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/content/docs/devguide/getting-started/prerequisites/index.md b/web/content/docs/devguide/getting-started/prerequisites/index.md index e37ffe324ad..6583f4f8c6a 100644 --- a/web/content/docs/devguide/getting-started/prerequisites/index.md +++ b/web/content/docs/devguide/getting-started/prerequisites/index.md @@ -288,7 +288,7 @@ brew install python
-## Optional: Install Qt and other dependencies for the Data Explorer +## Optional: Install Qt, NetCDF and other dependencies for the Data Explorer Use [Another Qt installer (`aqt`)](https://github.com/miurahr/aqtinstall) for installing the Qt binaries to some path on your machine: @@ -306,6 +306,8 @@ This will install Qt to `[your-directory]/qt/{{< dataFile "versions.tested_versi To finish add `[your-directory]/qt/{{< dataFile "versions.tested_version.qt" >}}/msvc2019_64/bin` bin to the `PATH` environment variable. +Install **NetCDF4** by downloading and installing the [official installer](https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netCDF4.9.2-NC4-64.exe). The C++-bindings to NetCDF are automatically build via CPM. +
From a26d52dc2969392c56a3bf1dc03ad537dc3e22db Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 12 Dec 2023 18:05:27 +0100 Subject: [PATCH 8/8] [juwels] Added note netcdf module. --- scripts/env/juwels/petsc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/env/juwels/petsc.sh b/scripts/env/juwels/petsc.sh index 5bff9e3d872..09d1a052344 100644 --- a/scripts/env/juwels/petsc.sh +++ b/scripts/env/juwels/petsc.sh @@ -9,6 +9,7 @@ module load Boost module load git module load HDF5/1.12.2 module load ScaLAPACK/2.2.0-fb +# module load netCDF-C++4 # uncomment when using OGS_USE_NETCDF=ON export CC=mpicc export CXX=mpic++