diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2023-09-07 11:38:59 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2023-09-07 11:38:59 +0200 |
| commit | 13cf6fe70cc68bd4d803385f5c6d7fe9c7691247 (patch) | |
| tree | e36644032f4c04134ec0754bb1bbbbe8df633954 | |
| parent | 77bf36d5183eb11642bdff771750a38d1b8fa8bd (diff) | |
| download | wanda-13cf6fe70cc68bd4d803385f5c6d7fe9c7691247.tar.xz wanda-13cf6fe70cc68bd4d803385f5c6d7fe9c7691247.zip | |
build: add a build version without libraries
| -rw-r--r-- | conanfile.py | 23 | ||||
| -rw-r--r-- | source/lib/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | source/lib/control/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | source/lib/meta/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | source/lib/proto/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | source/lib/std_ext/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | source/lib/system/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | test_package/conanfile.py | 21 |
8 files changed, 68 insertions, 26 deletions
diff --git a/conanfile.py b/conanfile.py index 5023db5..c54ac50 100644 --- a/conanfile.py +++ b/conanfile.py @@ -11,14 +11,21 @@ class Wanda(ConanFile): url = "https://github.com/fmorgner/wanda" license = "BSD 3-clause" description = "A wallpaper changer for the GNOME" + package_type = "library" scm = { "type": "git", "url": "auto", "revision": "auto", } generators = ("CMakeDeps",) - options = {"shared": [True, False]} - default_options = {"shared": False} + options = { + "nolibs": [True, False], + "shared": [True, False], + } + default_options = { + "nolibs": False, + "shared": False, + } settings = ( "os", "arch", @@ -30,7 +37,7 @@ class Wanda(ConanFile): tool_requires = ("cmake/[>=3.27]",) def requirements(self): - self.requires("boost/[~1.83]", transitive_headers=True, options={ + self.requires("boost/[~1.83]", transitive_headers=not self.options.nolibs, options={ "asio_no_deprecated": True, "system_no_deprecated": True, "header_only": True, @@ -38,7 +45,7 @@ class Wanda(ConanFile): self.requires("libjpeg-turbo/[~3.0]") self.requires("libpng/[~1.6]") self.requires("lyra/[~1.6]") - self.requires("spdlog/[~1.12]", transitive_headers=True, options={ + self.requires("spdlog/[~1.12]", transitive_headers=not self.options.nolibs, options={ "header_only": True, }) @@ -48,9 +55,14 @@ class Wanda(ConanFile): cmake.build() cmake.test(env="CTEST_OUTPUT_ON_FAILURE=1") + def configure(self): + if self.options.nolibs: + self.package_type = "application" + def generate(self): toolchain = CMakeToolchain(self) toolchain.variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True + toolchain.variables["WANDA_APPLICATIONS_ONLY"] = self.options.nolibs toolchain.generate() def layout(self): @@ -63,6 +75,9 @@ class Wanda(ConanFile): def package_info(self): self.runenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin")) + if self.options.nolibs: + return + self.cpp_info.components["control"].libs = ["wanda-control"] self.cpp_info.components["control"].requires = [ "meta", diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt index e2bb4b5..b9cafe7 100644 --- a/source/lib/CMakeLists.txt +++ b/source/lib/CMakeLists.txt @@ -1,3 +1,7 @@ +if(WANDA_APPLICATIONS_ONLY) + set(WANDA_LIBRARY_TYPE OBJECT) +endif() + add_subdirectory("control") add_subdirectory("meta") add_subdirectory("proto") diff --git a/source/lib/control/CMakeLists.txt b/source/lib/control/CMakeLists.txt index 2fce909..9e5a33d 100644 --- a/source/lib/control/CMakeLists.txt +++ b/source/lib/control/CMakeLists.txt @@ -6,7 +6,7 @@ file(GLOB_RECURSE LIB_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" CONFIGURE_D find_package("Boost" REQUIRED COMPONENTS "headers") find_package("spdlog" REQUIRED) -add_library("wanda-${LIB_NAME}" +add_library("wanda-${LIB_NAME}" ${WANDA_LIBRARY_TYPE} ${LIB_SOURCES} ) @@ -37,8 +37,10 @@ target_link_libraries("wanda-${LIB_NAME}" PUBLIC "spdlog::spdlog_header_only" ) -install(TARGETS "wanda-${LIB_NAME}" - FILE_SET HEADERS -) +if(NOT WANDA_APPLICATIONS_ONLY) + install(TARGETS "wanda-${LIB_NAME}" + FILE_SET HEADERS + ) +endif() add_library("wanda::${LIB_NAME}" ALIAS "wanda-${LIB_NAME}") diff --git a/source/lib/meta/CMakeLists.txt b/source/lib/meta/CMakeLists.txt index e6e3372..d21d45c 100644 --- a/source/lib/meta/CMakeLists.txt +++ b/source/lib/meta/CMakeLists.txt @@ -22,8 +22,10 @@ target_compile_features("wanda-${LIB_NAME}" INTERFACE "cxx_std_20" ) -install(TARGETS "wanda-${LIB_NAME}" - FILE_SET HEADERS -) +if(NOT WANDA_APPLICATIONS_ONLY) + install(TARGETS "wanda-${LIB_NAME}" + FILE_SET HEADERS + ) +endif() add_library("wanda::${LIB_NAME}" ALIAS "wanda-${LIB_NAME}") diff --git a/source/lib/proto/CMakeLists.txt b/source/lib/proto/CMakeLists.txt index cc218ba..a99c364 100644 --- a/source/lib/proto/CMakeLists.txt +++ b/source/lib/proto/CMakeLists.txt @@ -5,7 +5,7 @@ file(GLOB_RECURSE LIB_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" CONFIGURE_D find_package("spdlog") -add_library("wanda-${LIB_NAME}" +add_library("wanda-${LIB_NAME}" ${WANDA_LIBRARY_TYPE} ${LIB_SOURCES} ) @@ -31,8 +31,10 @@ target_link_libraries("wanda-${LIB_NAME}" PUBLIC "spdlog::spdlog_header_only" ) -install(TARGETS "wanda-${LIB_NAME}" - FILE_SET HEADERS -) +if(NOT WANDA_APPLICATIONS_ONLY) + install(TARGETS "wanda-${LIB_NAME}" + FILE_SET HEADERS + ) +endif() add_library("wanda::${LIB_NAME}" ALIAS "wanda-${LIB_NAME}") diff --git a/source/lib/std_ext/CMakeLists.txt b/source/lib/std_ext/CMakeLists.txt index e6e3372..d21d45c 100644 --- a/source/lib/std_ext/CMakeLists.txt +++ b/source/lib/std_ext/CMakeLists.txt @@ -22,8 +22,10 @@ target_compile_features("wanda-${LIB_NAME}" INTERFACE "cxx_std_20" ) -install(TARGETS "wanda-${LIB_NAME}" - FILE_SET HEADERS -) +if(NOT WANDA_APPLICATIONS_ONLY) + install(TARGETS "wanda-${LIB_NAME}" + FILE_SET HEADERS + ) +endif() add_library("wanda::${LIB_NAME}" ALIAS "wanda-${LIB_NAME}") diff --git a/source/lib/system/CMakeLists.txt b/source/lib/system/CMakeLists.txt index 6b7ce7c..59d0b50 100644 --- a/source/lib/system/CMakeLists.txt +++ b/source/lib/system/CMakeLists.txt @@ -24,7 +24,7 @@ pkg_check_modules("libmagic" "libmagic" ) -add_library("wanda-${LIB_NAME}" +add_library("wanda-${LIB_NAME}" ${WANDA_LIBRARY_TYPE} ${LIB_SOURCES} ) @@ -59,8 +59,10 @@ target_link_libraries("wanda-${LIB_NAME}" PUBLIC "PkgConfig::GIO" ) -install(TARGETS "wanda-${LIB_NAME}" - FILE_SET HEADERS -) +if(NOT WANDA_APPLICATIONS_ONLY) + install(TARGETS "wanda-${LIB_NAME}" + FILE_SET HEADERS + ) +endif() add_library("wanda::${LIB_NAME}" ALIAS "wanda-${LIB_NAME}") diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 6c01007..6077dcb 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -13,14 +13,27 @@ class WandaTestConan(ConanFile): self.requires(self.tested_reference_str) def build(self): + if self._apps_only: + return + cmake = CMake(self) cmake.configure() cmake.build() - + def layout(self): cmake_layout(self) - + def test(self): - if can_run(self): + if not can_run(self): + return + + if self._apps_only: + self.run("wandad -h", env="conanrun") + self.run("wandac -h", env="conanrun") + else: cmd = os.path.join(self.cpp.build.bindir, "test") - self.run(cmd, env="conanrun")
\ No newline at end of file + self.run(cmd, env="conanrun") + + @property + def _apps_only(self): + return self.dependencies[self.tested_reference_str].options.nolibs |
