diff options
| author | Alexander Kaspar <alexander.kaspar@gmail.com> | 2016-11-30 19:10:23 +0100 |
|---|---|---|
| committer | Alexander Kaspar <alexander.kaspar@gmail.com> | 2016-11-30 19:10:23 +0100 |
| commit | 255849a3c0d4638e37a538f9547625818516e6e4 (patch) | |
| tree | 6022d8f7360e3ab5bb0bfc251c23226dcb66f079 | |
| parent | 8de36e12dbd87db740a7ca089f3dcd1222a22637 (diff) | |
| parent | 61e484a640884bc33ae3754f98006ebb1b4c1f1f (diff) | |
| download | vcpkg-255849a3c0d4638e37a538f9547625818516e6e4.tar.gz vcpkg-255849a3c0d4638e37a538f9547625818516e6e4.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into qca
56 files changed, 1557 insertions, 131 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a1ad55b0d..f4e056cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +vcpkg (0.0.61) +-------------- + * Add ports: + - cairo 1.14.6 + - clockutils 1.1.1 + - directxtk oct2016-1 + - directxtk12 oct2016 + - glslang 1c573fbcfba6b3d631008b1babc838501ca925d3 + - libodb-pgsql 2.4.0 + - pixman 0.34.0 + - proj 4.9.3 + - zstd 1.1.1 + * Update ports: + - chakracore 1.3.0 -> 1.3.1 + - curl 7.51.0 -> 7.51.0-1 + - dxut 11.14 -> 11.14-2 + - fmt 3.0.1 -> 3.0.1-1 + - freetype 2.6.3-1 -> 2.6.3-2 + - rxcpp 2.3.0 -> 3.0.0 + - think-cell-range 1d785d9 -> e2d3018 + - tiff 4.0.6 -> 4.0.6-1 + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> MON, 28 Nov 2016 18:30:00 -0800 + + vcpkg (0.0.60) -------------- * Add ports: @@ -153,7 +179,7 @@ vcpkg (0.0.40) * Add mirror support * `vcpkg` now checks for valid package names: only ASCII lowercase chars, digits, or dashes are allowed * `vcpkg create` now also creates a templated CONTROL file - * `vcpkg create` now checks for invalid chars in the zip path + * `vcpkg create` now checks for invalid chars in the zip path * `vcpkg edit` now throws an error if it cannot launch an editor * Fix `vcpkg integrate` to only apply to C++ projects instead of all projects * Fix `vcpkg integrate` locale-specific failures diff --git a/ports/anax/CONTROL b/ports/anax/CONTROL new file mode 100644 index 000000000..f6d285b4c --- /dev/null +++ b/ports/anax/CONTROL @@ -0,0 +1,3 @@ +Source: anax +Version: 2.1.0 +Description: An open source C++ entity system. <https://github.com/miguelmartin75/anax> diff --git a/ports/anax/portfile.cmake b/ports/anax/portfile.cmake new file mode 100644 index 000000000..ae22332cf --- /dev/null +++ b/ports/anax/portfile.cmake @@ -0,0 +1,33 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() +include(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/anax-2.1.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/miguelmartin75/anax/archive/v2.1.0.zip" + FILENAME "anax-2.1.0.zip" + SHA512 89f2df64add676ab48a19953b95d8eae1da9c8c5f3c0f6bc757a3bc99af6e4360c56c12d27d12c672ccd754b1f53a5e271533b381641f20e8cf3ca8ddda6cd1a +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/anax) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/anax/LICENSE ${CURRENT_PACKAGES_DIR}/share/anax/copyright) diff --git a/ports/chakracore/CONTROL b/ports/chakracore/CONTROL index addb84aa2..593691bbf 100644 --- a/ports/chakracore/CONTROL +++ b/ports/chakracore/CONTROL @@ -1,3 +1,3 @@ Source: chakracore -Version: 1.3.0 +Version: 1.3.1 Description: Core part of the Chakra Javascript engine
\ No newline at end of file diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake index bdba23809..639cf0f65 100644 --- a/ports/chakracore/portfile.cmake +++ b/ports/chakracore/portfile.cmake @@ -4,11 +4,11 @@ endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.3.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.3.1) vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://github.com/Microsoft/ChakraCore/archive/v1.3.0.tar.gz" - FILENAME "ChakraCore-1.3.0.tar.gz" - SHA512 d00757e25f5c62bfc29721bd8f715df8dbaf0ac14c1dbdb0735227535cb4f2a209ec3957f24bb6a7e2bced540475bbf3e54712a930fb517fdfd5adb4d56cea07 + URLS "https://github.com/Microsoft/ChakraCore/archive/v1.3.1.tar.gz" + FILENAME "ChakraCore-1.3.1.tar.gz" + SHA512 52216a03333e44bce235917cfae5ccd6a756056678d9b81c63ec272d9ce5c6afabc673e7910dd3da54fda7927ea62ede980a4371dbb08f6ce4907121c27dbc53 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) diff --git a/ports/directxtk12/CONTROL b/ports/directxtk12/CONTROL new file mode 100644 index 000000000..dd9ca5620 --- /dev/null +++ b/ports/directxtk12/CONTROL @@ -0,0 +1,3 @@ +Source: directxtk12 +Version: oct2016 +Description: A collection of helper classes for writing DirectX 12 code in C++. diff --git a/ports/directxtk12/portfile.cmake b/ports/directxtk12/portfile.cmake new file mode 100644 index 000000000..19372a3b1 --- /dev/null +++ b/ports/directxtk12/portfile.cmake @@ -0,0 +1,38 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-oct2016) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Microsoft/DirectXTK12/archive/oct2016.tar.gz" + FILENAME "DirectXTK12-oct2016.tar.gz" + SHA512 f33af80dc018c1fda117eeef66bd08046b48572806d879651187cbed9d5ceb402b1798ecc0e1089b54ddb879e5355b45f2b67e3be99fbe270c5216a945a9924b +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2015_Win10.sln +) + +IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") + SET(BUILD_ARCH "Win32") +ELSE() + SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) +ENDIF() + +file(INSTALL + ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Release/DirectXTK12.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(INSTALL + ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Debug/DirectXTK12.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + +file(INSTALL + ${SOURCE_PATH}/Inc/ + DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK12 +) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxtk12 RENAME copyright) diff --git a/ports/dxut/CONTROL b/ports/dxut/CONTROL index 56fefdb32..372a98d72 100644 --- a/ports/dxut/CONTROL +++ b/ports/dxut/CONTROL @@ -1,3 +1,3 @@ Source: dxut -Version: 11.14-1 +Version: 11.14-2 Description: A "GLUT"-like framework for Direct3D 11.x Win32 desktop applications
\ No newline at end of file diff --git a/ports/dxut/portfile.cmake b/ports/dxut/portfile.cmake index 294f64a1f..97dc8b2e3 100644 --- a/ports/dxut/portfile.cmake +++ b/ports/dxut/portfile.cmake @@ -11,33 +11,34 @@ vcpkg_download_distfile(ARCHIVE_FILE ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/Core/DXUT_2015.vcxproj -) - IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") SET(BUILD_ARCH "Win32") ELSE() SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) ENDIF() +vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/DXUT_2015.sln + PLATFORM ${BUILD_ARCH} +) + file(INSTALL - ${SOURCE_PATH}/Core/DDSTextureLoader.h - ${SOURCE_PATH}/Core/DXErr.h - ${SOURCE_PATH}/Core/DXUT.h - ${SOURCE_PATH}/Core/DXUTDevice11.h - ${SOURCE_PATH}/Core/DXUTmisc.h - ${SOURCE_PATH}/Core/Screengrab.h - ${SOURCE_PATH}/Core/WICTextureLoader.h + ${SOURCE_PATH}/Core/ + ${SOURCE_PATH}/Optional/ DESTINATION ${CURRENT_PACKAGES_DIR}/include + FILES_MATCHING PATTERN "*.h" ) +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/include/Bin) file(INSTALL ${SOURCE_PATH}/Core/Bin/Desktop_2015/${BUILD_ARCH}/Release/DXUT.lib + ${SOURCE_PATH}/Optional/Bin/Desktop_2015/${BUILD_ARCH}/Release/DXUTOpt.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(INSTALL ${SOURCE_PATH}/Core/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DXUT.lib + ${SOURCE_PATH}/Optional/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DXUTOpt.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) vcpkg_copy_pdbs() diff --git a/ports/entityx/CONTROL b/ports/entityx/CONTROL new file mode 100644 index 000000000..f522fe702 --- /dev/null +++ b/ports/entityx/CONTROL @@ -0,0 +1,3 @@ +Source: entityx +Version: 1.2.0 +Description: EntityX - A fast, type-safe C++ Entity-Component system. <https://github.com/alecthomas/entityx> diff --git a/ports/entityx/portfile.cmake b/ports/entityx/portfile.cmake new file mode 100644 index 000000000..d7bcdbe1b --- /dev/null +++ b/ports/entityx/portfile.cmake @@ -0,0 +1,44 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/entityx-1.2.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/alecthomas/entityx/archive/1.2.0.zip" + FILENAME "entityx-1.2.0.zip" + SHA512 4d7009f0412fbccd7bee72713d53424c3b4fa39da62b87729dd84a710a059db27e65ca27b927285c82af09997caea125d85571824133d9b71b4e3c4eebd9917c +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if (VCPKG_CRT_LINKAGE STREQUAL dynamic) + SET(SHARED_FLAG ON) +else() + SET(SHARED_FLAG OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 + -DENTITYX_BUILD_SHARED=${SHARED_FLAG} + -DENTITYX_BUILD_TESTING=false +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/entityx) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/entityx/COPYING ${CURRENT_PACKAGES_DIR}/share/entityx/copyright) diff --git a/ports/freeimage/CMakeLists.txt b/ports/freeimage/CMakeLists.txt new file mode 100644 index 000000000..80a40b43b --- /dev/null +++ b/ports/freeimage/CMakeLists.txt @@ -0,0 +1,148 @@ +cmake_minimum_required(VERSION 3.4) + +include(GNUInstallDirs) + +project(FreeImage C CXX) + +find_package(zlib REQUIRED) +find_package(PNG REQUIRED) +find_package(JPEG REQUIRED) +find_package(TIFF REQUIRED) +find_package(OPENJPEG REQUIRED) + +# Include some custom Find***.cmake modules +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +find_package(WEBP REQUIRED) +find_package(JXR REQUIRED) +find_package(LibRaw REQUIRED) + +option(BUILD_SHARED_LIBS "Build shared libraries" ON) + +set(REAL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Source) + +# Add a debug postfix +set(CMAKE_DEBUG_POSTFIX "d") + +# For now the internal copy of OpenEXR is used (as a private always static library) +file(GLOB OPENEXR_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.h + ${REAL_SOURCE_DIR}/OpenEXR/Iex/*.h + ${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.h + ${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.h + ${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.h + ${REAL_SOURCE_DIR}/OpenEXR/Imath/*.h + ${REAL_SOURCE_DIR}/OpenEXR/*.h) + +file(GLOB OPENEXR_SRCS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.cpp + ${REAL_SOURCE_DIR}/OpenEXR/Iex/*.cpp + ${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.cpp + ${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.cpp + ${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.cpp + ${REAL_SOURCE_DIR}/OpenEXR/Imath/*.cpp) + +add_library(FreeImage_Private_OpenEXR STATIC ${OPENEXR_PRIVATE_HEADERS} ${OPENEXR_SRCS}) + +set(FreeImage_Private_OpenEXR_INCLUDE_DIRS ${REAL_SOURCE_DIR}/OpenEXR + ${REAL_SOURCE_DIR}/OpenEXR/Half + ${REAL_SOURCE_DIR}/OpenEXR/Iex + ${REAL_SOURCE_DIR}/OpenEXR/IexMath + ${REAL_SOURCE_DIR}/OpenEXR/IlmImf + ${REAL_SOURCE_DIR}/OpenEXR/IlmThread + ${REAL_SOURCE_DIR}/OpenEXR/Imath) + +target_include_directories(FreeImage_Private_OpenEXR PRIVATE ${FreeImage_Private_OpenEXR_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS}) + +# List the public header files +set(PUBLIC_HEADERS ${REAL_SOURCE_DIR}/FreeImage.h) + +# List the private header files +set(ROOT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/CacheFile.h + ${REAL_SOURCE_DIR}/FreeImageIO.h + ${REAL_SOURCE_DIR}/MapIntrospector.h + ${REAL_SOURCE_DIR}/Plugin.h + ${REAL_SOURCE_DIR}/Quantizers.h + ${REAL_SOURCE_DIR}/ToneMapping.h + ${REAL_SOURCE_DIR}/Utilities.h + ${REAL_SOURCE_DIR}/DeprecationManager/DeprecationMgr.h) + +file(GLOB FREEIMAGE_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImage/*.h) +file(GLOB FREEIMAGE_TOOLKIT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.h) +file(GLOB METADATA_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/Metadata/*.h) + +set(PRIVATE_HEADERS ${ROOT_PRIVATE_HEADERS} + ${FREEIMAGE_PRIVATE_HEADERS} + ${FREEIMAGE_TOOLKIT_PRIVATE_HEADERS} + ${METADATA_PRIVATE_HEADERS}) + +# List the source files +file(GLOB DEPRECATION_SRCS ${REAL_SOURCE_DIR}/DeprecationManager/*.cpp) +file(GLOB FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.cpp) +file(GLOB FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/*.cpp) +file(GLOB METADATA_SRCS ${REAL_SOURCE_DIR}/Metadata/*.cpp) + +# The G3 plugin is disabled because it require the private copy of tiff +list(REMOVE_ITEM FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/PluginG3.cpp) + +# The JPEGTransform plugin is disable because it requires a private copy of jpeg +list(REMOVE_ITEM FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/JPEGTransform.cpp) + + +set(SRCS ${DEPRECATION_SRCS} + ${FREEIMAGE_SRCS} + ${FREEIMAGE_TOOLKIT_SRCS} + ${METADATA_SRCS} +) + +# If FreeImage is used as a static library, FREEIMAGE_LIB +# needs to be defined (at the C preprocessor level) to correctly +# define (to nothing instead of _declspec(dllimport) ) the DLL_API macro. +# For this purpouse we include (depending on the BUILD_SHARED_LIBS ) +# the appropriate FreeImageConfig.h . +if(${BUILD_SHARED_LIBS}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-dynamic.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) +else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-static.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) +endif() +list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) + +add_library(FreeImage ${SRCS} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS}) + +if(${BUILD_SHARED_LIBS}) + target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_EXPORTS) +else() + target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_LIB) +endif() + +target_include_directories(FreeImage PRIVATE ${REAL_SOURCE_DIR} + ${ZLIB_INCLUDE_DIRS} + ${JPEG_INCLUDE_DIRS} + ${TIFF_INCLUDE_DIRS} + ${PNG_INCLUDE_DIRS} + ${OPENJPEG_INCLUDE_DIRS} + ${WEBP_INCLUDE_DIRS} + ${JXR_INCLUDE_DIRS} + ${LibRaw_INCLUDE_DIRS} + ${FreeImage_Private_OpenEXR_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR}) + + +target_link_libraries(FreeImage ${ZLIB_LIBRARIES} + ${JPEG_LIBRARIES} + ${TIFF_LIBRARIES} + ${PNG_LIBRARIES} + ${OPENJPEG_LIBRARIES} + ${WEBP_LIBRARIES} + ${JXR_LIBRARIES} + ${LibRaw_LIBRARIES} + FreeImage_Private_OpenEXR) + +target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS}) + +install(TARGETS FreeImage + COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib) + +install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
\ No newline at end of file diff --git a/ports/freeimage/CONTROL b/ports/freeimage/CONTROL new file mode 100644 index 000000000..961acc4be --- /dev/null +++ b/ports/freeimage/CONTROL @@ -0,0 +1,4 @@ +Source: freeimage +Version: 3.17.0 +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp, libraw, jxrlib +Description: Support library for graphics image formats diff --git a/ports/freeimage/FreeImageConfig-dynamic.h b/ports/freeimage/FreeImageConfig-dynamic.h new file mode 100644 index 000000000..d87b65b4c --- /dev/null +++ b/ports/freeimage/FreeImageConfig-dynamic.h @@ -0,0 +1,5 @@ +#ifndef FREEIMAGE_CONFIG_H +#define FREEIMAGE_CONFIG_H + + +#endif diff --git a/ports/freeimage/FreeImageConfig-static.h b/ports/freeimage/FreeImageConfig-static.h new file mode 100644 index 000000000..ed723490e --- /dev/null +++ b/ports/freeimage/FreeImageConfig-static.h @@ -0,0 +1,6 @@ +#ifndef FREEIMAGE_CONFIG_H +#define FREEIMAGE_CONFIG_H + +#define FREEIMAGE_LIB + +#endif diff --git a/ports/freeimage/cmake/FindJXR.cmake b/ports/freeimage/cmake/FindJXR.cmake new file mode 100644 index 000000000..7e4a5d45e --- /dev/null +++ b/ports/freeimage/cmake/FindJXR.cmake @@ -0,0 +1,28 @@ +# - Find JXR +# Find the JXR library +# This module defines +# JXR_INCLUDE_DIRS, where to find jxrlib/JXRGlue.h +# JXR_LIBRARIES, the libraries needed to use JXR +# + +find_path(JXR_INCLUDE_DIRS + NAMES JXRGlue.h + PATH_SUFFIXES jxrlib +) +mark_as_advanced(JXR_INCLUDE_DIRS) + +include(SelectLibraryConfigurations) + +find_library(JPEGXR_LIBRARY_RELEASE NAMES jpegxr PATH_SUFFIXES lib) +find_library(JPEGXR_LIBRARY_DEBUG NAMES jpegxrd PATH_SUFFIXES lib) +select_library_configurations(JPEGXR) + +find_library(JXRGLUE_LIBRARY_RELEASE NAMES jxrglue PATH_SUFFIXES lib) +find_library(JXRGLUE_LIBRARY_DEBUG NAMES jxrglued PATH_SUFFIXES lib) +select_library_configurations(JXRGLUE) + +set(JXR_LIBRARIES ${JPEGXR_LIBRARY} ${JXRGLUE_LIBRARY}) +mark_as_advanced(JXR_LIBRARIES) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JXR DEFAULT_MSG JXR_INCLUDE_DIRS JXR_LIBRARIES) diff --git a/ports/freeimage/cmake/FindWEBP.cmake b/ports/freeimage/cmake/FindWEBP.cmake new file mode 100644 index 000000000..9b8516e15 --- /dev/null +++ b/ports/freeimage/cmake/FindWEBP.cmake @@ -0,0 +1,26 @@ +# - Find WEBP +# Find the WEBP library +# This module defines +# WEBP_INCLUDE_DIRS, where to find webp/decode.h +# WEBP_LIBRARIES, the libraries needed to use WEBP +# + +find_path(WEBP_INCLUDE_DIRS + NAMES webp/decode.h +) +mark_as_advanced(WEBP_INCLUDE_DIRS) + +find_library( + WEBP_LIBRARIES + NAMES webp +) + +find_library(WEBP_LIBRARY_RELEASE NAMES webp PATH_SUFFIXES lib) +find_library(WEBP_LIBRARY_DEBUG NAMES webpd PATH_SUFFIXES lib) +include(SelectLibraryConfigurations) +select_library_configurations(WEBP) + +set(WEBP_LIBRARIES ${WEBP_LIBRARY}) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES) diff --git a/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch b/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch new file mode 100644 index 000000000..28d0e3a42 --- /dev/null +++ b/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch @@ -0,0 +1,71 @@ +diff --git a/Source/FreeImage.h b/Source/FreeImage.h +index e2d1c5a..cc66b7d 100644 +--- a/Source/FreeImage.h ++++ b/Source/FreeImage.h +@@ -410,7 +410,11 @@ FI_ENUM(FREE_IMAGE_FORMAT) { + FIF_DDS = 24, + FIF_GIF = 25, + FIF_HDR = 26, +- FIF_FAXG3 = 27, ++/* vcpkg: The G3 fax format plugin is deliberately disabled in our build of ++ FreeImage, since it requires usage of the vendored copy of libtiff. */ ++#if 0 ++ FIF_FAXG3 = 27, ++#endif + FIF_SGI = 28, + FIF_EXR = 29, + FIF_J2K = 30, +@@ -476,6 +480,9 @@ FI_ENUM(FREE_IMAGE_DITHER) { + /** Lossless JPEG transformations + Constants used in FreeImage_JPEGTransform + */ ++/* vcpkg: The JPEGTransform functions are deliberately disabled in our build ++ of FreeImage, since they require usage of the vendored copy of libjpeg. */ ++#if 0 + FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { + FIJPEG_OP_NONE = 0, //! no transformation + FIJPEG_OP_FLIP_H = 1, //! horizontal flip +@@ -486,6 +493,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { + FIJPEG_OP_ROTATE_180 = 6, //! 180-degree rotation + FIJPEG_OP_ROTATE_270 = 7 //! 270-degree clockwise (or 90 ccw) + }; ++#endif + + /** Tone mapping operators. + Constants used in FreeImage_ToneMapping. +@@ -1077,6 +1085,9 @@ DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, + // JPEG lossless transformation routines + // -------------------------------------------------------------------------- + ++/* vcpkg: The JPEGTransform functions are deliberately disabled in our build ++ of FreeImage, since they require usage of the vendored copy of libjpeg. */ ++#if 0 + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE)); + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE)); + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); +@@ -1085,7 +1096,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformFromHandle(FreeImageIO* src_io, + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE)); + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE)); + DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE)); +- ++#endif + + // -------------------------------------------------------------------------- + // Image manipulation toolkit +diff --git a/Source/FreeImage/Plugin.cpp b/Source/FreeImage/Plugin.cpp +index 57ebffd..a93440f 100644 +--- a/Source/FreeImage/Plugin.cpp ++++ b/Source/FreeImage/Plugin.cpp +@@ -263,7 +263,11 @@ FreeImage_Initialise(BOOL load_local_plugins_only) { + s_plugins->AddNode(InitDDS); + s_plugins->AddNode(InitGIF); + s_plugins->AddNode(InitHDR); +- s_plugins->AddNode(InitG3); ++/* vcpkg: The G3 fax format plugin is deliberately disabled in our build of FreeImage +++ since it requires usage of the vendored copy of libtiff. */ ++#if 0 ++ s_plugins->AddNode(InitG3); ++#endif + s_plugins->AddNode(InitSGI); + s_plugins->AddNode(InitEXR); + s_plugins->AddNode(InitJ2K); diff --git a/ports/freeimage/portfile.cmake b/ports/freeimage/portfile.cmake new file mode 100644 index 000000000..3e403f9ea --- /dev/null +++ b/ports/freeimage/portfile.cmake @@ -0,0 +1,56 @@ +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/FreeImage) +vcpkg_download_distfile(ARCHIVE + URLS "http://downloads.sourceforge.net/freeimage/FreeImage3170.zip" + FILENAME "FreeImage3170.zip" + SHA512 703c2626c0bcfe73eb40d720f45745208ca9650a7730759680a2b38ad3f6c719a43008477032bc70b76a95761f7d4b6f901b961359d36b54ace906dd78fb391b +) +vcpkg_extract_source_archive(${ARCHIVE}) + + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FreeImageConfig-static.h DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FreeImageConfig-dynamic.h DESTINATION ${SOURCE_PATH}) + +# Copy some useful Find***.cmake modules +file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH}) + +# This is not strictly necessary, but to make sure +# that no "internal" libraries are used by removing them +# Note that the only "internal" dependency used is OpenEXR +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJPEG) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibPNG) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibTIFF4) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/ZLib) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibOpenJPEG) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJXR) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibWebP) +file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibRawLite) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/disable-plugins-depending-on-internal-third-party-libraries.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-jpeg.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-jxrlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-libtiff.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-openjpeg.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-png-zlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-rawlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-webp.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-freeimage-config-include.patch" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/license-fi.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeimage) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeimage/license-fi.txt ${CURRENT_PACKAGES_DIR}/share/freeimage/copyright) + +vcpkg_copy_pdbs() diff --git a/ports/freeimage/use-external-jpeg.patch b/ports/freeimage/use-external-jpeg.patch new file mode 100644 index 000000000..2df2c9d2d --- /dev/null +++ b/ports/freeimage/use-external-jpeg.patch @@ -0,0 +1,17 @@ +diff --git a/Source/FreeImage/PluginJPEG.cpp b/Source/FreeImage/PluginJPEG.cpp +index 573989c..aaeefa4 100644 +--- a/Source/FreeImage/PluginJPEG.cpp ++++ b/Source/FreeImage/PluginJPEG.cpp +@@ -35,9 +35,9 @@ extern "C" { + #undef FAR + #include <setjmp.h> + +-#include "../LibJPEG/jinclude.h" +-#include "../LibJPEG/jpeglib.h" +-#include "../LibJPEG/jerror.h" ++#include <stdio.h> ++#include <jpeglib.h> ++#include <jerror.h> + } + + #include "FreeImage.h" diff --git a/ports/freeimage/use-external-jxrlib.patch b/ports/freeimage/use-external-jxrlib.patch new file mode 100644 index 000000000..d86a18e82 --- /dev/null +++ b/ports/freeimage/use-external-jxrlib.patch @@ -0,0 +1,14 @@ +diff --git a/Source/FreeImage/PluginJXR.cpp b/Source/FreeImage/PluginJXR.cpp +index 0e14e09..8eb9d5d 100644 +--- a/Source/FreeImage/PluginJXR.cpp ++++ b/Source/FreeImage/PluginJXR.cpp +@@ -23,7 +23,8 @@ + #include "Utilities.h" + #include "../Metadata/FreeImageTag.h" + +-#include "../LibJXR/jxrgluelib/JXRGlue.h" ++#define INITGUID ++#include <JXRGlue.h> + + // ========================================================== + // Plugin Interface diff --git a/ports/freeimage/use-external-libtiff.patch b/ports/freeimage/use-external-libtiff.patch new file mode 100644 index 000000000..f2ddd9ba6 --- /dev/null +++ b/ports/freeimage/use-external-libtiff.patch @@ -0,0 +1,174 @@ +diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp +index 1b45453..562fdd7 100644 +--- a/Source/FreeImage/PluginTIFF.cpp ++++ b/Source/FreeImage/PluginTIFF.cpp +@@ -37,7 +37,7 @@ + + #include "FreeImage.h" + #include "Utilities.h" +-#include "../LibTIFF4/tiffiop.h" ++#include <tiffio.h> + #include "../Metadata/FreeImageTag.h" + #include "../OpenEXR/Half/half.h" + +diff --git a/Source/Metadata/XTIFF.cpp b/Source/Metadata/XTIFF.cpp +index d5be902..8dbcd5d 100644 +--- a/Source/Metadata/XTIFF.cpp ++++ b/Source/Metadata/XTIFF.cpp +@@ -29,7 +29,7 @@ + #pragma warning (disable : 4786) // identifier was truncated to 'number' characters + #endif + +-#include "../LibTIFF4/tiffiop.h" ++#include <tiffio.h> + + #include "FreeImage.h" + #include "Utilities.h" +@@ -40,6 +40,43 @@ + // Extended TIFF Directory GEO Tag Support + // ---------------------------------------------------------- + ++// vcpkg: function imported from libtiff/tif_dirinfo.c, in which it is not exported ++/* ++ * Return size of TIFFDataType in bytes. ++ * ++ * XXX: We need a separate function to determine the space needed ++ * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8, ++ * but we use 4-byte float to represent rationals. ++ */ ++int ++FreeImage_TIFFDataSize(TIFFDataType type) ++{ ++ switch (type) ++ { ++ case TIFF_BYTE: ++ case TIFF_SBYTE: ++ case TIFF_ASCII: ++ case TIFF_UNDEFINED: ++ return 1; ++ case TIFF_SHORT: ++ case TIFF_SSHORT: ++ return 2; ++ case TIFF_LONG: ++ case TIFF_SLONG: ++ case TIFF_FLOAT: ++ case TIFF_IFD: ++ case TIFF_RATIONAL: ++ case TIFF_SRATIONAL: ++ return 4; ++ case TIFF_DOUBLE: ++ case TIFF_LONG8: ++ case TIFF_SLONG8: ++ case TIFF_IFD8: ++ return 8; ++ default: ++ return 0; ++ } ++} + /** + Tiff info structure. + Entry format: +@@ -224,6 +261,33 @@ tiff_write_geotiff_profile(TIFF *tif, FIBITMAP *dib) { + // TIFF EXIF tag reading & writing + // ---------------------------------------------------------- + ++static uint32 exif_tag_ids[] = { ++ EXIFTAG_EXPOSURETIME, EXIFTAG_FNUMBER, EXIFTAG_EXPOSUREPROGRAM, ++ EXIFTAG_SPECTRALSENSITIVITY, EXIFTAG_ISOSPEEDRATINGS, EXIFTAG_OECF, ++ EXIFTAG_EXIFVERSION, EXIFTAG_DATETIMEORIGINAL, EXIFTAG_DATETIMEDIGITIZED, ++ EXIFTAG_COMPONENTSCONFIGURATION, EXIFTAG_COMPRESSEDBITSPERPIXEL, ++ EXIFTAG_SHUTTERSPEEDVALUE, EXIFTAG_APERTUREVALUE, ++ EXIFTAG_BRIGHTNESSVALUE, EXIFTAG_EXPOSUREBIASVALUE, ++ EXIFTAG_MAXAPERTUREVALUE, EXIFTAG_SUBJECTDISTANCE, EXIFTAG_METERINGMODE, ++ EXIFTAG_LIGHTSOURCE, EXIFTAG_FLASH, EXIFTAG_FOCALLENGTH, ++ EXIFTAG_SUBJECTAREA, EXIFTAG_MAKERNOTE, EXIFTAG_USERCOMMENT, ++ EXIFTAG_SUBSECTIME, EXIFTAG_SUBSECTIMEORIGINAL, ++ EXIFTAG_SUBSECTIMEDIGITIZED, EXIFTAG_FLASHPIXVERSION, EXIFTAG_COLORSPACE, ++ EXIFTAG_PIXELXDIMENSION, EXIFTAG_PIXELYDIMENSION, ++ EXIFTAG_RELATEDSOUNDFILE, EXIFTAG_FLASHENERGY, ++ EXIFTAG_SPATIALFREQUENCYRESPONSE, EXIFTAG_FOCALPLANEXRESOLUTION, ++ EXIFTAG_FOCALPLANEYRESOLUTION, EXIFTAG_FOCALPLANERESOLUTIONUNIT, ++ EXIFTAG_SUBJECTLOCATION, EXIFTAG_EXPOSUREINDEX, EXIFTAG_SENSINGMETHOD, ++ EXIFTAG_FILESOURCE, EXIFTAG_SCENETYPE, EXIFTAG_CFAPATTERN, ++ EXIFTAG_CUSTOMRENDERED, EXIFTAG_EXPOSUREMODE, EXIFTAG_WHITEBALANCE, ++ EXIFTAG_DIGITALZOOMRATIO, EXIFTAG_FOCALLENGTHIN35MMFILM, ++ EXIFTAG_SCENECAPTURETYPE, EXIFTAG_GAINCONTROL, EXIFTAG_CONTRAST, ++ EXIFTAG_SATURATION, EXIFTAG_SHARPNESS, EXIFTAG_DEVICESETTINGDESCRIPTION, ++ EXIFTAG_SUBJECTDISTANCERANGE, EXIFTAG_GAINCONTROL, EXIFTAG_GAINCONTROL, ++ EXIFTAG_IMAGEUNIQUEID ++}; ++static int nExifTags = sizeof(exif_tag_ids) / sizeof(exif_tag_ids[0]); ++ + /** + Read a single Exif tag + +@@ -575,43 +639,10 @@ tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { + + // loop over all Core Directory Tags + // ### uses private data, but there is no other way ++ // -> vcpkg: Best we can do without private headers is to hard-code a list of known EXIF tags and read those + if(md_model == TagLib::EXIF_MAIN) { +- const TIFFDirectory *td = &tif->tif_dir; +- +- uint32 lastTag = 0; //<- used to prevent reading some tags twice (as stored in tif_fieldinfo) +- +- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) { +- const TIFFField *fld = tif->tif_fields[fi]; +- +- const uint32 tag_id = TIFFFieldTag(fld); +- +- if(tag_id == lastTag) { +- continue; +- } +- +- // test if tag value is set +- // (lifted directly from LibTiff _TIFFWriteDirectory) +- +- if( fld->field_bit == FIELD_CUSTOM ) { +- int is_set = FALSE; +- +- for(int ci = 0; ci < td->td_customValueCount; ci++ ) { +- is_set |= (td->td_customValues[ci].info == fld); +- } +- +- if( !is_set ) { +- continue; +- } +- +- } else if(!TIFFFieldSet(tif, fld->field_bit)) { +- continue; +- } +- +- // process *all* other tags (some will be ignored) +- +- tiff_read_exif_tag(tif, tag_id, dib, md_model); +- +- lastTag = tag_id; ++ for (int i = 0; i < nExifTags; ++i) { ++ tiff_read_exif_tag(tif, exif_tag_ids[i], dib, md_model); + } + + } +@@ -723,10 +754,9 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { + + TagLib& tag_lib = TagLib::instance(); + +- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) { +- const TIFFField *fld = tif->tif_fields[fi]; +- +- const uint32 tag_id = TIFFFieldTag(fld); ++ for (int fi = 0, nfi = nExifTags; nfi > 0; nfi--, fi++) { ++ const uint32 tag_id = exif_tag_ids[fi]; ++ const TIFFField *fld = TIFFFieldWithTag(tif, tag_id); + + if(skip_write_field(tif, tag_id)) { + // skip tags that are already handled by the LibTIFF writing process +@@ -749,7 +779,7 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { + continue; + } + // type of storage may differ (e.g. rationnal array vs float array type) +- if((unsigned)_TIFFDataSize(tif_tag_type) != FreeImage_TagDataWidth(tag_type)) { ++ if((unsigned)FreeImage_TIFFDataSize(tif_tag_type) != FreeImage_TagDataWidth(tag_type)) { + // skip tag or _TIFFmemcpy will fail + continue; + } diff --git a/ports/freeimage/use-external-openjpeg.patch b/ports/freeimage/use-external-openjpeg.patch new file mode 100644 index 000000000..fa4f8e7b6 --- /dev/null +++ b/ports/freeimage/use-external-openjpeg.patch @@ -0,0 +1,39 @@ +diff --git a/Source/FreeImage/J2KHelper.cpp b/Source/FreeImage/J2KHelper.cpp +index 1776c3b..538f1c5 100644 +--- a/Source/FreeImage/J2KHelper.cpp ++++ b/Source/FreeImage/J2KHelper.cpp +@@ -21,7 +21,7 @@ + + #include "FreeImage.h" + #include "Utilities.h" +-#include "../LibOpenJPEG/openjpeg.h" ++#include <openjpeg.h> + #include "J2KHelper.h" + + // -------------------------------------------------------------------------- +diff --git a/Source/FreeImage/PluginJ2K.cpp b/Source/FreeImage/PluginJ2K.cpp +index b8bcfc8..621a903 100644 +--- a/Source/FreeImage/PluginJ2K.cpp ++++ b/Source/FreeImage/PluginJ2K.cpp +@@ -21,7 +21,7 @@ + + #include "FreeImage.h" + #include "Utilities.h" +-#include "../LibOpenJPEG/openjpeg.h" ++#include <openjpeg.h> + #include "J2KHelper.h" + + // ========================================================== +diff --git a/Source/FreeImage/PluginJP2.cpp b/Source/FreeImage/PluginJP2.cpp +index 742fe2c..c57f626 100644 +--- a/Source/FreeImage/PluginJP2.cpp ++++ b/Source/FreeImage/PluginJP2.cpp +@@ -21,7 +21,7 @@ + + #include "FreeImage.h" + #include "Utilities.h" +-#include "../LibOpenJPEG/openjpeg.h" ++#include <openjpeg.h> + #include "J2KHelper.h" + + // ========================================================== diff --git a/ports/freeimage/use-external-png-zlib.patch b/ports/freeimage/use-external-png-zlib.patch new file mode 100644 index 000000000..fc7837e43 --- /dev/null +++ b/ports/freeimage/use-external-png-zlib.patch @@ -0,0 +1,40 @@ +diff --git a/Source/FreeImage/PluginPNG.cpp b/Source/FreeImage/PluginPNG.cpp +index ba2ef17..c3c5cd6 100644 +--- a/Source/FreeImage/PluginPNG.cpp ++++ b/Source/FreeImage/PluginPNG.cpp +@@ -40,8 +40,8 @@ + + // ---------------------------------------------------------- + +-#include "../ZLib/zlib.h" +-#include "../LibPNG/png.h" ++#include <zlib.h> ++#include <png.h> + + // ---------------------------------------------------------- + +diff --git a/Source/FreeImage/ZLibInterface.cpp b/Source/FreeImage/ZLibInterface.cpp +index 3ab6d32..725618b 100644 +--- a/Source/FreeImage/ZLibInterface.cpp ++++ b/Source/FreeImage/ZLibInterface.cpp +@@ -19,10 +19,9 @@ + // Use at your own risk! + // ========================================================== + +-#include "../ZLib/zlib.h" ++#include <zlib.h> + #include "FreeImage.h" + #include "Utilities.h" +-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */ + + /** + Compresses a source buffer into a target buffer, using the ZLib library. +@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_s + return 0; + case Z_OK: { + // patch header, setup crc and length (stolen from mod_trace_output) +- BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code ++ BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code + crc = crc32(crc, source, source_size); + memcpy(target + 4 + dest_len, &crc, 4); + memcpy(target + 8 + dest_len, &source_size, 4); diff --git a/ports/freeimage/use-external-rawlib.patch b/ports/freeimage/use-external-rawlib.patch new file mode 100644 index 000000000..6afa0bffa --- /dev/null +++ b/ports/freeimage/use-external-rawlib.patch @@ -0,0 +1,13 @@ +diff --git a/Source/FreeImage/PluginRAW.cpp b/Source/FreeImage/PluginRAW.cpp +index e9bd5bf..c7f8758 100644 +--- a/Source/FreeImage/PluginRAW.cpp ++++ b/Source/FreeImage/PluginRAW.cpp +@@ -19,7 +19,7 @@ + // Use at your own risk! + // ========================================================== + +-#include "../LibRawLite/libraw/libraw.h" ++#include <libraw/libraw.h> + + #include "FreeImage.h" + #include "Utilities.h" diff --git a/ports/freeimage/use-external-webp.patch b/ports/freeimage/use-external-webp.patch new file mode 100644 index 000000000..ae6328431 --- /dev/null +++ b/ports/freeimage/use-external-webp.patch @@ -0,0 +1,18 @@ +diff --git a/Source/FreeImage/PluginWebP.cpp b/Source/FreeImage/PluginWebP.cpp +index 9fb0b69..c401447 100644 +--- a/Source/FreeImage/PluginWebP.cpp ++++ b/Source/FreeImage/PluginWebP.cpp +@@ -24,10 +24,9 @@ + + #include "../Metadata/FreeImageTag.h" + +-#include "../LibWebP/src/webp/decode.h" +-#include "../LibWebP/src/webp/encode.h" +-#include "../LibWebP/src/enc/vp8enci.h" +-#include "../LibWebP/src/webp/mux.h" ++#include <webp/decode.h> ++#include <webp/encode.h> ++#include <webp/mux.h> + + // ========================================================== + // Plugin Interface diff --git a/ports/freeimage/use-freeimage-config-include.patch b/ports/freeimage/use-freeimage-config-include.patch new file mode 100644 index 000000000..4927aff5b --- /dev/null +++ b/ports/freeimage/use-freeimage-config-include.patch @@ -0,0 +1,16 @@ +diff --git a/Source/FreeImage.h b/Source/FreeImage.h +index cc66b7d..cc66812 100644 +--- a/Source/FreeImage.h ++++ b/Source/FreeImage.h +@@ -32,6 +32,11 @@ + #define FREEIMAGE_MINOR_VERSION 17 + #define FREEIMAGE_RELEASE_SERIAL 0 + ++// vcpkg specific includes -------------------------------------------------- ++// Include FreeImageConfig.h to define FREEIMAGE_LIB in static builds, ++// or do not define it in dynamic builds ++#include "FreeImageConfig.h" ++ + // Compiler options --------------------------------------------------------- + + #include <wchar.h> // needed for UNICODE functions diff --git a/ports/glbinding/CONTROL b/ports/glbinding/CONTROL index bc04bf5f6..5e7ec029c 100644 --- a/ports/glbinding/CONTROL +++ b/ports/glbinding/CONTROL @@ -1,3 +1,3 @@ Source: glbinding -Version: 2.1.1 +Version: 2.1.1-1 Description: glbinding is an MIT licensed, cross-platform C++ binding for the OpenGL API diff --git a/ports/glbinding/portfile.cmake b/ports/glbinding/portfile.cmake index cf578c0a5..6da7d4858 100644 --- a/ports/glbinding/portfile.cmake +++ b/ports/glbinding/portfile.cmake @@ -43,6 +43,16 @@ endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) file(RENAME ${CURRENT_PACKAGES_DIR}/data ${CURRENT_PACKAGES_DIR}/share/data) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/data) +file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS + ${CURRENT_PACKAGES_DIR}/LICENSE + ${CURRENT_PACKAGES_DIR}/README.md + ${CURRENT_PACKAGES_DIR}/VERSION + ${CURRENT_PACKAGES_DIR}/debug/AUTHORS + ${CURRENT_PACKAGES_DIR}/debug/LICENSE + ${CURRENT_PACKAGES_DIR}/debug/README.md + ${CURRENT_PACKAGES_DIR}/debug/VERSION + ) + # Handle copyright file(COPY ${CURRENT_BUILDTREES_DIR}/src/glbinding-2.1.1/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/glbinding) file(RENAME ${CURRENT_PACKAGES_DIR}/share/glbinding/LICENSE ${CURRENT_PACKAGES_DIR}/share/glbinding/copyright) diff --git a/ports/globjects/CONTROL b/ports/globjects/CONTROL new file mode 100644 index 000000000..7917bacac --- /dev/null +++ b/ports/globjects/CONTROL @@ -0,0 +1,5 @@ +Source: globjects +Maintainer: mattias@mattiascibien.net +Version: 1.0.0 +Build-Depends: glbinding, glm +Description: C++ library strictly wrapping OpenGL objects. <https://github.com/cginternals/globjects> diff --git a/ports/globjects/portfile.cmake b/ports/globjects/portfile.cmake new file mode 100644 index 000000000..e46c34509 --- /dev/null +++ b/ports/globjects/portfile.cmake @@ -0,0 +1,61 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/globjects-1.0.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/cginternals/globjects/archive/v1.0.0.zip" + FILENAME "globjects-1.0.0.zip" + SHA512 e03ae16786b11891a61f0e2f85b0d98a858d1bad3cf4c45944982d6a753dbaa8b28975dc02153360a5ac0f3be73fe86c91af130cfc0dda7459dd782f16868eeb +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/globjects-1.0.0) +#vcpkg_build_cmake() +vcpkg_install_cmake() + + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) +file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/globjects ${CURRENT_PACKAGES_DIR}/share/globjects) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) + +file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/globjects/globjects-export-debug.cmake globjects_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" globjects_DEBUG_MODULE "${globjects_DEBUG_MODULE}") +string(REPLACE "globjectsd.dll" "bin/globjectsd.dll" globjects_DEBUG_MODULE "${globjects_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-debug.cmake "${globjects_DEBUG_MODULE}") +file(READ ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-release.cmake RELEASE_CONF) +string(REPLACE "globjects.dll" "bin/globjects.dll" RELEASE_CONF "${RELEASE_CONF}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-release.cmake "${RELEASE_CONF}") +file(REMOVE ${CURRENT_PACKAGES_DIR}/globjects-config.cmake) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/globjects-config.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export.cmake ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-config.cmake) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/globjects.dll ${CURRENT_PACKAGES_DIR}/bin/globjects.dll) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/globjectsd.dll ${CURRENT_PACKAGES_DIR}/debug/bin/globjectsd.dll) +endif() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/data ${CURRENT_PACKAGES_DIR}/share/data) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/data) +file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS + ${CURRENT_PACKAGES_DIR}/LICENSE + ${CURRENT_PACKAGES_DIR}/README.md + ${CURRENT_PACKAGES_DIR}/VERSION + ${CURRENT_PACKAGES_DIR}/debug/AUTHORS + ${CURRENT_PACKAGES_DIR}/debug/LICENSE + ${CURRENT_PACKAGES_DIR}/debug/README.md + ${CURRENT_PACKAGES_DIR}/debug/VERSION + ) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/globjects-1.0.0/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/globjects) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/globjects/LICENSE ${CURRENT_PACKAGES_DIR}/share/globjects/copyright) + +vcpkg_copy_pdbs() diff --git a/ports/glslang/0001-Fix-export-symbol-for-Windows.patch b/ports/glslang/0001-Fix-export-symbol-for-Windows.patch new file mode 100644 index 000000000..80ce58da4 --- /dev/null +++ b/ports/glslang/0001-Fix-export-symbol-for-Windows.patch @@ -0,0 +1,86 @@ +From 1ccadd2cb6db3ce5a00635f65db21e561eb7f705 Mon Sep 17 00:00:00 2001 +From: vlj <vljn.ovi@gmail.com> +Date: Fri, 25 Nov 2016 17:12:35 +0100 +Subject: [PATCH] Fix export symbol for Windows. + +--- + StandAlone/CMakeLists.txt | 1 + + StandAlone/ResourceLimits.cpp | 3 +++ + StandAlone/ResourceLimits.h | 10 ++++++++++ + 3 files changed, 14 insertions(+) + +diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt +index 231ba27..3aff02e 100644 +--- a/StandAlone/CMakeLists.txt ++++ b/StandAlone/CMakeLists.txt +@@ -2,6 +2,7 @@ add_library(glslang-default-resource-limits + ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp + ) + set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang) ++set_property(TARGET glslang-default-resource-limits PROPERTY COMPILE_DEFINITIONS DLLEXPORT) + + target_include_directories(glslang-default-resource-limits + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} +diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp +index e22ec80..634d9c9 100644 +--- a/StandAlone/ResourceLimits.cpp ++++ b/StandAlone/ResourceLimits.cpp +@@ -41,6 +41,7 @@ + + namespace glslang { + ++DLL_EXPORT + const TBuiltInResource DefaultTBuiltInResource = { + /* .MaxLights = */ 32, + /* .MaxClipPlanes = */ 6, +@@ -137,6 +138,7 @@ const TBuiltInResource DefaultTBuiltInResource = { + /* .generalConstantMatrixVectorIndexing = */ 1, + }}; + ++DLL_EXPORT + std::string GetDefaultTBuiltInResourceString() + { + std::ostringstream ostream; +@@ -239,6 +241,7 @@ std::string GetDefaultTBuiltInResourceString() + return ostream.str(); + } + ++DLL_EXPORT + void DecodeResourceLimits(TBuiltInResource* resources, char* config) + { + static const char* delims = " \t\n\r"; +diff --git a/StandAlone/ResourceLimits.h b/StandAlone/ResourceLimits.h +index 9c3eb3e..932a59f 100644 +--- a/StandAlone/ResourceLimits.h ++++ b/StandAlone/ResourceLimits.h +@@ -39,17 +39,27 @@ + + #include "glslang/Include/ResourceLimits.h" + ++#ifdef DLLEXPORT ++#define DLL_EXPORT __declspec(dllexport) ++#else ++#define DLL_EXPORT __declspec(dllimport) ++#endif ++ + namespace glslang { + + // These are the default resources for TBuiltInResources, used for both + // - parsing this string for the case where the user didn't supply one, + // - dumping out a template for user construction of a config file. ++ ++DLL_EXPORT + extern const TBuiltInResource DefaultTBuiltInResource; + + // Returns the DefaultTBuiltInResource as a human-readable string. ++DLL_EXPORT + std::string GetDefaultTBuiltInResourceString(); + + // Decodes the resource limits from |config| to |resources|. ++DLL_EXPORT + void DecodeResourceLimits(TBuiltInResource* resources, char* config); + + } // end namespace glslang +-- +2.10.2.windows.1 + diff --git a/ports/glslang/CONTROL b/ports/glslang/CONTROL new file mode 100644 index 000000000..7bd0c7e40 --- /dev/null +++ b/ports/glslang/CONTROL @@ -0,0 +1,3 @@ +Source: glslang +Version: 1c573fbcfba6b3d631008b1babc838501ca925d3 +Description: Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator diff --git a/ports/glslang/copyright b/ports/glslang/copyright new file mode 100644 index 000000000..dfffea6a8 --- /dev/null +++ b/ports/glslang/copyright @@ -0,0 +1,35 @@ +// +//Copyright (C) 2002-2005 3Dlabs Inc. Ltd. +//Copyright (C) 2012-2013 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. +// diff --git a/ports/glslang/portfile.cmake b/ports/glslang/portfile.cmake new file mode 100644 index 000000000..bdeece78a --- /dev/null +++ b/ports/glslang/portfile.cmake @@ -0,0 +1,68 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(vcpkg_common_functions) +find_program(GIT git) + +set(GIT_URL "https://github.com/KhronosGroup/glslang.git") +set(GIT_REF "1c573fbcfba6b3d631008b1babc838501ca925d3") + +if(NOT EXISTS "${DOWNLOADS}/glslang.git") + message(STATUS "Cloning") + vcpkg_execute_required_process( + COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/glslang.git + WORKING_DIRECTORY ${DOWNLOADS} + LOGNAME clone + ) +endif() + +if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + message(STATUS "Adding worktree and patching") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) + vcpkg_execute_required_process( + COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF} + WORKING_DIRECTORY ${DOWNLOADS}/glslang.git + LOGNAME worktree + ) + message(STATUS "Patching") + vcpkg_execute_required_process( + COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-export-symbol-for-Windows.patch --ignore-whitespace --whitespace=fix + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src + LOGNAME patch + ) +endif() + + + +vcpkg_configure_cmake( + SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src" +) + +vcpkg_install_cmake() + +file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Public/ShaderLang.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang) +file(COPY "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe" DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/glslangValidator.exe") +file(COPY "${CURRENT_PACKAGES_DIR}/bin/spirv-remap.exe" DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/spirv-remap.exe") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/spirv-remap.exe") + +file(GLOB BIN_DIR "${CURRENT_PACKAGES_DIR}/bin/*") +list(LENGTH BIN_DIR BIN_DIR_SIZE) +if(${BIN_DIR_SIZE} EQUAL 0) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") +endif() +file(GLOB DEBUG_BIN_DIR "${CURRENT_PACKAGES_DIR}/debug/bin/*") +list(LENGTH DEBUG_BIN_DIR DEBUG_BIN_DIR_SIZE) +if(${DEBUG_BIN_DIR_SIZE} EQUAL 0) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +# Handle copyright +file(COPY ${CMAKE_CURRENT_LIST_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/glslang) diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake index e1d601d7b..d1ba722d7 100644 --- a/ports/gtest/portfile.cmake +++ b/ports/gtest/portfile.cmake @@ -37,8 +37,6 @@ message(STATUS "Adding worktree and patching done") vcpkg_configure_cmake( SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src - OPTIONS - -DBUILD_SHARED_LIBS=ON ) vcpkg_install_cmake() @@ -55,4 +53,15 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.dll ${CURRENT_PACKAGES_ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock_main.dll) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest_main.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock_main.lib) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest_main.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock_main.lib) + vcpkg_copy_pdbs() diff --git a/ports/libiconv/0003-Fix-uwp.patch b/ports/libiconv/0003-Fix-uwp.patch new file mode 100644 index 000000000..0b2444166 --- /dev/null +++ b/ports/libiconv/0003-Fix-uwp.patch @@ -0,0 +1,25 @@ +diff --git a/libcharset/lib/localcharset.c b/libcharset/lib/localcharset.c +index 3aceb42..dadd95a 100644 +--- a/libcharset/lib/localcharset.c ++++ b/libcharset/lib/localcharset.c +@@ -455,7 +455,10 @@ locale_charset (void) + # endif + + #elif defined WIN32_NATIVE +- ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++ // GetACP() not available to UWP apps ++ codeset = NULL; ++#else + static char buf[2 + 10 + 1]; + + /* Woe32 has a function returning the locale's codepage as a number: +@@ -467,7 +470,7 @@ locale_charset (void) + encoding is the best bet. */ + sprintf (buf, "CP%u", GetACP ()); + codeset = buf; +- ++#endif + #elif defined OS2 + + const char *locale; diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt index 46575ca27..0d2a2a4d3 100644 --- a/ports/libiconv/CMakeLists.txt +++ b/ports/libiconv/CMakeLists.txt @@ -55,6 +55,8 @@ list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/localcharset.h) # set(libname libiconv) +add_definitions(-D_CRT_SECURE_NO_WARNINGS) + configure_file( ${Libiconv_SOURCE_DIR}/include/iconv.h.build.in ${Libiconv_BINARY_DIR}/iconv.h diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake index cfb96391b..46bd2f9e9 100644 --- a/ports/libiconv/portfile.cmake +++ b/ports/libiconv/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Add-export-definitions.patch ${CMAKE_CURRENT_LIST_DIR}/0002-Config-for-MSVC.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-uwp.patch ) vcpkg_configure_cmake( diff --git a/ports/libraw/CONTROL b/ports/libraw/CONTROL index d627cdd16..b10e10794 100644 --- a/ports/libraw/CONTROL +++ b/ports/libraw/CONTROL @@ -1,4 +1,4 @@ Source: libraw -Version: 0.17.2 +Version: 0.17.2-2 Build-Depends: libjpeg-turbo Description: raw image decoder library diff --git a/ports/libraw/portfile.cmake b/ports/libraw/portfile.cmake index 69c168a07..159251c28 100644 --- a/ports/libraw/portfile.cmake +++ b/ports/libraw/portfile.cmake @@ -23,12 +23,16 @@ file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/cmake DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS - -DINSTALL_CMAKE_MODULE_PATH=${SOURCE_PATH} + -DINSTALL_CMAKE_MODULE_PATH=${CURRENT_PACKAGES_DIR}/share/libraw ) vcpkg_install_cmake() -file(COPY ${SOURCE_PATH}/FindLibRaw.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libraw/cmake/FindLibRaw.cmake) +# Rename thread-safe version to be "raw.lib". This is unfortunately needed +# because otherwise libraries that build on top of libraw have to choose. +file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/raw.lib ${CURRENT_PACKAGES_DIR}/debug/lib/raw.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/raw_r.lib ${CURRENT_PACKAGES_DIR}/lib/raw.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/raw_r.lib ${CURRENT_PACKAGES_DIR}/debug/lib/raw.lib) # Cleanup file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) @@ -38,8 +42,13 @@ file(GLOB DEBUG_EXECUTABLES ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) file(REMOVE ${DEBUG_EXECUTABLES}) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +else() + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/raw.dll ${CURRENT_PACKAGES_DIR}/debug/bin/raw.dll) endif() +# Rename cmake module into a config in order to allow more flexible lookup rules +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libraw/FindLibRaw.cmake ${CURRENT_PACKAGES_DIR}/share/libraw/LibRaw-config.cmake) + # Handle copyright file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libraw) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libraw/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libraw/copyright) diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake index f71ba9f88..173d3bcdc 100644 --- a/ports/libuv/portfile.cmake +++ b/ports/libuv/portfile.cmake @@ -16,38 +16,10 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src) ) endif() -find_program(PYTHON2 - NAMES python2 python - PATHS C:/python27 ENV PYTHON -) -if(NOT PYTHON2 MATCHES "NOTFOUND") - execute_process( - COMMAND ${PYTHON2} --version - OUTPUT_VARIABLE PYTHON_VER_CHECK_OUT - ERROR_VARIABLE PYTHON_VER_CHECK_ERR - ) - set(PYTHON_VER_CHECK "${PYTHON_VER_CHECK_OUT}${PYTHON_VER_CHECK_ERR}") - debug_message("PYTHON_VER_CHECK=${PYTHON_VER_CHECK}") - if(NOT PYTHON_VER_CHECK MATCHES "Python 2.7") - set(PYTHON2 PYTHON2-NOTFOUND) - find_program(PYTHON2 - NAMES python2 python - PATHS C:/python27 ENV PYTHON - NO_SYSTEM_ENVIRONMENT_PATH - ) - endif() -endif() - -if(PYTHON2 MATCHES "NOTFOUND") - message(FATAL_ERROR "libuv uses the GYP build system, which requires Python 2.7.\n" - "Python 2.7 was not found in the path or by searching inside C:\\Python27.\n" - "There is no portable redistributable for Python 2.7, so you will need to install the MSI located at:\n" - " https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi\n" - ) -endif() +vcpkg_find_acquire_program(PYTHON2) -set(ENV{GYP_MSVS_VERSION} 2015) set(ENV{PYTHON} ${PYTHON2}) +set(ENV{GYP_MSVS_VERSION} 2015) if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(LIBUV_LINKAGE shared) diff --git a/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch b/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch new file mode 100644 index 000000000..9be5438aa --- /dev/null +++ b/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch @@ -0,0 +1,26 @@ +From ca8bb14234091ab7b1ada2b9e5abb04f40d459cb Mon Sep 17 00:00:00 2001 +From: Manuel Massing <Manuel Massing m.massing@warped-space.de> +Date: Tue, 22 Nov 2016 12:00:39 +0100 +Subject: [PATCH 1/3] CMake: add detection of recent visual studio versions + +--- + cmake/Proj4SystemInfo.cmake | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/cmake/Proj4SystemInfo.cmake b/cmake/Proj4SystemInfo.cmake +index 294a50b..c7fb6bf 100644 +--- a/cmake/Proj4SystemInfo.cmake ++++ b/cmake/Proj4SystemInfo.cmake +@@ -50,6 +50,9 @@ if(WIN32) + if(MSVC_VERSION EQUAL 1800) + set(PROJ_COMPILER_NAME "msvc-12.0") #Visual Studio 2013 + endif() ++ if(MSVC_VERSION EQUAL 1900) ++ set(PROJ_COMPILER_NAME "msvc-14.0") #Visual Studio 2015 ++ endif() + endif(MSVC) + + if(MINGW) +-- +2.9.2.windows.1 + diff --git a/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch b/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch new file mode 100644 index 000000000..2c470570e --- /dev/null +++ b/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch @@ -0,0 +1,52 @@ +From 1265d13f29259be05535241e9bcbfcf16857dc06 Mon Sep 17 00:00:00 2001 +From: Manuel Massing <Manuel Massing m.massing@warped-space.de> +Date: Tue, 22 Nov 2016 12:04:10 +0100 +Subject: [PATCH 2/3] CMake: fix error by only setting properties for targets + which are actually defined + +--- + src/CMakeLists.txt | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 8d7e7d1..59ad00a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -22,25 +22,30 @@ if(NOT MSVC) + endif () + endif () + ++ + if(BUILD_CS2CS) +- include(bin_cs2cs.cmake) ++ list(APPEND BINARY_TARGETS cs2cs) ++ include(bin_cs2cs.cmake) + endif(BUILD_CS2CS) + + if(BUILD_PROJ) ++ list(APPEND BINARY_TARGETS proj) + include(bin_proj.cmake) + endif(BUILD_PROJ) + + if(BUILD_GEOD) ++ list(APPEND BINARY_TARGETS geod) + include(bin_geod.cmake) + include(bin_geodtest.cmake) + endif(BUILD_GEOD) + + if(BUILD_NAD2BIN) ++ list(APPEND BINARY_TARGETS nad2bin) + include(bin_nad2bin.cmake) + endif(BUILD_NAD2BIN) + +-if (MSVC OR CMAKE_CONFIGURATION_TYPES) ++if ((MSVC OR CMAKE_CONFIGURATION_TYPES) AND BINARY_TARGETS) + # Add _d suffix for your debug versions of the tools +- set_target_properties (cs2cs binproj geod nad2bin PROPERTIES +- DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) ++ set_target_properties(${BINARY_TARGETS} PROPERTIES ++ DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) + endif () +-- +2.9.2.windows.1 + diff --git a/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch b/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch new file mode 100644 index 000000000..5870e12ea --- /dev/null +++ b/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch @@ -0,0 +1,98 @@ +From 0be627798d943558c674d4d92767ca255d847631 Mon Sep 17 00:00:00 2001 +From: Manuel Massing <Manuel Massing m.massing@warped-space.de> +Date: Tue, 22 Nov 2016 12:26:39 +0100 +Subject: [PATCH 3/3] CMake: configurable cmake config install location + +--- + CMakeLists.txt | 1 + + cmake/CMakeLists.txt | 14 +++++++------- + cmake/Proj4InstallPath.cmake | 12 +++++++++--- + 3 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cde21f0..1b1f892 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,6 +106,7 @@ set(LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries in + set(DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.") + set(DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.") + set(INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.") ++set(CMAKEDIR "${DEFAULT_CMAKE_CONFIGDIR}" CACHE PATH "The directory to install cmake files into.") + + ################################################################################# + # Build configured components +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 742da0e..2bdef0d 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -2,13 +2,13 @@ + # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative + # path to the root from there. (Note that the whole install tree can + # be relocated.) +-if (NOT WIN32) +- set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}") +- set (PROJECT_ROOT_DIR "../../..") +-else () +- set (INSTALL_CMAKE_DIR "cmake") +- set (PROJECT_ROOT_DIR "..") +-endif () ++ ++set (INSTALL_CMAKE_DIR ${CMAKEDIR}) ++if(NOT IS_ABSOLUTE ${INSTALL_CMAKE_DIR}) ++ set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKEDIR}") ++endif() ++ ++file(RELATIVE_PATH PROJECT_ROOT_DIR ${INSTALL_CMAKE_DIR} ${CMAKE_INSTALL_PREFIX}) + + string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER) + configure_file (project-config.cmake.in project-config.cmake @ONLY) +diff --git a/cmake/Proj4InstallPath.cmake b/cmake/Proj4InstallPath.cmake +index da1491c..826fb29 100644 +--- a/cmake/Proj4InstallPath.cmake ++++ b/cmake/Proj4InstallPath.cmake +@@ -28,13 +28,15 @@ if(WIN32) + set(DEFAULT_DATA_SUBDIR share) + set(DEFAULT_INCLUDE_SUBDIR local/include) + set(DEFAULT_DOC_SUBDIR share/doc/proj) ++ set(DEFAULT_CMAKE_CONFIG_SUBDIR "cmake") + else() +- # Common locatoins for Unix and Mac OS X ++ # Common locations for Unix and Mac OS X + set(DEFAULT_BIN_SUBDIR bin) + set(DEFAULT_LIB_SUBDIR lib) + set(DEFAULT_DATA_SUBDIR share/proj) + set(DEFAULT_DOC_SUBDIR doc/proj) + set(DEFAULT_INCLUDE_SUBDIR include) ++ set(DEFAULT_CMAKE_CONFIG_SUBDIR "share/cmake/${PROJECT_NAME}") + endif() + + # Locations are changeable by user to customize layout of PDAL installation +@@ -49,19 +51,23 @@ set(PROJ_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING + "Subdirectory where data will be installed") + set(PROJ_DOC_SUBDIR ${DEFAULT_DOC_SUBDIR} CACHE STRING + "Subdirectory where data will be installed") +- ++set(PROJ_CMAKE_CONFIG_SUBDIR ${DEFAULT_CMAKE_CONFIG_SUBDIR} CACHE STRING ++ "Subdirectory where cmake configuration files will be installed") ++ + # Mark *DIR variables as advanced and dedicated to use by power-users only. + mark_as_advanced(PROJ_ROOT_DIR + PROJ_BIN_SUBDIR + PROJ_LIB_SUBDIR + PROJ_INCLUDE_SUBDIR + PROJ_DATA_SUBDIR +- PROJ_DOC_SUBDIR ) ++ PROJ_DOC_SUBDIR ++ PROJ_CMAKE_CONFIG_SUBDIR) + + set(DEFAULT_BINDIR "${PROJ_BIN_SUBDIR}") + set(DEFAULT_LIBDIR "${PROJ_LIB_SUBDIR}") + set(DEFAULT_DATADIR "${PROJ_DATA_SUBDIR}") + set(DEFAULT_DOCDIR "${PROJ_DOC_SUBDIR}") + set(DEFAULT_INCLUDEDIR "${PROJ_INCLUDE_SUBDIR}") ++set(DEFAULT_CMAKE_CONFIGDIR "${PROJ_CMAKE_CONFIG_SUBDIR}") + + +-- +2.9.2.windows.1 + diff --git a/ports/proj/CONTROL b/ports/proj/CONTROL new file mode 100644 index 000000000..b706ca11a --- /dev/null +++ b/ports/proj/CONTROL @@ -0,0 +1,3 @@ +Source: proj +Version: 4.9.3 +Description: PROJ.4 library for cartographic projections diff --git a/ports/proj/portfile.cmake b/ports/proj/portfile.cmake new file mode 100644 index 000000000..6007ab62a --- /dev/null +++ b/ports/proj/portfile.cmake @@ -0,0 +1,57 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/proj-4.9.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://download.osgeo.org/proj/proj-4.9.3.zip" + FILENAME "proj-4.9.3.zip" + SHA512 c9703008cd1f75fe1239b180158e560b9b88ae2ffd900b72923c716908eb86d1abbc4230647af5e3131f8c34481bdc66b03826d669620161ffcfbe67801cb631 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH}/ + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-CMake-add-detection-of-recent-visual-studio-versions.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-CMake-configurable-cmake-config-install-location.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + list(APPEND CMAKE_OPTIONS "-DBUILD_LIBPROJ_SHARED=YES") +else() + list(APPEND CMAKE_OPTIONS "-DBUILD_LIBPROJ_SHARED=NO") +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS ${CMAKE_OPTIONS} + -DPROJ_LIB_SUBDIR=lib + -DPROJ_INCLUDE_SUBDIR=include + -DPROJ_DATA_SUBDIR=share/proj + -DPROJ_CMAKE_CONFIG_SUBDIR=share/proj + -DBUILD_CS2CS=NO + -DBUILD_PROJ=NO + -DBUILD_GEOD=NO + -DBUILD_NAD2BIN=NO + -DPROJ4_TESTS=NO +) + +vcpkg_install_cmake() + + +# Rename library and adapt cmake configuration +# N.B. debug cmake export is not copied, as it's not relocatable +file(READ ${CURRENT_PACKAGES_DIR}/share/proj/proj4-targets-release.cmake PROJ4_TARGETS_RELEASE) +string(REPLACE "proj_4_9.lib" "proj.lib" PROJ4_TARGETS_RELEASE ${PROJ4_TARGETS_RELEASE}) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/proj/proj4-targets-release.cmake ${PROJ4_TARGETS_RELEASE}) + +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/proj_4_9.lib ${CURRENT_PACKAGES_DIR}/lib/proj.lib) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/proj_4_9_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/projd.lib) + +# Remove duplicate headers installed from debug build +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +# Remove data installed from debug build +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/proj) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/proj/COPYING ${CURRENT_PACKAGES_DIR}/share/proj/copyright) diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 18c4e9d9f..7782551c2 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -31,11 +31,13 @@ <ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'"> <Link> - <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug'">$(VcpkgRoot)debug\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release'">$(VcpkgRoot)lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies> + <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies> + <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories> </Link> <ClCompile> - <AdditionalIncludeDirectories>$(VcpkgRoot)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgRoot)include</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 54960a138..44db05a22 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -46,21 +46,29 @@ if(NOT VCPKG_TOOLCHAIN) list(APPEND CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ) + list(APPEND CMAKE_LIBRARY_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link + ) + link_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link) endif() list(APPEND CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ) + list(APPEND CMAKE_LIBRARY_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link + ) + link_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link) include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include) set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) - option(OVERRIDE_ADD_EXECUTABLE "Automatically copy dependencies into the output directory for executables." ON) - if(OVERRIDE_ADD_EXECUTABLE) - function(add_executable name) - _add_executable(${ARGV}) - list(FIND ARGV "IMPORTED" IMPORTED_IDX) - if(IMPORTED_IDX EQUAL -1) + option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) + function(add_executable name) + _add_executable(${ARGV}) + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + if(IMPORTED_IDX EQUAL -1) + if(VCPKG_APPLOCAL_DEPS) add_custom_command(TARGET ${name} POST_BUILD COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 -targetBinary $<TARGET_FILE:${name}> @@ -68,7 +76,17 @@ if(NOT VCPKG_TOOLCHAIN) -OutVariable out ) endif() - endfunction() - endif() + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() + endfunction() + + function(add_library name) + _add_library(${ARGV}) + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + if(IMPORTED_IDX EQUAL -1) + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() + endfunction() + set(VCPKG_TOOLCHAIN ON) endif() diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 633721f0e..b192bc5d7 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -30,6 +30,28 @@ function(vcpkg_find_acquire_program VAR) set(URL "https://www.python.org/ftp/python/3.5.2/python-3.5.2-embed-amd64.zip") set(ARCHIVE "python-3.5.2-embed-amd64.zip") set(HASH 48bdcb6f94c993acad6782ee33ad4a07a0ea3b9b1bfcdeadf446d459a9224336837e2e7b518d54d8d99c5c3f4e9f8877ea1789cae513fa2eda2a3cad9e4dfd8f) + elseif(VAR MATCHES "PYTHON2") + find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON) + if(NOT PYTHON2 MATCHES "NOTFOUND") + execute_process( + COMMAND ${PYTHON2} --version + OUTPUT_VARIABLE PYTHON_VER_CHECK_OUT + ERROR_VARIABLE PYTHON_VER_CHECK_ERR + ) + set(PYTHON_VER_CHECK "${PYTHON_VER_CHECK_OUT}${PYTHON_VER_CHECK_ERR}") + debug_message("PYTHON_VER_CHECK=${PYTHON_VER_CHECK}") + if(NOT PYTHON_VER_CHECK MATCHES "Python 2.7") + set(PYTHON2 PYTHON2-NOTFOUND) + find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON NO_SYSTEM_ENVIRONMENT_PATH) + endif() + endif() + if(PYTHON2 MATCHES "NOTFOUND") + message(FATAL_ERROR "libuv uses the GYP build system, which requires Python 2.7.\n" + "Python 2.7 was not found in the path or by searching inside C:\\Python27.\n" + "There is no portable redistributable for Python 2.7, so you will need to install the MSI located at:\n" + " https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi\n" + ) + endif() elseif(VAR MATCHES "JOM") set(PROGNAME jom) set(PATHS ${DOWNLOADS}/tools/jom) diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 19b2518b7..7d83b8c7b 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.60"
\ No newline at end of file +"0.0.61"
\ No newline at end of file diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index 7f64c51cc..ccf40abbf 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -46,8 +46,8 @@ namespace vcpkg const ConfigurationType& config() const; const LinkageType& linkage() const; - const std::regex crt_regex() const; - const std::string toString() const; + std::regex crt_regex() const; + std::string toString() const; private: BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) diff --git a/toolsrc/src/BuildInfo.cpp b/toolsrc/src/BuildInfo.cpp index 8d46a0dba..44c7fdcf0 100644 --- a/toolsrc/src/BuildInfo.cpp +++ b/toolsrc/src/BuildInfo.cpp @@ -14,13 +14,13 @@ namespace vcpkg return this->m_linkage; } - const std::regex BuildType::crt_regex() const + std::regex BuildType::crt_regex() const { const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase); return r; } - const std::string BuildType::toString() const + std::string BuildType::toString() const { const std::string s = Strings::format("[%s,%s]", to_string(this->m_config), to_string(this->m_linkage)); return s; diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp index 3789e3b42..b6b604e54 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/commands_portsdiff.cpp @@ -8,6 +8,7 @@ #include <set> #include "Paragraphs.h" #include "SourceParagraph.h" +#include "vcpkg_Environment.h" namespace vcpkg { @@ -87,14 +88,28 @@ namespace vcpkg return names_and_versions; } + static void check_commit_exists(const std::wstring& git_commit_id) + { + static const std::string VALID_COMMIT_OUTPUT = "commit\n"; + + const std::wstring cmd = Strings::wformat(LR"(git cat-file -t %s 2>NUL)", git_commit_id); + const System::exit_code_and_output output = System::cmd_execute_and_capture_output(cmd); + Checks::check_exit(output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id)); + } + void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", create_example_string("portsdiff mybranchname")); args.check_min_arg_count(1, example.c_str()); args.check_max_arg_count(2, example.c_str()); + + Environment::ensure_git_on_path(paths); const std::wstring git_commit_id_for_previous_snapshot = Strings::utf8_to_utf16(args.command_arguments.at(0)); const std::wstring git_commit_id_for_current_snapshot = args.command_arguments.size() < 2 ? L"HEAD" : Strings::utf8_to_utf16(args.command_arguments.at(1)); + check_commit_exists(git_commit_id_for_current_snapshot); + check_commit_exists(git_commit_id_for_previous_snapshot); + const std::map<std::string, std::string> current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); const std::map<std::string, std::string> previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 9ae91748e..d358cca45 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -33,6 +33,12 @@ namespace vcpkg } template <class Pred> + void non_recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output) + { + std::copy_if(fs::directory_iterator(dir), fs::directory_iterator(), std::back_inserter(*output), predicate); + } + + template <class Pred> void recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output) { std::copy_if(fs::recursive_directory_iterator(dir), fs::recursive_directory_iterator(), std::back_inserter(*output), predicate); @@ -62,9 +68,9 @@ namespace vcpkg } } - static lint_status check_for_files_in_include_directory(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_files_in_include_directory(const fs::path& package_dir) { - const fs::path include_dir = paths.packages / spec.dir() / "include"; + const fs::path include_dir = package_dir / "include"; if (!fs::exists(include_dir) || fs::is_empty(include_dir)) { System::println(System::color::warning, "The folder /include is empty. This indicates the library was not correctly installed."); @@ -74,9 +80,9 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_for_files_in_debug_include_directory(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_files_in_debug_include_directory(const fs::path& package_dir) { - const fs::path debug_include_dir = paths.packages / spec.dir() / "debug" / "include"; + const fs::path debug_include_dir = package_dir / "debug" / "include"; std::vector<fs::path> files_found; recursive_find_matching_paths_in_dir(debug_include_dir, [&](const fs::path& current) @@ -95,9 +101,9 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_for_files_in_debug_share_directory(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_files_in_debug_share_directory(const fs::path& package_dir) { - const fs::path debug_share = paths.packages / spec.dir() / "debug" / "share"; + const fs::path debug_share = package_dir / "debug" / "share"; if (fs::exists(debug_share) && !fs::is_empty(debug_share)) { @@ -108,9 +114,9 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_folder_lib_cmake(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_folder_lib_cmake(const fs::path& package_dir) { - const fs::path lib_cmake = paths.packages / spec.dir() / "lib" / "cmake"; + const fs::path lib_cmake = package_dir / "lib" / "cmake"; if (fs::exists(lib_cmake)) { System::println(System::color::warning, "The /lib/cmake folder should be moved to just /cmake"); @@ -120,14 +126,13 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_for_misplaced_cmake_files(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_misplaced_cmake_files(const fs::path& package_dir, const package_spec& spec) { - const fs::path current_packages_dir = paths.packages / spec.dir(); std::vector<fs::path> misplaced_cmake_files; - recursive_find_files_with_extension_in_dir(current_packages_dir / "cmake", ".cmake", &misplaced_cmake_files); - recursive_find_files_with_extension_in_dir(current_packages_dir / "debug" / "cmake", ".cmake", &misplaced_cmake_files); - recursive_find_files_with_extension_in_dir(current_packages_dir / "lib" / "cmake", ".cmake", &misplaced_cmake_files); - recursive_find_files_with_extension_in_dir(current_packages_dir / "debug" / "lib" / "cmake", ".cmake", &misplaced_cmake_files); + recursive_find_files_with_extension_in_dir(package_dir / "cmake", ".cmake", &misplaced_cmake_files); + recursive_find_files_with_extension_in_dir(package_dir / "debug" / "cmake", ".cmake", &misplaced_cmake_files); + recursive_find_files_with_extension_in_dir(package_dir / "lib" / "cmake", ".cmake", &misplaced_cmake_files); + recursive_find_files_with_extension_in_dir(package_dir / "debug" / "lib" / "cmake", ".cmake", &misplaced_cmake_files); if (!misplaced_cmake_files.empty()) { @@ -139,9 +144,9 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_folder_debug_lib_cmake(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_folder_debug_lib_cmake(const fs::path& package_dir) { - const fs::path lib_cmake_debug = paths.packages / spec.dir() / "debug" / "lib" / "cmake"; + const fs::path lib_cmake_debug = package_dir / "debug" / "lib" / "cmake"; if (fs::exists(lib_cmake_debug)) { System::println(System::color::warning, "The /debug/lib/cmake folder should be moved to just /debug/cmake"); @@ -151,11 +156,11 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_for_dlls_in_lib_dirs(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_dlls_in_lib_dirs(const fs::path& package_dir) { std::vector<fs::path> dlls; - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "lib", ".dll", &dlls); - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "lib", ".dll", &dlls); + recursive_find_files_with_extension_in_dir(package_dir / "lib", ".dll", &dlls); + recursive_find_files_with_extension_in_dir(package_dir / "debug" / "lib", ".dll", &dlls); if (!dlls.empty()) { @@ -169,7 +174,8 @@ namespace vcpkg static lint_status check_for_copyright_file(const package_spec& spec, const vcpkg_paths& paths) { - const fs::path copyright_file = paths.packages / spec.dir() / "share" / spec.name() / "copyright"; + const fs::path packages_dir = paths.packages / spec.dir(); + const fs::path copyright_file = packages_dir / "share" / spec.name() / "copyright"; if (fs::exists(copyright_file)) { return lint_status::SUCCESS; @@ -210,17 +216,15 @@ namespace vcpkg print_vector_of_files(potential_copyright_files); } - const fs::path current_packages_dir = paths.packages / spec.dir(); - System::println(" %s/share/%s/copyright", current_packages_dir.generic_string(), spec.name()); - + System::println(" %s/share/%s/copyright", packages_dir.generic_string(), spec.name()); return lint_status::ERROR_DETECTED; } - static lint_status check_for_exes(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_for_exes(const fs::path& package_dir) { std::vector<fs::path> exes; - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".exe", &exes); - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".exe", &exes); + recursive_find_files_with_extension_in_dir(package_dir / "bin", ".exe", &exes); + recursive_find_files_with_extension_in_dir(package_dir / "debug" / "bin", ".exe", &exes); if (!exes.empty()) { @@ -446,10 +450,10 @@ namespace vcpkg return lint_status::SUCCESS; } - static lint_status check_bin_folders_are_not_present_in_static_build(const package_spec& spec, const vcpkg_paths& paths) + static lint_status check_bin_folders_are_not_present_in_static_build(const fs::path& package_dir) { - const fs::path bin = paths.packages / spec.dir() / "bin"; - const fs::path debug_bin = paths.packages / spec.dir() / "debug" / "bin"; + const fs::path bin = package_dir / "bin"; + const fs::path debug_bin = package_dir / "debug" / "bin"; if (!fs::exists(bin) && !fs::exists(debug_bin)) { @@ -591,6 +595,33 @@ namespace vcpkg return lint_status::SUCCESS; } + static lint_status check_no_files_in_package_dir_and_debug_dir(const fs::path& package_dir) + { + std::vector<fs::path> misplaced_files; + + non_recursive_find_matching_paths_in_dir(package_dir, [](const fs::path& current) + { + const std::string filename = current.filename().generic_string(); + return !fs::is_directory(current) && !((_stricmp(filename.c_str(), "CONTROL") == 0 || _stricmp(filename.c_str(), "BUILD_INFO") == 0)); + }, &misplaced_files); + + const fs::path debug_dir = package_dir / "debug"; + non_recursive_find_matching_paths_in_dir(debug_dir, [](const fs::path& current) + { + return !fs::is_directory(current); + }, &misplaced_files); + + if (!misplaced_files.empty()) + { + System::println(System::color::warning, "The following files are placed in\n%s and\n%s: ", package_dir.generic_string(), debug_dir.generic_string()); + print_vector_of_files(misplaced_files); + System::println(System::color::warning, "Files cannot be present in those directories.\n"); + return lint_status::ERROR_DETECTED; + } + + return lint_status::SUCCESS; + } + static void operator +=(size_t& left, const lint_status& right) { left += static_cast<size_t>(right); @@ -601,22 +632,24 @@ namespace vcpkg System::println("-- Performing post-build validation"); BuildInfo build_info = read_build_info(paths.build_info_file_path(spec)); + const fs::path package_dir = paths.package_dir(spec); size_t error_count = 0; - error_count += check_for_files_in_include_directory(spec, paths); - error_count += check_for_files_in_debug_include_directory(spec, paths); - error_count += check_for_files_in_debug_share_directory(spec, paths); - error_count += check_folder_lib_cmake(spec, paths); - error_count += check_for_misplaced_cmake_files(spec, paths); - error_count += check_folder_debug_lib_cmake(spec, paths); - error_count += check_for_dlls_in_lib_dirs(spec, paths); + error_count += check_for_files_in_include_directory(package_dir); + error_count += check_for_files_in_debug_include_directory(package_dir); + error_count += check_for_files_in_debug_share_directory(package_dir); + error_count += check_folder_lib_cmake(package_dir); + error_count += check_for_misplaced_cmake_files(package_dir, spec); + error_count += check_folder_debug_lib_cmake(package_dir); + error_count += check_for_dlls_in_lib_dirs(package_dir); error_count += check_for_copyright_file(spec, paths); - error_count += check_for_exes(spec, paths); + error_count += check_for_exes(package_dir); - const fs::path debug_lib_dir = paths.packages / spec.dir() / "debug" / "lib"; - const fs::path release_lib_dir = paths.packages / spec.dir() / "lib"; - const fs::path debug_bin_dir = paths.packages / spec.dir() / "debug" / "bin"; - const fs::path release_bin_dir = paths.packages / spec.dir() / "bin"; + + const fs::path debug_lib_dir = package_dir / "debug" / "lib"; + const fs::path release_lib_dir = package_dir / "lib"; + const fs::path debug_bin_dir = package_dir / "debug" / "bin"; + const fs::path release_bin_dir = package_dir / "bin"; const std::vector<fs::path> debug_libs = recursive_find_files_with_extension_in_dir(debug_lib_dir, ".lib"); const std::vector<fs::path> release_libs = recursive_find_files_with_extension_in_dir(release_lib_dir, ".lib"); @@ -655,10 +688,10 @@ namespace vcpkg case LinkageType::STATIC: { std::vector<fs::path> dlls; - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir(), ".dll", &dlls); + recursive_find_files_with_extension_in_dir(package_dir, ".dll", &dlls); error_count += check_no_dlls_present(dlls); - error_count += check_bin_folders_are_not_present_in_static_build(spec, paths); + error_count += check_bin_folders_are_not_present_in_static_build(package_dir); error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs); error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs); @@ -674,11 +707,12 @@ namespace vcpkg Checks::unreachable(); } #if 0 - error_count += check_no_subdirectories(paths.packages / spec.dir() / "lib"); - error_count += check_no_subdirectories(paths.packages / spec.dir() / "debug" / "lib"); + error_count += check_no_subdirectories(package_dir / "lib"); + error_count += check_no_subdirectories(package_dir / "debug" / "lib"); #endif - error_count += check_no_empty_folders(paths.packages / spec.dir()); + error_count += check_no_empty_folders(package_dir); + error_count += check_no_files_in_package_dir_and_debug_dir(package_dir); if (error_count != 0) { diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index db85eee8f..b1fe76982 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -20,19 +20,6 @@ bool vcpkg::g_do_dry_run = false; namespace { - template <class M, class K, class V> - auto find_or_default(const M& map, const K& key, const V& val) - { - auto it = map.find(key); - if (it == map.end()) - return decltype(it->second)(val); - else - return it->second; - } -} - -namespace -{ std::fstream open_status_file(const vcpkg_paths& paths, std::ios_base::openmode mode = std::ios_base::app | std::ios_base::in | std::ios_base::out | std::ios_base::binary) { return std::fstream(paths.vcpkg_dir_status_file, mode); @@ -157,8 +144,8 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it) { - const auto& filename = it->path().filename(); - if (fs::is_regular_file(it->status()) && (_stricmp(filename.generic_string().c_str(), "CONTROL") == 0 || _stricmp(filename.generic_string().c_str(), "BUILD_INFO") == 0)) + const std::string filename = it->path().filename().generic_string(); + if (fs::is_regular_file(it->status()) && (_stricmp(filename.c_str(), "CONTROL") == 0 || _stricmp(filename.c_str(), "BUILD_INFO") == 0)) { // Do not copy the control file continue; |
