From c71711ec365de5a228f5703d22a399be55b63991 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Thu, 4 Jul 2019 22:30:26 +0300 Subject: [PATCH] Disabled real-time visualization by default. SDL2 is no longer a dependency when building with the default flags. --- CMakeLists.txt | 16 ++++++++++------ src/standalone/renderer.cc | 10 ++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf47f5d..c320a79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(DOUBLE_PRECISION "Generates double precision code" OFF) option(TIARA_CLUSTER "Special settings for compilation TIARA GPU cluster" OFF) option(MULTIGPU_ENABLED "If enabled, uses all the available GPUs" ON) option(ALTER_CONF "If enabled, loads astaroth.conf from the build directory" OFF) +option(BUILD_RT_VISUALIZATION "Builds the module for real-time visualization using SDL2" OFF) #-------------------Determine build type--------------------------------------# @@ -56,12 +57,15 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") endif() endif() -# SDL 2 -set(SDL2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/SDL2/include/) -set(SDL2_LIBRARY_DIR ${CMAKE_SOURCE_DIR}/3rdparty/SDL2/build/) -set(SDL2_LIBRARY "SDL2") -include_directories(${SDL2_INCLUDE_DIR}) -link_directories(${SDL2_LIBRARY_DIR}) +if (BUILD_RT_VISUALIZATION) + add_definitions(-DAC_BUILD_RT_VISUALIZATION=1) + # SDL 2 + set(SDL2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/SDL2/include/) + set(SDL2_LIBRARY_DIR ${CMAKE_SOURCE_DIR}/3rdparty/SDL2/build/) + set(SDL2_LIBRARY "SDL2") + include_directories(${SDL2_INCLUDE_DIR}) + link_directories(${SDL2_LIBRARY_DIR}) +endif() # CUDA find_package(CUDA) diff --git a/src/standalone/renderer.cc b/src/standalone/renderer.cc index 9024627..4497001 100644 --- a/src/standalone/renderer.cc +++ b/src/standalone/renderer.cc @@ -26,6 +26,7 @@ */ #include "run.h" +#if AC_BUILD_RT_VISUALIZATION #include // Note: using local version in src/3rdparty dir #include // ceil #include // memcpy @@ -421,3 +422,12 @@ run_renderer(void) return 0; } +#else // BUILD_RT_VISUALIZATION == 0 +#include "core/errchk.h" +int +run_renderer(void) +{ + WARNING("Real-time visualization module not built. Set BUILD_RT_VISUALIZATION=ON with cmake."); + return 1; +} +#endif // BUILD_RT_VISUALIZATION