Deps: Speed up shaderc build

Mainly for flatpak...
This commit is contained in:
Stenzek 2024-04-05 22:39:39 +10:00
parent d9b1d39638
commit 69f79c3a4f
No known key found for this signature in database
11 changed files with 317 additions and 163 deletions

View File

@ -158,7 +158,7 @@ Due to Ubuntu LTS using older package versions, DuckStation releases use manuall
Fedora package names (assumes you are using the dependency build script):
```
alsa-lib-devel brotli-devel clang cmake dbus-devel egl-wayland-devel fontconfig-devel gcc-c++ libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libSM-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel lld llvm make mesa-libEGL-devel mesa-libGL-devel ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel zlib-devel
alsa-lib-devel brotli-devel clang cmake dbus-devel egl-wayland-devel fontconfig-devel gcc-c++ libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libSM-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel lld llvm make mesa-libEGL-devel mesa-libGL-devel ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xcb-util-xrm-devel zlib-devel
```
1. Clone the repository: `git clone https://github.com/stenzek/duckstation.git -b dev`.

View File

@ -328,7 +328,7 @@ tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
cd ..
patch -p1 < "$SCRIPTDIR/shaderc-install.patch"
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -B build
make -C build "-j$NPROCS"
make -C build install
cd ..

View File

@ -241,7 +241,7 @@ rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
cd .. || goto error
%PATCH% -p1 < "%SCRIPTDIR%\shaderc-install.patch" || goto error
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error
cd .. || goto error

View File

@ -238,7 +238,7 @@ rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
cd .. || goto error
%PATCH% -p1 < "%SCRIPTDIR%\shaderc-install.patch" || goto error
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error
cd .. || goto error

View File

@ -292,7 +292,7 @@ tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
cd ..
patch -p1 < "$SCRIPTDIR/shaderc-install.patch"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -B build -G Ninja
cmake --build build --parallel
ninja -C build install
cd ..

View File

@ -2,6 +2,12 @@
"name": "sdl2",
"buildsystem": "cmake-ninja",
"builddir": true,
"config-opts": [
"-DBUILD_SHARED_LIBS=ON",
"-DSDL_SHARED=ON",
"-DSDL_STATIC=OFF",
"-DSDL_TESTS=OFF"
],
"build-options": {
"strip": true
},
@ -21,4 +27,3 @@
"/lib/pkgconfig"
]
}

View File

@ -1,22 +1,21 @@
{
"name": "libbacktrace",
"buildsystem": "autotools",
"no-autogen": true,
"build-options": {
"strip": false,
"no-debuginfo": true
},
"sources": [
{
"type": "git",
"url": "https://github.com/ianlancetaylor/libbacktrace.git",
"commit": "ad106d5fdd5d960bd33fae1c48a351af567fd075"
}
],
"cleanup": [
"/include",
"/lib/*.a",
"/lib/*.la"
]
}
"name": "libbacktrace",
"buildsystem": "autotools",
"no-autogen": true,
"build-options": {
"strip": false,
"no-debuginfo": true
},
"sources": [
{
"type": "git",
"url": "https://github.com/ianlancetaylor/libbacktrace.git",
"commit": "ad106d5fdd5d960bd33fae1c48a351af567fd075"
}
],
"cleanup": [
"/include",
"/lib/*.a",
"/lib/*.la"
]
}

View File

@ -1,50 +1,50 @@
{
"name": "shaderc",
"buildsystem": "cmake-ninja",
"builddir": true,
"config-opts": [
"-DSHADERC_SKIP_TESTS=ON",
"-DSHADERC_SKIP_EXAMPLES=ON",
"-DSHADERC_ENABLE_SHARED_CRT=ON"
],
"build-options": {
"strip": true
"name": "shaderc",
"buildsystem": "cmake-ninja",
"builddir": true,
"config-opts": [
"-DSHADERC_SKIP_TESTS=ON",
"-DSHADERC_SKIP_EXAMPLES=ON",
"-DSHADERC_SKIP_COPYRIGHT_CHECK=ON"
],
"build-options": {
"strip": true
},
"sources": [
{
"type": "git",
"url": "https://github.com/google/shaderc.git",
"commit": "d792558a8902cb39b1c237243cc4edab226513a5"
},
"sources": [
{
"type": "git",
"url": "https://github.com/google/shaderc.git",
"commit": "d792558a8902cb39b1c237243cc4edab226513a5"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/glslang/archive/d73712b8f6c9047b09e99614e20d456d5ada2390.tar.gz",
"sha256": "d27f7359156a92749f8fd4681d1d518c736864213c431cf8144ecc2fb6689a2d",
"dest": "third_party/glslang"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Headers/archive/8b246ff75c6615ba4532fe4fde20f1be090c3764.tar.gz",
"sha256": "cfeed5f9a97d12a9761a26e7f5bd10fedb1a8ce92033075151ae3bc7206fc229",
"dest": "third_party/spirv-headers"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Tools/archive/04896c462d9f3f504c99a4698605b6524af813c1.tar.gz",
"sha256": "c0d01e758a543b3a358cb97af02c6817ebd3f5ff13a2edf9fb220646a3d67999",
"dest": "third_party/spirv-tools"
},
{
"type": "patch",
"path": "shaderc-install.patch"
}
],
"cleanup": [
"/bin",
"/include",
"/lib/*.a",
"/lib/*.la",
"/lib/cmake",
"/lib/pkgconfig"
]
{
"type": "archive",
"url": "https://github.com/KhronosGroup/glslang/archive/d73712b8f6c9047b09e99614e20d456d5ada2390.tar.gz",
"sha256": "d27f7359156a92749f8fd4681d1d518c736864213c431cf8144ecc2fb6689a2d",
"dest": "third_party/glslang"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Headers/archive/8b246ff75c6615ba4532fe4fde20f1be090c3764.tar.gz",
"sha256": "cfeed5f9a97d12a9761a26e7f5bd10fedb1a8ce92033075151ae3bc7206fc229",
"dest": "third_party/spirv-headers"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Tools/archive/04896c462d9f3f504c99a4698605b6524af813c1.tar.gz",
"sha256": "c0d01e758a543b3a358cb97af02c6817ebd3f5ff13a2edf9fb220646a3d67999",
"dest": "third_party/spirv-tools"
},
{
"type": "patch",
"path": "shaderc-install.patch"
}
],
"cleanup": [
"/bin",
"/include",
"/lib/*.a",
"/lib/*.la",
"/lib/cmake",
"/lib/pkgconfig"
]
}

View File

@ -1,3 +1,100 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,9 @@ if(MSVC)
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -124,7 +127,6 @@ add_subdirectory(third_party)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
-add_subdirectory(glslc)
if(${SHADERC_ENABLE_EXAMPLES})
add_subdirectory(examples)
endif()
@@ -158,5 +160,3 @@ function(define_pkg_config_file NAME LIBS)
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -24,13 +24,6 @@ set(SHADERC_SOURCES
src/shaderc_private.h
)
-add_library(shaderc STATIC ${SHADERC_SOURCES})
-shaderc_default_compile_options(shaderc)
-target_include_directories(shaderc
- PUBLIC include
- 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
@@ -54,7 +47,7 @@ if(SHADERC_ENABLE_INSTALL)
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -69,20 +62,8 @@ set(SHADERC_LIBS
SPIRV-Tools
)
-target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS})
target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
-shaderc_add_tests(
- TEST_PREFIX shaderc
- LINK_LIBS shaderc
- 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
@@ -94,22 +75,6 @@ shaderc_add_tests(
shaderc_cpp
shaderc_private)
-shaderc_combine_static_lib(shaderc_combined shaderc)
-
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
-shaderc_add_tests(
- TEST_PREFIX shaderc_combined
- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
- 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)
-
if(${SHADERC_ENABLE_TESTS})
add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c)
shaderc_default_c_compile_options(shaderc_c_smoke_test)
diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
index e5f5d10..f4f0fef 100644
--- a/libshaderc_util/src/compiler.cc
+++ b/libshaderc_util/src/compiler.cc
@@ -341,6 +341,10 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
@ -16,56 +113,34 @@
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
"Location of re2 source")
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
+set( SKIP_GLSLANG_INSTALL ON )
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
+set( SKIP_GOOGLETEST_INSTALL ON )
# Configure third party projects.
if(${SHADERC_ENABLE_TESTS})
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,10 @@
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
+
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -158,5 +162,4 @@
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
+
@@ -64,7 +64,10 @@ if (NOT TARGET SPIRV-Tools)
add_subdirectory(${SHADERC_RE2_DIR} re2)
add_subdirectory(${SHADERC_EFFCEE_DIR} effcee)
endif()
- add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools)
+ set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "Skip building SPIRV-Tools executables")
+ set(SPIRV_TOOLS_BUILD_STATIC OFF CACHE BOOL "Skip building two SPIRV-Tools libs")
+ set(SPIRV_TOOLS_LIBRARY_TYPE STATIC CACHE STRING "Build static SPIRV-Tools libs")
+ add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools EXCLUDE_FROM_ALL)
if (NOT "${SPIRV_SKIP_TESTS}")
if (MSVC)
if (${MSVC_VERSION} LESS 1920)
@@ -83,7 +86,7 @@ endif()
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -54,7 +54,7 @@
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -96,10 +96,6 @@
shaderc_combine_static_lib(shaderc_combined shaderc)
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
shaderc_add_tests(
TEST_PREFIX shaderc_combined
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
if (NOT TARGET glslang)
if (IS_DIRECTORY ${SHADERC_GLSLANG_DIR})
- add_subdirectory(${SHADERC_GLSLANG_DIR} glslang)
+ add_subdirectory(${SHADERC_GLSLANG_DIR} glslang EXCLUDE_FROM_ALL)
endif()
if (NOT TARGET glslang)
message(FATAL_ERROR "glslang was not found - required for compilation")

View File

@ -1,3 +1,100 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,9 @@ if(MSVC)
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -124,7 +127,6 @@ add_subdirectory(third_party)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
-add_subdirectory(glslc)
if(${SHADERC_ENABLE_EXAMPLES})
add_subdirectory(examples)
endif()
@@ -158,5 +160,3 @@ function(define_pkg_config_file NAME LIBS)
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -24,13 +24,6 @@ set(SHADERC_SOURCES
src/shaderc_private.h
)
-add_library(shaderc STATIC ${SHADERC_SOURCES})
-shaderc_default_compile_options(shaderc)
-target_include_directories(shaderc
- PUBLIC include
- 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
@@ -54,7 +47,7 @@ if(SHADERC_ENABLE_INSTALL)
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -69,20 +62,8 @@ set(SHADERC_LIBS
SPIRV-Tools
)
-target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS})
target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
-shaderc_add_tests(
- TEST_PREFIX shaderc
- LINK_LIBS shaderc
- 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
@@ -94,22 +75,6 @@ shaderc_add_tests(
shaderc_cpp
shaderc_private)
-shaderc_combine_static_lib(shaderc_combined shaderc)
-
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
-shaderc_add_tests(
- TEST_PREFIX shaderc_combined
- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
- 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)
-
if(${SHADERC_ENABLE_TESTS})
add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c)
shaderc_default_c_compile_options(shaderc_c_smoke_test)
diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
index e5f5d10..f4f0fef 100644
--- a/libshaderc_util/src/compiler.cc
+++ b/libshaderc_util/src/compiler.cc
@@ -341,6 +341,10 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
@ -16,56 +113,34 @@
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
"Location of re2 source")
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
+set( SKIP_GLSLANG_INSTALL ON )
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
+set( SKIP_GOOGLETEST_INSTALL ON )
# Configure third party projects.
if(${SHADERC_ENABLE_TESTS})
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,10 @@
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
+
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -158,5 +162,4 @@
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
+
@@ -64,7 +64,10 @@ if (NOT TARGET SPIRV-Tools)
add_subdirectory(${SHADERC_RE2_DIR} re2)
add_subdirectory(${SHADERC_EFFCEE_DIR} effcee)
endif()
- add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools)
+ set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "Skip building SPIRV-Tools executables")
+ set(SPIRV_TOOLS_BUILD_STATIC OFF CACHE BOOL "Skip building two SPIRV-Tools libs")
+ set(SPIRV_TOOLS_LIBRARY_TYPE STATIC CACHE STRING "Build static SPIRV-Tools libs")
+ add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools EXCLUDE_FROM_ALL)
if (NOT "${SPIRV_SKIP_TESTS}")
if (MSVC)
if (${MSVC_VERSION} LESS 1920)
@@ -83,7 +86,7 @@ endif()
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -54,7 +54,7 @@
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -96,10 +96,6 @@
shaderc_combine_static_lib(shaderc_combined shaderc)
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
shaderc_add_tests(
TEST_PREFIX shaderc_combined
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
if (NOT TARGET glslang)
if (IS_DIRECTORY ${SHADERC_GLSLANG_DIR})
- add_subdirectory(${SHADERC_GLSLANG_DIR} glslang)
+ add_subdirectory(${SHADERC_GLSLANG_DIR} glslang EXCLUDE_FROM_ALL)
endif()
if (NOT TARGET glslang)
message(FATAL_ERROR "glslang was not found - required for compilation")

View File

@ -28,7 +28,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
{
Win32ProgressCallback progress;
const bool com_initialized = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const bool com_initialized = SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED));
const ScopedGuard com_guard = [com_initialized]() {
if (com_initialized)
CoUninitialize();