diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ba3410075..60a8618f46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,9 @@ option(NBL_BUILD_BULLET "Enable Bullet Physics building and integration?" OFF) option(NBL_BUILD_DOCS "Enable building documentation?" OFF) # No one has doxygen installed, plus we dont know when was the last time we generated working doxy and we'll use SphinX in the future option(NBL_ENABLE_PROJECT_JSON_CONFIG_VALIDATION "" ON) option(NBL_EMBED_BUILTIN_RESOURCES "Embed built-in resources?" OFF) +set(NBL_NSC_MODE "PACKAGE" CACHE STRING "How to provide the nsc build tool. Valid values: SOURCE and PACKAGE") +set_property(CACHE NBL_NSC_MODE PROPERTY STRINGS SOURCE PACKAGE) +option(NBL_NSC_USE_PACKAGE_BUILTINS "When NBL_NSC_MODE=PACKAGE, use builtin resources embedded in the packaged nsc instead of host checkout builtins." OFF) option(NBL_ENABLE_DOCKER_INTEGRATION "Enables docker integration, if client is not found Docker Desktop will be installed" OFF) option(NBL_ENABLE_CONFIG_INSTALL "Install Relocatable NablaConfig.cmake and NablaConfigVersion.cmake scripts" ON) diff --git a/cmake/FindZLIB.cmake b/cmake/FindZLIB.cmake index f855c396b9..73c79e628a 100644 --- a/cmake/FindZLIB.cmake +++ b/cmake/FindZLIB.cmake @@ -4,4 +4,5 @@ endif() set(ZLIB_FOUND TRUE) set(ZLIB_LIBRARY ZLIB::ZLIB) -set(ZLIB_INCLUDE_DIR "${THIRD_PARTY_SOURCE_DIR}/zlib;${THIRD_PARTY_BINARY_DIR}/zlib") \ No newline at end of file +set(ZLIB_INCLUDE_DIR "${THIRD_PARTY_SOURCE_DIR}/zlib;${THIRD_PARTY_BINARY_DIR}/zlib") +set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") diff --git a/cmake/common.cmake b/cmake/common.cmake index c50e1f6fb2..234698fc3d 100755 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -1254,7 +1254,16 @@ struct DeviceConfigCaps list(APPEND REQUIRED_OPTIONS $<$:-fspv-debug=vulkan-with-source>) endif() - if(NOT NBL_EMBED_BUILTIN_RESOURCES) + set(_NBL_NSC_USE_HOST_BUILTINS FALSE) + if(NBL_NSC_MODE STREQUAL "PACKAGE") + if(NOT NBL_NSC_USE_PACKAGE_BUILTINS) + set(_NBL_NSC_USE_HOST_BUILTINS TRUE) + endif() + elseif(NOT NBL_EMBED_BUILTIN_RESOURCES) + set(_NBL_NSC_USE_HOST_BUILTINS TRUE) + endif() + + if(_NBL_NSC_USE_HOST_BUILTINS) list(APPEND REQUIRED_OPTIONS -no-nbl-builtins -isystem "${NBL_ROOT_PATH}/include" @@ -1263,6 +1272,7 @@ struct DeviceConfigCaps -isystem "${NBL_ROOT_PATH_BINARY}/src/nbl/device/include" ) endif() + unset(_NBL_NSC_USE_HOST_BUILTINS) set(REQUIRED_SINGLE_ARGS TARGET BINARY_DIR OUTPUT_VAR INPUTS INCLUDE NAMESPACE MOUNT_POINT_DEFINE) set(OPTIONAL_SINGLE_ARGS GLOB_DIR) diff --git a/tools/nsc/CMakeLists.txt b/tools/nsc/CMakeLists.txt index 36da743982..e8549eb281 100644 --- a/tools/nsc/CMakeLists.txt +++ b/tools/nsc/CMakeLists.txt @@ -14,6 +14,10 @@ if(NOT NBL_NSC_MODE MATCHES "^(SOURCE|PACKAGE)$") message(FATAL_ERROR "Invalid NBL_NSC_MODE=\"${NBL_NSC_MODE}\". Valid values are SOURCE and PACKAGE.") endif() +if(NBL_NSC_USE_PACKAGE_BUILTINS AND NOT NBL_NSC_MODE STREQUAL "PACKAGE") + message(FATAL_ERROR "NBL_NSC_USE_PACKAGE_BUILTINS=ON requires NBL_NSC_MODE=PACKAGE.") +endif() + if(NBL_ENABLE_CONFIG_INSTALL) configure_file( "${NBL_ROOT_PATH}/cmake/NablaNSCHelpers.cmake"