Fix CMake OS dependent default options.

The defaults were setting local variables, while the "option" command
uses the values from the CMake cache. This made the CI not build the
D3D12 or Metal backend on their platforms.
This commit is contained in:
Corentin Wallez 2017-07-14 09:53:59 -04:00 committed by Corentin Wallez
parent bcee1e5981
commit 28684d93ed
1 changed files with 6 additions and 4 deletions

View File

@ -22,14 +22,16 @@ project(nxt C CXX)
option(NXT_USE_WERROR "Treat warnings as error (useful for CI)" 0)
# Default values for the backend-enabling options
set(ENABLE_D3D12 OFF)
set(ENABLE_METAL OFF)
if (WIN32)
set(NXT_ENABLE_D3D12 ON)
set(ENABLE_D3D12 ON)
elseif(APPLE)
set(NXT_ENABLE_METAL ON)
set(ENABLE_METAL ON)
endif()
option(NXT_ENABLE_D3D12 "Enable compilation of the D3D12 backend" OFF)
option(NXT_ENABLE_METAL "Enable compilation of the Metal backend" OFF)
option(NXT_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
option(NXT_ENABLE_METAL "Enable compilation of the Metal backend" ${ENABLE_METAL})
option(NXT_ENABLE_NULL "Enable compilation of the Null backend" ON)
option(NXT_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ON)
option(NXT_ENABLE_VULKAN "Enable compilation of the Vulkan backend" OFF)