Open
Description
- Merge Cross-compiling and toolchains #171 by @abeimler
- Test cross-compiling with Conan @aminya
- Test cross-compiling without using Conan NOR vcpkg, just plain C++ Experimental: Cross-compiling with ARM cross-compiler #188
- by just using
enable_cross_compiler()
andCMAKE_TOOLCHAIN_FILE
Experimental: Cross-compiling with ARM cross-compiler #188
- by just using
- May add a more specific (cross-compile) example for windows
- So it can compile with both MSVC AND MinGW
- Update setup-cpp (toolchain) examples in project-options add mingw cross-compiler setup-cpp#103
- After adding cross-compiler to setup-cpp, update
Dockerfile.mingw
so setup-cpp can install the cross-compiler (MinGW) install mingw with setup-cpp #233 - Update
Taskfile
in add cross-compiling support from project_options cpp_vcpkg_project#15
Future Ideas
- add more specific project_options for emscripten
- Like Packaging Files and assets
- add cross-compiler for ARM
- Maybe Android (toolchain)
Usage
The best you can do is add this to your cmake file:
# opt-in cross-compiling
option(ENABLE_CROSS_COMPILING "Detect cross compiler and setup toolchain" OFF)
if(ENABLE_CROSS_COMPILING)
enable_cross_compiler()
endif()
run_vcpkg() # run_vcpkg AFTER enable_cross_compiler, when using vcpkg
and run cmake with these additional arguments:
-DENABLE_CROSS_COMPILING:BOOL=ON -DDEFAULT_TRIPLET=x64-mingw-dynamic
See Taskfile and docker examples
Notes
- This feature isn't a magic switch to enable cross-compiling
- vcpkg Community triplets are not guaranteed to succeed.
- emscripten can be more of a specific use case and you may need to add some flags
- The toolchain files are more of a basic setup and examples
enable_cross_compiler()
andrun_vcpkg()
can help you set up Community triplets easier- Best way to experiment with cross-compiling is by using docker and in a closed environment
Originally posted by @abeimler in #171 (comment)
Metadata
Metadata
Assignees
Labels
No labels