Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Move to conan 2.0 #1339

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/build/osx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build/windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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' }}
Expand Down
26 changes: 14 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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)
Expand Down
15 changes: 10 additions & 5 deletions cmake/Modules/conan-dissolve.cmake
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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}
)

Expand Down
Loading