lol

spirv-tools: fix static build

+35
+5
pkgs/development/tools/spirv-tools/default.nix
··· 11 11 hash = "sha256-HV7jNvgTRRGnhurtT5pf5f5gzUOmr3iWNcDc8TE4ICQ="; 12 12 }; 13 13 14 + # The cmake options are sufficient for turning on static building, but not 15 + # for disabling shared building, just trim the shared lib from the CMake 16 + # description 17 + patches = lib.optional stdenv.hostPlatform.isStatic ./no-shared-libs.patch; 18 + 14 19 nativeBuildInputs = [ cmake python3 ]; 15 20 16 21 cmakeFlags = [
+30
pkgs/development/tools/spirv-tools/no-shared-libs.patch
··· 1 + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt 2 + index acfa0c12..bf3eb686 100644 3 + --- a/source/CMakeLists.txt 4 + +++ b/source/CMakeLists.txt 5 + @@ -378,16 +378,6 @@ function(spirv_tools_default_target_options target) 6 + add_dependencies(${target} spirv-tools-build-version core_tables enum_string_mapping extinst_tables) 7 + endfunction() 8 + 9 + -# Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and 10 + -# unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility. 11 + -add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES}) 12 + -spirv_tools_default_target_options(${SPIRV_TOOLS}-shared) 13 + -set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) 14 + -target_compile_definitions(${SPIRV_TOOLS}-shared 15 + - PRIVATE SPIRV_TOOLS_IMPLEMENTATION 16 + - PUBLIC SPIRV_TOOLS_SHAREDLIB 17 + -) 18 + - 19 + if(SPIRV_TOOLS_BUILD_STATIC) 20 + add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES}) 21 + spirv_tools_default_target_options(${SPIRV_TOOLS}-static) 22 + @@ -402,7 +392,7 @@ if(SPIRV_TOOLS_BUILD_STATIC) 23 + add_library(${SPIRV_TOOLS} ALIAS ${SPIRV_TOOLS}-static) 24 + endif() 25 + 26 + - set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-static ${SPIRV_TOOLS}-shared) 27 + + set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-static) 28 + else() 29 + add_library(${SPIRV_TOOLS} ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_SOURCES}) 30 + spirv_tools_default_target_options(${SPIRV_TOOLS})