- Notifications
You must be signed in to change notification settings - Fork3
MinGW specialized toolchain and target#179
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
20 commits Select commitHold shift + click to select a range
e0786e9 Update style_guide.rst
coder137246136b Create toolchain_mingw.h
coder137697e992 Create target_mingw.h
coder13792186f2 Added mingw executable example
coder1377201419 Update buildcc.h
coder137784fc18 Update CMakeLists.txt
coder137df3519d Update CMakeLists.txt
coder1371dcd1a5 Added Mingw StaticLib example
coder137e05deee Update target_mingw.h
coder13746698bc Added mingw DynamicLib examples
coder137941c40d Update target_mingw.h
coder1376af2e6a Update build.cpp
coder137657487c Added Mingw pch example
coder1377457bf3 Update target_mingw.h
coder13741a01ad Update build.cpp
coder137b01ec5d Update target_mingw.h
coder137b6c4080 Update mingw.rst
coder1377356e2a Update build.cpp
coder13734c2c0b Update mingw.rst
coder1374c49f75 Update README.md
coder137File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 3 additions & 1 deletionbuildcc/buildcc.h
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
1 change: 1 addition & 0 deletionsbuildcc/targets/CMakeLists.txt
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
87 changes: 87 additions & 0 deletionsbuildcc/targets/include/targets/target_mingw.h
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,87 @@ | ||
| /* | ||
| * Copyright 2021-2022 Niket Naidu. All rights reserved. | ||
| * | ||
| * 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. | ||
| */ | ||
| #ifndef TARGETS_TARGET_MINGW_H_ | ||
| #define TARGETS_TARGET_MINGW_H_ | ||
| #include "target/target.h" | ||
| #include "target_config_interface.h" | ||
| #include "target_gcc.h" | ||
| // MinGW | ||
| // ".exe", ".a", ".so" -> (x86_64-w64-mingw32) | ||
| namespace buildcc { | ||
| // Extensions | ||
| constexpr const char *const kMingwExecutableExt = ".exe"; | ||
| constexpr const char *const kMingwDynamicLibExt = ".dll"; | ||
| constexpr const char *const kMingwDynamicLibLinkCommand = | ||
| "{cpp_compiler} -shared {link_flags} {compiled_sources} -o {output} " | ||
| "-Wl,--out-implib,{output}.a"; | ||
| class MingwConfig : ConfigInterface<MingwConfig> { | ||
| public: | ||
| static TargetConfig Executable() { | ||
| return DefaultMingwConfig(kMingwExecutableExt, kGccGenericCompileCommand, | ||
| kGccExecutableLinkCommand); | ||
| } | ||
| static TargetConfig DynamicLib() { | ||
| return DefaultMingwConfig(kMingwDynamicLibExt, kGccGenericCompileCommand, | ||
| kMingwDynamicLibLinkCommand); | ||
| } | ||
| private: | ||
| static TargetConfig DefaultMingwConfig(const std::string &target_ext, | ||
| const std::string &compile_command, | ||
| const std::string &link_command) { | ||
| TargetConfig config; | ||
| config.target_ext = target_ext; | ||
| config.obj_ext = kGccObjExt; | ||
| config.pch_header_ext = kGccPchHeaderExt; | ||
| config.pch_compile_ext = kGccPchCompileExt; | ||
| std::string prefix_include_dir = kGccPrefixIncludeDir; | ||
| std::string prefix_lib_dir = kGccPrefixLibDir; | ||
| config.pch_command = kGccGenericPchCompileCommand; | ||
| config.compile_command = compile_command; | ||
| config.link_command = link_command; | ||
| return config; | ||
| } | ||
| }; | ||
| class ExecutableTarget_mingw : public ExecutableTarget_gcc { | ||
| public: | ||
| ExecutableTarget_mingw(const std::string &name, | ||
| const BaseToolchain &toolchain, const TargetEnv &env, | ||
| const TargetConfig &config = MingwConfig::Executable()) | ||
| : ExecutableTarget_gcc(name, toolchain, env, config) {} | ||
| }; | ||
| typedef StaticTarget_gcc StaticTarget_mingw; | ||
| class DynamicTarget_mingw : public DynamicTarget_gcc { | ||
| public: | ||
| DynamicTarget_mingw(const std::string &name, const BaseToolchain &toolchain, | ||
| const TargetEnv &env, | ||
| const TargetConfig &config = MingwConfig::DynamicLib()) | ||
| : DynamicTarget_gcc(name, toolchain, env, config) {} | ||
| }; | ||
| } // namespace buildcc | ||
| #endif |
1 change: 1 addition & 0 deletionsbuildcc/toolchains/CMakeLists.txt
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
33 changes: 33 additions & 0 deletionsbuildcc/toolchains/include/toolchains/toolchain_mingw.h
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,33 @@ | ||
| /* | ||
| * Copyright 2021-2022 Niket Naidu. All rights reserved. | ||
| * | ||
| * 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. | ||
| */ | ||
| #ifndef TOOLCHAINS_TOOLCHAIN_MINGW_H_ | ||
| #define TOOLCHAINS_TOOLCHAIN_MINGW_H_ | ||
| #include "toolchain/toolchain.h" | ||
| namespace buildcc { | ||
| class Toolchain_mingw : public BaseToolchain { | ||
| public: | ||
| Toolchain_mingw() | ||
| : Toolchain(ToolchainId::MinGW, "gcc", "as", "gcc", "g++", "ar", "ld") {} | ||
| Toolchain_mingw(const Toolchain_mingw &) = delete; | ||
| }; | ||
| } // namespace buildcc | ||
| #endif |
4 changes: 3 additions & 1 deletiondocs/source/arch/style_guide.rst
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
169 changes: 169 additions & 0 deletionsdocs/source/examples/mingw.rst
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
12 changes: 8 additions & 4 deletionsexample/README.md
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
8 changes: 8 additions & 0 deletionsexample/mingw/DynamicLib/.gitignore
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,8 @@ | ||
| # Folder | ||
| generated | ||
| buildcc | ||
| # Files | ||
| *.exe | ||
| *.o | ||
| *.bin |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.