diff options
| author | Alexander Saprykin <xelfium@gmail.com> | 2018-05-26 13:27:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-26 13:27:14 +0200 |
| commit | 4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5 (patch) | |
| tree | d95c9490352eb73f078d34a33bc4bb44ac9fa48b /ports/date | |
| parent | fb689bd13dd6ba563a885d71fff1dd2b32a615db (diff) | |
| parent | 2ac7527b40b1dbeb7856b9f763362c1e139e2ca9 (diff) | |
| download | vcpkg-4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5.tar.gz vcpkg-4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5.zip | |
Merge pull request #1 from Microsoft/master
Update vcpkg from upstream
Diffstat (limited to 'ports/date')
| -rw-r--r-- | ports/date/CMakeLists.txt | 44 | ||||
| -rw-r--r-- | ports/date/CONTROL | 7 | ||||
| -rw-r--r-- | ports/date/fix-date.patch | 36 | ||||
| -rw-r--r-- | ports/date/portfile.cmake | 51 |
4 files changed, 138 insertions, 0 deletions
diff --git a/ports/date/CMakeLists.txt b/ports/date/CMakeLists.txt new file mode 100644 index 000000000..292c1758a --- /dev/null +++ b/ports/date/CMakeLists.txt @@ -0,0 +1,44 @@ +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 new file mode 100644 index 000000000..f9a86d671 --- /dev/null +++ b/ports/date/CONTROL @@ -0,0 +1,7 @@ +Source: date +Version: 2.4.1 +Description: A date and time library based on the C++11/14/17 <chrono> header + +Feature: remote-api +Description: support automatic download of tz data +Build-Depends: curl diff --git a/ports/date/fix-date.patch b/ports/date/fix-date.patch new file mode 100644 index 000000000..bf4c05b38 --- /dev/null +++ b/ports/date/fix-date.patch @@ -0,0 +1,36 @@ +diff --git a/include/date/tz.h b/include/date/tz.h +index 280a598..f9b5a35 100644 +--- a/include/date/tz.h ++++ b/include/date/tz.h +@@ -1963,7 +1963,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt, + bool is_60_sec = fds.tod.seconds() == seconds{60}; + if (is_60_sec) + fds.tod.seconds() -= seconds{1}; +- auto tmp = to_utc_time(sys_days(fds.ymd) - *offptr + fds.tod.to_duration()); ++ auto tmp = utc_clock::from_sys(sys_days(fds.ymd) - *offptr + fds.tod.to_duration()); + if (is_60_sec) + tmp += seconds{1}; + if (is_60_sec != is_leap_second(tmp).first || !fds.tod.in_conventional_range()) +@@ -2197,7 +2197,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt, + return is; + } + +-#if !defined(_MSC_VER) || _MSC_VER > 1912 ++#if !defined(_MSC_VER) || _MSC_VER > 1913 + + // clock_time_conversion + +@@ -2471,7 +2471,7 @@ clock_cast(const std::chrono::time_point<SrcClock, Duration>& tp) + return clock_cast_detail::cc_impl<DstClock>(tp, &tp); + } + +-#endif // !defined(_MSC_VER) || _MSC_VER > 1912 ++#endif // !defined(_MSC_VER) || _MSC_VER > 1913 + + // Deprecated API + +@@ -2579,3 +2579,4 @@ to_gps_time(const tai_time<Duration>& t) + } // namespace date + + #endif // TZ_H ++ diff --git a/ports/date/portfile.cmake b/ports/date/portfile.cmake new file mode 100644 index 000000000..749c0c5f0 --- /dev/null +++ b/ports/date/portfile.cmake @@ -0,0 +1,51 @@ +include(vcpkg_common_functions) + +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(WARNING + "You will need to also install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml into your install location.\n" + "See https://howardhinnant.github.io/date/tz.html" + ) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO HowardHinnant/date + REF v2.4.1 + SHA512 ce7d1c4518558d3690b3a33cd3da1066b43a5f641282c331c60be73e9b010227d4998bca5f34694215ae52f6514a2f5eccd6b0a5ee3dcf8cef2f2d1644c8beee + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-date.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +set(HAS_REMOTE_API 0) +if("remote-api" IN_LIST FEATURES) + set(HAS_REMOTE_API 1) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DHAS_REMOTE_API=${HAS_REMOTE_API} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-date TARGET_PATH share/unofficial-date) + +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(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright) |
