diff --git a/CMakeLists.txt b/CMakeLists.txt index a3a8eb95f919..10e04f7c0edb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -845,16 +845,14 @@ if (FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR) set(IMPORT_EXECUTABLES_DIR ${FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR}) endif() -if (WASM) - set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-Release.cmake) +if (FILAMENT_EXPORT_PREBUILT_EXECUTABLES OR FILAMENT_IMPORT_PREBUILT_EXECUTABLES) + set(IMPORT_EXECUTABLES_BUILD_TYPE Prebuilt) +elseif (WASM) + set(IMPORT_EXECUTABLES_BUILD_TYPE Release) else() - if (FILAMENT_EXPORT_PREBUILT_EXECUTABLES OR FILAMENT_IMPORT_PREBUILT_EXECUTABLES) - set(IMPORT_EXECUTABLES_BUILD_TYPE Prebuilt) - else() - set(IMPORT_EXECUTABLES_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - endif() - set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${IMPORT_EXECUTABLES_BUILD_TYPE}.cmake) + set(IMPORT_EXECUTABLES_BUILD_TYPE ${CMAKE_BUILD_TYPE}) endif() +set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${IMPORT_EXECUTABLES_BUILD_TYPE}.cmake) # ================================================================================================== # Common Functions diff --git a/build.sh b/build.sh index 39757e0696f9..7a72c77a29f7 100755 --- a/build.sh +++ b/build.sh @@ -81,8 +81,10 @@ function print_help { echo " Enable perfetto traces on Android. Disabled by default on the Release build, enabled otherwise." echo " -y build_type" echo " Build the filament dependent tools (matc, resgen) separately from the project. This will set" - echo " the tools as prebuilts that filament target will then use to build. The built_type option" - echo " (debug|release) is meant to indicate the type of build of the resulting prebuilts." + echo " the tools as prebuilts that filament target will then use to build. The build_type option" + echo " (debug|release|none) is meant to indicate the type of build of the resulting prebuilts," + echo " or 'none' to disable the split build." + echo " Defaults to 'release' (tools are always prebuilt as release unless overridden)." echo "" echo "Build types:" echo " release" @@ -223,8 +225,8 @@ OSMESA_OPTION="" IOS_BUILD_SIMULATOR=false BUILD_UNIVERSAL_LIBRARIES=false -ISSUE_SPLIT_BUILD=false -SPLIT_BUILD_TYPE="" +ISSUE_SPLIT_BUILD=true +SPLIT_BUILD_TYPE="release" PREBUILT_TOOLS_DIR="" IMPORT_EXECUTABLES_DIR_OPTION="-DIMPORT_EXECUTABLES_DIR=out" @@ -1085,14 +1087,17 @@ while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:Py:E" opt; do X) OSMESA_OPTION="-DFILAMENT_OSMESA_PATH=${OPTARG}" ;; y) - ISSUE_SPLIT_BUILD=true SPLIT_BUILD_TYPE=${OPTARG} case $(echo "${SPLIT_BUILD_TYPE}" | tr '[:upper:]' '[:lower:]') in debug|release) + ISSUE_SPLIT_BUILD=true + ;; + none) + ISSUE_SPLIT_BUILD=false ;; *) echo "Unknown build type for -y: ${SPLIT_BUILD_TYPE}" - echo "Build type must be one of [debug|release]" + echo "Build type must be one of [debug|release|none]" echo "" exit 1 ;; @@ -1132,13 +1137,6 @@ done validate_build_command -if [[ "${ISSUE_SPLIT_BUILD}" == "true" ]]; then - # Capitalize first letter of SPLIT_BUILD_TYPE - SPLIT_BUILD_TYPE_CAPITALIZED="$(echo ${SPLIT_BUILD_TYPE:0:1} | tr '[:lower:]' '[:upper:]')${SPLIT_BUILD_TYPE:1}" - build_tools_for_split_build "${SPLIT_BUILD_TYPE_CAPITALIZED}" - IMPORT_EXECUTABLES_DIR_OPTION="-DFILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR=${PREBUILT_TOOLS_DIR}" -fi - if [[ "${ISSUE_CLEAN}" == "true" ]]; then build_clean fi @@ -1147,6 +1145,16 @@ if [[ "${ISSUE_CLEAN_AGGRESSIVE}" == "true" ]]; then build_clean_aggressive fi +# Only runs the split build for tools if an actual debug or release build is requested. +# This prevents the split build from being triggered when a clean (-c or -C) is requested. +if [[ "${ISSUE_SPLIT_BUILD}" == "true" ]] && \ + [[ "${ISSUE_DEBUG_BUILD}" == "true" || "${ISSUE_RELEASE_BUILD}" == "true" ]]; then + # Capitalize first letter of SPLIT_BUILD_TYPE + SPLIT_BUILD_TYPE_CAPITALIZED="$(echo ${SPLIT_BUILD_TYPE:0:1} | tr '[:lower:]' '[:upper:]')${SPLIT_BUILD_TYPE:1}" + build_tools_for_split_build "${SPLIT_BUILD_TYPE_CAPITALIZED}" + IMPORT_EXECUTABLES_DIR_OPTION="-DFILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR=${PREBUILT_TOOLS_DIR}" +fi + if [[ "${ISSUE_DESKTOP_BUILD}" == "true" ]]; then check_debug_release_build build_desktop fi