Skip to content

Cross-compiling #180

Open
Open
@aminya

Description

@aminya

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions