Skip to content

Commit

Permalink
Merge branch 'gha-windows-remove-nsis-override' into webrtc_ice_serve…
Browse files Browse the repository at this point in the history
…r_list_override
  • Loading branch information
namark committed May 28, 2024
2 parents c970360 + 7a70320 commit 9445625
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 85 deletions.
3 changes: 0 additions & 3 deletions cmake/ports/glslang/CONTROL

This file was deleted.

35 changes: 0 additions & 35 deletions cmake/ports/glslang/copyright

This file was deleted.

63 changes: 46 additions & 17 deletions cmake/ports/glslang/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,55 @@
include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/glslang
REF untagged-048c4dbc7f021224a933
SHA512 e3097dd2db88320982d7da1ddce138839daf3251935909c3998a114aeadd408760b26b2d7c7ee547fb0519895ac1853a45c23df2eecf61135849b080252e9dec
HEAD_REF master
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/glslang
REF "${VERSION}"
SHA512 45ec1a23a390319b9270761cf8befb832ac8b4bc215b211c41a543553a97e5ccf17c134c34d8fdbed6efe887a9a7c2f0a955d1bfe1add9e04cc3e95b12e1973a
HEAD_REF master
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
opt ENABLE_OPT
opt ALLOW_EXTERNAL_SPIRV_TOOLS
tools ENABLE_GLSLANG_BINARIES
rtti ENABLE_RTTI
)

if (ENABLE_GLSLANG_BINARIES)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON_PATH ${PYTHON3} DIRECTORY)
vcpkg_add_to_path("${PYTHON_PATH}")
endif ()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_EXTERNAL=OFF
-DGLSLANG_TESTS=OFF
${FEATURE_OPTIONS}
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DCMAKE_DEBUG_POSTFIX=d
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/glslang DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/glslang-config.cmake"
[[${PACKAGE_PREFIX_DIR}/lib/cmake/glslang/glslang-targets.cmake]]
[[${CMAKE_CURRENT_LIST_DIR}/glslang-targets.cmake]]
)
file(REMOVE_RECURSE CONFIG_PATH "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/glslang/Public/ShaderLang.h" "ifdef GLSLANG_IS_SHARED_LIBRARY" "if 1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/glslang/Include/glslang_c_interface.h" "ifdef GLSLANG_IS_SHARED_LIBRARY" "if 1")
endif()

vcpkg_copy_pdbs()

vcpkg_install_cmake()
if (ENABLE_GLSLANG_BINARIES)
vcpkg_copy_tools(TOOL_NAMES glslang glslangValidator spirv-remap AUTO_CLEAN)
endif ()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/tools")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

# Handle copyright
file(COPY ${CMAKE_CURRENT_LIST_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/glslang)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
4 changes: 4 additions & 0 deletions cmake/ports/glslang/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
glslang provides CMake targets:

find_package(glslang CONFIG REQUIRED)
target_link_libraries(main PRIVATE glslang::glslang glslang::glslang-default-resource-limits glslang::SPIRV glslang::SPVRemapper)
32 changes: 32 additions & 0 deletions cmake/ports/glslang/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "glslang",
"version": "14.0.0",
"description": "Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.",
"homepage": "https://github.com/KhronosGroup/glslang",
"license": "Apache-2.0 AND BSD-3-Clause AND MIT AND GPL-3.0-or-later",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"opt": {
"description": "Build with spirv-opt capability",
"dependencies": [
"spirv-tools"
]
},
"rtti": {
"description": "Build with dynamic typeinfo"
},
"tools": {
"description": "Build the glslangValidator and spirv-remap binaries",
"supports": "!ios"
}
}
}
2 changes: 1 addition & 1 deletion cmake/ports/hifi-host-tools/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: hifi-host-tools
Version: 0
Description: Host build system compatible tools for building High Fidelity applications
Build-Depends: hifi-scribe, glslang, spirv-cross, spirv-tools
Build-Depends: hifi-scribe, glslang[opt,tools], spirv-cross, spirv-tools
3 changes: 0 additions & 3 deletions cmake/ports/spirv-cross/CONTROL

This file was deleted.

49 changes: 31 additions & 18 deletions cmake/ports/spirv-cross/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/SPIRV-Cross
REF 2018-08-07
SHA512 1ac6ee6b2864d950199d4e856ae1576f9435827501baa5d53821a973cd68aaa03ec428094bf74c570784997baac5b2e3802ddc7f02844e2ee546741fa726bf91
REF vulkan-sdk-${VERSION}
SHA512 56172ce2a766ea83a04701a3253a17fb611c66e25303448d7ca34d507b0476f4d14420021066b382ae6f35a1b1ee4b35443e2e0475b468552f3bd1ad3413e3af
HEAD_REF master
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=OFF
)
if(VCPKG_TARGET_IS_IOS)
message(STATUS "Using iOS triplet. Executables won't be created...")
set(BUILD_CLI OFF)
else()
set(BUILD_CLI ON)
endif()

vcpkg_install_cmake()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=OFF
-DSPIRV_CROSS_CLI=${BUILD_CLI}
-DSPIRV_CROSS_SKIP_INSTALL=OFF
-DSPIRV_CROSS_ENABLE_C_API=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

foreach(COMPONENT core cpp glsl hlsl msl reflect util)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/spirv_cross_${COMPONENT}/cmake TARGET_PATH share/spirv_cross_${COMPONENT})
foreach(COMPONENT core c cpp glsl hlsl msl reflect util)
vcpkg_cmake_config_fixup(CONFIG_PATH share/spirv_cross_${COMPONENT}/cmake PACKAGE_NAME spirv_cross_${COMPONENT})
endforeach()

if(BUILD_CLI)
vcpkg_copy_tools(TOOL_NAMES spirv-cross AUTO_CLEAN)
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*")
file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)

# cleanup
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/spirv-cross/copyright COPYONLY)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
17 changes: 17 additions & 0 deletions cmake/ports/spirv-cross/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "spirv-cross",
"version": "1.3.280.0",
"description": "SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.",
"homepage": "https://github.com/KhronosGroup/SPIRV-Cross",
"dependencies": [
"spirv-headers",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
16 changes: 8 additions & 8 deletions tools/shadergen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# # Target dependant Custom rule on the SHADER_FILE
# if (ANDROID)
# set(GLPROFILE LINUX_GL)
# else()
# else()
# if (APPLE)
# set(GLPROFILE MAC_GL)
# elseif(UNIX)
Expand Down Expand Up @@ -157,7 +157,7 @@ def executeSubprocess(processArgs):
if (0 != processResult.returncode):
raise RuntimeError('Call to "{}" failed.\n\narguments:\n{}\n\nstdout:\n{}\n\nstderr:\n{}'.format(
processArgs[0],
' '.join(processArgs[1:]),
' '.join(processArgs[1:]),
processResult.stdout.decode('utf-8'),
processResult.stderr.decode('utf-8')))

Expand All @@ -166,8 +166,8 @@ def executeSubprocess(processArgs):
def processCommand(line):
global args
global scribeDepCache
glslangExec = args.tools_dir + '/glslangValidator'
spirvCrossExec = args.tools_dir + '/spirv-cross'
glslangExec = args.tools_dir + '/glslang/glslangValidator'
spirvCrossExec = args.tools_dir + '/spirv-cross/spirv-cross'
spirvOptExec = args.tools_dir + '/spirv-opt'
params = line.split(';')
dialect = params.pop(0)
Expand All @@ -188,12 +188,12 @@ def processCommand(line):

scribeOutputDir = os.path.abspath(os.path.join(unoptGlslFile, os.pardir))

# Serialize checking and creation of the output directory to avoid occasional
# Serialize checking and creation of the output directory to avoid occasional
# crashes
global folderMutex
folderMutex.acquire()
if not os.path.exists(scribeOutputDir):
os.makedirs(scribeOutputDir)
os.makedirs(scribeOutputDir)
folderMutex.release()

scribeDeps = scribeDepCache.getOrGen(scribeFile, libs, dialect, variant, defines)
Expand All @@ -217,7 +217,7 @@ def processCommand(line):
executeSubprocess(scribeArgs)

# Generate the un-optimized output
executeSubprocess([glslangExec, '-V110', '-o', upoptSpirvFile, unoptGlslFile])
executeSubprocess([glslangExec, '-V100', '-o', upoptSpirvFile, unoptGlslFile])

# Optimize the SPIRV
executeSubprocess([spirvOptExec, '-O', '-o', spirvFile, upoptSpirvFile])
Expand All @@ -233,7 +233,7 @@ def processCommand(line):
if (dialect == '410'): spirvCrossArgs.append('--no-420pack-extension')
executeSubprocess(spirvCrossArgs)
else:
# This logic is necessary because cmake will agressively keep re-executing the shadergen
# This logic is necessary because cmake will agressively keep re-executing the shadergen
# code otherwise
Path(unoptGlslFile).touch()
Path(upoptSpirvFile).touch()
Expand Down

0 comments on commit 9445625

Please sign in to comment.