vcpkg/ports/openvdb/0003-build-only-necessary-targets.patch
Victor Romero bd94d1e254
[freeimage, libwebp, OpenEXR, OpenVDB] Updates (#5417)
* [libwebp] update to v1.0.2, greatly simplify port, remove unnecessary custom find_package script in favour of original Config files for cmake

* [libwebp] enable building of all tools

* [libwebp] install cmake config file in expected path

* [libwebp] add compatibility layer inside CMake Config file

* [libwebp] fix libwebpmux library name

* [OpenEXR] Update to v2.3.0, enable tools, improve cmake module while still maintaining backwards compatibility (there's an official one distributed with the package but it is completely different, for now it is avoided)

* [OpenEXR] remove unused patches

* [OpenEXR] remove forced definition, could hide problems downstream

* [freeimage] add compatibility with latest OpenEXR

* [freeimage] bump control

* [OpenEXR] restore ilmbase as an empty package to permit clean update

* [OpenVDB] update to v6.0

* [OpenEXR] disable building on UWP platform

* [openexr] Fix tools suffixes

* [openexr] Fix Linux build paths
2019-02-26 08:16:20 -08:00

231 lines
5.9 KiB
Diff

diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt
index 9404dbc..b4129e3 100644
--- a/openvdb/CMakeLists.txt
+++ b/openvdb/CMakeLists.txt
@@ -29,12 +29,13 @@ PROJECT ( OpenVDBCore )
set(CMAKE_CXX_STANDARD 11)
+IF ( OPENVDB_BUILD_TOOLS )
IF ( USE_GLFW3 )
FIND_PACKAGE ( GLFW3 REQUIRED )
SET ( OPENVDB_USE_GLFW_FLAG "-DOPENVDB_USE_GLFW_3" )
IF ( UNIX AND NOT APPLE )
SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" )
- ENDIF ( UNIX AND NOT APPLE )
+ ENDIF ()
SET ( GLFW_LINK_LIBRARY ${GLFW3_glfw_LIBRARY} )
SET ( GLFW_INCLUDE_DIRECTORY ${GLFW3_INCLUDE_DIR} CACHE STRING "GLFW3 include directory")
ELSE ()
@@ -45,12 +46,14 @@ ELSE ()
SET ( GLFW_LINK_LIBRARY ${GLFW_glfw_LIBRARY} )
SET ( GLFW_INCLUDE_DIRECTORY ${GLFW_INCLUDE_DIR} CACHE STRING "GLFW include directory")
ENDIF ()
+ENDIF ()
-IF (WIN32)
+IF ( OPENVDB_BUILD_TOOLS )
+IF ( WIN32 )
FIND_PACKAGE ( GLEW REQUIRED )
-ELSE ()
- FIND_PACKAGE ( Threads REQUIRED )
-ENDIF()
+ENDIF ()
+ENDIF ()
+FIND_PACKAGE ( Threads REQUIRED )
# Determine OpenVDB version
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 4
@@ -130,7 +133,12 @@ INCLUDE_DIRECTORIES ( SYSTEM ${BLOSC_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( SYSTEM ${CPPUNIT_INCLUDE_DIR} )
IF (WIN32)
- ADD_DEFINITIONS ( -D_WIN32 -DNOMINMAX -DHALF_EXPORTS -DOPENVDB_DLL )
+ ADD_DEFINITIONS ( -D__TBB_NO_IMPLICIT_LINKAGE )
+ ADD_DEFINITIONS ( -D__TBBMALLOC_NO_IMPLICIT_LINKAGE )
+ ADD_DEFINITIONS ( -D_WIN32 -DNOMINMAX )
+ IF ( OPENVDB_SHARED )
+ ADD_DEFINITIONS ( -DOPENEXR_DLL -DOPENVDB_DLL )
+ ENDIF ()
ELSE ()
ADD_DEFINITIONS ( -pthread -fPIC )
ENDIF ()
@@ -170,16 +178,21 @@ SET ( OPENVDB_LIBRARY_SOURCE_FILES
SET_SOURCE_FILES_PROPERTIES ( ${OPENVDB_LIBRARY_SOURCE_FILES}
PROPERTIES
- COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}"
+ COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$<CXX_COMPILER_ID:MSVC>:/bigobj>"
)
+IF ( OPENVDB_STATIC )
ADD_LIBRARY ( openvdb_static STATIC
${OPENVDB_LIBRARY_SOURCE_FILES}
)
+ENDIF ()
+IF ( OPENVDB_SHARED )
ADD_LIBRARY ( openvdb_shared SHARED
${OPENVDB_LIBRARY_SOURCE_FILES}
)
+ENDIF ()
+IF ( OPENVDB_STATIC )
TARGET_LINK_LIBRARIES ( openvdb_static
${Boost_IOSTREAMS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
@@ -188,6 +201,8 @@ TARGET_LINK_LIBRARIES ( openvdb_static
${ZLIB_LIBRARY}
${BLOSC_blosc_LIBRARY}
)
+ENDIF ()
+IF ( OPENVDB_SHARED )
TARGET_LINK_LIBRARIES ( openvdb_shared
${Boost_IOSTREAMS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
@@ -196,7 +211,9 @@ TARGET_LINK_LIBRARIES ( openvdb_shared
${ZLIB_LIBRARY}
${BLOSC_blosc_LIBRARY}
)
+ENDIF ()
+IF ( OPENVDB_STATIC )
IF (WIN32)
SET_TARGET_PROPERTIES ( openvdb_static
PROPERTIES OUTPUT_NAME libopenvdb
@@ -205,8 +222,10 @@ ELSE()
SET_TARGET_PROPERTIES ( openvdb_static
PROPERTIES OUTPUT_NAME openvdb
)
-ENDIF()
+ENDIF ()
+ENDIF ()
+IF ( OPENVDB_SHARED )
SET_TARGET_PROPERTIES(
openvdb_shared
PROPERTIES
@@ -214,13 +233,15 @@ SET_TARGET_PROPERTIES(
SOVERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}
VERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}.${OPENVDB_PATCH_VERSION_NUMBER}
)
+ENDIF ()
SET ( VDB_PRINT_SOURCE_FILES cmd/openvdb_print/main.cc )
SET_SOURCE_FILES_PROPERTIES ( ${VDB_PRINT_SOURCE_FILES}
PROPERTIES
- COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}"
+ COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$<CXX_COMPILER_ID:MSVC>:/bigobj>"
)
+IF ( OPENVDB_BUILD_TOOLS )
ADD_EXECUTABLE ( vdb_print
${VDB_PRINT_SOURCE_FILES}
)
@@ -236,7 +257,7 @@ TARGET_LINK_LIBRARIES ( vdb_print
SET ( VDB_RENDER_SOURCE_FILES cmd/openvdb_render/main.cc )
SET_SOURCE_FILES_PROPERTIES ( ${VDB_RENDER_SOURCE_FILES}
PROPERTIES
- COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}"
+ COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$<CXX_COMPILER_ID:MSVC>:/bigobj>"
)
ADD_EXECUTABLE ( vdb_render
${VDB_RENDER_SOURCE_FILES}
@@ -263,31 +284,40 @@ SET ( VDB_VIEW_SOURCE_FILES
)
SET_SOURCE_FILES_PROPERTIES ( ${VDB_VIEW_SOURCE_FILES}
PROPERTIES
- COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1"
+ COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1 $<$<CXX_COMPILER_ID:MSVC>:/bigobj>"
)
-IF (NOT WIN32)
+
ADD_EXECUTABLE ( vdb_view
${VDB_VIEW_SOURCE_FILES}
)
-
+
target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} )
TARGET_LINK_LIBRARIES ( vdb_view
openvdb_shared
- ${Boost_THREAD_LIBRARY}
+ ${Boost_LIBRARIES}
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
- ${COCOA_LIBRARY}
- ${IOKIT_LIBRARY}
- ${COREVIDEO_LIBRARY}
${GLFW_LINK_LIBRARY}
${GLFW_DEPENDENT_LIBRARIES}
${GLEW_GLEW_LIBRARY}
+ )
+ IF (APPLE)
+ TARGET_LINK_LIBRARIES ( vdb_view
+ ${COCOA_LIBRARY}
+ ${IOKIT_LIBRARY}
+ ${COREVIDEO_LIBRARY}
+ )
+ ENDIF ()
+ IF (NOT WIN32)
+ TARGET_LINK_LIBRARIES ( vdb_view
m
stdc++
- )
+ )
+ ENDIF ()
ENDIF ()
+
SET ( UNITTEST_SOURCE_FILES
unittest/main.cc
unittest/TestAttributeArray.cc
@@ -398,7 +428,7 @@ IF ( OPENVDB_BUILD_UNITTESTS )
ADD_TEST ( vdb_unit_test vdb_test )
-ENDIF (OPENVDB_BUILD_UNITTESTS)
+ENDIF ()
# Doxygen docmentation
IF (OPENVDB_BUILD_DOCS)
@@ -419,26 +449,29 @@ IF (OPENVDB_BUILD_DOCS)
ENDIF ()
# Installation
-IF ( NOT WIN32 )
+IF ( OPENVDB_BUILD_TOOLS )
INSTALL ( TARGETS
vdb_view
DESTINATION
bin
)
-ENDIF ()
INSTALL ( TARGETS
vdb_print
vdb_render
DESTINATION
bin
)
+ENDIF ()
+IF ( OPENVDB_STATIC)
INSTALL ( TARGETS
openvdb_static
DESTINATION
lib
)
+ENDIF ()
+IF ( OPENVDB_SHARED )
IF (WIN32)
INSTALL ( TARGETS
openvdb_shared
@@ -452,6 +485,7 @@ ELSE()
lib
)
ENDIF ()
+ENDIF ()
INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR} DESTINATION include
FILES_MATCHING PATTERN "*.h"