diff --git a/CMakeLists.txt b/CMakeLists.txt index d6d2502c20e..5d3d226133a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,14 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) option(WITH_GUI "Setting this option will enable the Qt-based UI client." ON) +if(NOT WIN32) + option(WITH_VULKAN "Setting this option will enable Vulkan" ON) + + if(WITH_VULKAN) + add_definitions(-DVULKAN_ENABLED) + endif() +endif() + # This is only for designated initializers if(WIN32) set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ Standard" FORCE) @@ -127,9 +135,11 @@ else() find_package(libbase REQUIRED) find_package(liblog REQUIRED) find_package(libprocinfo REQUIRED) - find_package(volk REQUIRED) - find_package(VulkanHeaders REQUIRED) - find_package(vulkan-validationlayers REQUIRED) + if(WITH_VULKAN) + find_package(volk REQUIRED) + find_package(VulkanHeaders REQUIRED) + find_package(vulkan-validationlayers REQUIRED) + endif() endif() include("cmake/protobuf.cmake") @@ -173,13 +183,15 @@ else() add_subdirectory(src/OrbitClientGgp) add_subdirectory(src/OrbitCaptureGgpClient) add_subdirectory(src/OrbitCaptureGgpService) - add_subdirectory(src/OrbitTriggerCaptureVulkanLayer) - add_subdirectory(src/OrbitVulkanLayer) add_subdirectory(src/ProcessService) add_subdirectory(src/TracepointService) add_subdirectory(src/UserSpaceInstrumentation) - add_subdirectory(src/VulkanTutorial) add_subdirectory(third_party/libunwindstack) + if(WITH_VULKAN) + add_subdirectory(src/OrbitTriggerCaptureVulkanLayer) + add_subdirectory(src/OrbitVulkanLayer) + add_subdirectory(src/VulkanTutorial) + endif() endif() add_subdirectory(src/Api) diff --git a/src/LinuxTracingIntegrationTests/CMakeLists.txt b/src/LinuxTracingIntegrationTests/CMakeLists.txt index dc57415a3b5..db15515156c 100644 --- a/src/LinuxTracingIntegrationTests/CMakeLists.txt +++ b/src/LinuxTracingIntegrationTests/CMakeLists.txt @@ -35,7 +35,6 @@ target_link_libraries(IntegrationTestCommons PUBLIC ModuleUtils ObjectUtils OrbitBase - OffscreenRenderingVulkanTutorialLib GTest::gtest absl::base absl::time @@ -43,6 +42,10 @@ target_link_libraries(IntegrationTestCommons PUBLIC absl::strings absl::synchronization) +if(WITH_VULKAN) + target_link_libraries(IntegrationTestCommons PUBLIC OffscreenRenderingVulkanTutorialLib) +endif() + add_executable(LinuxTracingIntegrationTests) diff --git a/src/LinuxTracingIntegrationTests/IntegrationTestPuppet.cpp b/src/LinuxTracingIntegrationTests/IntegrationTestPuppet.cpp index c72fd993a7f..51e27d7eee1 100644 --- a/src/LinuxTracingIntegrationTests/IntegrationTestPuppet.cpp +++ b/src/LinuxTracingIntegrationTests/IntegrationTestPuppet.cpp @@ -19,7 +19,9 @@ #include "OrbitBase/ExecutablePath.h" #include "OrbitBase/Logging.h" #include "OrbitBase/ThreadUtils.h" -#include "VulkanTutorial/OffscreenRenderingVulkanTutorial.h" +#ifdef VULKAN_ENABLED + #include "VulkanTutorial/OffscreenRenderingVulkanTutorial.h" +#endif // This executable is used by LinuxTracingIntegrationTest to test the generation of specific // perf_event_open events. The behavior is controlled by commands sent on standard input. @@ -104,10 +106,12 @@ static void LoadSoWithDlopenAndCallFunction() { ORBIT_LOG("Function call completed: %f", function()); } +#ifdef VULKAN_ENABLED static void RunVulkanTutorial() { orbit_vulkan_tutorial::OffscreenRenderingVulkanTutorial tutorial; tutorial.Run(PuppetConstants::kFrameCount); } +#endif extern "C" __attribute__((noinline)) void UseOrbitApi() { for (uint64_t i = 0; i < PuppetConstants::kOrbitApiUsageCount; ++i) { @@ -194,7 +198,11 @@ int IntegrationTestPuppetMain() { } else if (command == PuppetConstants::kDlopenCommand) { LoadSoWithDlopenAndCallFunction(); } else if (command == PuppetConstants::kVulkanTutorialCommand) { +#ifdef VULKAN_ENABLED RunVulkanTutorial(); +#else + ORBIT_ERROR("Vulkan isn't enabled"); +#endif } else if (command == PuppetConstants::kOrbitApiCommand) { UseOrbitApi(); } else if (command == PuppetConstants::kIncreaseRssCommand) {