CMake: Fold HLSL source into glslang

... and stub the HLSL target.

Fixes the building of shared libraries.

This breaks the cyclic dependency between the `glslang` and `hlsl` targets (by essentially removing the `hlsl` target).

The `BUILD.gn` and `BUILD.bazel` build rules already pull the `HLSL` source into the `glslang` target.

`Android.mk` is the only remaining build config that has a dedicated `HLSL` target, but this is explicity static and does not suffer the same link-time issues with the cyclic dependency (we may wish to stub this target too).

Related issue: #1484, #2147
Related PR: #2267
This commit is contained in:
Ben Clayton
2020-06-15 13:54:55 +01:00
parent 1a6c8ecb20
commit dcad9ad056
3 changed files with 67 additions and 29 deletions

View File

@@ -1,25 +1,10 @@
set(SOURCES
hlslAttributes.cpp
hlslParseHelper.cpp
hlslScanContext.cpp
hlslOpMap.cpp
hlslTokenStream.cpp
hlslGrammar.cpp
hlslParseables.cpp)
set(HEADERS
hlslAttributes.h
hlslParseHelper.h
hlslTokens.h
hlslScanContext.h
hlslOpMap.h
hlslTokenStream.h
hlslGrammar.h
hlslParseables.h)
# The HLSL source is directly embedded into the glslang target when ENABLE_HLSL
# is set.
# The HLSL target is now just a stub that exists for backwards compatibility for
# projects that referenced this target.
glslang_pch(SOURCES pch.cpp)
add_library(HLSL ${LIB_TYPE} ${SOURCES} ${HEADERS})
add_library(HLSL ${LIB_TYPE} "stub.cpp")
set_property(TARGET HLSL PROPERTY FOLDER hlsl)
set_property(TARGET HLSL PROPERTY POSITION_INDEPENDENT_CODE ON)
@@ -27,10 +12,6 @@ if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(HLSL PROPERTIES PREFIX "")
endif()
if(WIN32)
source_group("Source" FILES ${SOURCES} ${HEADERS})
endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS)
install(TARGETS HLSL EXPORT HLSLTargets