diff options
| author | venkataram-nv <vedavamadath@nvidia.com> | 2024-06-27 11:04:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-27 11:04:26 -0700 |
| commit | b1f564b0974303e330ca3370651696191d40aa51 (patch) | |
| tree | a964ea2825c62a63edd2c9815ee2ad5e4ac078be | |
| parent | 5dd8f29443508bd8663a92c62d33e69cc47b61af (diff) | |
Include examples in default build (#4482)
* Include examples in default build
* Omit building examples on unnecessary CI workflows
| -rw-r--r-- | .github/workflows/ci.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/compile-regression-test.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/falcor-compiler-perf-test.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/falcor-test.yml | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | premake5.lua | 67 |
6 files changed, 43 insertions, 34 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a64d3972..d6fa7673f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,7 @@ jobs: cmake --preset default --fresh \ -DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \ -DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-slang-llvm.zip \ + -DSLANG_ENABLE_EXAMPLES=OFF \ -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}} cmake --workflow --preset "${{matrix.config}}" else @@ -104,6 +105,7 @@ jobs: # cache in the setup phase cmake --preset default --fresh \ -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \ + -DSLANG_ENABLE_EXAMPLES=OFF \ -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}} cmake --workflow --preset "${{matrix.config}}" fi diff --git a/.github/workflows/compile-regression-test.yml b/.github/workflows/compile-regression-test.yml index ff5598560..962b2cf54 100644 --- a/.github/workflows/compile-regression-test.yml +++ b/.github/workflows/compile-regression-test.yml @@ -34,7 +34,7 @@ jobs: uses: microsoft/setup-msbuild@v1 - name: build run: | - .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true + .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true --enable-examples=false .\make-slang-tag-version.bat diff --git a/.github/workflows/falcor-compiler-perf-test.yml b/.github/workflows/falcor-compiler-perf-test.yml index cfd1837bd..6a5a91929 100644 --- a/.github/workflows/falcor-compiler-perf-test.yml +++ b/.github/workflows/falcor-compiler-perf-test.yml @@ -34,7 +34,7 @@ jobs: uses: microsoft/setup-msbuild@v1 - name: build run: | - .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true + .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true --enable-examples=false .\make-slang-tag-version.bat diff --git a/.github/workflows/falcor-test.yml b/.github/workflows/falcor-test.yml index dd1c6fe57..60506f062 100644 --- a/.github/workflows/falcor-test.yml +++ b/.github/workflows/falcor-test.yml @@ -45,7 +45,7 @@ jobs: cd ..\ - name: build run: | - .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true + .\premake.bat vs2019 --arch=${{matrix.platform}} --deps=true --no-progress=true --enable-cuda=true --enable-examples=false .\make-slang-tag-version.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index d08147403..526b65aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -689,7 +689,6 @@ if (SLANG_ENABLE_EXAMPLES AND SLANG_ENABLE_GFX) slang_add_target( examples/example-base STATIC - EXCLUDE_FROM_ALL LINK_WITH_PRIVATE core slang @@ -713,7 +712,6 @@ if (SLANG_ENABLE_EXAMPLES AND SLANG_ENABLE_GFX) slang_add_target( ${dir} EXECUTABLE - EXCLUDE_FROM_ALL USE_FEWER_WARNINGS LINK_WITH_PRIVATE core diff --git a/premake5.lua b/premake5.lua index f06c2c81c..48c7ee01b 100644 --- a/premake5.lua +++ b/premake5.lua @@ -166,6 +166,14 @@ newoption { } newoption { + trigger = "enable-examples", + description = "(Optional) If true build the examples for slang.", + value = "bool", + default = "true", + allowed = { { "true", "True"}, { "false", "False" } } +} + +newoption { trigger = "disable-stdlib-source", description = "(Optional) If true stdlib source will not be included in binary.", value = "bool", @@ -254,6 +262,7 @@ enableOptix = not not (_OPTIONS["enable-optix"] == "true" or optixPath) enableProfile = (_OPTIONS["enable-profile"] == "true") enableEmbedStdLib = (_OPTIONS["enable-embed-stdlib"] == "true") enableXlib = (_OPTIONS["enable-xlib"] == "true") +enableExamples = (_OPTIONS["enable-examples"] == "true") skipSourceGeneration = (_OPTIONS["skip-source-generation"] == "true") deployLLVM = (_OPTIONS["deploy-slang-llvm"] == "true") deployGLSLang = (_OPTIONS["deploy-slang-glslang"] == "true") @@ -847,46 +856,46 @@ function generatorProject(name, sourcePath, projectKind) end end --- --- With all of these helper routines defined, we can now define the --- actual projects quite simply. For example, here is the entire --- declaration of the "Hello, World" example project: --- -example "hello-world" - kind "ConsoleApp" - includedirs {"external/vulkan/include"} +-- Enable examples conditionally +if enableExamples then + -- With all of these helper routines defined, we can now define the + -- actual projects quite simply. For example, here is the entire + -- declaration of the "Hello, World" example project: + example "hello-world" + kind "ConsoleApp" + includedirs {"external/vulkan/include"} --- Note how we are calling our custom `example()` subroutine with --- the same syntax sugar that Premake usually advocates for their --- `project()` function. This allows us to treat `example` as --- a kind of specialized "subclass" of `project` --- + -- Note how we are calling our custom `example()` subroutine with + -- the same syntax sugar that Premake usually advocates for their + -- `project()` function. This allows us to treat `example` as + -- a kind of specialized "subclass" of `project` --- Let's go ahead and set up the projects for our other example now. -example "platform-test" + -- Let's go ahead and set up the projects for our other example now. + example "platform-test" -example "triangle" + example "triangle" -example "ray-tracing" -example "ray-tracing-pipeline" + example "ray-tracing" + example "ray-tracing-pipeline" -example "autodiff-texture" + example "autodiff-texture" -example "gpu-printing" - kind "ConsoleApp" + example "gpu-printing" + kind "ConsoleApp" -example "shader-toy" + example "shader-toy" -example "model-viewer" + example "model-viewer" -example "shader-object" - kind "ConsoleApp" + example "shader-object" + kind "ConsoleApp" -example "cpu-com-example" - kind "ConsoleApp" + example "cpu-com-example" + kind "ConsoleApp" -example "cpu-hello-world" - kind "ConsoleApp" + example "cpu-hello-world" + kind "ConsoleApp" +end if enableAftermath then example "nv-aftermath-example" |
