From 50828dde933d6c17b934a121bcf1d2d8b3f9c067 Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Wed, 17 Jun 2020 19:10:33 -0400 Subject: [PATCH] fetchDependencies supports iOS simulator fat external library builds. fetchDependencies supports options for specifying which platform options to build for. Fix SPIRV-Tools builds to avoid code stripping warnings. --- .../project.pbxproj | 4 - README.md | 14 ++- fetchDependencies | 93 +++++++++++++++++-- 3 files changed, 97 insertions(+), 14 deletions(-) diff --git a/ExternalDependencies.xcodeproj/project.pbxproj b/ExternalDependencies.xcodeproj/project.pbxproj index 7ce5a91b..6e8b4a89 100644 --- a/ExternalDependencies.xcodeproj/project.pbxproj +++ b/ExternalDependencies.xcodeproj/project.pbxproj @@ -3833,7 +3833,6 @@ A972A80D21CECBBF0013AB25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEPLOYMENT_POSTPROCESSING = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -3850,7 +3849,6 @@ A972A80E21CECBBF0013AB25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DEPLOYMENT_POSTPROCESSING = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -3867,7 +3865,6 @@ A972A82121CECBE90013AB25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEPLOYMENT_POSTPROCESSING = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -3884,7 +3881,6 @@ A972A82221CECBE90013AB25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DEPLOYMENT_POSTPROCESSING = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", diff --git a/README.md b/README.md index a8f4e844..30c1f4a2 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,19 @@ on which **MoltenVK** relies: 3. Retrieve and build the external libraries: cd MoltenVK - ./fetchDependencies + ./fetchDependencies [platform...] + +When running the `fetchDependencies` script, you must specify one or more platforms +for which to build the external libraries. The platform choices include: + + --ios --ios-fat --macos --all + +You can specify multiple of these selections. The `--ios-fat` selection builds one binary for +each external library, with each binary including code for both *iOS* and *iOS Simulator* platforms. +The `--all` selection is the same as selecting `--ios-fat --macos` and results in two binaries +for each external library: a *fat iOS* binary, and a *macOS* binary. The more selections you include, +the longer the build time. + For more information about the external open-source libraries used by **MoltenVK**, see the [`ExternalRevisions/README.md`](ExternalRevisions/README.md) document. diff --git a/fetchDependencies b/fetchDependencies index cd4f3a84..976dddcb 100755 --- a/fetchDependencies +++ b/fetchDependencies @@ -4,9 +4,27 @@ # # fetchDependencies - Retrieves the correct versions of all dependencies # -# macOS usage: ./fetchDependencies [-v] [--debug] [--build-spirv-tools] +# macOS usage: ./fetchDependencies [--ios] [--ios-fat] [--macos] [--all] +# [-v] [--debug] [--build-spirv-tools] # [--v-headers-root path] [--spirv-cross-root path] [--glslang-root path] # +# --ios +# Build the external libraries for the iOS platform. +# +# --ios-fat +# Build a single binary for each external library, each containing code +# for both iOS and iOS Simulator platforms. +# +# --macos +# Build the external libraries for the macOS platform. +# +# --all +# Equivalent to specifying [--ios-fat --macos]. Results in two binaries for +# each external library: one for the iOS and iOS Simulator platforms, and +# another for the macOS platform. +# +# Multiple platform options may be specified. +# # --debug # Build the external libraries in Debug mode, which may be useful when debugging # and tracing calls into those libraries. @@ -41,7 +59,11 @@ set -e # ----------------- Functions ------------------- -XC_SCHEME_SFX="" +BLD_IOS="" +BLD_IOS_SIM="" +BLD_MACOS="" +BLD_SPECIFIED="" +XC_CONFIG="Release" XC_BUILD_VERBOSITY="-quiet" V_HEADERS_ROOT="" SPIRV_CROSS_ROOT="" @@ -50,8 +72,31 @@ BLD_SPV_TLS="" while (( "$#" )); do case "$1" in + --ios) + BLD_IOS="Y" + BLD_SPECIFIED="Y" + shift 1 + ;; + --ios-fat) + BLD_IOS="Y" + BLD_IOS_SIM="Y" + BLD_SPECIFIED="Y" + shift 1 + ;; + --macos) + BLD_MACOS="Y" + BLD_SPECIFIED="Y" + shift 1 + ;; + --all) + BLD_IOS="Y" + BLD_IOS_SIM="Y" + BLD_MACOS="Y" + BLD_SPECIFIED="Y" + shift 1 + ;; --debug) - XC_SCHEME_SFX=" (Debug)" + XC_CONFIG="Debug" shift 1 ;; -v) @@ -85,6 +130,13 @@ while (( "$#" )); do esac done +# if no platform was specified, print usage message and exit +if [ "$BLD_SPECIFIED" = "" ]; then + echo ERROR: You did not specify a platform to build. + echo Include one or more of the following platform options: --ios --ios-fat --macos --all + exit 1 +fi + # Update a repository. If it exists, fetch it; if not, clone it. # $1 repo name # $2 repo url @@ -286,17 +338,40 @@ echo echo ========== Building dependency libraries quietly. Please be patient on first build. ========== echo +# Build an Xcode scheme +function build() { + echo Building external libraries for ${XC_PLTFM} + xcodebuild \ + -project "${XC_PROJ}" \ + -scheme "${XC_SCHEME}" \ + -destination "generic/platform=${XC_PLTFM}" \ + -configuration "${XC_CONFIG}" \ + -derivedDataPath "${XC_DD_PATH}" \ + ${XC_BUILD_VERBOSITY} \ + build +} + EXT_DEPS=ExternalDependencies XC_PROJ="${EXT_DEPS}.xcodeproj" -XC_SCHEME="${EXT_DEPS}${XC_SCHEME_SFX}" XC_DD_PATH="${EXT_DIR}/build" -xcodebuild \ - -project "${XC_PROJ}" \ - -scheme "${XC_SCHEME}" \ - -derivedDataPath "${XC_DD_PATH}" \ - ${XC_BUILD_VERBOSITY} \ +if [ "$BLD_IOS" != "" ]; then + XC_SCHEME="${EXT_DEPS}-iOS" + XC_PLTFM="iOS" build +fi + +if [ "$BLD_IOS_SIM" != "" ]; then + XC_SCHEME="${EXT_DEPS}-iOS" + XC_PLTFM="iOS Simulator" + build +fi + +if [ "$BLD_MACOS" != "" ]; then + XC_SCHEME="${EXT_DEPS}-macOS" + XC_PLTFM="macOS" + build +fi echo ========== Done! ==========