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

231 lines
5.9 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..b4129e3 100644
2017-11-22 01:55:55 +08:00
--- a/openvdb/CMakeLists.txt
+++ b/openvdb/CMakeLists.txt
@@ -29,12 +29,13 @@ 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 )
+ 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 ()
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 (WIN32)
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}
)
@@ -236,7 +257,7 @@ TARGET_LINK_LIBRARIES ( vdb_print
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}
@@ -263,31 +284,40 @@ 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>"
2017-11-22 01:55:55 +08:00
)
-IF (NOT WIN32)
+
2017-11-22 01:55:55 +08:00
ADD_EXECUTABLE ( vdb_view
${VDB_VIEW_SOURCE_FILES}
)
-
+
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
- ${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 ()
2017-11-22 01:55:55 +08:00
+
2017-11-22 01:55:55 +08:00
SET ( UNITTEST_SOURCE_FILES
unittest/main.cc
unittest/TestAttributeArray.cc
@@ -398,7 +428,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 +449,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
)
-ENDIF ()
INSTALL ( TARGETS
vdb_print
vdb_render
DESTINATION
bin
)
+ENDIF ()
2017-11-22 01:55:55 +08:00
+IF ( OPENVDB_STATIC)
INSTALL ( TARGETS
openvdb_static
DESTINATION
lib
)
+ENDIF ()
+IF ( OPENVDB_SHARED )
IF (WIN32)
INSTALL ( TARGETS
openvdb_shared
@@ -452,6 +485,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"