forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
declutter top level CMakeLists.txt (shader-slang#5391)
* Split examples cmake desc * declutter top level CMakeLists.txt * fail if building tests without gfx * Move llvm fetching to another cmake file * Further split CMakeLists.txt * Neaten llvm fetching * Remove last premake remnant * correct cross builds * Neaten * Neaten project organization in vs
- Loading branch information
1 parent
fb50c03
commit 61aa670
Showing
12 changed files
with
597 additions
and
614 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
function(example dir) | ||
set(debug_dir ${CMAKE_CURRENT_BINARY_DIR}/${dir}) | ||
|
||
file( | ||
GLOB asset_files | ||
CONFIGURE_DEPENDS | ||
"${dir}/*.slang" | ||
"${dir}/*.jpg" | ||
"${dir}/*.obj" | ||
"${dir}/*.mtl" | ||
"${dir}/*.h" | ||
) | ||
|
||
list(LENGTH asset_files asset_files_length) | ||
if(asset_files_length GREATER 0) | ||
set(copy_assets_target "${dir}-copy-assets") | ||
|
||
add_custom_target( | ||
${copy_assets_target} | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${debug_dir} | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy_if_different ${asset_files} | ||
${debug_dir} | ||
COMMENT "Copy example assets to ${debug_dir}" | ||
) | ||
|
||
set_target_properties( | ||
${copy_assets_target} | ||
PROPERTIES FOLDER "examples/copy_assets" | ||
) | ||
endif() | ||
|
||
slang_add_target( | ||
${dir} | ||
EXECUTABLE | ||
USE_FEWER_WARNINGS | ||
LINK_WITH_PRIVATE | ||
core | ||
example-base | ||
slang | ||
gfx | ||
gfx-util | ||
platform | ||
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver> | ||
EXTRA_COMPILE_DEFINITIONS_PRIVATE | ||
$<$<BOOL:${SLANG_ENABLE_XLIB}>:SLANG_ENABLE_XLIB> | ||
REQUIRED_BY all-examples | ||
OPTIONAL_REQUIRES ${copy_assets_target} copy-prebuilt-binaries | ||
FOLDER examples | ||
DEBUG_DIR ${debug_dir} | ||
${ARGN} | ||
) | ||
endfunction() | ||
|
||
if(SLANG_ENABLE_EXAMPLES) | ||
# | ||
# Examples | ||
# | ||
slang_add_target( | ||
example-base | ||
STATIC | ||
LINK_WITH_PRIVATE | ||
core | ||
slang | ||
gfx | ||
platform | ||
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver> | ||
FOLDER examples | ||
) | ||
|
||
add_custom_target( | ||
all-examples | ||
COMMENT "meta target which depends on all examples" | ||
) | ||
set_target_properties(all-examples PROPERTIES FOLDER examples) | ||
example(autodiff-texture WIN32_EXECUTABLE) | ||
example(cpu-com-example) | ||
example(cpu-hello-world) | ||
example(gpu-printing) | ||
example(hello-world LINK_WITH_PRIVATE Vulkan-Headers) | ||
example(model-viewer WIN32_EXECUTABLE) | ||
example(platform-test WIN32_EXECUTABLE) | ||
example(ray-tracing WIN32_EXECUTABLE) | ||
example(ray-tracing-pipeline WIN32_EXECUTABLE) | ||
example(shader-object) | ||
example(shader-toy WIN32_EXECUTABLE) | ||
example(triangle WIN32_EXECUTABLE) | ||
if(SLANG_ENABLE_AFTERMATH) | ||
example(nv-aftermath-example WIN32_EXECUTABLE) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
slang_add_target( | ||
. | ||
STATIC | ||
EXCLUDE_FROM_ALL | ||
USE_EXTRA_WARNINGS | ||
LINK_WITH_PRIVATE core | ||
INCLUDE_FROM_PUBLIC SPIRV-Headers | ||
) | ||
if(NOT MSVC) | ||
# This is necessary to compile the DXC headers | ||
set_source_files_properties( | ||
slang-dxc-compiler.cpp | ||
PROPERTIES COMPILE_OPTIONS "-fms-extensions" | ||
DIRECTORY ${slang_SOURCE_DIR} | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
slang_add_target( | ||
. | ||
STATIC | ||
EXCLUDE_FROM_ALL | ||
USE_EXTRA_WARNINGS | ||
LINK_WITH_PRIVATE | ||
miniz lz4_static Threads::Threads ${CMAKE_DL_LIBS} | ||
LINK_WITH_PUBLIC unordered_dense::unordered_dense | ||
INCLUDE_DIRECTORIES_PUBLIC ${slang_SOURCE_DIR}/source ${slang_SOURCE_DIR}/include | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Our wrapper for glslang | ||
# | ||
if(SLANG_ENABLE_SLANG_GLSLANG) | ||
slang_add_target( | ||
. | ||
MODULE | ||
USE_FEWER_WARNINGS | ||
LINK_WITH_PRIVATE glslang SPIRV SPIRV-Tools-opt | ||
INCLUDE_DIRECTORIES_PRIVATE ${slang_SOURCE_DIR}/include | ||
INSTALL | ||
) | ||
# Our only interface is through what we define in source/slang-glslang, in the | ||
# interests of hygiene, hide anything else we link in. | ||
add_supported_cxx_linker_flags(slang-glslang PRIVATE "-Wl,--exclude-libs,ALL") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
if(SLANG_ENABLE_SLANGRT) | ||
slang_add_target( | ||
. | ||
SHARED | ||
# This compiles 'core' again with the SLANG_RT_DYNAMIC_EXPORT macro defined | ||
EXTRA_SOURCE_DIRS ${slang_SOURCE_DIR}/source/core | ||
USE_EXTRA_WARNINGS | ||
LINK_WITH_PRIVATE | ||
miniz lz4_static Threads::Threads ${CMAKE_DL_LIBS} | ||
LINK_WITH_PUBLIC unordered_dense::unordered_dense | ||
EXPORT_MACRO_PREFIX SLANG_RT | ||
INCLUDE_DIRECTORIES_PUBLIC ${slang_SOURCE_DIR}/include | ||
INSTALL | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# WebAssembly bindings for Slang | ||
# | ||
# This is an executable target because emcmake produces .a files without bindings if you just create a static library | ||
# https://stackoverflow.com/questions/63622009/static-library-built-with-cmake-as-a-with-emscripten-instead-of-wasm-js | ||
if (EMSCRIPTEN) | ||
slang_add_target( | ||
. | ||
EXECUTABLE | ||
EXCLUDE_FROM_ALL | ||
USE_FEWER_WARNINGS | ||
LINK_WITH_PRIVATE miniz lz4_static slang core compiler-core | ||
INCLUDE_DIRECTORIES_PUBLIC ${slang_SOURCE_DIR}/include . | ||
) | ||
# To generate binding code | ||
target_link_options(slang-wasm PUBLIC "--bind") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
if(SLANG_ENABLE_SLANGC) | ||
slang_add_target( | ||
. | ||
EXECUTABLE | ||
USE_FEWER_WARNINGS | ||
DEBUG_DIR ${slang_SOURCE_DIR} | ||
LINK_WITH_PRIVATE core slang Threads::Threads | ||
INSTALL | ||
) | ||
endif() |
Oops, something went wrong.