vcpkg/ports/openvdb/0003-build-only-necessary-targets.patch

283 lines
7.0 KiB
Diff
Raw Normal View History

2017-11-22 01:55:55 +08:00
diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt
index 9404dbc..94daf8c 100644
2017-11-22 01:55:55 +08:00
--- a/openvdb/CMakeLists.txt
+++ b/openvdb/CMakeLists.txt
@@ -29,28 +29,31 @@ PROJECT ( OpenVDBCore )
set(CMAKE_CXX_STANDARD 11)
2017-11-22 01:55:55 +08:00
+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 )
+ SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" )
+ ENDIF ()
SET ( GLFW_LINK_LIBRARY ${GLFW3_glfw_LIBRARY} )
SET ( GLFW_INCLUDE_DIRECTORY ${GLFW3_INCLUDE_DIR} CACHE STRING "GLFW3 include directory")
ELSE ()
FIND_PACKAGE ( GLFW REQUIRED )
IF ( UNIX AND NOT APPLE )
- SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" )
+ SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" )
ENDIF ()
2017-11-22 01:55:55 +08:00
SET ( GLFW_LINK_LIBRARY ${GLFW_glfw_LIBRARY} )
SET ( GLFW_INCLUDE_DIRECTORY ${GLFW_INCLUDE_DIR} CACHE STRING "GLFW include directory")
ENDIF ()
+ENDIF ()
2017-11-22 01:55:55 +08:00
+IF ( OPENVDB_BUILD_TOOLS )
IF (WIN32)
FIND_PACKAGE ( GLEW REQUIRED )
-ELSE ()
- FIND_PACKAGE ( Threads REQUIRED )
-ENDIF()
2017-11-22 01:55:55 +08:00
+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} )
2017-11-22 01:55:55 +08:00
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 )
2017-11-22 01:55:55 +08:00
+ ADD_DEFINITIONS ( -D_WIN32 -DNOMINMAX )
+ IF ( OPENVDB_SHARED )
+ ADD_DEFINITIONS ( -DOPENEXR_DLL -DOPENVDB_DLL )
2017-11-22 01:55:55 +08:00
+ ENDIF ()
ELSE ()
ADD_DEFINITIONS ( -pthread -fPIC )
ENDIF ()
@@ -170,16 +178,21 @@ SET ( OPENVDB_LIBRARY_SOURCE_FILES
2017-11-22 01:55:55 +08:00
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>"
2017-11-22 01:55:55 +08:00
)
-
+
2017-11-22 01:55:55 +08:00
+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
2017-11-22 01:55:55 +08:00
${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
2017-11-22 01:55:55 +08:00
${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
2017-11-22 01:55:55 +08:00
PROPERTIES OUTPUT_NAME openvdb
)
-ENDIF()
+ENDIF ()
2017-11-22 01:55:55 +08:00
+ENDIF ()
+IF ( OPENVDB_SHARED )
SET_TARGET_PROPERTIES(
openvdb_shared
PROPERTIES
@@ -214,13 +233,15 @@ SET_TARGET_PROPERTIES(
2017-11-22 01:55:55 +08:00
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>"
2017-11-22 01:55:55 +08:00
)
+IF ( OPENVDB_BUILD_TOOLS )
ADD_EXECUTABLE ( vdb_print
${VDB_PRINT_SOURCE_FILES}
)
@@ -229,14 +250,19 @@ TARGET_LINK_LIBRARIES ( vdb_print
openvdb_shared
${CMAKE_THREAD_LIBS_INIT}
${BLOSC_blosc_LIBRARY}
+ )
+
+IF (NOT WIN32)
+TARGET_LINK_LIBRARIES ( vdb_print
m
stdc++
)
+ENDIF ()
2017-11-22 01:55:55 +08:00
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>"
2017-11-22 01:55:55 +08:00
)
ADD_EXECUTABLE ( vdb_render
${VDB_RENDER_SOURCE_FILES}
@@ -249,9 +275,14 @@ TARGET_LINK_LIBRARIES ( vdb_render
${Openexr_ILMIMF_LIBRARY}
${Ilmbase_ILMTHREAD_LIBRARY}
${Ilmbase_IEX_LIBRARY}
+ )
+
+IF (NOT WIN32)
+TARGET_LINK_LIBRARIES ( vdb_render
m
stdc++
)
+ENDIF ()
SET ( VDB_VIEW_SOURCE_FILES
cmd/openvdb_view/main.cc
@@ -263,29 +294,38 @@ SET ( VDB_VIEW_SOURCE_FILES
2017-11-22 01:55:55 +08:00
)
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>"
+ )
+
+ADD_EXECUTABLE ( vdb_view
+ ${VDB_VIEW_SOURCE_FILES}
2017-11-22 01:55:55 +08:00
)
-IF (NOT WIN32)
- ADD_EXECUTABLE ( vdb_view
- ${VDB_VIEW_SOURCE_FILES}
- )
- target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} )
+target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} )
2017-11-22 01:55:55 +08:00
- TARGET_LINK_LIBRARIES ( vdb_view
- openvdb_shared
2017-11-22 01:55:55 +08:00
- ${Boost_THREAD_LIBRARY}
- ${OPENGL_gl_LIBRARY}
- ${OPENGL_glu_LIBRARY}
2017-11-22 01:55:55 +08:00
- ${COCOA_LIBRARY}
- ${IOKIT_LIBRARY}
- ${COREVIDEO_LIBRARY}
- ${GLFW_LINK_LIBRARY}
- ${GLFW_DEPENDENT_LIBRARIES}
- ${GLEW_GLEW_LIBRARY}
- m
- stdc++
- )
+TARGET_LINK_LIBRARIES ( vdb_view
+ openvdb_shared
+ ${Boost_LIBRARIES}
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_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 ()
2017-11-22 01:55:55 +08:00
SET ( UNITTEST_SOURCE_FILES
@@ -398,7 +438,7 @@ IF ( OPENVDB_BUILD_UNITTESTS )
2017-11-22 01:55:55 +08:00
ADD_TEST ( vdb_unit_test vdb_test )
-ENDIF (OPENVDB_BUILD_UNITTESTS)
+ENDIF ()
# Doxygen docmentation
IF (OPENVDB_BUILD_DOCS)
@@ -419,26 +459,29 @@ IF (OPENVDB_BUILD_DOCS)
2017-11-22 01:55:55 +08:00
ENDIF ()
# Installation
-IF ( NOT WIN32 )
+IF ( OPENVDB_BUILD_TOOLS )
2017-11-22 01:55:55 +08:00
INSTALL ( TARGETS
vdb_view
DESTINATION
bin
)
+ INSTALL ( TARGETS
+ vdb_print
+ vdb_render
+ DESTINATION
+ bin
+ )
ENDIF ()
-INSTALL ( TARGETS
- vdb_print
- vdb_render
- DESTINATION
- bin
- )
2017-11-22 01:55:55 +08:00
-INSTALL ( TARGETS
- openvdb_static
- DESTINATION
- lib
- )
2017-11-22 01:55:55 +08:00
+IF ( OPENVDB_STATIC)
+ INSTALL ( TARGETS
+ openvdb_static
+ DESTINATION
+ lib
+ )
2017-11-22 01:55:55 +08:00
+ENDIF ()
+IF ( OPENVDB_SHARED )
IF (WIN32)
INSTALL ( TARGETS
openvdb_shared
@@ -452,6 +495,7 @@ ELSE()
2017-11-22 01:55:55 +08:00
lib
)
ENDIF ()
+ENDIF ()
2017-11-22 01:55:55 +08:00
INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR} DESTINATION include
FILES_MATCHING PATTERN "*.h"