From 1a30b7a8a12084062ad0060c72792ba7e72750b5 Mon Sep 17 00:00:00 2001 From: codicodi Date: Sat, 10 Jun 2017 16:54:03 +0200 Subject: [PATCH] [ilmbase] initial commit --- ports/ilmbase/CONTROL | 3 ++ ports/ilmbase/fix-parallel-build.patch | 54 ++++++++++++++++++++++++++ ports/ilmbase/portfile.cmake | 49 +++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 ports/ilmbase/CONTROL create mode 100644 ports/ilmbase/fix-parallel-build.patch create mode 100644 ports/ilmbase/portfile.cmake diff --git a/ports/ilmbase/CONTROL b/ports/ilmbase/CONTROL new file mode 100644 index 0000000000..8bb0229059 --- /dev/null +++ b/ports/ilmbase/CONTROL @@ -0,0 +1,3 @@ +Source: ilmbase +Version: 2.2.0 +Description: Base libraries from ILM for OpenEXR diff --git a/ports/ilmbase/fix-parallel-build.patch b/ports/ilmbase/fix-parallel-build.patch new file mode 100644 index 0000000000..85c773f312 --- /dev/null +++ b/ports/ilmbase/fix-parallel-build.patch @@ -0,0 +1,54 @@ +diff --git a/Half/CMakeLists.txt b/Half/CMakeLists.txt +index 6f9714d..0c43904 100644 +--- a/Half/CMakeLists.txt ++++ b/Half/CMakeLists.txt +@@ -2,10 +2,10 @@ + + ADD_EXECUTABLE ( eLut eLut.cpp ) + +-ADD_CUSTOM_COMMAND ( +- TARGET eLut POST_BUILD ++ADD_CUSTOM_TARGET ( make_eLut + COMMAND eLut > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ++ DEPENDS eLut + ) + SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_BINARY_DIR}/eLut.h +@@ -13,25 +13,16 @@ SET_SOURCE_FILES_PROPERTIES( + ) + + ADD_EXECUTABLE ( toFloat toFloat.cpp ) +-ADD_CUSTOM_COMMAND ( +- TARGET toFloat POST_BUILD ++ADD_CUSTOM_TARGET ( make_toFloat + COMMAND toFloat > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ++ DEPENDS toFloat + ) + SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h + PROPERTIES HEADER_FILE_ONLY TRUE + ) + +-SET_SOURCE_FILES_PROPERTIES( +- half.cpp +- PROPERTIES +- OBJECT_DEPENDS +- ${CMAKE_CURRENT_BINARY_DIR}/eLut.h +- OBJECT_DEPENDS +- ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h +- ) +- + IF(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DHALF_EXPORTS) + ENDIF() +@@ -41,7 +32,7 @@ ADD_LIBRARY ( Half ${LIB_TYPE} + ) + + +-ADD_DEPENDENCIES ( Half toFloat eLut ) ++ADD_DEPENDENCIES ( Half make_toFloat make_eLut ) + + INSTALL ( TARGETS + Half diff --git a/ports/ilmbase/portfile.cmake b/ports/ilmbase/portfile.cmake new file mode 100644 index 0000000000..8036413ade --- /dev/null +++ b/ports/ilmbase/portfile.cmake @@ -0,0 +1,49 @@ +if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "UWP build not supported") +endif() + +set(ILM_VERSION 2.2.0) +set(ILM_HASH 0bbad14ed2bd286dff3987b16ef8631470211da54f822cb3e29b7931807216845ded81c9bf41fd2d22a8b362e8b9904a5450f61f5a242e460083e86b846513f1) + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ilmbase-${ILM_VERSION}) +vcpkg_download_distfile(ARCHIVE + URLS "http://download.savannah.nongnu.org/releases/openexr/ilmbase-${ILM_VERSION}.tar.gz" + FILENAME "ilmbase-${ILM_VERSION}.zip" + SHA512 ${ILM_HASH}) + +vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-parallel-build.patch) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA) +vcpkg_install_cmake() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + foreach(SUBDIR "" "/debug") + file(GLOB DLLS ${CURRENT_PACKAGES_DIR}${SUBDIR}/lib/*.dll) + file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}${SUBDIR}/bin) + file(REMOVE ${DLLS}) + endforeach() +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +vcpkg_copy_pdbs() + +foreach(HEADER halfExport.h IexExport.h IexMathFloatExc.h IlmThreadExport.h ImathExport.h) + file(READ ${CURRENT_PACKAGES_DIR}/include/OpenEXR/${HEADER} HEADER_FILE) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + string(REPLACE "defined(OPENEXR_DLL)" "1" HEADER_FILE "${HEADER_FILE}") + else() + string(REPLACE "defined(OPENEXR_DLL)" "0" HEADER_FILE "${HEADER_FILE}") + endif() + file(WRITE ${CURRENT_PACKAGES_DIR}/include/OpenEXR/${HEADER} "${HEADER_FILE}") +endforeach() + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ilmbase) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/ilmbase/LICENSE ${CURRENT_PACKAGES_DIR}/share/ilmbase/copyright)