Skip to content

Commit

Permalink
Next 2
Browse files Browse the repository at this point in the history
  • Loading branch information
wardru committed Oct 30, 2023
1 parent 76bd1eb commit 71381d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
35 changes: 8 additions & 27 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conans import ConanFile
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
import os
import re
Expand All @@ -14,47 +14,28 @@ class PzaCxx(ConanFile):
"shared": True,
"build_examples": True
}
generators = "CMakeDeps", "CMakeToolchain", "virtualrunenv"
exports_sources = "CMakeLists.txt", "source/*", "version.h.in", "CHANGELOG.md", "test/*", "cmake/*", "examples/*", "LICENSE"

def requirements(self):
self.requires("paho-mqtt-cpp/[>=1.2.0]")
self.requires("spdlog/[>=1.11.0]")
self.requires("spdlog/[>=1.12.0]")
self.requires("nlohmann_json/[>=3.11.2]")
self.requires("magic_enum/[>=0.9.2]")
if self.settings.os == "Linux":
self.requires("gtest/cci.20210126")
self.requires("cppcheck/[>=2.10]")
self.requires("gtest/[>=1.14.0]")
self.requires("cppcheck/[>=2.12.1]")

def layout(self):
cmake_layout(self, build_folder=os.getcwd())

def configure(self):
self.options["*"].shared = self.options.shared
self.options["paho-mqtt-cpp"].shared = self.options.shared
self.options["spdlog"].shared = self.options.shared
self.options["nlohmann_json"].shared = self.options.shared
self.options["magic_enum"].shared = self.options.shared

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_EXAMPLES"] = self.options.build_examples
tc.filename = "pzacxx_toolchain.cmake"
tc.generate()
deps = CMakeDeps(self)
deps.generate()

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

def package(self):
cmake = CMake(self)
cmake.install()

def imports(self):
if self.settings.os == "Windows" and self.options.shared:
folder = f"{self.build_folder}/bin"
self.copy("*.dll", dst=folder, src="bin")
mingw_dlls = ["libgcc_s_seh-1.dll", "libwinpthread-1.dll", "libstdc++-6.dll"]
mingw_dll_path = "/usr/x86_64-w64-mingw32/bin"
for dll in mingw_dlls:
self.copy(dll, dst=folder, src=mingw_dll_path)

Binary file added scripts/.install_dependencies.sh.swp
Binary file not shown.
1 change: 0 additions & 1 deletion scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ conan install \
--build=missing \
--profile:b $FULL_PROFILE_BUILD \
--profile:h $FULL_PROFILE_HOST \
--install-folder=$FULL_BUILD_DIR \
$PROJECT_ROOT_DIR

0 comments on commit 71381d0

Please sign in to comment.