Commit 5837d877 by Ben Clayton

CMakeLists: Only expose options if they're not set as vars

This allows outer projects to force-set these build options without exposing them in CMakeCache.txt Bug: b/148010928 Change-Id: Ib7d3965c04cf9822566ed569af9832db30f133b1 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40329 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 8fff8c3b
......@@ -88,28 +88,34 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo)
option(SWIFTSHADER_BUILD_EGL "Build the EGL library" 1)
option(SWIFTSHADER_BUILD_GLESv2 "Build the OpenGL ES 2 library" 1)
option(SWIFTSHADER_BUILD_GLES_CM "Build the OpenGL ES 1.1 library" 1)
option(SWIFTSHADER_BUILD_VULKAN "Build the Vulkan library" 1)
option(SWIFTSHADER_BUILD_PVR "Fetch and build the PowerVR examples" 0)
option(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" 1)
option(SWIFTSHADER_BUILD_SAMPLES "Build sample programs" 1)
option(SWIFTSHADER_BUILD_TESTS "Build test programs" 1)
option(SWIFTSHADER_MSAN "Build with memory sanitizer" 0)
option(SWIFTSHADER_ASAN "Build with address sanitizer" 0)
option(SWIFTSHADER_TSAN "Build with thread sanitizer" 0)
option(SWIFTSHADER_UBSAN "Build with undefined behavior sanitizer" 0)
option(SWIFTSHADER_WARNINGS_AS_ERRORS "Treat all warnings as errors" 1)
option(SWIFTSHADER_DCHECK_ALWAYS_ON "Check validation macros even in release builds" 0)
option(REACTOR_EMIT_DEBUG_INFO "Emit debug info for JIT functions" 0)
option(REACTOR_EMIT_PRINT_LOCATION "Emit printing of location info for JIT functions" 0)
option(REACTOR_VERIFY_LLVM_IR "Check reactor-generated LLVM IR is valid even in release builds" 0)
option(SWIFTSHADER_LESS_DEBUG_INFO "Generate less debug info to reduce file size" 0)
option(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER "Enable vulkan debugger support" 0)
function (option_if_not_defined name description default)
if(NOT DEFINED ${name})
option(${name} ${description} ${default})
endif()
endfunction()
option_if_not_defined(SWIFTSHADER_BUILD_EGL "Build the EGL library" 1)
option_if_not_defined(SWIFTSHADER_BUILD_GLESv2 "Build the OpenGL ES 2 library" 1)
option_if_not_defined(SWIFTSHADER_BUILD_GLES_CM "Build the OpenGL ES 1.1 library" 1)
option_if_not_defined(SWIFTSHADER_BUILD_VULKAN "Build the Vulkan library" 1)
option_if_not_defined(SWIFTSHADER_BUILD_PVR "Fetch and build the PowerVR examples" 0)
option_if_not_defined(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" 1)
option_if_not_defined(SWIFTSHADER_BUILD_SAMPLES "Build sample programs" 1)
option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build test programs" 1)
option_if_not_defined(SWIFTSHADER_MSAN "Build with memory sanitizer" 0)
option_if_not_defined(SWIFTSHADER_ASAN "Build with address sanitizer" 0)
option_if_not_defined(SWIFTSHADER_TSAN "Build with thread sanitizer" 0)
option_if_not_defined(SWIFTSHADER_UBSAN "Build with undefined behavior sanitizer" 0)
option_if_not_defined(SWIFTSHADER_WARNINGS_AS_ERRORS "Treat all warnings as errors" 1)
option_if_not_defined(SWIFTSHADER_DCHECK_ALWAYS_ON "Check validation macros even in release builds" 0)
option_if_not_defined(REACTOR_EMIT_DEBUG_INFO "Emit debug info for JIT functions" 0)
option_if_not_defined(REACTOR_EMIT_PRINT_LOCATION "Emit printing of location info for JIT functions" 0)
option_if_not_defined(REACTOR_VERIFY_LLVM_IR "Check reactor-generated LLVM IR is valid even in release builds" 0)
option_if_not_defined(SWIFTSHADER_LESS_DEBUG_INFO "Generate less debug info to reduce file size" 0)
option_if_not_defined(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER "Enable vulkan debugger support" 0)
set(BUILD_MARL ${SWIFTSHADER_BUILD_VULKAN})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment