diff --git a/.github/workflows/build/osx/action.yml b/.github/workflows/build/osx/action.yml index 7e3834a83a..00bc91efe3 100644 --- a/.github/workflows/build/osx/action.yml +++ b/.github/workflows/build/osx/action.yml @@ -34,7 +34,7 @@ runs: - name: Install Python Dependencies shell: bash run: | - pip3 install aqtinstall conan==1.* --break-system-packages + pip3 install aqtinstall conan --break-system-packages - name: Retrieve Qt Cache id: cache-qt diff --git a/.github/workflows/build/windows/action.yml b/.github/workflows/build/windows/action.yml index db32cea968..f28b4f651b 100644 --- a/.github/workflows/build/windows/action.yml +++ b/.github/workflows/build/windows/action.yml @@ -26,7 +26,7 @@ runs: - name: Install Python Dependencies shell: bash - run: pip3 install aqtinstall conan==1.* + run: pip3 install aqtinstall conan # # Retrieve Qt cache (or install it) @@ -142,9 +142,7 @@ runs: if: ${{ steps.cache-conan.outputs.cache-hit != 'true' }} shell: bash run: | - conan profile new default --detect - conan profile update settings.compiler="Visual Studio" default - conan profile update settings.compiler.version=17 default + conan profile detect - name: Build if: ${{ inputs.cacheOnly == 'false' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b84593c7f..cd0b3f7c7a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,17 @@ -cmake_minimum_required(VERSION 3.15) -project(Dissolve) +cmake_minimum_required(VERSION 3.24) + +# Use Conan for dependency provision? +option(CONAN "Use conan to find dependencies" ON) +if(CONAN) + # Add local dirs to cmake Module search path + list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) + list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) + + list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "cmake/Modules/conan-dissolve.cmake") +endif(CONAN) + +# Set up the project +project(Dissolve LANGUAGES CXX) set(DESCRIPTION "Dissolve") set(AUTHOR "Team Dissolve") @@ -26,16 +38,6 @@ set(CMAKE_CXX_STANDARD 17) # Add our custom module search path list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules") -# Include Conan Packages -option(CONAN "Use conan to find dependencies" ON) -if(CONAN) - # Add local dirs to cmake Module search path - list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) - - include(conan-dissolve) -endif(CONAN) - # Find core dependencies set(CORE_LINK_LIBS "") find_package(fmt REQUIRED) diff --git a/cmake/Modules/conan-dissolve.cmake b/cmake/Modules/conan-dissolve.cmake index 02edd55aab..dcd6219908 100644 --- a/cmake/Modules/conan-dissolve.cmake +++ b/cmake/Modules/conan-dissolve.cmake @@ -1,7 +1,12 @@ # Fetch and include Conan-cmake integration if it doesn't exist if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") - message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") - file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake") + message(STATUS "Downloading conan_provider.cmake from https://github.com/conan-io/cmake-conan") + file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop2/conan_provider.cmake" "${CMAKE_BINARY_DIR}/conan.cmake" STATUS DOWNLOAD_STATUS) + list(GET DOWNLOAD_STATUS 0 ERROR_CODE) + if (NOT ${ERROR_CODE} STREQUAL "0") + list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE) + message(FATAL_ERROR "Failed to download Conan2 CMake integration: ${ERROR_MESSAGE}") + endif() endif () include(${CMAKE_BINARY_DIR}/conan.cmake) @@ -16,9 +21,9 @@ set(_conan_requires antlr4-cppruntime/4.13.1 ) set(_conan_options - fmt:header_only=True - pugixml:header_only=False - antlr4-cppruntime:shared=True + fmt/*:header_only=True + pugixml/*:header_only=False + antlr4-cppruntime/*:shared=True ${EXTRA_CONAN_OPTIONS} )