Merge ancillary libraries into main glslang library and stub originals
This commit is contained in:
parent
0dc6711e5a
commit
4f01996c9d
13 changed files with 181 additions and 95 deletions
|
|
@ -47,9 +47,12 @@ endif()
|
|||
################################################################################
|
||||
# GenericCodeGen
|
||||
################################################################################
|
||||
add_library(GenericCodeGen STATIC
|
||||
set(GENERICCODEGEN_SOURCES
|
||||
GenericCodeGen/CodeGen.cpp
|
||||
GenericCodeGen/Link.cpp)
|
||||
|
||||
add_library(GenericCodeGen STATIC
|
||||
stub.cpp)
|
||||
set_property(TARGET GenericCodeGen PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
set_property(TARGET GenericCodeGen PROPERTY FOLDER glslang)
|
||||
|
||||
|
|
@ -130,7 +133,7 @@ if(ENABLE_HLSL)
|
|||
HLSL/hlslParseables.h)
|
||||
endif()
|
||||
|
||||
add_library(MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS})
|
||||
add_library(MachineIndependent STATIC stub.cpp)
|
||||
set_property(TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
set_property(TARGET MachineIndependent PROPERTY FOLDER glslang)
|
||||
|
||||
|
|
@ -139,12 +142,6 @@ if (NOT MSVC)
|
|||
set_source_files_properties(MachineIndependent/glslang_tab.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
|
||||
endif()
|
||||
|
||||
glslang_add_build_info_dependency(MachineIndependent)
|
||||
|
||||
glslang_pch(MachineIndependent MachineIndependent/pch.h)
|
||||
|
||||
target_link_libraries(MachineIndependent PRIVATE OSDependent GenericCodeGen)
|
||||
|
||||
################################################################################
|
||||
# glslang
|
||||
################################################################################
|
||||
|
|
@ -168,26 +165,42 @@ set(GLSLANG_HEADERS
|
|||
Include/SpirvIntrinsics.h
|
||||
Include/Types.h)
|
||||
|
||||
add_library(glslang ${LIB_TYPE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS})
|
||||
add_library(glslang ${LIB_TYPE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS} ${GENERICCODEGEN_SOURCES} ${GENERICCODEGEN_HEADERS} ${OSDEPENDENT_SOURCES} ${OSDEPENDENT_HEADERS} ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS} ${SPIRV_SOURCES} ${SPIRV_HEADERS})
|
||||
add_library(glslang::glslang ALIAS glslang)
|
||||
set_target_properties(glslang PROPERTIES
|
||||
FOLDER glslang
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
VERSION "${GLSLANG_VERSION}"
|
||||
SOVERSION "${GLSLANG_VERSION_MAJOR}")
|
||||
target_link_libraries(glslang PRIVATE OSDependent MachineIndependent)
|
||||
target_include_directories(glslang PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
glslang_add_build_info_dependency(glslang)
|
||||
|
||||
glslang_pch(glslang MachineIndependent/pch.h)
|
||||
|
||||
glslang_only_export_explicit_symbols(glslang)
|
||||
|
||||
if(WIN32 AND BUILD_SHARED_LIBS)
|
||||
set_target_properties(glslang PROPERTIES PREFIX "")
|
||||
endif()
|
||||
|
||||
if(ENABLE_SPIRV)
|
||||
if(ENABLE_OPT)
|
||||
target_include_directories(glslang PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>)
|
||||
target_link_libraries(glslang SPIRV-Tools-opt)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link pthread
|
||||
if(UNIX OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia" OR ANDROID)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(glslang Threads::Threads)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# ResourceLimits
|
||||
################################################################################
|
||||
|
|
@ -217,6 +230,8 @@ target_include_directories(glslang-default-resource-limits PUBLIC
|
|||
# source_groups
|
||||
################################################################################
|
||||
if(WIN32)
|
||||
source_group("OSDependent" REGULAR_EXPRESSION "OSDependent/[^/]*")
|
||||
source_group("OSDependent\\Windows" REGULAR_EXPRESSION "OSDependent/Windows/*")
|
||||
source_group("Public" REGULAR_EXPRESSION "Public/*")
|
||||
source_group("MachineIndependent" REGULAR_EXPRESSION "MachineIndependent/[^/]*")
|
||||
source_group("Include" REGULAR_EXPRESSION "Include/[^/]*")
|
||||
|
|
@ -224,6 +239,8 @@ if(WIN32)
|
|||
source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*")
|
||||
source_group("HLSL" REGULAR_EXPRESSION "HLSL/*")
|
||||
source_group("CInterface" REGULAR_EXPRESSION "CInterface/*")
|
||||
source_group("SPIRV" REGULAR_EXPRESSION "SPIRV/[^/]*")
|
||||
source_group("SPIRV\\CInterface" REGULAR_EXPRESSION "SPIRV/CInterface/*")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
|
|
|
|||
|
|
@ -31,15 +31,18 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
add_library(OSDependent STATIC ossource.cpp ../osinclude.h)
|
||||
set(OSDEPENDENT_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ossource.cpp
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(OSDEPENDENT_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../osinclude.h
|
||||
PARENT_SCOPE)
|
||||
|
||||
add_library(OSDependent STATIC ${CMAKE_CURRENT_SOURCE_DIR}/../../stub.cpp)
|
||||
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
|
||||
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Link pthread
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(OSDependent Threads::Threads)
|
||||
|
||||
if(GLSLANG_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS OSDependent EXPORT glslang-targets)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
if(ENABLE_GLSLANG_JS)
|
||||
add_executable(glslang.js "glslang.js.cpp")
|
||||
glslang_set_link_args(glslang.js)
|
||||
target_link_libraries(glslang.js glslang SPIRV)
|
||||
target_link_libraries(glslang.js glslang)
|
||||
|
||||
# Link library names that start with "-" are treated as link flags.
|
||||
# "-Os" should be OK in MSVC; don't use /Os because CMake won't
|
||||
|
|
|
|||
|
|
@ -31,12 +31,18 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set(OSDEPENDENT_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ossource.cpp
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(OSDEPENDENT_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../osinclude.h
|
||||
PARENT_SCOPE)
|
||||
|
||||
add_library(OSDependent STATIC)
|
||||
|
||||
target_sources(OSDependent PRIVATE
|
||||
../osinclude.h
|
||||
ossource.cpp
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../stub.cpp)
|
||||
|
||||
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
|
||||
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
|
@ -44,7 +50,7 @@ set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|||
# MinGW GCC complains about function pointer casts to void*.
|
||||
# Turn that off with -fpermissive.
|
||||
if(MINGW AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
target_compile_options(OSDependent PRIVATE -fpermissive)
|
||||
set_source_files_properties(${OSDEPENDENT_SOURCES} PROPERTIES COMPILE_FLAGS -fpermissive)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
|||
37
glslang/stub.cpp
Normal file
37
glslang/stub.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// Copyright (C) 2024 The Khronos Group Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
//
|
||||
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// This empty source file exists to support building stubbed versions of
|
||||
// deprecated libraries which have been integrated into the main glslang
|
||||
// library. It should be deleted once the stub libraries are fully removed.
|
||||
Loading…
Add table
Add a link
Reference in a new issue