Skip to content

Commit 072cb60

Browse files
authored
Remove duplicate call to install() for libslang (#5767)
Closes #5764 Also mention other installed targets in cmake config
1 parent 3f4b311 commit 072cb60

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
lines changed

CMakeLists.txt

+4-7
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,12 @@ configure_package_config_file(
365365
INSTALL_DESTINATION cmake
366366
)
367367

368-
# Conditionally handle the case for Emscripten where slang does not create linkable
369-
# targets. In this case do not export the targets. Otherwise, just export the
370-
# slang target, as this is the library that is required to use the compiler. This possibly
371-
# should later be expanded to include slang-rhi targets if some program intends to use them,
372-
# but possibly wait for a future request before expanding this export set.
368+
# Conditionally handle the case for Emscripten where slang does not create
369+
# linkable targets. In this case do not export the targets. Otherwise, just
370+
# export the slang targets.
373371
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
374-
install(TARGETS slang EXPORT SlangExportTarget)
375372
install(
376-
EXPORT SlangExportTarget
373+
EXPORT SlangTargets
377374
FILE ${PROJECT_NAME}Targets.cmake
378375
NAMESPACE ${PROJECT_NAME}::
379376
DESTINATION cmake

cmake/LLVM.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function(fetch_or_build_slang_llvm)
8888
EXPORT_MACRO_PREFIX SLANG
8989
INSTALL
9090
INSTALL_COMPONENT slang-llvm
91+
EXPORT_SET_NAME SlangTargets
9192
)
9293
# If we don't include this, then the symbols in the LLVM linked here may
9394
# conflict with those of other LLVMs linked at runtime, for instance in mesa.

cmake/SlangTarget.cmake

+17-6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ function(slang_add_target dir type)
5353
# explicit name instead, used for externally built things such as
5454
# slang-glslang and slang-llvm which have large pdb files
5555
DEBUG_INFO_INSTALL_COMPONENT
56+
# The name of the Export set to associate with this installed target
57+
EXPORT_SET_NAME
5658
)
5759
set(multi_value_args
5860
# Use exactly these sources, instead of globbing from the directory
@@ -408,22 +410,31 @@ function(slang_add_target dir type)
408410
# Mark for installation
409411
#
410412
macro(i)
413+
if(ARG_EXPORT_SET_NAME)
414+
set(export_args EXPORT ${ARG_EXPORT_SET_NAME})
415+
else()
416+
if(type MATCHES "^(EXECUTABLE|SHARED|MODULE)$")
417+
message(
418+
WARNING
419+
"Target ${target} is set to be INSTALLED but EXPORT_SET_NAME wasn't specified"
420+
)
421+
endif()
422+
set(export_args)
423+
endif()
411424
install(
412-
TARGETS ${target}
413-
EXPORT SlangTargets
425+
TARGETS ${target} ${export_args}
414426
ARCHIVE DESTINATION ${archive_subdir} ${ARGN}
415427
LIBRARY DESTINATION ${library_subdir} ${ARGN}
416428
RUNTIME DESTINATION ${runtime_subdir} ${ARGN}
417429
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${ARGN}
418430
)
419431
endmacro()
420-
if(ARG_INSTALL)
421-
i()
422-
set(pdb_component "debug-info")
423-
endif()
424432
if(ARG_INSTALL_COMPONENT)
425433
i(EXCLUDE_FROM_ALL COMPONENT ${ARG_INSTALL_COMPONENT})
426434
set(pdb_component "${ARG_INSTALL_COMPONENT}-debug-info")
435+
elseif(ARG_INSTALL)
436+
i()
437+
set(pdb_component "debug-info")
427438
endif()
428439
if(ARG_DEBUG_INFO_INSTALL_COMPONENT)
429440
set(pdb_component ${ARG_DEBUG_INFO_INSTALL_COMPONENT})

source/slang-glslang/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if(SLANG_ENABLE_SLANG_GLSLANG)
99
LINK_WITH_PRIVATE glslang SPIRV SPIRV-Tools-opt
1010
INCLUDE_DIRECTORIES_PRIVATE ${slang_SOURCE_DIR}/include
1111
INSTALL
12+
EXPORT_SET_NAME SlangTargets
1213
DEBUG_INFO_INSTALL_COMPONENT slang-glslang-debug-info
1314
)
1415
# Our only interface is through what we define in source/slang-glslang, in the

source/slang-rt/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ if(SLANG_ENABLE_SLANGRT)
1010
EXPORT_MACRO_PREFIX SLANG_RT
1111
INCLUDE_DIRECTORIES_PUBLIC ${slang_SOURCE_DIR}/include
1212
INSTALL
13+
# This depends on unordered_dense in the header, so we can't export
14+
# this via cmake without obligating ourselves to also install our
15+
# bundled version of unordered_dense, give it this different export set
16+
# name so we don't attempt to export it
17+
EXPORT_SET_NAME SlangRTTargets
1318
)
1419
endif()

source/slang/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ set(slang_public_lib_args
233233
$<IF:$<BOOL:${SLANG_EMBED_CORE_MODULE}>,slang-embedded-core-module,slang-no-embedded-core-module>
234234
$<IF:$<BOOL:${SLANG_EMBED_CORE_MODULE_SOURCE}>,slang-embedded-core-module-source,slang-no-embedded-core-module-source>
235235
INSTALL
236+
EXPORT_SET_NAME
237+
SlangTargets
236238
)
237239

238240
#
@@ -284,6 +286,7 @@ else()
284286
OUTPUT_DIR generators
285287
FOLDER generators
286288
INSTALL_COMPONENT generators
289+
EXPORT_SET_NAME SlangGeneratorTargets
287290
)
288291
slang_add_target(
289292
.

source/slangc/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ if(SLANG_ENABLE_SLANGC)
66
DEBUG_DIR ${slang_SOURCE_DIR}
77
LINK_WITH_PRIVATE core slang Threads::Threads
88
INSTALL
9+
EXPORT_SET_NAME SlangTargets
910
)
1011
endif()

tools/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function(generator dir)
3939
REQUIRED_BY all-generators
4040
FOLDER generators
4141
INSTALL_COMPONENT generators
42+
EXPORT_SET_NAME SlangGeneratorTargets
4243
${ARGN}
4344
)
4445
endif()
@@ -93,6 +94,7 @@ if(SLANG_ENABLE_SLANGD)
9394
slang-capability-defs
9495
Threads::Threads
9596
INSTALL
97+
EXPORT_SET_NAME SlangTargets
9698
)
9799
endif()
98100

@@ -152,6 +154,7 @@ if(SLANG_ENABLE_GFX)
152154
${slang_SOURCE_DIR}/include
153155
REQUIRES copy-gfx-slang-modules
154156
INSTALL
157+
EXPORT_SET_NAME SlangTargets
155158
FOLDER gfx
156159
)
157160
set(modules_dest_dir $<TARGET_FILE_DIR:slang-test>)

0 commit comments

Comments
 (0)