-
Notifications
You must be signed in to change notification settings - Fork 2k
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
add a custom toolchain for customized use #8077
Changes from 2 commits
099ff7a
bbf12f3
72f29b1
9e402de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2020 The Pigweed Authors | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# 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 | ||
# | ||
# http://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. | ||
|
||
import("linux_arm_toolchain.gni") | ||
|
||
linux_arm_toolchain("linux_arm") { | ||
toolchain_args = { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# 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 | ||
# | ||
# http://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. | ||
|
||
import("//build_overrides/build.gni") | ||
|
||
import("${build_root}/config/android/config.gni") | ||
import("${build_root}/toolchain/gcc_toolchain.gni") | ||
|
||
declare_args() { | ||
# similar to "CROSS_COMPILE" when build kernel | ||
linux_arm_cross_compile = "" | ||
} | ||
|
||
template("linux_arm_toolchain") { | ||
if (linux_arm_cross_compile == "") { | ||
assert( | ||
false, | ||
"assign a value to the build argument 'linux_arm_cross_compile' when use linux_arm_toolchain") | ||
} | ||
|
||
_invoker_toolchain_args = invoker.toolchain_args | ||
_linux_arm_toolchain_args = { | ||
current_os = invoker.current_os | ||
is_clang = false | ||
forward_variables_from(_invoker_toolchain_args, "*") | ||
} | ||
|
||
gcc_toolchain(target_name) { | ||
toolchain_args = _linux_arm_toolchain_args | ||
ar = linux_arm_cross_compile + "ar" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand E.g.
Also, could you maybe just check that definition into the repository somewhere and point custom_toolchain at it to use it?
The current modifications to BUILDCONFIG.gn activate for any Linux ARM config even if you are running on a Linux ARM host and you are not cross compiling, so your compiler is really just "gcc". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @mspang For your second comment, in fact, I used to specify the toolchain with build argument "custom_toolchain", and then found it a bit unease of use:
Different string is used to specify the same toolchain, For me this is totally okay, but I think that this may be a bit confusing for customers who are beginners of gn tools. Can I made the change to "build/config/BUILDCONFIG.gn" like below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What about
Otherwise I think defining a new argument and doing something like
would be fine.
I don't think we should couple providing a toolchain to cross compiling on Linux. Linux ARM[64] is a very common target, and we already need to support it well for Raspberry Pi. This should be made to work by using the compiler that running the "bootstrap" process provides you:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, @mspang , I've updated the PR based on your comments. |
||
cc = linux_arm_cross_compile + "gcc" | ||
cxx = linux_arm_cross_compile + "g++" | ||
} | ||
} |
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.
There is nothing ARM specific about this. I think you are looking for just a customizable toolchain.