From 0ee615c4d3199c75cd34034edc6745c99f7cd88b Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 23 Dec 2024 10:42:09 +0100 Subject: [PATCH] :wrench: Use conan_provider for running conan --- .github/workflows/build-conan.yml | 26 +++++++---------------- .github/workflows/build-native.yml | 2 +- CMakeLists.txt | 12 +++++++++++ tools/conan-profiles/vs-19-debug | 8 ------- tools/conan-profiles/vs-19-debug-ninja | 10 --------- tools/conan-profiles/vs-19-release | 8 ------- tools/conan-profiles/vs-19-release-ninja | 10 --------- tools/conan-profiles/vs-19-relwithdebinfo | 8 ------- tools/conan-profiles/vs-22-debug | 8 ------- tools/conan-profiles/vs-22-debug-ninja | 10 --------- tools/conan-profiles/vs-22-release | 8 ------- tools/conan-profiles/vs-22-release-ninja | 10 --------- tools/conan-profiles/vs-22-relwithdebinfo | 8 ------- 13 files changed, 21 insertions(+), 107 deletions(-) delete mode 100644 tools/conan-profiles/vs-19-debug delete mode 100644 tools/conan-profiles/vs-19-debug-ninja delete mode 100644 tools/conan-profiles/vs-19-release delete mode 100644 tools/conan-profiles/vs-19-release-ninja delete mode 100644 tools/conan-profiles/vs-19-relwithdebinfo delete mode 100644 tools/conan-profiles/vs-22-debug delete mode 100644 tools/conan-profiles/vs-22-debug-ninja delete mode 100644 tools/conan-profiles/vs-22-release delete mode 100644 tools/conan-profiles/vs-22-release-ninja delete mode 100644 tools/conan-profiles/vs-22-relwithdebinfo diff --git a/.github/workflows/build-conan.yml b/.github/workflows/build-conan.yml index 856bfcea..be3732ab 100644 --- a/.github/workflows/build-conan.yml +++ b/.github/workflows/build-conan.yml @@ -34,34 +34,24 @@ jobs: curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash sudo apt-get update sudo apt-get -y install ninja-build + conan profile detect --force + echo "tools.system.package_manager:mode = install" > ~/.conan2/global.conf + echo "tools.system.package_manager:sudo = True" >> ~/.conan2/global.conf - name: Install dependencies (Windows) if: startsWith(matrix.os, 'windows') shell: cmd run: git clone https://git.anotherfoxguy.com/AnotherFoxGuy/build-tools.git %BUILD_TOOLS_PATH% - - name: Configure (Ubuntu) - if: startsWith(matrix.os, 'ubuntu') - run: | - conan profile detect --force - echo "tools.system.package_manager:mode = install" > ~/.conan2/global.conf - echo "tools.system.package_manager:sudo = True" >> ~/.conan2/global.conf - conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f - conan install . -s build_type=Release -b missing -pr:b=default -c tools.cmake.cmaketoolchain:generator="Ninja" - cmake --preset conan-release - shell: bash - - - - name: Configure (Windows) - if: startsWith(matrix.os, 'windows') + - name: Configure run: | conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f - conan install . -b missing -pr:b=tools/conan-profiles/vs-22-release-ninja -pr=tools/conan-profiles/vs-22-release-ninja - cmake --preset conan-release - shell: cmd + cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -Bbuild - name: Build - run: ninja + run: | + cd build + ninja - name: Upload bin folder uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index 43d54318..e197babf 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - name: Configure - run: cmake -DCMAKE_BUILD_TYPE=Release . + run: cmake -DCMAKE_BUILD_TYPE=Release -DUSE_CONAN=OFF . - name: Build run: make -j4 diff --git a/CMakeLists.txt b/CMakeLists.txt index b8f371a8..f3cc7f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,17 @@ # ensure cmake features we need CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + +option(USE_CONAN "Use Conan to automatically manage dependencies" ON) +if(USE_CONAN) + if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan_provider.cmake") + file(DOWNLOAD "https://cdn.statically.io/gh/conan-io/cmake-conan/c22bbf0af0b73d5f0def24a9cdf4ce503ae79e5d/conan_provider.cmake" + "${CMAKE_BINARY_DIR}/conan_provider.cmake" + EXPECTED_HASH SHA256=796E17C1240D7B2167388B9F68411208084A641ED25DF172D64D80EF92F8DA7A + TLS_VERIFY ON) + endif() + list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_BINARY_DIR}/conan_provider.cmake) +endif() + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) include(CMakeDependentOption) diff --git a/tools/conan-profiles/vs-19-debug b/tools/conan-profiles/vs-19-debug deleted file mode 100644 index e2c293d9..00000000 --- a/tools/conan-profiles/vs-19-debug +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=192 -compiler.runtime=dynamic -compiler.runtime_type=Debug -build_type=Debug diff --git a/tools/conan-profiles/vs-19-debug-ninja b/tools/conan-profiles/vs-19-debug-ninja deleted file mode 100644 index f3cdbf4a..00000000 --- a/tools/conan-profiles/vs-19-debug-ninja +++ /dev/null @@ -1,10 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=192 -compiler.runtime=dynamic -compiler.runtime_type=Debug -build_type=Debug -[conf] -tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-19-release b/tools/conan-profiles/vs-19-release deleted file mode 100644 index 724f12a9..00000000 --- a/tools/conan-profiles/vs-19-release +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=192 -compiler.runtime=dynamic -compiler.runtime_type=Release -build_type=Release diff --git a/tools/conan-profiles/vs-19-release-ninja b/tools/conan-profiles/vs-19-release-ninja deleted file mode 100644 index 24be6d9f..00000000 --- a/tools/conan-profiles/vs-19-release-ninja +++ /dev/null @@ -1,10 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=192 -compiler.runtime=dynamic -compiler.runtime_type=Release -build_type=Release -[conf] -tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-19-relwithdebinfo b/tools/conan-profiles/vs-19-relwithdebinfo deleted file mode 100644 index 4749266f..00000000 --- a/tools/conan-profiles/vs-19-relwithdebinfo +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -os_build=Windows -arch=x86_64 -arch_build=x86_64 -compiler=Visual Studio -compiler.version=16 -build_type=RelWithDebInfo \ No newline at end of file diff --git a/tools/conan-profiles/vs-22-debug b/tools/conan-profiles/vs-22-debug deleted file mode 100644 index eedff185..00000000 --- a/tools/conan-profiles/vs-22-debug +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=194 -compiler.runtime=dynamic -compiler.runtime_type=Debug -build_type=Debug \ No newline at end of file diff --git a/tools/conan-profiles/vs-22-debug-ninja b/tools/conan-profiles/vs-22-debug-ninja deleted file mode 100644 index 84bafd1c..00000000 --- a/tools/conan-profiles/vs-22-debug-ninja +++ /dev/null @@ -1,10 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=194 -compiler.runtime=dynamic -compiler.runtime_type=Debug -build_type=Debug -[conf] -tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-22-release b/tools/conan-profiles/vs-22-release deleted file mode 100644 index aed387cb..00000000 --- a/tools/conan-profiles/vs-22-release +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=194 -compiler.runtime=dynamic -compiler.runtime_type=Release -build_type=Release \ No newline at end of file diff --git a/tools/conan-profiles/vs-22-release-ninja b/tools/conan-profiles/vs-22-release-ninja deleted file mode 100644 index 8ee985e0..00000000 --- a/tools/conan-profiles/vs-22-release-ninja +++ /dev/null @@ -1,10 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=194 -compiler.runtime=dynamic -compiler.runtime_type=Release -build_type=Release -[conf] -tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-22-relwithdebinfo b/tools/conan-profiles/vs-22-relwithdebinfo deleted file mode 100644 index d5bc3d4a..00000000 --- a/tools/conan-profiles/vs-22-relwithdebinfo +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=194 -compiler.runtime=dynamic -compiler.runtime_type=RelWithDebInfo -build_type=RelWithDebInfo