Disable shared libraries manually for shaderc

This commit is contained in:
Benau 2022-03-17 13:12:55 +08:00
parent bc1d885bd1
commit 2bc31f1518
2 changed files with 41 additions and 41 deletions

View File

@ -31,17 +31,17 @@ target_include_directories(shaderc
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)
add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc_shared)
target_include_directories(shaderc_shared
PUBLIC include
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)
target_compile_definitions(shaderc_shared
PRIVATE SHADERC_IMPLEMENTATION
PUBLIC SHADERC_SHAREDLIB
)
set_target_properties(shaderc_shared PROPERTIES SOVERSION 1)
#add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
#shaderc_default_compile_options(shaderc_shared)
#target_include_directories(shaderc_shared
# PUBLIC include
# PRIVATE ${glslang_SOURCE_DIR}
# ${SPIRV-Headers_SOURCE_DIR}/include)
#target_compile_definitions(shaderc_shared
# PRIVATE SHADERC_IMPLEMENTATION
# PUBLIC SHADERC_SHAREDLIB
#)
#set_target_properties(shaderc_shared PROPERTIES SOVERSION 1)
if(SHADERC_ENABLE_INSTALL)
install(
@ -54,10 +54,10 @@ if(SHADERC_ENABLE_INSTALL)
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
install(TARGETS shaderc shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# install(TARGETS shaderc shaderc_shared
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(SHADERC_ENABLE_INSTALL)
find_package(Threads)
@ -69,7 +69,7 @@ set(SHADERC_LIBS
)
target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS})
target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
#target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
shaderc_add_tests(
TEST_PREFIX shaderc
@ -82,16 +82,16 @@ shaderc_add_tests(
shaderc_cpp
shaderc_private)
shaderc_add_tests(
TEST_PREFIX shaderc_shared
LINK_LIBS shaderc_shared SPIRV-Tools
INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
${spirv-tools_SOURCE_DIR}/include
${SPIRV-Headers_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp
shaderc_private)
#shaderc_add_tests(
# TEST_PREFIX shaderc_shared
# LINK_LIBS shaderc_shared SPIRV-Tools
# INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
# ${spirv-tools_SOURCE_DIR}/include
# ${SPIRV-Headers_SOURCE_DIR}/include
# TEST_NAMES
# shaderc
# shaderc_cpp
# shaderc_private)
shaderc_combine_static_lib(shaderc_combined shaderc)

View File

@ -371,13 +371,13 @@ endfunction()
# Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and
# unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility.
add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
spirv_tools_default_target_options(${SPIRV_TOOLS}-shared)
set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${SPIRV_TOOLS}-shared
PRIVATE SPIRV_TOOLS_IMPLEMENTATION
PUBLIC SPIRV_TOOLS_SHAREDLIB
)
#add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
#spirv_tools_default_target_options(${SPIRV_TOOLS}-shared)
#set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
#target_compile_definitions(${SPIRV_TOOLS}-shared
# PRIVATE SPIRV_TOOLS_IMPLEMENTATION
# PUBLIC SPIRV_TOOLS_SHAREDLIB
#)
if(SPIRV_TOOLS_BUILD_STATIC)
add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES})
@ -400,14 +400,14 @@ else()
set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared)
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
find_library(LIBRT rt)
if(LIBRT)
foreach(target ${SPIRV_TOOLS_TARGETS})
target_link_libraries(${target} ${LIBRT})
endforeach()
endif()
endif()
#if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# find_library(LIBRT rt)
# if(LIBRT)
# foreach(target ${SPIRV_TOOLS_TARGETS})
# target_link_libraries(${target} ${LIBRT})
# endforeach()
# endif()
#endif()
if (ANDROID)
foreach(target ${SPIRV_TOOLS_TARGETS})