diff options
| author | Juan Ramos <juan@lunarg.com> | 2023-10-11 11:59:10 -0600 |
|---|---|---|
| committer | Juan Ramos <114601453+juan-lunarg@users.noreply.github.com> | 2023-10-11 12:39:07 -0600 |
| commit | 08165e9f6459081d91661ee4b0fc73db85d5d655 (patch) | |
| tree | 0368684aa27baeb96c396057537e033d97523b82 | |
| parent | ef55edf1d63d1de0df9c81bff305c975074b2a5c (diff) | |
| download | usermoji-08165e9f6459081d91661ee4b0fc73db85d5d655.tar.xz | |
gn: Cleanup chromium build
| -rw-r--r-- | .github/workflows/tools.yml | 34 | ||||
| -rw-r--r-- | .gitignore | 13 | ||||
| -rw-r--r-- | .gn | 24 | ||||
| -rw-r--r-- | BUILD.gn | 2 | ||||
| -rw-r--r-- | scripts/gn/DEPS (renamed from build-gn/DEPS) | 0 | ||||
| -rwxr-xr-x | scripts/gn/generate_vulkan_icd_json.py (renamed from build-gn/generate_vulkan_layers_json.py) | 2 | ||||
| -rwxr-xr-x | scripts/gn/gn.py | 56 | ||||
| -rw-r--r-- | scripts/gn/secondary/build_overrides/build.gni (renamed from build-gn/secondary/build_overrides/build.gni) | 2 | ||||
| -rw-r--r-- | scripts/gn/secondary/build_overrides/vulkan_headers.gni (renamed from build-gn/secondary/build_overrides/vulkan_headers.gni) | 2 | ||||
| -rw-r--r-- | scripts/gn/secondary/build_overrides/vulkan_tools.gni (renamed from build-gn/secondary/build_overrides/vulkan_tools.gni) | 2 | ||||
| -rwxr-xr-x | scripts/gn/update_deps.sh (renamed from build-gn/update_deps.sh) | 20 |
11 files changed, 96 insertions, 61 deletions
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 23d12188..21c1c2c9 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -164,34 +164,6 @@ jobs: - name: Verify generated source files run: python scripts/generate_source.py --verify external/Release/Vulkan-Headers/build/install/share/vulkan/registry - gn: - runs-on: ubuntu-20.04 - - strategy: - matrix: - config: [ Debug, Release ] - - steps: - - uses: actions/checkout@v3 - - - name: Get depot tools - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools - echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH - - name: Fetch and install headers - run: ./build-gn/update_deps.sh - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=true" - if: matrix.config != 'Release' - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=false" - if: matrix.config == 'Release' - - - name: Build the tools - run: ninja -C out/${{matrix.config}} - android: runs-on: ubuntu-22.04 strategy: @@ -233,3 +205,9 @@ jobs: - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON - run: cmake --build build --target tools_codegen - run: git diff --exit-code + + chromium: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: scripts/gn/gn.py @@ -31,3 +31,16 @@ out64/* *.includes .vscode/ .DS_Store + +# Chromium build artifacts +.cipd/ +.gn +.gclient +.gclient_entries +.gclient_previous_sync_commits +out/ +third_party/ +buildtools/ +depot_tools/ +testing/ +tools/ @@ -1,24 +0,0 @@ -# Copyright (C) 2019 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -buildconfig = "//build/config/BUILDCONFIG.gn" -secondary_source = "//build-gn/secondary/" - -script_executable = "python3" - -default_args = { - clang_use_chrome_plugins = false - use_custom_libcxx = false -} - @@ -54,7 +54,7 @@ if (!is_android) { } action("vulkan_gen_icd_json_file") { - script = "build-gn/generate_vulkan_layers_json.py" + script = "scripts/gn/generate_vulkan_icd_json.py" public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] diff --git a/build-gn/DEPS b/scripts/gn/DEPS index 8cf931a8..8cf931a8 100644 --- a/build-gn/DEPS +++ b/scripts/gn/DEPS diff --git a/build-gn/generate_vulkan_layers_json.py b/scripts/gn/generate_vulkan_icd_json.py index c4135db4..498bc07e 100755 --- a/build-gn/generate_vulkan_layers_json.py +++ b/scripts/gn/generate_vulkan_icd_json.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -# Copyright (C) 2016 The ANGLE Project Authors. # Copyright (c) 2022-2023 LunarG, Inc. +# Copyright (C) 2016 The ANGLE Project Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/gn/gn.py b/scripts/gn/gn.py new file mode 100755 index 00000000..52b20c58 --- /dev/null +++ b/scripts/gn/gn.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Khronos Group Inc. +# Copyright 2023 Valve Corporation +# Copyright 2023 LunarG, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import subprocess +import sys + +# helper to define paths relative to the repo root +def RepoRelative(path): + return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../', path)) + +def BuildGn(): + if not os.path.exists(RepoRelative("depot_tools")): + print("Cloning Chromium depot_tools\n", flush=True) + clone_cmd = 'git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools'.split(" ") + subprocess.call(clone_cmd) + + os.environ['PATH'] = os.environ.get('PATH') + ":" + RepoRelative("depot_tools") + + print("Updating Repo Dependencies and GN Toolchain\n", flush=True) + update_cmd = './scripts/gn/update_deps.sh' + subprocess.call(update_cmd) + + print("Checking Header Dependencies\n", flush=True) + gn_check_cmd = 'gn gen --check out/Debug'.split(" ") + subprocess.call(gn_check_cmd) + + print("Generating Ninja Files\n", flush=True) + gn_gen_cmd = 'gn gen out/Debug'.split(" ") + subprocess.call(gn_gen_cmd) + + print("Running Ninja Build\n", flush=True) + ninja_build_cmd = 'ninja -C out/Debug'.split(" ") + subprocess.call(ninja_build_cmd) + +# +# Module Entrypoint +def main(): + try: + BuildGn() + + except subprocess.CalledProcessError as proc_error: + print('Command "%s" failed with return code %s' % (' '.join(proc_error.cmd), proc_error.returncode)) + sys.exit(proc_error.returncode) + except Exception as unknown_error: + print('An unkown error occured: %s', unknown_error) + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/build-gn/secondary/build_overrides/build.gni b/scripts/gn/secondary/build_overrides/build.gni index c6c11fa9..dbf47039 100644 --- a/build-gn/secondary/build_overrides/build.gni +++ b/scripts/gn/secondary/build_overrides/build.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/secondary/build_overrides/vulkan_headers.gni b/scripts/gn/secondary/build_overrides/vulkan_headers.gni index 0cd8307d..5f24b39e 100644 --- a/build-gn/secondary/build_overrides/vulkan_headers.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_headers.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2020 LunarG, Inc. +# Copyright (c) 2020-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/secondary/build_overrides/vulkan_tools.gni b/scripts/gn/secondary/build_overrides/vulkan_tools.gni index 9f808460..c62fb64d 100644 --- a/build-gn/secondary/build_overrides/vulkan_tools.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_tools.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/update_deps.sh b/scripts/gn/update_deps.sh index 41da2ab3..763c3058 100755 --- a/build-gn/update_deps.sh +++ b/scripts/gn/update_deps.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,17 +15,29 @@ # limitations under the License. # Execute at repo root -cd "$(dirname $0)/.." +cd "$(dirname $0)/../../" # Use update_deps.py to update source dependencies from /scripts/known_good.json scripts/update_deps.py --dir="external" --no-build -# Use gclient to update toolchain dependencies from /build-gn/DEPS (from chromium) +cat << EOF > .gn +buildconfig = "//build/config/BUILDCONFIG.gn" +secondary_source = "//scripts/gn/secondary/" + +script_executable = "python3" + +default_args = { + clang_use_chrome_plugins = false + use_custom_libcxx = false +} +EOF + +# Use gclient to update toolchain dependencies from /scripts/gn/DEPS (from chromium) cat << EOF >> .gclient solutions = [ { "name" : ".", "url" : "https://github.com/KhronosGroup/Vulkan-Tools", - "deps_file" : "build-gn/DEPS", + "deps_file" : "scripts/gn/DEPS", "managed" : False, "custom_deps" : { }, |
