"commit" : "2fd5a24ec4a6df303b2155b3f85b6b8c1d56f6c0"
},
{
+ "name" : "MoltenVK",
+ "url" : "https://github.com/KhronosGroup/MoltenVK.git",
+ "sub_dir" : "MoltenVK",
+ "build_dir" : "MoltenVK",
+ "install_dir" : "MoltenVK",
+ "commit" : "4c8c14a7ad756e73b172edc16dceaca4e8dbe90c",
+ "custom_build" : [
+ "./fetchDependencies --v-headers-root {0[Vulkan-Headers][repo_dir]} --glslang-root {0[glslang][repo_dir]}",
+ "xcodebuild -project MoltenVKPackaging.xcodeproj -scheme \"MoltenVK ({2})\" build"
+ ],
+ "build_step" : "custom",
+ "build_platforms" : [
+ "darwin"
+ ]
+ },
+ {
"name" : "Vulkan-Loader",
"url" : "https://github.com/KhronosGroup/Vulkan-Loader.git",
"sub_dir" : "Vulkan-Loader",
"install_names" : {
"glslang" : "GLSLANG_INSTALL_DIR",
"Vulkan-Headers" : "VULKAN_HEADERS_INSTALL_DIR",
- "Vulkan-Loader" : "VULKAN_LOADER_INSTALL_DIR"
+ "Vulkan-Loader" : "VULKAN_LOADER_INSTALL_DIR",
+ "MoltenVK" : "MOLTENVK_REPO_ROOT"
}
}
The commands listed in "prebuild" are executed first, and then the
commands for the specific platform are executed.
+- custom_build (optional)
+
+A list of commands to execute as a custom build instead of using
+the built in CMake way of building. Requires "build_step" to be
+set to "custom"
+
+You can insert the following keywords into the commands listed in
+"custom_build" if they require runtime information (like whether the
+build config is "Debug" or "Release").
+
+Keywords:
+{0} reference to a dictionary of repos and their attributes
+{1} reference to the command line arguments set before start
+{2} reference to the CONFIG_MAP value of config.
+
+Example:
+{2} returns the CONFIG_MAP value of config e.g. debug -> Debug
+{1}.config returns the config variable set when you ran update_dep.py
+{0}[Vulkan-Headers][repo_root] returns the repo_root variable from
+ the Vulkan-Headers GoodRepo object.
+
- cmake_options (optional)
A list of options to pass to CMake during the generation phase.
- build_step (optional)
Specifies if the dependent repository should be built or not. This can
-have a value of 'build' or 'skip'. The dependent repositories are
+have a value of 'build', 'custom', or 'skip'. The dependent repositories are
built by default.
+- build_platforms (optional)
+
+A list of platforms the repository will be built on.
+Legal options include:
+"windows"
+"linux"
+"darwin"
+
+Builds on all platforms by default.
+
Note
----
import sys
import platform
import multiprocessing
+import shlex
import shutil
KNOWN_GOOD_FILE_NAME = 'known_good.json'
print(stdout)
return stdout
-
class GoodRepo(object):
"""Represents a repository at a known-good commit."""
'prebuild_linux' in json) else []
self.prebuild_windows = json['prebuild_windows'] if (
'prebuild_windows' in json) else []
+ self.custom_build = json['custom_build'] if ('custom_build' in json) else []
self.cmake_options = json['cmake_options'] if (
'cmake_options' in json) else []
self.ci_only = json['ci_only'] if ('ci_only' in json) else []
self.build_step = json['build_step'] if ('build_step' in json) else 'build'
+ self.build_platforms = json['build_platforms'] if ('build_platforms' in json) else []
# Absolute paths for a repo's directories
dir_top = os.path.abspath(args.dir)
self.repo_dir = os.path.join(dir_top, self.sub_dir)
self.build_dir = os.path.join(dir_top, self.build_dir)
if self.install_dir:
self.install_dir = os.path.join(dir_top, self.install_dir)
+ # Check if platform is one to build on
+ self.on_build_platform = False
+ if self.build_platforms == [] or platform.system().lower() in self.build_platforms:
+ self.on_build_platform = True
def Clone(self):
distutils.dir_util.mkpath(self.repo_dir)
command_output(['git', 'checkout', self.commit], self.repo_dir)
print(command_output(['git', 'status'], self.repo_dir))
+ def CustomPreProcess(self, cmd_str, repo_dict):
+ return cmd_str.format(repo_dict, self._args, CONFIG_MAP[self._args.config])
+
def PreBuild(self):
"""Execute any prebuild steps from the repo root"""
for p in self.prebuild:
- command_output(p.split(), self.repo_dir)
+ command_output(shlex.split(p), self.repo_dir)
if platform.system() == 'Linux' or platform.system() == 'Darwin':
for p in self.prebuild_linux:
- command_output(p.split(), self.repo_dir)
+ command_output(shlex.split(p), self.repo_dir)
if platform.system() == 'Windows':
for p in self.prebuild_windows:
- command_output(p.split(), self.repo_dir)
+ command_output(shlex.split(p), self.repo_dir)
+
+ def CustomBuild(self, repo_dict):
+ """Execute any custom_build steps from the repo root"""
+ for p in self.custom_build:
+ cmd = self.CustomPreProcess(p, repo_dict)
+ command_output(shlex.split(cmd), self.repo_dir)
def CMakeConfig(self, repos):
"""Build CMake command for the configuration phase and execute it"""
if ret_code != 0:
sys.exit(ret_code)
- def Build(self, repos):
+ def Build(self, repos, repo_dict):
"""Build the dependent repo"""
print('Building {n} in {d}'.format(n=self.name, d=self.repo_dir))
print('Build dir = {b}'.format(b=self.build_dir))
# Run any prebuild commands
self.PreBuild()
+ if self.build_step == 'custom':
+ self.CustomBuild(repo_dict)
+ return
+
# Build and execute CMake command for creating build files
self.CMakeConfig(repos)
install_names = GetInstallNames(args)
with open(filename, 'w') as helper_file:
for repo in repos:
- if install_names and repo.name in install_names:
+ if install_names and repo.name in install_names and repo.on_build_platform:
helper_file.write('set({var} "{dir}" CACHE STRING "" FORCE)\n'
.format(
var=install_names[repo.name],
abs_top_dir = os.path.abspath(args.dir)
repos = GetGoodRepos(args)
+ repo_dict = {}
print('Starting builds in {d}'.format(d=abs_top_dir))
for repo in repos:
+ # If the repo has a platform whitelist, skip the repo
+ # unless we are building on a whitelisted platform.
+ if not repo.on_build_platform:
+ continue
+
+ field_list = ('url',
+ 'sub_dir',
+ 'commit',
+ 'build_dir',
+ 'install_dir',
+ 'deps',
+ 'prebuild',
+ 'prebuild_linux',
+ 'prebuild_windows',
+ 'custom_build',
+ 'cmake_options',
+ 'ci_only',
+ 'build_step',
+ 'build_platforms',
+ 'repo_dir',
+ 'on_build_platform')
+ repo_dict[repo.name] = {field: getattr(repo, field) for field in field_list};
+
# If the repo has a CI whitelist, skip the repo unless
# one of the CI's environment variable is set to true.
if len(repo.ci_only):
repo.Checkout()
# Build the repository
- if args.do_build and repo.build_step == 'build':
- repo.Build(repos)
+ if args.do_build and repo.build_step != 'skip':
+ repo.Build(repos, repo_dict)
# Need to restore original cwd in order for CreateHelper to find json file
os.chdir(save_cwd)