Skip to content

Commit

Permalink
daggy: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 9, 2023
1 parent e70aa81 commit 35f9756
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
17 changes: 12 additions & 5 deletions recipes/daggy/2.1/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy, get
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"
required_conan_version = ">=1.60.0 <2 || >=2.0.5"


class DaggyConan(ConanFile):
Expand All @@ -17,7 +17,7 @@ class DaggyConan(ConanFile):
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/synacker/daggy"
topics = ("streaming", "qt", "monitoring", "process", "stream-processing", "extensible", "serverless-framework", "aggregation", "ssh2", "crossplatform", "ssh-client")
topics = ("streaming", "qt", "monitoring", "process", "stream-processing", "extensible", "serverless-framework", "aggregation", "ssh2", "cross-platform", "ssh-client")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
Expand Down Expand Up @@ -63,7 +63,8 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("qt/6.6.0")
# Qt is used in the public headers
self.requires("qt/6.6.0", transitive_headers=True, transitive_libs=True)
self.requires("kainjow-mustache/4.1")
if self.options.with_yaml:
self.requires("yaml-cpp/0.8.0")
Expand All @@ -83,13 +84,19 @@ def validate(self):

def build_requirements(self):
self.tool_requires("cmake/[>=3.21 <4]")
self.tool_requires("qt/<host_version>")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
env = VirtualBuildEnv(self)
env.generate()

# Required for Qt's moc
env = VirtualRunEnv(self)
env.generate(scope="build")

tc = CMakeToolchain(self)
tc.variables["CMAKE_CXX_STANDARD"] = 17
tc.variables["CMAKE_CXX_STANDARD_REQUIRED"] = True
Expand All @@ -110,7 +117,7 @@ def generate(self):

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.configure(build_script_folder=os.path.join(self.source_folder, "src"))
cmake.build()

def package(self):
Expand Down
4 changes: 2 additions & 2 deletions recipes/daggy/2.1/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ if (NOT CMAKE_CXX_STANDARD)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(testcpp test.cpp)
target_link_libraries(testcpp daggy::daggy)
add_executable(test_package test.cpp)
target_link_libraries(test_package daggy::daggy)
2 changes: 1 addition & 1 deletion recipes/daggy/2.1/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def requirements(self):
self.requires(self.tested_reference_str)

def build_requirements(self):
self.tool_requires("cmake/3.21.3")
self.tool_requires("cmake/[>=3.21 <4]")

def layout(self):
cmake_layout(self)
Expand Down
5 changes: 2 additions & 3 deletions recipes/daggy/2.1/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ class DaggyTestConan(ConanFile):
generators = "cmake", "cmake_find_package_multi", "cmake_paths", "cmake_find_package"

def build_requirements(self):
self.build_requires("cmake/3.21.3")
self.build_requires("cmake/[>=3.21 <4]")

def build(self):
cmake = CMake(self)

cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
self.run(os.path.join("bin", "testcpp"), run_environment=True)
self.run(os.path.join("bin", "test_package"), run_environment=True)

0 comments on commit 35f9756

Please sign in to comment.