Skip to content

Commit

Permalink
(#24998) date : add an option to install all headers
Browse files Browse the repository at this point in the history
* date : add an option to install all headers

* Tweaked conanfile

* Copy all headers always

Signed-off-by: Uilian Ries <uilianries@gmail.com>

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: PerseoGI <perseog@jfrog.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
3 people authored Sep 2, 2024
1 parent 1ea7e40 commit 9c1d6a3
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions recipes/date/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,13 @@ def build(self):

def package(self):
copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
if self.options.header_only:
src = os.path.join(self.source_folder, "include", "date")
dst = os.path.join(self.package_folder, "include", "date")
copy(self, "date.h", dst=dst, src=src)
copy(self, "tz.h", dst=dst, src=src)
copy(self, "ptz.h", dst=dst, src=src)
copy(self, "iso_week.h", dst=dst, src=src)
copy(self, "julian.h", dst=dst, src=src)
copy(self, "islamic.h", dst=dst, src=src)
else:
if not self.options.header_only:
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "CMake"))
copy(self, "*.h", dst=os.path.join(self.package_folder, "include", "date"),
src=os.path.join(self.source_folder, "include", "date"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "date")
Expand All @@ -120,18 +113,13 @@ def package_info(self):
lib_name = "{}tz".format("date-" if Version(self.version) >= "3.0.0" else "")
self.cpp_info.components["date-tz"].libs = [lib_name]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["date-tz"].system_libs.append("pthread")
self.cpp_info.components["date-tz"].system_libs.append("m")
self.cpp_info.components["date-tz"].system_libs.extend(["m", "pthread"])

if not self.options.use_system_tz_db:
self.cpp_info.components["date-tz"].requires.append("libcurl::libcurl")

if self.options.use_system_tz_db and not self.settings.os == "Windows":
use_os_tzdb = 1
else:
use_os_tzdb = 0

defines = ["USE_OS_TZDB={}".format(use_os_tzdb)]
use_os_tzdb = 1 if self.options.use_system_tz_db and not self.settings.os == "Windows" else 0
defines = [f"USE_OS_TZDB={use_os_tzdb}"]
if self.settings.os == "Windows" and self.options.shared:
defines.append("DATE_USE_DLL=1")

Expand Down

0 comments on commit 9c1d6a3

Please sign in to comment.