Skip to content

Commit

Permalink
Freeimage/libraw/lcms debug build fixes (#3643)
Browse files Browse the repository at this point in the history
* Patch libraw-local FindLCMS2.cmake to handle debug postfix

* Remove library statement from def as name is incorrect for debug builds

https://msdn.microsoft.com/en-us/library/d91k01sh.aspx claims it is
required, but works fine (better) without.

* Patch FindLibRaw.cmake to handle debug postfix

* [lcms] Use vcpkg_from_github()'s PATCHES parameter
  • Loading branch information
trylle authored and ras0219-msft committed Aug 8, 2018
1 parent 6d4223f commit b286cd5
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ports/lcms/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: lcms
Version: 2.8-4
Version: 2.8-5
Build-Depends:
Description: Little CMS.
3 changes: 2 additions & 1 deletion ports/lcms/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ vcpkg_from_github(
REPO mm2/Little-CMS
REF lcms2.8
SHA512 22ee94aa3333db4248607d8aa84343d324e04b30c154c46672c6f668e14a369b9b72f2557b8465218b6e9a2676cf8fa37d617b4aa13a013dc2337197a599e63a
HEAD_REF master
HEAD_REF master
PATCHES "${CMAKE_CURRENT_LIST_DIR}/remove_library_directive.patch"
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
Expand Down
8 changes: 8 additions & 0 deletions ports/lcms/remove_library_directive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- a/src/lcms2.def 2016-07-20 09:46:01.000000000 +0200
+++ b/src/lcms2.def 2018-06-02 02:11:04.135781600 +0200
@@ -1,5 +1,3 @@
-LIBRARY LCMS2.DLL
-
EXPORTS

_cms15Fixed16toDouble = _cms15Fixed16toDouble
39 changes: 39 additions & 0 deletions ports/libraw/findlibraw_debug_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- a/cmake/modules/FindLibRaw.cmake 2016-11-02 07:09:50.000000000 +0100
+++ b/cmake/modules/FindLibRaw.cmake 2018-06-02 02:50:10.501142400 +0200
@@ -31,18 +31,34 @@
PATH_SUFFIXES libraw
)

-FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw
+FIND_LIBRARY(LibRaw_LIBRARY_RELEASE NAMES raw
HINTS
${PC_LIBRAW_LIBDIR}
${PC_LIBRAW_LIBRARY_DIRS}
)

-FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
+FIND_LIBRARY(LibRaw_LIBRARY_DEBUG NAMES rawd
+ HINTS
+ ${PC_LIBRAW_LIBDIR}
+ ${PC_LIBRAW_LIBRARY_DIRS}
+ )
+
+select_library_configurations(LibRaw)
+
+FIND_LIBRARY(LibRaw_r_LIBRARY_RELEASE NAMES raw_r
HINTS
${PC_LIBRAW_R_LIBDIR}
${PC_LIBRAW_R_LIBRARY_DIRS}
)

+FIND_LIBRARY(LibRaw_r_LIBRARY_DEBUG NAMES raw_rd
+ HINTS
+ ${PC_LIBRAW_R_LIBDIR}
+ ${PC_LIBRAW_R_LIBRARY_DIRS}
+ )
+
+select_library_configurations(LibRaw_r)
+
IF(LibRaw_INCLUDE_DIR)
FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)

66 changes: 66 additions & 0 deletions ports/libraw/lcms2_debug_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- a/cmake/modules/FindLCMS2.cmake 2016-11-02 07:09:50.000000000 +0100
+++ b/cmake/modules/FindLCMS2.cmake 2018-06-02 00:43:27.309100600 +0200
@@ -13,7 +13,6 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying LICENSE file.

-
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if(NOT WIN32)
@@ -29,18 +28,30 @@
PATH_SUFFIXES lcms2 liblcms2
)

-find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
+include(SelectLibraryConfigurations)
+
+find_library(LCMS2_LIBRARY_RELEASE NAMES lcms2 liblcms2 lcms-2 liblcms-2
+ PATHS
+ ${PC_LCMS2_LIBDIR}
+ ${PC_LCMS2_LIBRARY_DIRS}
+ PATH_SUFFIXES lcms2
+)
+
+find_library(LCMS2_LIBRARY_DEBUG NAMES lcms2d liblcms2d lcms-2d liblcms-2d
PATHS
${PC_LCMS2_LIBDIR}
${PC_LCMS2_LIBRARY_DIRS}
PATH_SUFFIXES lcms2
)

-if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+select_library_configurations(LCMS2)
+
+
+if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARY)
set(LCMS2_FOUND TRUE)
-else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARY)
set(LCMS2_FOUND FALSE)
-endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARY)

if(LCMS2_FOUND)
file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
@@ -50,11 +61,11 @@
if(NOT LCMS2_FIND_QUIETLY)
string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION)
string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION)
- message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}")
+ message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARY}")
endif(NOT LCMS2_FIND_QUIETLY)
else(LCMS2_VERSION_MATCH)
if(NOT LCMS2_FIND_QUIETLY)
- message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
+ message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARY}")
endif(NOT LCMS2_FIND_QUIETLY)
set(LCMS2_VERSION NOTFOUND)
endif(LCMS2_VERSION_MATCH)
@@ -68,5 +79,5 @@
endif(NOT LCMS2_FIND_QUIETLY)
endif(LCMS2_FOUND)

-mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
+mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY LCMS2_VERSION)

7 changes: 7 additions & 0 deletions ports/libraw/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ vcpkg_extract_source_archive(${CMAKE_BUILD_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/sr
file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/cmake DESTINATION ${SOURCE_PATH})

vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/findlibraw_debug_fix.patch
${CMAKE_CURRENT_LIST_DIR}/lcms2_debug_fix.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
Expand Down

0 comments on commit b286cd5

Please sign in to comment.