Skip to content

Commit

Permalink
add conanfile
Browse files Browse the repository at this point in the history
  • Loading branch information
pasbi committed Sep 29, 2024
1 parent 87752c6 commit d54c617
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 12 deletions.
13 changes: 1 addition & 12 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
Expand Down
62 changes: 62 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -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 = "<Put the package license here>"
author = "<Put your name here> <And your email here>"
url = "<Package recipe repository url here, for issues about the package>"
description = "<Description of hello package here>"
topics = ("<Put some tag here>", "<here>", "<and here>")

# 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"]

0 comments on commit d54c617

Please sign in to comment.