Future Ideas
- add more specific project_options for emscripten
- 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() and run_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)
enable_cross_compiler()andCMAKE_TOOLCHAIN_FILEExperimental: Cross-compiling with ARM cross-compiler #188Dockerfile.mingwso setup-cpp can install the cross-compiler (MinGW) install mingw with setup-cpp #233Taskfilein add cross-compiling support from project_options cpp_vcpkg_project#15Future Ideas
Usage
The best you can do is add this to your cmake file:
and run cmake with these additional arguments:
See Taskfile and docker examples
Notes
enable_cross_compiler()andrun_vcpkg()can help you set up Community triplets easierOriginally posted by @abeimler in #171 (comment)