draco cmake: Defer windows shared lib check until after plugin checks.

We rely upon CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS for windows DLL
support, but we must defer the BUILD_SHARED_LIBS check until after the
plugin args are checked since the plugin checks can enable BUILD_SHARED_LIBS.

Without this change Visual Studio will not create import libs for the draco DLLs,
and that breaks the build.
This commit is contained in:
Tom Finegan 2019-07-10 12:10:22 -07:00
parent 7e3a61d46d
commit 5bf650555c

View File

@ -56,11 +56,6 @@ option(BUILD_FOR_GLTF "" OFF)
option(BUILD_MAYA_PLUGIN "Build plugin library for Maya." OFF) option(BUILD_MAYA_PLUGIN "Build plugin library for Maya." OFF)
option(BUILD_USD_PLUGIN "Build plugin library for USD." OFF) option(BUILD_USD_PLUGIN "Build plugin library for USD." OFF)
if(WIN32 AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
include(GenerateExportHeader)
endif()
if(BUILD_FOR_GLTF) if(BUILD_FOR_GLTF)
# Override settings when building for GLTF. # Override settings when building for GLTF.
draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED") draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED")
@ -137,6 +132,10 @@ if(BUILD_USD_PLUGIN)
draco_enable_feature(FEATURE "BUILD_USD_PLUGIN") draco_enable_feature(FEATURE "BUILD_USD_PLUGIN")
endif() endif()
if(WIN32 AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()
if(ENABLE_EXTRA_SPEED) if(ENABLE_EXTRA_SPEED)
if(MSVC) if(MSVC)
# Maximum optimization in Release mode. # Maximum optimization in Release mode.