From 9bbd0248879b5c6da554a5bdd52e4ed615e688a4 Mon Sep 17 00:00:00 2001 From: pascal Date: Sun, 29 Sep 2024 14:36:11 +0200 Subject: [PATCH] add conanfile --- .github/workflows/cmake-multi-platform.yml | 15 +----- conanfile.py | 62 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 conanfile.py diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index c2e8636..501b085 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -12,7 +12,7 @@ jobs: build: env: CONAN_HOME: "${{ github.workspace }}/.conan2" - + runs-on: ${{ matrix.os }} strategy: @@ -76,19 +76,8 @@ jobs: name: Create default Conan profile run: conan profile detect - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} - - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: conan create . --build=missing - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..ecf23a7 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,62 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps + + +class TireRecipe(ConanFile): + name = "tire" + version = "1.0" + + # Optional metadata + license = "" + author = " " + url = "" + description = "" + topics = ("", "", "") + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "CMakeLists.txt", "src/*", "include/*", "test/*" + + def requirements(self): + self.requires("qt/[>=6.4]", options={ + "openssl": False, + "with_pq": False, + "with_md4c": False, + "with_odbc": False, + "with_brotli": False, + "with_libpng": False, + "with_sqlite3": True, + "shared": True, + }) + self.requires("spdlog/[>=1.14]") + self.requires("nlohmann_json/[>=3.0]") + self.requires("fmt/[>=10.0]") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["hello"]