diff options
| author | Juan Ramos <juan@lunarg.com> | 2023-06-26 12:53:10 -0600 |
|---|---|---|
| committer | Juan Ramos <114601453+juan-lunarg@users.noreply.github.com> | 2023-06-27 09:38:38 -0600 |
| commit | ea8ea35f4e61ca90f5c8bec43e506ee77b9b57a7 (patch) | |
| tree | 0a7e6d5d71cd601e9d85b2fa70203209ed681bea /scripts | |
| parent | 247c806c93c720488daa0bc86acd5b6f3a0e14f9 (diff) | |
| download | usermoji-ea8ea35f4e61ca90f5c8bec43e506ee77b9b57a7.tar.xz | |
cmake: Update update_deps
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/CMakeLists.txt | 16 | ||||
| -rwxr-xr-x | scripts/update_deps.py | 30 |
2 files changed, 24 insertions, 22 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 74545673..ad467ae0 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -28,15 +28,9 @@ if (UPDATE_DEPS) list(APPEND update_dep_command "${CMAKE_GENERATOR}") if (CMAKE_GENERATOR_PLATFORM) - set(_target_arch ${CMAKE_GENERATOR_PLATFORM}) - else() - if (MSVC_IDE) - message(WARNING "CMAKE_GENERATOR_PLATFORM not set. Using x64 as target architecture.") - endif() - set(_target_arch x64) + list(APPEND update_dep_command "--arch") + list(APPEND update_dep_command "${CMAKE_GENERATOR_PLATFORM}") endif() - list(APPEND update_dep_command "--arch") - list(APPEND update_dep_command "${_target_arch}") if (NOT CMAKE_BUILD_TYPE) message(WARNING "CMAKE_BUILD_TYPE not set. Using Debug for dependency build type") @@ -88,12 +82,16 @@ if (UPDATE_DEPS) set(UPDATE_DEPS_HASH "0" CACHE STRING "Default value until we run update_deps.py") mark_as_advanced(UPDATE_DEPS_HASH) + if ("${UPDATE_DEPS_HASH}" STREQUAL "0") + list(APPEND update_dep_command "--clean-build") + list(APPEND update_dep_command "--clean-install") + endif() + if ("${md5_hash}" STREQUAL $CACHE{UPDATE_DEPS_HASH}) message(DEBUG "update_deps.py: no work to do.") else() execute_process( COMMAND ${Python3_EXECUTABLE} ${update_dep_command} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _update_deps_result ) if (NOT (${_update_deps_result} EQUAL 0)) diff --git a/scripts/update_deps.py b/scripts/update_deps.py index d53760a0..6a394266 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -32,11 +32,6 @@ this home repository depend on. It also checks out each dependent repository at a "known-good" commit in order to provide stability in the dependent repositories. -Python Compatibility --------------------- - -This program can be used with Python 2.7 and Python 3. - Known-Good JSON Database ------------------------ @@ -225,6 +220,7 @@ Legal options include: "windows" "linux" "darwin" +"android" Builds on all platforms by default. @@ -238,8 +234,6 @@ option can be a relative or absolute path. """ -from __future__ import print_function - import argparse import json import os.path @@ -269,7 +263,7 @@ DEVNULL = open(os.devnull, 'wb') def on_rm_error( func, path, exc_info): """Error handler for recursively removing a directory. The shutil.rmtree function can fail on Windows due to read-only files. - This handler will change the permissions for tha file and continue. + This handler will change the permissions for the file and continue. """ os.chmod( path, stat.S_IWRITE ) os.unlink( path ) @@ -348,9 +342,16 @@ class GoodRepo(object): 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 + + # By default the target platform is the host platform. + target_platform = platform.system().lower() + # However, we need to account for cross-compiling. + for cmake_var in self._args.cmake_var: + if "android.toolchain.cmake" in cmake_var: + target_platform = 'android' + self.on_build_platform = False - if self.build_platforms == [] or platform.system().lower() in self.build_platforms: + if self.build_platforms == [] or target_platform in self.build_platforms: self.on_build_platform = True def Clone(self, retries=10, retry_seconds=60): @@ -431,9 +432,11 @@ class GoodRepo(object): def CMakeConfig(self, repos): """Build CMake command for the configuration phase and execute it""" if self._args.do_clean_build: - shutil.rmtree(self.build_dir) + if os.path.isdir(self.build_dir): + shutil.rmtree(self.build_dir, onerror=on_rm_error) if self._args.do_clean_install: - shutil.rmtree(self.install_dir) + if os.path.isdir(self.install_dir): + shutil.rmtree(self.install_dir, onerror=on_rm_error) # Create and change to build directory make_or_exist_dirs(self.build_dir) @@ -668,7 +671,7 @@ def main(): '--api', dest='api', default='vulkan', - choices=['vulkan', 'vulkansc'], + choices=['vulkan'], help="Target API") parser.add_argument( '--generator', @@ -770,3 +773,4 @@ def main(): if __name__ == '__main__': main() + |
