Skip to content

Commit

Permalink
[date] Fix installation (#32772)
Browse files Browse the repository at this point in the history
* [date] Fix installation

* update version database
  • Loading branch information
xiaozhuai authored Jul 26, 2023
1 parent e65af7b commit c269756
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 41 deletions.
32 changes: 0 additions & 32 deletions ports/date/0002-fix-cmake-3.14.patch

This file was deleted.

63 changes: 63 additions & 0 deletions ports/date/0002-fix-cmake-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 012512a..2cbcc21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,10 +73,6 @@ target_sources( date INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/iso_week.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/julian.h>
)
-if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
- # public headers will get installed:
- set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
-endif ()

# These used to be set with generator expressions,
#
@@ -144,7 +140,6 @@ if( BUILD_TZ_LIB )
endif( )
set_target_properties( date-tz PROPERTIES
POSITION_INDEPENDENT_CODE ON
- PUBLIC_HEADER "${TZ_HEADERS}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${ABI_VERSION}" )
if( NOT MSVC )
@@ -169,30 +164,26 @@ write_basic_package_version_file( "${version_config}"
COMPATIBILITY SameMajorVersion )

install( TARGETS date
- EXPORT dateConfig
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
+ EXPORT dateConfig )
export( TARGETS date NAMESPACE date:: FILE dateTargets.cmake )
-if (CMAKE_VERSION VERSION_LESS 3.15)
- install(
- FILES include/date/date.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
-endif ()
+install(
+ DIRECTORY "${CMAKE_SOURCE_DIR}/include/date"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ PATTERN "chrono_io.h" EXCLUDE
+)

if( BUILD_TZ_LIB )
install( TARGETS date-tz
EXPORT dateConfig
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # This is for Windows
export( TARGETS date-tz NAMESPACE date:: APPEND FILE dateTargets.cmake )
endif( )

-if( WIN32 AND NOT CYGWIN)
- set( CONFIG_LOC CMake )
-else( )
- set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" )
-endif( )
+
+set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" )
+
install( EXPORT dateConfig
FILE dateTargets.cmake
NAMESPACE date::
10 changes: 3 additions & 7 deletions ports/date/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
0001-fix-uwp.patch
0002-fix-cmake-3.14.patch
0002-fix-cmake-install.patch
fix-uninitialized-values.patch #Update the new version please remove this patch
)

Expand All @@ -30,15 +30,11 @@ vcpkg_cmake_configure(
)

vcpkg_cmake_install()

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
else()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/date)
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/date)

vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
4 changes: 4 additions & 0 deletions ports/date/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
date provides CMake targets:

find_package(date CONFIG REQUIRED)
target_link_libraries(main PRIVATE date::date date::date-tz)
2 changes: 1 addition & 1 deletion ports/date/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "date",
"version": "3.0.1",
"port-version": 3,
"port-version": 4,
"description": "A date and time library based on the C++17 <chrono> header",
"homepage": "https://github.com/HowardHinnant/date",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@
},
"date": {
"baseline": "3.0.1",
"port-version": 3
"port-version": 4
},
"dav1d": {
"baseline": "1.2.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/d-/date.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4f6b5d17f3cf8ffb0330963bf0b6d8efa9175e13",
"version": "3.0.1",
"port-version": 4
},
{
"git-tree": "b3ca1bdc08676cd1bb802421bd94a18872305737",
"version": "3.0.1",
Expand Down

0 comments on commit c269756

Please sign in to comment.