[lcms] Backfill compat for lcms::lcms (#20034)

* [lcms] Backfill compat for lcms::lcms

* Remove :@TARGET_TRIPLET@

* Add comment for duplicate vcpkg_cmake_config_fixup.

* [lcms] Update version db

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Robert Schumacher 2021-09-23 11:00:41 -07:00 committed by GitHub
parent 23cfcb4cd0
commit 674e616a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 57 deletions

View File

@ -1,42 +1,10 @@
cmake_minimum_required(VERSION 3.5)
option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF)
option(BUILD_SHARED_LIBS "Create lcms2 as a shared library" ON)
project(little-cms)
set(CMAKE_DEBUG_POSTFIX d)
file(GLOB SRCS src/*.c)
add_library(lcms2
"${CMAKE_CURRENT_LIST_DIR}/src/cmstypes.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsvirt.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmswtpnt.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsxform.c"
"${CMAKE_CURRENT_LIST_DIR}/src/lcms2.def"
"${CMAKE_CURRENT_LIST_DIR}/src/lcms2_internal.h"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsalpha.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmscam02.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmscgats.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmscnvrt.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmserr.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsgamma.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsgmt.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmshalf.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsintrp.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsio0.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsio1.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmslut.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsmd5.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsmtrx.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsnamed.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsopt.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmspack.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmspcs.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsplugin.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmsps2.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmssamp.c"
"${CMAKE_CURRENT_LIST_DIR}/src/cmssm.c"
)
add_library(lcms2 ${SRCS} src/lcms2.def)
if(BUILD_SHARED_LIBS)
target_compile_options(lcms2 PRIVATE -DCMS_DLL_BUILD)
@ -44,7 +12,7 @@ if(BUILD_SHARED_LIBS)
endif()
target_compile_options(lcms2 PRIVATE -DUNICODE -D_UNICODE)
target_include_directories(lcms2 PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include")
target_include_directories(lcms2 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
set_target_properties(lcms2 PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/lcms2.h;${CMAKE_CURRENT_LIST_DIR}/include/lcms2_plugin.h")
# Generate pkg-config file
@ -58,30 +26,29 @@ SET(exec_prefix "\${prefix}")
SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
SET(includedir "\${prefix}/include")
CONFIGURE_FILE(lcms2.pc.in "${PROJECT_BINARY_DIR}/lcms2.pc" @ONLY)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
# Add CMAKE_DEBUG_POSTFIX
file(READ "${PROJECT_BINARY_DIR}/lcms2.pc" LCMS2_PC)
string(REPLACE "-llcms2" "-llcms2${CMAKE_DEBUG_POSTFIX}" LCMS2_PC "${LCMS2_PC}")
file(WRITE "${PROJECT_BINARY_DIR}/lcms2.pc" "${LCMS2_PC}")
ENDIF()
install(TARGETS lcms2
EXPORT lcmsConfig
EXPORT lcms2Config
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include"
COMPONENT dev
)
INSTALL(FILES ${PROJECT_BINARY_DIR}/lcms2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
export(TARGETS lcms2
install(EXPORT lcms2Config
DESTINATION "share/lcms2"
NAMESPACE lcms2::
FILE "share/lcms/lcmsConfig.cmake"
)
install(EXPORT lcmsConfig
# Backwards compatibility for previous vcpkg users
add_library(lcms INTERFACE)
target_link_libraries(lcms INTERFACE lcms2)
install(TARGETS lcms EXPORT lcms-targets)
install(EXPORT lcms-targets
DESTINATION "share/lcms"
NAMESPACE lcms2::
NAMESPACE lcms::
)

View File

@ -15,15 +15,19 @@ vcpkg_from_github(
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_cmake_install()
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
vcpkg_cmake_config_fixup(PACKAGE_NAME lcms2)
vcpkg_cmake_config_fixup() # provides old PACKAGE_NAME lcms
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/lcms/lcms-config.cmake" [[
include(CMakeFindDependencyMacro)
find_dependency(lcms2 CONFIG)
include(${CMAKE_CURRENT_LIST_DIR}/lcms-targets.cmake)
]])
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

4
ports/lcms/usage Normal file
View File

@ -0,0 +1,4 @@
The package lcms provides CMake targets:
find_package(lcms2 CONFIG REQUIRED)
target_link_libraries(main PRIVATE lcms2::lcms2)

View File

@ -1,7 +1,17 @@
{
"name": "lcms",
"version-string": "2.12",
"port-version": 1,
"version": "2.12",
"port-version": 2,
"description": "Little CMS.",
"homepage": "https://github.com/mm2/Little-CMS"
"homepage": "https://github.com/mm2/Little-CMS",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -3146,7 +3146,7 @@
},
"lcms": {
"baseline": "2.12",
"port-version": 1
"port-version": 2
},
"leaf": {
"baseline": "0.2.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "27ea0f07f8132e37a1e265ee54216eb0abc185dd",
"version": "2.12",
"port-version": 2
},
{
"git-tree": "40c7773d4774034a567f4b9f5427e558afe66ebd",
"version-string": "2.12",