Conan packaging refactored
This commit is contained in:
1 parent
88a3b9b50a
commit
85cd880572
7 files changed
+47
-40
No files matched your search
@@ -29,6 +29,11 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
# test conan-generated target
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) # conan is not able to propagate that yet :-(
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::mp-units)
|
||||
add_executable(${PROJECT_NAME}_conan test_package.cpp)
|
||||
target_compile_features(${PROJECT_NAME}_conan PRIVATE cxx_std_20) # Conan is not able to propagate that yet :-(
|
||||
target_link_libraries(${PROJECT_NAME}_conan PRIVATE CONAN_PKG::mp-units)
|
||||
|
||||
# test cmake-generated target
|
||||
find_package(units CONFIG REQUIRED)
|
||||
add_executable(${PROJECT_NAME}_cmake test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}_cmake PRIVATE mp::units)
|
||||
@@ -24,7 +24,7 @@ from conans import ConanFile, CMake, tools, RunEnvironment
|
||||
import os
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
settings = "cppstd", "os", "compiler", "build_type", "arch"
|
||||
generators = "cmake"
|
||||
|
||||
def build(self):
|
||||
@@ -32,20 +32,7 @@ class TestPackageConan(ConanFile):
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def imports(self):
|
||||
self.copy("*.dll", dst="bin", src="bin")
|
||||
self.copy("*.dylib*", dst="bin", src="lib")
|
||||
self.copy('*.so*', dst='bin', src='lib')
|
||||
|
||||
def _test_run(self, bin_path):
|
||||
if self.settings.os == "Windows":
|
||||
self.run(bin_path)
|
||||
elif self.settings.os == "Macos":
|
||||
self.run("DYLD_LIBRARY_PATH=%s %s" % (os.environ.get('DYLD_LIBRARY_PATH', ''), bin_path))
|
||||
else:
|
||||
self.run("LD_LIBRARY_PATH=%s %s" % (os.environ.get('LD_LIBRARY_PATH', ''), bin_path))
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self.settings):
|
||||
with tools.environment_append(RunEnvironment(self).vars):
|
||||
self._test_run(os.path.join("bin", "test_package"))
|
||||
self.run(os.path.join("bin", "test_package_conan"), run_environment=True)
|
||||
self.run(os.path.join("bin", "test_package_cmake"), run_environment=True)
|
||||
Reference in new issue
Block a user