From 4b8d0723cfa80a133014bbea93fef07811450d34 Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sun, 20 Oct 2024 18:57:15 +0200 Subject: [PATCH] github, use conan2 instead of conan --- .github/workflows/c-cpp.yml | 29 +++++++++++++---------------- INSTALL | 2 +- conanfile.py | 23 +++++++++++++++++++++++ conanfile.txt | 21 --------------------- 4 files changed, 37 insertions(+), 38 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index a75e9bc..c8c4352 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -13,13 +13,11 @@ jobs: - name: Install Conan uses: turtlebrowser/get-conan@main with: - version: 1.62.0 + version: 2.8.1 - name: Configure conan - run: conan profile new default --detect - - name: Update default profile - run: conan profile update settings.compiler.libcxx=libstdc++11 default + run: conan profile detect - name: Install deps - run: conan install . --install-folder=${{github.workspace}}/build --build=missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True + run: conan install . --output-folder=${{github.workspace}}/build --build=missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True - name: "Configure and build" run: cmake -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -S . -B build - name: build @@ -37,14 +35,12 @@ jobs: - name: Install Conan uses: turtlebrowser/get-conan@main with: - version: 1.62.0 + version: 2.8.1 - name: Configure conan - run: conan profile new default --detect - - name: Update default profile - run: conan profile update settings.compiler.libcxx=libc++ default + run: conan profile detect - name: Install deps - run: conan install . --install-folder=${{github.workspace}}/build --build=missing + run: conan install . --output-folder=${{github.workspace}}/build --build=missing - name: "Configure and build" run: cmake -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -S . -B build @@ -64,20 +60,21 @@ jobs: - name: Install Conan uses: turtlebrowser/get-conan@main with: - version: 1.62.0 + version: 2.8.1 - name: Configure conan - run: conan profile new default --detect + run: conan profile detect - name: Install deps - run: conan install . --install-folder=${{github.workspace}}/build --build=missing + run: conan install . --output-folder=${{github.workspace}}/build --build=missing - name: "Configure and build" - run: cmake -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/build/generators/conan_toolchain.cmake -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -S . -B build + run: cmake -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/build/build/generators/conan_toolchain.cmake" -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -S . -B build + - name: build run: cmake --build build --config Release - name: Install NSIS - uses: repolevedavaj/install-nsis@v1.0.1 + uses: repolevedavaj/install-nsis@v1.0.2 with: - nsis-version: 3.08 + nsis-version: "3.10" - name: package run: cmake --build build --config Release --target package - uses: actions/upload-artifact@v4 diff --git a/INSTALL b/INSTALL index 6bb814d..4503fc0 100644 --- a/INSTALL +++ b/INSTALL @@ -5,7 +5,7 @@ Li-Ri depends on SDL2 and SDL2_mixer (and their dependencies). Compilation via conan: ======================= -Install conan (version 1 for now, it is not compatible with conan 2 yet as SDL2_mixer is not yet available) and run it: `conan install . --install-folder=build --build=missing`. +Install conan 2 and run it: `conan install . --output-folder=build --build=missing`. Then, run cmake to generate the build files: `cmake -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -S . -B build`. diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..8d3d7cf --- /dev/null +++ b/conanfile.py @@ -0,0 +1,23 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain + +class LiRi(ConanFile): + settings = "os", "compiler", "build_type", "arch" + requires = "sdl/[~2.28.5]", "sdl_mixer/[~2.8.0]", "openssl/1.1.1w" + + def layout(self): + cmake_layout(self) + + def configure(self): + self.options["sdl_mixer/*"].mpg123 = False + self.options["sdl_mixer/*"].opus = False + self.options["sdl_mixer/*"].ogg = False + self.options["sdl_mixer/*"].flac = False + self.options["sdl_mixer/*"].mad = False + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.user_presets_path = 'ConanPresets.json' + tc.generate() diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 74250d5..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,21 +0,0 @@ -[requires] -sdl/[~2.0] -sdl_mixer/[~2.0] -openssl/1.1.1q -libxml2/2.11.5 - -[generators] -CMakeToolchain -CMakeDeps - -[layout] -cmake_layout - -[options] -sdl_mixer:mpg123=False -sdl_mixer:opus=False -sdl_mixer:ogg=False -sdl_mixer:flac=False -sdl_mixer:mad=False -sdl_mixer:mikmod=False -