From b75c613be583e4ee71fb7384d63ddf9fc6240819 Mon Sep 17 00:00:00 2001 From: bradgrantham-lunarg <50641407+bradgrantham-lunarg@users.noreply.github.com> Date: Mon, 27 Jan 2025 21:44:08 -0800 Subject: [PATCH] Use CMake variables to enable/disable test apps (#1987) * use CMake GFXRECON_INCLUDE_TEST_APPS instead of GFXRECON_NO_TEST_APPS * Don't use environment variable GFXRECON_NO_TEST_APPS at the level of tests/ * Instead use CMake variable GFXRECON_INCLUDE_TEST_APPS, default ON To turn off test apps, provide "-DGFXRECON_INCLUDE_TEST_APPS=OFF" to CMake. * document change of variable and meaning for test app build --- CMakeLists.txt | 5 +++++ TESTING_test_apps.md | 2 +- test/CMakeLists.txt | 6 ++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec238a14bf..2545b37607 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,8 @@ endif() option(GFXRECON_TOCPP_SUPPORT "Build ToCpp export tool as part of GFXReconstruct builds." TRUE) +option(GFXRECON_INCLUDE_TEST_APPS "Build and install test apps" ON) + if(MSVC) # The host toolchain architecture (i.e. are the compiler and other tools compiled to ARM/Intel 32bit/64bit binaries): @@ -380,7 +382,10 @@ if(NOT BUILD_STATIC) add_subdirectory(layer) endif() add_subdirectory(tools) + +if(GFXRECON_INCLUDE_TEST_APPS) add_subdirectory(test) +endif() if (${RUN_TESTS}) add_test_package_file(${CMAKE_CURRENT_LIST_DIR}/scripts/build.py) diff --git a/TESTING_test_apps.md b/TESTING_test_apps.md index 09a6281146..d37ac4141e 100644 --- a/TESTING_test_apps.md +++ b/TESTING_test_apps.md @@ -35,4 +35,4 @@ Use of the *TestAppBase* is optional. ## **Building Test Apps** Test apps are built as part of the default build CMAKE build process. In order to stop test apps from building, set the -**GFXRECON_NO_TEST_APPS** environment variable at CMAKE build time. \ No newline at end of file +**GFXRECON_INCLUDE_TEST_APPS** CMake variable to OFF, e.g. provide `-DGFXRECON_INCLUDE_TEST_APPS=OFF` in your cmake command line. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 02ae97f68e..3be14c0445 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,8 +25,6 @@ ############################################################################### -if (NOT DEFINED ENV{GFXRECON_NO_TEST_APPS}) - add_subdirectory(test_apps) -endif () +add_subdirectory(test_apps) -# TODO: runner goes here \ No newline at end of file +# TODO: runner goes here