Fixed static library linking on Windows

Changed the glLoader library to an object library
instead of a static library to improve generating
opensubdiv static libraries.
This commit is contained in:
David G Yu 2020-03-31 21:43:26 -07:00
parent e6963dac5a
commit b93725be26
3 changed files with 6 additions and 4 deletions

View File

@ -467,7 +467,7 @@ if(GLEW_FOUND AND GLEW_INCLUDE_DIR)
${GLEW_INCLUDE_DIR} ${GLEW_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/glLoader) ${PROJECT_SOURCE_DIR}/glLoader)
set(OPENGL_LOADER_LIBRARIES set(OPENGL_LOADER_LIBRARIES
glLoader $<TARGET_OBJECTS:glLoader_obj>
${GLEW_LIBRARY} ${GLEW_LIBRARY}
${OPENGL_gl_LIBRARY}) ${OPENGL_gl_LIBRARY})
@ -478,7 +478,7 @@ elseif(OPENGL_FOUND)
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/glLoader) ${PROJECT_SOURCE_DIR}/glLoader)
set(OPENGL_LOADER_LIBRARIES set(OPENGL_LOADER_LIBRARIES
glLoader $<TARGET_OBJECTS:glLoader_obj>
${OPENGL_gl_LIBRARY}) ${OPENGL_gl_LIBRARY})
endif() endif()

View File

@ -45,8 +45,8 @@ list(APPEND PLATFORM_LIBRARIES
"${OPENGL_LOADER_LIBRARIES}" "${OPENGL_LOADER_LIBRARIES}"
) )
add_library(glLoader add_library(glLoader_obj
STATIC OBJECT
${GLLOADER_SOURCE_FILES} ${GLLOADER_SOURCE_FILES}
${GLLOADER_HEADER_FILES} ${GLLOADER_HEADER_FILES}
) )

View File

@ -64,6 +64,7 @@ if (NOT NO_LIB)
list(APPEND PLATFORM_GPU_LIBRARIES list(APPEND PLATFORM_GPU_LIBRARIES
${OPENGL_LOADER_LIBRARIES} ${OPENGL_LOADER_LIBRARIES}
) )
set(OPENGL_LOADER_OBJS $<TARGET_OBJECTS:glLoader_obj>)
elseif( OPENGLES_FOUND ) elseif( OPENGLES_FOUND )
include_directories("${OPENGLES_INCLUDE_DIR}") include_directories("${OPENGLES_INCLUDE_DIR}")
list(APPEND PLATFORM_GPU_LIBRARIES list(APPEND PLATFORM_GPU_LIBRARIES
@ -153,6 +154,7 @@ if (NOT NO_LIB)
STATIC STATIC
version.cpp version.cpp
$<TARGET_OBJECTS:osd_gpu_obj> $<TARGET_OBJECTS:osd_gpu_obj>
${OPENGL_LOADER_OBJS}
${CUDA_KERNEL_FILES} ${CUDA_KERNEL_FILES}
) )
set_target_properties(osd_static_gpu PROPERTIES OUTPUT_NAME osdGPU CLEAN_DIRECT_OUTPUT 1) set_target_properties(osd_static_gpu PROPERTIES OUTPUT_NAME osdGPU CLEAN_DIRECT_OUTPUT 1)