Reorganize External dependencies.

fetchDependencies script now in top directory to avoid Travis caching of
External directory. fetchDependencies is now smart about fetching vs cloning
and building only what is necessary.
This commit is contained in:
Bill Hollings 2018-03-30 22:16:27 -04:00
parent d974ce46b8
commit 979a7f801f
9 changed files with 53 additions and 38 deletions

View File

@ -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)"

View File

@ -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,

View File

@ -137,7 +137,7 @@
A92DB3E61CE0F37D00FBC835 /* Whats_New.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = Whats_New.md; path = Docs/Whats_New.md; sourceTree = "<group>"; };
A92DB3EE1CE0F72500FBC835 /* MoltenVK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MoltenVK.xcodeproj; path = MoltenVK/MoltenVK.xcodeproj; sourceTree = "<group>"; };
A92DB40E1CE0F89600FBC835 /* MoltenVKShaderConverter.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MoltenVKShaderConverter.xcodeproj; path = MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj; sourceTree = "<group>"; };
A943100220546CDD00F5CF87 /* fetchDependencies */ = {isa = PBXFileReference; lastKnownFileType = text; path = fetchDependencies; sourceTree = "<group>"; };
A943100220546CDD00F5CF87 /* fetchDependencies */ = {isa = PBXFileReference; lastKnownFileType = text; name = fetchDependencies; path = ../fetchDependencies; sourceTree = "<group>"; };
A98149E51FB78829005F00B4 /* MoltenVK_Runtime_UserGuide.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = MoltenVK_Runtime_UserGuide.md; path = Docs/MoltenVK_Runtime_UserGuide.md; sourceTree = "<group>"; };
A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = VulkanSamples_repo_revision; sourceTree = "<group>"; };
A9AD67D22054E2D700ED3C08 /* Vulkan-LoaderAndValidationLayers_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Vulkan-LoaderAndValidationLayers_repo_revision"; sourceTree = "<group>"; };
@ -187,7 +187,8 @@
A9AD67D22054E2D700ED3C08 /* Vulkan-LoaderAndValidationLayers_repo_revision */,
A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */,
);
path = External;
name = External;
path = ExternalRevisions;
sourceTree = "<group>";
};
A98149741FB6B565005F00B4 /* Products */ = {

View File

@ -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.
<a name="building"></a>

View File

@ -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"
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 ..