From 675323c45c0ffb47c62adb2d3ac098bda5cc5d1d Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Tue, 15 Aug 2017 12:47:23 -0700 Subject: [PATCH 1/2] [date] init port --- ports/date/CMakeLists.txt | 25 +++++++++++++++++++++++++ ports/date/CONTROL | 3 +++ ports/date/portfile.cmake | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 ports/date/CMakeLists.txt create mode 100644 ports/date/CONTROL create mode 100644 ports/date/portfile.cmake diff --git a/ports/date/CMakeLists.txt b/ports/date/CMakeLists.txt new file mode 100644 index 0000000000..2f4771db14 --- /dev/null +++ b/ports/date/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.5.1) +project(tz CXX) + +if(MSVC) + add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) +endif() + +if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +include_directories(${PROJECT_SRC_DIR}) + +add_library(tz tz.cpp) + +install( + TARGETS tz + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES date.h tz.h julian.h iso_week.h islamic.h DESTINATION include) +endif() diff --git a/ports/date/CONTROL b/ports/date/CONTROL new file mode 100644 index 0000000000..8eab618c28 --- /dev/null +++ b/ports/date/CONTROL @@ -0,0 +1,3 @@ +Source: date +Version: 2.2 +Description: A date and time library based on the C++11/14/17 header diff --git a/ports/date/portfile.cmake b/ports/date/portfile.cmake new file mode 100644 index 0000000000..ef49b7d0a8 --- /dev/null +++ b/ports/date/portfile.cmake @@ -0,0 +1,22 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO HowardHinnant/date + REF v2.2 + SHA512 6889152acf1d0cc551d572eccaabd9f00ebecdb5723356949db2f1bd5f4b13e1ffad889082451cfb28254968a576b983116bc1a77e060426c9f33ca7774822cb + HEAD_REF master +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) From a1c3bd230a327e0ba7252a4e6be72f614ad90986 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Thu, 31 Aug 2017 16:06:18 -0700 Subject: [PATCH 2/2] [date] Howard HInnant date utils init --- ports/date/CMakeLists.txt | 13 +++++++++---- ports/date/portfile.cmake | 34 +++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ports/date/CMakeLists.txt b/ports/date/CMakeLists.txt index 2f4771db14..91fcab1c7e 100644 --- a/ports/date/CMakeLists.txt +++ b/ports/date/CMakeLists.txt @@ -5,14 +5,19 @@ if(MSVC) add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() -if(BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() +add_definitions(-DNOMINMAX) -include_directories(${PROJECT_SRC_DIR}) + +include_directories(".") add_library(tz tz.cpp) +if(BUILD_SHARED_LIBS) + target_compile_definitions(tz PRIVATE -DDATE_BUILD_DLL) +else() + target_compile_definitions(tz PRIVATE -DDATE_BUILD_LIB) +endif() + install( TARGETS tz RUNTIME DESTINATION bin diff --git a/ports/date/portfile.cmake b/ports/date/portfile.cmake index ef49b7d0a8..f73c72b52e 100644 --- a/ports/date/portfile.cmake +++ b/ports/date/portfile.cmake @@ -1,22 +1,38 @@ include(vcpkg_common_functions) +message(WARNING + "You will need to also install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml into your install location" + "See https://howardhinnant.github.io/date/tz.html" +) + vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO HowardHinnant/date - REF v2.2 - SHA512 6889152acf1d0cc551d572eccaabd9f00ebecdb5723356949db2f1bd5f4b13e1ffad889082451cfb28254968a576b983116bc1a77e060426c9f33ca7774822cb - HEAD_REF master + OUT_SOURCE_PATH SOURCE_PATH + REPO HowardHinnant/date + REF 272d487b3d490126e520b67fe76bbb2e67226c07 + SHA512 59e8ff642d3eb82cb6116a77d4c5e14bbc2ae6bd4019e64a49609b6e46d679c2cb4ccae74807b72223aed18ae015596193919cdb58b011bfb774ff3e29a1d43b + HEAD_REF master ) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON ) vcpkg_install_cmake() -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright) +vcpkg_copy_pdbs() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +set(HEADER "${CURRENT_PACKAGES_DIR}/include/tz.h") +file(READ "${HEADER}" _contents) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + string(REPLACE "DATE_BUILD_DLL" "1" _contents "${_contents}") +else() + string(REPLACE "DATE_BUILD_LIB" "1" _contents "${_contents}") +endif() +file(WRITE "${HEADER}" "${_contents}") + + +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright)