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} PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include) ${SPIRV-Headers_SOURCE_DIR}/include)
add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) #add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc_shared) #shaderc_default_compile_options(shaderc_shared)
target_include_directories(shaderc_shared #target_include_directories(shaderc_shared
PUBLIC include # PUBLIC include
PRIVATE ${glslang_SOURCE_DIR} # PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include) # ${SPIRV-Headers_SOURCE_DIR}/include)
target_compile_definitions(shaderc_shared #target_compile_definitions(shaderc_shared
PRIVATE SHADERC_IMPLEMENTATION # PRIVATE SHADERC_IMPLEMENTATION
PUBLIC SHADERC_SHAREDLIB # PUBLIC SHADERC_SHAREDLIB
) #)
set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) #set_target_properties(shaderc_shared PROPERTIES SOVERSION 1)
if(SHADERC_ENABLE_INSTALL) if(SHADERC_ENABLE_INSTALL)
install( install(
@ -54,10 +54,10 @@ if(SHADERC_ENABLE_INSTALL)
DESTINATION DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc) ${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
install(TARGETS shaderc shaderc_shared # install(TARGETS shaderc shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(SHADERC_ENABLE_INSTALL) endif(SHADERC_ENABLE_INSTALL)
find_package(Threads) find_package(Threads)
@ -69,7 +69,7 @@ set(SHADERC_LIBS
) )
target_link_libraries(shaderc PRIVATE ${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( shaderc_add_tests(
TEST_PREFIX shaderc TEST_PREFIX shaderc
@ -82,16 +82,16 @@ shaderc_add_tests(
shaderc_cpp shaderc_cpp
shaderc_private) shaderc_private)
shaderc_add_tests( #shaderc_add_tests(
TEST_PREFIX shaderc_shared # TEST_PREFIX shaderc_shared
LINK_LIBS shaderc_shared SPIRV-Tools # LINK_LIBS shaderc_shared SPIRV-Tools
INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} # INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
${spirv-tools_SOURCE_DIR}/include # ${spirv-tools_SOURCE_DIR}/include
${SPIRV-Headers_SOURCE_DIR}/include # ${SPIRV-Headers_SOURCE_DIR}/include
TEST_NAMES # TEST_NAMES
shaderc # shaderc
shaderc_cpp # shaderc_cpp
shaderc_private) # shaderc_private)
shaderc_combine_static_lib(shaderc_combined shaderc) 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 # Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and
# unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility. # unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility.
add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES}) #add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
spirv_tools_default_target_options(${SPIRV_TOOLS}-shared) #spirv_tools_default_target_options(${SPIRV_TOOLS}-shared)
set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) #set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${SPIRV_TOOLS}-shared #target_compile_definitions(${SPIRV_TOOLS}-shared
PRIVATE SPIRV_TOOLS_IMPLEMENTATION # PRIVATE SPIRV_TOOLS_IMPLEMENTATION
PUBLIC SPIRV_TOOLS_SHAREDLIB # PUBLIC SPIRV_TOOLS_SHAREDLIB
) #)
if(SPIRV_TOOLS_BUILD_STATIC) if(SPIRV_TOOLS_BUILD_STATIC)
add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES}) add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES})
@ -400,14 +400,14 @@ else()
set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared) set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared)
endif() endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") #if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
find_library(LIBRT rt) # find_library(LIBRT rt)
if(LIBRT) # if(LIBRT)
foreach(target ${SPIRV_TOOLS_TARGETS}) # foreach(target ${SPIRV_TOOLS_TARGETS})
target_link_libraries(${target} ${LIBRT}) # target_link_libraries(${target} ${LIBRT})
endforeach() # endforeach()
endif() # endif()
endif() #endif()
if (ANDROID) if (ANDROID)
foreach(target ${SPIRV_TOOLS_TARGETS}) foreach(target ${SPIRV_TOOLS_TARGETS})