aboutsummaryrefslogtreecommitdiff
path: root/ports/date
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2019-11-22 09:47:40 -0800
committerGitHub <noreply@github.com>2019-11-22 09:47:40 -0800
commit45f4b820e5743b89bca3508ba2028cdd5d8bbd17 (patch)
treef874a8c4a7392309bdbb86447288597ec0a4a281 /ports/date
parent62d67d3bf8eeff1afa8009041fd08b8822676b7b (diff)
parent8831e8f25f1ff6546ee4a5291b91d599421637b3 (diff)
downloadvcpkg-45f4b820e5743b89bca3508ba2028cdd5d8bbd17.tar.gz
vcpkg-45f4b820e5743b89bca3508ba2028cdd5d8bbd17.zip
Merge branch 'master' into vcpkg_nuget
Diffstat (limited to 'ports/date')
-rw-r--r--ports/date/0001-fix-uwp.patch13
-rw-r--r--ports/date/0002-fix-cmake-3.14.patch31
-rw-r--r--ports/date/CMakeLists.txt44
-rw-r--r--ports/date/CONTROL4
-rw-r--r--ports/date/portfile.cmake38
-rw-r--r--ports/date/usage4
-rw-r--r--ports/date/vcpkg-cmake-wrapper.cmake11
7 files changed, 82 insertions, 63 deletions
diff --git a/ports/date/0001-fix-uwp.patch b/ports/date/0001-fix-uwp.patch
new file mode 100644
index 000000000..b414722cd
--- /dev/null
+++ b/ports/date/0001-fix-uwp.patch
@@ -0,0 +1,13 @@
+diff --git i/include/date/date.h w/include/date/date.h
+index fce6200..6a77ad4 100644
+--- i/include/date/date.h
++++ w/include/date/date.h
+@@ -82,7 +82,7 @@
+ #ifdef _MSC_VER
+ # pragma warning(push)
+ // warning C4127: conditional expression is constant
+-# pragma warning(disable : 4127)
++# pragma warning(disable : 4127 4996)
+ #endif
+
+ namespace date
diff --git a/ports/date/0002-fix-cmake-3.14.patch b/ports/date/0002-fix-cmake-3.14.patch
new file mode 100644
index 000000000..de5ec1bd3
--- /dev/null
+++ b/ports/date/0002-fix-cmake-3.14.patch
@@ -0,0 +1,31 @@
+diff --git i/CMakeLists.txt w/CMakeLists.txt
+index 885e424..b9e0b43 100644
+--- i/CMakeLists.txt
++++ w/CMakeLists.txt
+@@ -72,7 +72,6 @@ target_sources( date INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/julian.h>
+ )
+ # public headers will get installed:
+-set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
+ target_compile_definitions( date INTERFACE
+ #To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
+ ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
+@@ -112,7 +111,6 @@ if( BUILD_TZ_LIB )
+ endif( )
+ set_target_properties( tz PROPERTIES
+ POSITION_INDEPENDENT_CODE ON
+- PUBLIC_HEADER "${TZ_HEADERS}"
+ VERSION "${PROJECT_VERSION}"
+ SOVERSION "${PROJECT_VERSION}" )
+ if( NOT MSVC )
+@@ -136,8 +134,8 @@ write_basic_package_version_file( "${version_config}"
+ COMPATIBILITY SameMajorVersion )
+
+ install( TARGETS date
+- EXPORT dateConfig
+- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
++ EXPORT dateConfig )
++install( FILES include/date/date.h ${TZ_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
+ export( TARGETS date NAMESPACE date:: FILE dateConfig.cmake )
+
+ if( BUILD_TZ_LIB )
diff --git a/ports/date/CMakeLists.txt b/ports/date/CMakeLists.txt
deleted file mode 100644
index 292c1758a..000000000
--- a/ports/date/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-cmake_minimum_required(VERSION 3.5.1)
-project(tz CXX)
-
-set(CMAKE_CXX_STANDARD 11)
-if(MSVC)
- add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
-endif()
-
-option(HAS_REMOTE_API "" 0)
-
-add_definitions(-DNOMINMAX -DHAS_REMOTE_API=${HAS_REMOTE_API})
-
-add_library(date INTERFACE)
-target_include_directories(date INTERFACE $<INSTALL_INTERFACE:include>)
-
-add_library(tz src/tz.cpp)
-target_include_directories(tz PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
-
-if(HAS_REMOTE_API)
- find_package(CURL REQUIRED)
- target_link_libraries(tz PUBLIC $<BUILD_INTERFACE:${CURL_LIBRARIES}>)
- target_include_directories(tz PUBLIC $<BUILD_INTERFACE:${CURL_INCLUDE_DIRS}>)
-endif()
-
-if(BUILD_SHARED_LIBS)
- target_compile_definitions(tz PRIVATE -DDATE_BUILD_DLL)
-endif()
-
-install(
- TARGETS tz date
- EXPORT tz
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
-)
-
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-date-config.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-date-targets.cmake)\n")
-
-install(EXPORT tz FILE unofficial-date-targets.cmake NAMESPACE unofficial::date:: DESTINATION share/unofficial-date)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-date-config.cmake DESTINATION share/unofficial-date)
-
-if(NOT DISABLE_INSTALL_HEADERS)
- install(FILES include/date/date.h include/date/tz.h include/date/julian.h include/date/iso_week.h include/date/islamic.h DESTINATION include/date)
-endif()
diff --git a/ports/date/CONTROL b/ports/date/CONTROL
index 93f4b37cd..7aaa8a823 100644
--- a/ports/date/CONTROL
+++ b/ports/date/CONTROL
@@ -1,7 +1,7 @@
Source: date
-Version: ed0368f
+Version: 2019-11-08
Homepage: https://github.com/HowardHinnant/date
-Description: A date and time library based on the C++11/14/17 <chrono> header
+Description: A date and time library based on the C++17 <chrono> header
Feature: remote-api
Description: support automatic download of tz data
diff --git a/ports/date/portfile.cmake b/ports/date/portfile.cmake
index c82db3330..28c723a5f 100644
--- a/ports/date/portfile.cmake
+++ b/ports/date/portfile.cmake
@@ -10,37 +10,41 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO HowardHinnant/date
- REF ed0368fc75427ef05cefdf19a39b60d7bed2f039
- SHA512 5f6a0d7e094fd1ab7b6a1ea9a96e467138220e9207e2eda68f71b68d6c56759e7470fabdfa920d92876e9c9b466e56ea8102333f407a46bb4cba43a2dfeb5e3a
+ REF 3e376be2e9b4d32c946bd83c22601e4b7a1ce421
+ SHA512 9dad181f8544bfcff8c42200552b6673e537c53b34fbad11663d6435d4e5fd5a3ac6cabbb76312481c9784b237151d9ccd161bb1b8c54c563fa75073896f3cff
HEAD_REF master
+ PATCHES
+ "${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/0002-fix-cmake-3.14.patch"
)
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
-
-set(HAS_REMOTE_API 0)
+set(DATE_USE_SYSTEM_TZ_DB 1)
if("remote-api" IN_LIST FEATURES)
- set(HAS_REMOTE_API 1)
+ set(DATE_USE_SYSTEM_TZ_DB 0)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS -DHAS_REMOTE_API=${HAS_REMOTE_API}
- OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
+ OPTIONS
+ -DBUILD_TZ_LIB=ON
+ -DUSE_SYSTEM_TZ_DB=${DATE_USE_SYSTEM_TZ_DB}
)
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-date TARGET_PATH share/unofficial-date)
+if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ vcpkg_fixup_cmake_targets(CONFIG_PATH CMake TARGET_PATH share/date)
+else()
+ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/date TARGET_PATH share/date)
+endif()
vcpkg_copy_pdbs()
-set(HEADER "${CURRENT_PACKAGES_DIR}/include/date/tz.h")
-file(READ "${HEADER}" _contents)
-string(REPLACE "#define TZ_H" "#define TZ_H\n#undef HAS_REMOTE_API\n#define HAS_REMOTE_API ${HAS_REMOTE_API}" _contents "${_contents}")
-if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- string(REPLACE "ifdef DATE_BUILD_DLL" "if 1" _contents "${_contents}")
-endif()
-file(WRITE "${HEADER}" "${_contents}")
-
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright)
+file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/date)
+
+# Remove the wrapper when backwards compatibility when the unofficial::date::date and unofficial::date::tz
+# targets are no longer required.
+file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/date)
diff --git a/ports/date/usage b/ports/date/usage
new file mode 100644
index 000000000..82f42f7f2
--- /dev/null
+++ b/ports/date/usage
@@ -0,0 +1,4 @@
+The package date provides CMake targets:
+
+ find_package(date CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE date::date date::tz)
diff --git a/ports/date/vcpkg-cmake-wrapper.cmake b/ports/date/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..317c49b8c
--- /dev/null
+++ b/ports/date/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,11 @@
+_find_package(${ARGS})
+
+if(NOT TARGET unofficial::date::date AND TARGET date::date)
+ add_library(unofficial::date::date INTERFACE IMPORTED)
+ target_link_libraries(unofficial::date::date INTERFACE date::date)
+endif()
+
+if(NOT TARGET unofficial::date::tz AND TARGET date::tz)
+ add_library(unofficial::date::tz INTERFACE IMPORTED)
+ target_link_libraries(unofficial::date::tz INTERFACE date::tz)
+endif()