-
Notifications
You must be signed in to change notification settings - Fork 245
[ci] adding windows configuration for configure project script #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3d4f02a
Adding uniform build_configure
geomin12 5e876f1
lint
geomin12 3728163
missing comma
geomin12 9987f08
PR comments
geomin12 62d89e0
Removing Path
geomin12 d8b5f37
Pr comments
geomin12 8ee3ed3
Adding cleanup
geomin12 e135e04
Adding back
geomin12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| """ | ||
| This script runs the Linux build configuration | ||
|
|
||
| Required environment variables: | ||
| - amdgpu_families | ||
| - package_version | ||
| - extra_cmake_options | ||
| """ | ||
|
|
||
| import logging | ||
| import os | ||
| from pathlib import Path | ||
| import platform | ||
| import shlex | ||
| import subprocess | ||
|
|
||
| logging.basicConfig(level=logging.INFO) | ||
| THIS_SCRIPT_DIR = Path(__file__).resolve().parent | ||
| THEROCK_DIR = THIS_SCRIPT_DIR.parent.parent | ||
|
|
||
| PLATFORM = platform.system().lower() | ||
|
|
||
| amdgpu_families = os.getenv("amdgpu_families") | ||
| package_version = os.getenv("package_version") | ||
| extra_cmake_options = os.getenv("extra_cmake_options") | ||
| build_dir = os.getenv("BUILD_DIR") | ||
| vctools_install_dir = os.getenv("VCToolsInstallDir") | ||
| github_workspace = os.getenv("GITHUB_WORKSPACE") | ||
|
|
||
| platform_options = { | ||
| "windows": [ | ||
| f"-DCMAKE_C_COMPILER={vctools_install_dir}/bin/Hostx64/x64/cl.exe", | ||
| f"-DCMAKE_CXX_COMPILER={vctools_install_dir}/bin/Hostx64/x64/cl.exe", | ||
| f"-DCMAKE_LINKER={vctools_install_dir}/bin/Hostx64/x64/link.exe", | ||
| "-DTHEROCK_BACKGROUND_BUILD_JOBS=4", | ||
| ], | ||
| } | ||
|
|
||
|
|
||
| def build_configure(): | ||
| logging.info(f"Building package {package_version}") | ||
|
|
||
| cmd = [ | ||
| "cmake", | ||
| "-B", | ||
| build_dir, | ||
| "-GNinja", | ||
| ".", | ||
| f"-DTHEROCK_AMDGPU_FAMILIES={amdgpu_families}", | ||
| f"-DTHEROCK_PACKAGE_VERSION='{package_version}'", | ||
| "-DCMAKE_C_COMPILER_LAUNCHER=ccache", | ||
| "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", | ||
| "-DTHEROCK_VERBOSE=ON", | ||
| "-DBUILD_TESTING=ON", | ||
| ] | ||
|
|
||
| # Adding platform specific options | ||
| cmd += platform_options.get(PLATFORM, []) | ||
|
|
||
| if PLATFORM == "windows": | ||
| # VCToolsInstallDir is required for build. Throwing an error if environment variable doesn't exist | ||
| if not vctools_install_dir: | ||
| raise Exception( | ||
| "Environment variable VCToolsInstallDir is not set. Please see https://github.com/ROCm/TheRock/blob/main/docs/development/windows_support.md#important-tool-settings about Windows tool configurations. Exiting." | ||
| ) | ||
|
|
||
| if os.path.isdir(f"{github_workspace}/amdgpu-windows-interop"): | ||
| cmd.append( | ||
| f"-DTHEROCK_AMDGPU_WINDOWS_INTEROP_DIR={github_workspace}/amdgpu-windows-interop" | ||
| ) | ||
|
|
||
| # Splitting cmake options into an array (ex: "-flag X" -> ["-flag", "X"]) for subprocess.run | ||
| cmake_options_arr = extra_cmake_options.split() | ||
| cmd += cmake_options_arr | ||
|
|
||
| logging.info(shlex.join(cmd)) | ||
| subprocess.run(cmd, cwd=THEROCK_DIR, check=True) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| build_configure() | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this docstring (works on both Windows and Linux, then document which env vars are required on each platform)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunate. let me update this in the next PR