Skip to content

Commit

Permalink
feat: compatible with linux/arm64 (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Hu Yueh-Wei <[email protected]>
  • Loading branch information
wangyoucao577 and halajohn authored Oct 14, 2024
1 parent 258196d commit 1681035
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
Binary file added .gnfiles/bin/linux/arm64/gn
Binary file not shown.
Binary file added .gnfiles/bin/linux/arm64/ninja
Binary file not shown.
File renamed without changes.
File renamed without changes.
20 changes: 17 additions & 3 deletions .gnfiles/build/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ config("specific_cpp") {
if (is_clang) {
if (linux_clang_stdlib == "c++") {
if (linux_stl_static) {
libs += [ "/usr/lib/x86_64-linux-gnu/libc++.a" ]
if (target_cpu == "arm64") {
libs += [ "/usr/lib/aarch64-linux-gnu/libc++.a" ]
} else {
libs += [ "/usr/lib/x86_64-linux-gnu/libc++.a" ]
}
} else {
libs += [ "c++" ]
}
Expand All @@ -97,7 +101,13 @@ config("specific_cpp") {
[ "gcc" ],
"value")
assert(_gcc_version == 0 || _gcc_version != 0)
libs += [ "/usr/lib/gcc/x86_64-linux-gnu/${_gcc_version}/libstdc++.a" ]
if (target_cpu == "arm64") {
libs +=
[ "/usr/lib/gcc/aarch64-linux-gnu/${_gcc_version}/libstdc++.a" ]
} else {
libs +=
[ "/usr/lib/gcc/x86_64-linux-gnu/${_gcc_version}/libstdc++.a" ]
}
} else {
libs += [ "stdc++" ]
}
Expand All @@ -110,7 +120,11 @@ config("specific_cpp") {
[ "gcc" ],
"value")
assert(_gcc_version == 0 || _gcc_version != 0)
libs += [ "/usr/lib/gcc/x86_64-linux-gnu/${_gcc_version}/libstdc++.a" ]
if (target_cpu == "arm64") {
libs += [ "/usr/lib/gcc/aarch64-linux-gnu/${_gcc_version}/libstdc++.a" ]
} else {
libs += [ "/usr/lib/gcc/x86_64-linux-gnu/${_gcc_version}/libstdc++.a" ]
}
} else {
libs += [ "stdc++" ]
}
Expand Down
18 changes: 14 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,20 @@ def determine_essential_paths(all_args: AllArgumentInfo) -> None:
all_args.gn_path = os.path.join(all_args.gn_path, "mac", "gn")
all_args.ninja_path = os.path.join(all_args.ninja_path, "mac", "ninja")
else:
all_args.gn_path = os.path.join(all_args.gn_path, "linux", "gn")
all_args.ninja_path = os.path.join(
all_args.ninja_path, "linux", "ninja"
)
if os.uname().machine in ["arm64", "aarch64"]:
all_args.gn_path = os.path.join(
all_args.gn_path, "linux", "arm64", "gn"
)
all_args.ninja_path = os.path.join(
all_args.ninja_path, "linux", "arm64", "ninja"
)
else:
all_args.gn_path = os.path.join(
all_args.gn_path, "linux", "x64", "gn"
)
all_args.ninja_path = os.path.join(
all_args.ninja_path, "linux", "x64", "ninja"
)

# 'gn_path' is the path of the 'gn' executable.
all_args.gn_path = os.path.abspath(all_args.gn_path).replace("\\", "/")
Expand Down

0 comments on commit 1681035

Please sign in to comment.