diff --git a/.travis.yml b/.travis.yml index 4a0318a3..c801c34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,12 @@ osx_image: xcode9.2 # Build dependencies install: - brew install python3 - - ( cd External && ./fetchDependencies ) + - ./fetchDependencies # Cache built deps -#cache: -# directories: -# - External +cache: + directories: + - External script: - xcodebuild -scheme "MoltenVK (Debug)" diff --git a/External/README.md b/ExternalRevisions/README.md similarity index 97% rename from External/README.md rename to ExternalRevisions/README.md index fcd48910..5ff3db30 100644 --- a/External/README.md +++ b/ExternalRevisions/README.md @@ -39,10 +39,9 @@ Fetching External Libraries - [*cereal*](https://github.com/USCiLab/cereal) These external open-source libraries are maintained in the `External` directory. -To retrieve these libraries from their sources, run the `fetchDependencies` -script in that directory: +To retrieve these libraries from their sources, run the `fetchDependencies` script +in the main repository directory: - cd External ./fetchDependencies [-sdk] The `-sdk` option tells the script that **MoltenVK** is being installed as part of @@ -62,13 +61,13 @@ versions of each external library. The version of each external library is determined as follows: - **_SPIRV-Cross_**: a GitHub repository commit identifier found in the - `External/SPIRV-Cross_repo_revision` file. + `ExternalRevisions/SPIRV-Cross_repo_revision` file. - **_VulkanSamples_**: a GitHub repository commit identifier found in the - `External/VulkanSamples_repo_revision` file. + `ExternalRevisions/VulkanSamples_repo_revision` file. - **_Vulkan-LoaderAndValidationLayers_**: a GitHub repository commit identifier found - in the `External/Vulkan-LoaderAndValidationLayers_repo_revision` file. + in the `ExternalRevisions/Vulkan-LoaderAndValidationLayers_repo_revision` file. - **_glslang_**: a GitHub repository commit identifier found in the retrieved *Vulkan-LoaderAndValidationLayers* repository. @@ -78,7 +77,7 @@ determined as follows: - **_SPIRV-Headers_**: automatically retrieved by the *glslang* repository. - **_cereal_**: a GitHub repository commit identifier found in the - `External/cereal_repo_revision` file. + `ExternalRevisions/cereal_repo_revision` file. You can update which versions of the *SPIRV-Cross*, *VulkanSamples*, *Vulkan-LoaderAndValidationLayers*, or *cereal* libraries are retrieved, diff --git a/External/SPIRV-Cross_repo_revision b/ExternalRevisions/SPIRV-Cross_repo_revision similarity index 100% rename from External/SPIRV-Cross_repo_revision rename to ExternalRevisions/SPIRV-Cross_repo_revision diff --git a/External/Vulkan-LoaderAndValidationLayers_repo_revision b/ExternalRevisions/Vulkan-LoaderAndValidationLayers_repo_revision similarity index 100% rename from External/Vulkan-LoaderAndValidationLayers_repo_revision rename to ExternalRevisions/Vulkan-LoaderAndValidationLayers_repo_revision diff --git a/External/VulkanSamples_repo_revision b/ExternalRevisions/VulkanSamples_repo_revision similarity index 100% rename from External/VulkanSamples_repo_revision rename to ExternalRevisions/VulkanSamples_repo_revision diff --git a/External/cereal_repo_revision b/ExternalRevisions/cereal_repo_revision similarity index 100% rename from External/cereal_repo_revision rename to ExternalRevisions/cereal_repo_revision diff --git a/MoltenVKPackaging.xcodeproj/project.pbxproj b/MoltenVKPackaging.xcodeproj/project.pbxproj index 74e762bc..fe950eb4 100644 --- a/MoltenVKPackaging.xcodeproj/project.pbxproj +++ b/MoltenVKPackaging.xcodeproj/project.pbxproj @@ -137,7 +137,7 @@ A92DB3E61CE0F37D00FBC835 /* Whats_New.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = Whats_New.md; path = Docs/Whats_New.md; sourceTree = ""; }; A92DB3EE1CE0F72500FBC835 /* MoltenVK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MoltenVK.xcodeproj; path = MoltenVK/MoltenVK.xcodeproj; sourceTree = ""; }; A92DB40E1CE0F89600FBC835 /* MoltenVKShaderConverter.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MoltenVKShaderConverter.xcodeproj; path = MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj; sourceTree = ""; }; - A943100220546CDD00F5CF87 /* fetchDependencies */ = {isa = PBXFileReference; lastKnownFileType = text; path = fetchDependencies; sourceTree = ""; }; + A943100220546CDD00F5CF87 /* fetchDependencies */ = {isa = PBXFileReference; lastKnownFileType = text; name = fetchDependencies; path = ../fetchDependencies; sourceTree = ""; }; A98149E51FB78829005F00B4 /* MoltenVK_Runtime_UserGuide.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = MoltenVK_Runtime_UserGuide.md; path = Docs/MoltenVK_Runtime_UserGuide.md; sourceTree = ""; }; A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = VulkanSamples_repo_revision; sourceTree = ""; }; A9AD67D22054E2D700ED3C08 /* Vulkan-LoaderAndValidationLayers_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Vulkan-LoaderAndValidationLayers_repo_revision"; sourceTree = ""; }; @@ -187,7 +187,8 @@ A9AD67D22054E2D700ED3C08 /* Vulkan-LoaderAndValidationLayers_repo_revision */, A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */, ); - path = External; + name = External; + path = ExternalRevisions; sourceTree = ""; }; A98149741FB6B565005F00B4 /* Products */ = { diff --git a/README.md b/README.md index 6d9a75ab..62065cd2 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Installing **MoltenVK** ----------------------- To install **MoltenVK**, clone this `MoltenVK` repository, and then run the -`External/fetchDependencies` script to retrieve and build several external +`fetchDependencies` script to retrieve and build several external open-source libraries on which **MoltenVK** relies: 1. Ensure you have `cmake` and `python3` installed: @@ -81,11 +81,11 @@ open-source libraries on which **MoltenVK** relies: 3. Retrieve and build the external libraries: - cd MoltenVK/External + cd MoltenVK ./fetchDependencies For more information about the external open-source libraries used by **MoltenVK**, -see the [`External/README.md`](External/README.md) document. +see the [`ExternalRevisions/README.md`](ExternalRevisions/README.md) document. diff --git a/External/fetchDependencies b/fetchDependencies similarity index 67% rename from External/fetchDependencies rename to fetchDependencies index 2e6d07aa..5a9122a7 100755 --- a/External/fetchDependencies +++ b/fetchDependencies @@ -12,19 +12,26 @@ # ----------------- Functions ------------------- -# Clone a repository +# Update a repository. If it exists, fetch it, if not clone it. # $1 repo name # $2 repo url # $3 repo revision (commit SHA) -clone_repo() { +update_repo() { echo "$1 repo: $2" echo "$1 revision: $3" - rm -rf $1 - git clone $2 $1 - cd $1 - git checkout $3 - cd - + if [ -d $1 -a -d $1/.git ]; then + cd $1 + git fetch --all + git checkout --force $3 + cd - + else + rm -rf $1 + git clone $2 $1 + cd $1 + git checkout $3 + cd - + fi } # Build a repository @@ -32,8 +39,7 @@ clone_repo() { build_repo() { echo "Building $1" - rm -rf $1/build - mkdir $1/build + mkdir -p $1/build cd $1/build cmake .. make @@ -41,39 +47,46 @@ build_repo() { } -echo -echo Retrieving MoltenVK dependencies. -echo +# ----------------- Main ------------------- +EXT_DIR=External +EXT_REV_DIR=ExternalRevisions V_LVL_NAME=Vulkan-LoaderAndValidationLayers GLSLANG_NAME=glslang +echo +echo Retrieving MoltenVK dependencies into ${EXT_DIR}. +echo + +mkdir -p ${EXT_DIR} +cd ${EXT_DIR} + # ----------------- Cereal ------------------- REPO_NAME=cereal REPO_URL="https://github.com/USCiLab/${REPO_NAME}.git" -REPO_REV=$(cat "./${REPO_NAME}_repo_revision") +REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision") -clone_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} +update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} # ----------------- SPIRV-Cross ------------------- REPO_NAME=SPIRV-Cross REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git" -REPO_REV=$(cat "./${REPO_NAME}_repo_revision") +REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision") -clone_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} +update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} # ----------------- VulkanSamples ------------------- REPO_NAME=VulkanSamples REPO_URL="https://github.com/brenwill/${REPO_NAME}.git" -REPO_REV=$(cat "./${REPO_NAME}_repo_revision") +REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision") -clone_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} +update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} # ----------------- Vulkan-LoaderAndValidationLayers, glslang, SPIRV-Tools & SPIRV-Headers ------------------- @@ -96,9 +109,9 @@ else REPO_NAME=${V_LVL_NAME} REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git" - REPO_REV=$(cat "./${REPO_NAME}_repo_revision") + REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision") - clone_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} + update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} # ----------------- glslang, SPIRV-Tools & SPIRV-Headers --------------- @@ -107,13 +120,15 @@ else REPO_URL=$(cat "${V_LVL_NAME}/external_revisions/glslang_giturl") REPO_REV=$(cat "${V_LVL_NAME}/external_revisions/glslang_revision") - clone_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} + update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV} cd ${REPO_NAME} ./update_glslang_sources.py cd - - build_repo ${GLSLANG_NAME} + build_repo ${REPO_NAME} fi +cd .. +