Skip to content

Commit

Permalink
[vcpkg baseline][lensfun] Fix and cleanup (microsoft#36342)
Browse files Browse the repository at this point in the history
* [lensfun] Add feature and fix python module

* [lensfun] Cleanup, fix, update license

* versions

* [lensfun] No python on windows
  • Loading branch information
dg0yt authored and TomKatom committed Feb 23, 2024
1 parent 2c4f0b2 commit 9b667dd
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
44 changes: 30 additions & 14 deletions ports/lensfun/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lensfun/lensfun
Expand All @@ -12,12 +10,31 @@ vcpkg_from_github(
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LENSFUN_STATIC_LIB)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" LENSFUN_STATIC_CRT)


set(LENSFUN_EXTRA_OPTS "")
if (VCPKG_TARGET_IS_WINDOWS)
if("python" IN_LIST FEATURES)
find_file(INITIAL_PYTHON3
NAMES "python3${VCPKG_HOST_EXECUTABLE_SUFFIX}" "python${VCPKG_HOST_EXECUTABLE_SUFFIX}"
PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/python3"
NO_DEFAULT_PATH
REQUIRED
)
x_vcpkg_get_python_packages(OUT_PYTHON_VAR PYTHON3
PYTHON_EXECUTABLE "${INITIAL_PYTHON3}"
PYTHON_VERSION "3"
PACKAGES setuptools
)
else()
set(PYTHON3 "false")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND LENSFUN_EXTRA_OPTS -DPLATFORM_WINDOWS=ON)
endif()

if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
list(APPEND LENSFUN_EXTRA_OPTS -DBUILD_FOR_SSE=OFF -DBUILD_FOR_SSE2=OFF)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
Expand All @@ -26,25 +43,24 @@ vcpkg_cmake_configure(
-DBUILD_WITH_MSVC_STATIC_RUNTIME=${LENSFUN_STATIC_CRT}
-DBUILD_TESTS=OFF
-DBUILD_DOC=OFF
-DINSTALL_PYTHON_MODULE=ON
-DINSTALL_HELPER_SCRIPTS=OFF
-DBUILD_LENSTOOL=OFF
-DBUILD_FOR_SSE=OFF
-DBUILD_FOR_SSE2=OFF
-DINSTALL_HELPER_SCRIPTS=OFF
"-DPYTHON=${PYTHON3}"
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()

if (LENSFUN_STATIC_LIB)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

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

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/docs/gpl-3.0.txt" "${SOURCE_PATH}/docs/lgpl-3.0.txt")
file(READ "${SOURCE_PATH}/README.md" license_comment)
string(REGEX REPLACE "^.*\n(LICENSE\n)---+\n(.*)" "\\1\\2" license_comment "${license_comment}")
string(REGEX REPLACE "[^\n]+\n---+.*\$" "" license_comment "${license_comment}")
vcpkg_install_copyright(
COMMENT "${license_comment}"
FILE_LIST "${SOURCE_PATH}/docs/gpl-3.0.txt" "${SOURCE_PATH}/docs/lgpl-3.0.txt"
)
18 changes: 14 additions & 4 deletions ports/lensfun/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "lensfun",
"version": "0.3.4",
"port-version": 1,
"port-version": 2,
"description": "Provide a open source database of photographic lenses and their characteristics",
"homepage": "https://scnlib.dev/",
"license": "LGPL-3.0 OR GPL-3.0",
"homepage": "https://lensfun.github.io/",
"license": null,
"supports": "!arm",
"dependencies": [
"glib",
Expand All @@ -16,5 +16,15 @@
"name": "vcpkg-cmake-config",
"host": true
}
]
],
"features": {
"python": {
"description": "Build python module",
"supports": "native & !windows",
"dependencies": [
"python3",
"vcpkg-get-python-packages"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4042,7 +4042,7 @@
},
"lensfun": {
"baseline": "0.3.4",
"port-version": 1
"port-version": 2
},
"leptonica": {
"baseline": "1.83.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/lensfun.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "84eb6a4d2a0d8d670e0f54ec70bb4ad36cb004df",
"version": "0.3.4",
"port-version": 2
},
{
"git-tree": "a085269b70f184d8dbf07c595e37ce336bd79906",
"version": "0.3.4",
Expand Down

0 comments on commit 9b667dd

Please sign in to comment.