Toolchains for crosscompiling with CMake.

Overview

This repository contains toolchains usable for crosscompiling with CMake. They are meant to be used on ArchLinux, but they can also (with some directory structure modifications) work on other systems.

How to use them?

Suppose you have sources which use CMake build system. Create new clean build directory, pick any toolchain and run cmake with your selected toolchain in it, e.g.:

mkdir build-win
cd build-win
cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchains/archlinux/Qt4-mingw32.cmake ..

Now you can compile (and install/package) the application as usual:

make -j3
make package
make me happy

The result is application crosscompiled for given architecture and system (here it is Qt4 application for Windows).

Dependencies for crosscompiling

Every toolchain file has listed dependecies, which are needed for successful crosscompilation. Packages are available either in official ArchLinux repositories, in AUR or, for more exotic architectures, in my own repository.

Comments
  • Emscripten-wasm: Add options to enable SIMD and Threads

    Emscripten-wasm: Add options to enable SIMD and Threads

    Hi @mosra !

    As these feature are getting ready/are ready in modern browsers, here's a proposal how they could be supported in the toolchain.

    Best, Jonathan

    scrapped 
    opened by Squareys 6
  • Enable normal CMake EMSCRIPTEN detection

    Enable normal CMake EMSCRIPTEN detection

    The default EMSCRIPTEN detection is based on a global EMSCRIPTEN variable. If we use these toolchains, this variable won't be set making crosscompilation fail

    changelog mention added 
    opened by isc30 6
  • emscripten: Remove linker only flag from compiler flags

    emscripten: Remove linker only flag from compiler flags

    Hi @mosra !

    This is a tiny one: Newer emscripten versions produce a loud warning when using linker-only flags during compilation:

    em++: warning: linker setting ignored during compilation: 'WASM' [-Wunused-command-line-argument]
    

    I went ahead and removed it from CMAKE_CXX_FLAGS_INIT.

    Best, Jonathan

    changelog mention added 
    opened by Squareys 3
  • Errors building sdl2

    Errors building sdl2

    Hi, I'm trying to build sdl2 from sources here: https://github.com/SDL-mirror/SDL The cmake config goes fine with the ios toolchain, but builds fail complaining about missing headers, etc.

    I use the following steps:

    mkdir build-ios && cd build-ios
    cmake .. \
        -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
        -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
        -DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \
        -DCMAKE_INSTALL_PREFIX=~/ios-libs \
        -G Xcode
    cmake --build .
    
    no action needed 
    opened by hsdk123 2
  • Emscripten: Normalize emscripten SDK path if using from environment

    Emscripten: Normalize emscripten SDK path if using from environment

    Hi @mosra !

    Since setting up emscripten on a new computer, I finally found time to properly fix this issue: when using github.com/juj/emsdk the toolchain will autodetect the Emscripten Prefix from the environment, but it is set as a Windows path and produces syntax errors in the generated ninja build files.

    My previous workaround was to manually specify a normalized path to emscripten, but cleaning the path in the toolchain is way cleaner imo.

    This allows for super straight forward, frictionless use of the Toolchain (except that on Windows, MSVC generator will be chosen automatically, so you do still have to specify -GNinja.)

    Cheers, Jonathan

    changelog mention added 
    opened by Squareys 2
  • DEFIEND != DEFINED

    DEFIEND != DEFINED

    https://github.com/mosra/toolchains/blob/d7beaeddc68c5ee07603f1c87cef4d4323c6f0f4/generic/Emscripten-wasm.cmake#L17

    Hi, there is a typo if(DEFIEND ENV{EMSCRIPTEN}) should be if(DEFINED ENV{EMSCRIPTEN}) Best, Tomas

    changelog mention added 
    opened by lecopivo 2
  • Update toolchain s.t. we can debug android applications through visual studio

    Update toolchain s.t. we can debug android applications through visual studio

    Creating an issue here s.t. this can be addressed when https://developercommunity.visualstudio.com/t/Debug-android-device-through-cmake-proje/10087552 this is given a reply to.

    opened by hsdk123 0
  • Enabling ThinLTO

    Enabling ThinLTO

    When enable IPO for CMake, it defaults to ThinLTO on Clang which is much faster than normal LTO, but does occasionally run into issues. #14 brings us part of the way there and immediately solves the issue with Full LTO. One of the main blockers is a bug in the EMSDK Toolchain here: https://github.com/emscripten-core/emscripten/issues/12763 but there is also a workaround in the first issue about the naming of the archive libraries and object files. We should look into solving that in this toolchain as well.

    opened by Skylion007 0
  • Properly set EMAR for Interprocedural Optimization

    Properly set EMAR for Interprocedural Optimization

    This properly sets the EMAR for InterproceduralOptimization as described here: https://github.com/emscripten-core/emscripten/issues/11143 and here https://github.com/mosra/magnum/issues/490

    opened by Skylion007 2
  • Depecrated --llvm-lto used in Emscripten upstream backend

    Depecrated --llvm-lto used in Emscripten upstream backend

    The Emscripten upstream backend uses the standard -flto option and emits a warning when --llvm-lto is used.

    emcc:WARNING: --llvm-lto ignored when using llvm backend

    One way to check whether the fastcomp backend is being used is to check for Clang 6.0.1 or older. Fastcomp stopped being supported with Emscripten > 1.40.1 which has that version. Upstream as old as 1.38.33 (oldest version I could get from emsdk) uses Clang 9.

    However, the following doesn't work because the toolchain file doesn't have access the compiler version (CMAKE_CXX_COMPILER_VERSION is only detected by CMake afterwards):

    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
        set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 --llvm-lto 1")
    else()
        set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 -flto")
    endif()
    

    I fixed it with a

    string(REPLACE "--llvm-lto 1" "-flto" CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
    

    in my code but the correct flag in the toolchain depending on the backend would be nicer.

    opened by pezcode 3
  • Unable to import APK through Android Studio

    Unable to import APK through Android Studio

    I've just managed to get up to apk packaging completing, and now trying to debug, I've initially tried importing the APK through Android Studio (option: Profile or debug APK), but I'm getting errors when selecting the cmake built file:

    APK Import
    Unable to find file
    'Users/hkim809/ApkProjects/MyApplication/small/classes.dex'
    

    Any ideas?

    opened by hsdk123 5
Owner
Vladimír Vondruš
Trying to make the world a better place.
Vladimír Vondruš
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.5k Nov 25, 2022
CMake checks cache helper modules – for fast CI CMake builds!

cmake-checks-cache Cross platform CMake projects do platform introspection by the means of "Check" macros. Have a look at CMake's How To Write Platfor

Cristian Adam 64 Nov 18, 2022
CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Lin

Jose Luis Blanco-Claraco 393 Nov 18, 2022
cmake-font-lock - Advanced, type aware, highlight support for CMake

cmake-font-lock - Advanced, type aware, highlight support for CMake

Anders Lindgren 39 Oct 2, 2022
cmake-avr - a cmake toolchain for AVR projects

cmake-avr - a cmake toolchain for AVR projects Testing the example provided The toolchain was created and tested within the following environment: Lin

Matthias Kleemann 162 Oct 24, 2022
Make CMake less painful when trying to write Modern Flexible CMake

Izzy's eXtension Modules IXM is a CMake library for writing Modern flexible CMake. This means: Reducing the amount of CMake written Selecting reasonab

IXM 107 Sep 1, 2022
CMake module to enable code coverage easily and generate coverage reports with CMake targets.

CMake-codecov CMake module to enable code coverage easily and generate coverage reports with CMake targets. Include into your project To use Findcodec

HPC 82 Oct 25, 2022
unmaintained - CMake module to activate certain C++ standard, feature checks and appropriate automated workarounds - basically an improved version of cmake-compile-features

Compatibility This library provides an advanced target_compile_features() and write_compiler_detection_header(). The problem with those is that they a

Jonathan Müller 72 Apr 14, 2022
[CMake] [BSD-2] CMake module to find ICU

FindICU.cmake A CMake module to find International Components for Unicode (ICU) Library Note that CMake, since its version 3.7.0, includes a FindICU m

julp 29 Nov 2, 2022
CMake project for BL602 RISC-V processor

bl602_cmake_base CMake project for BL602 RISC-V processor How to build NOTE : This project uses a pre-compiled version of the Buffalo SDK (bl_iot_sdk)

null 9 Jan 6, 2022
A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development

A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development

Alexander Widerberg 1.4k Nov 17, 2022
curl cmake module libcurl build with msvc x86

curl-msvc Infomation curl cmake module libcurl build with MSVC10.0 arch (x86 | i386) source from https://github.com/curl/curl tags: curl-7_79_1 Usage

Jason Payne 0 May 16, 2022
NeoWorld is a resampler using the CMake build system

NeoWorld is a resampler using the CMake build system. It's designed for utsu, OpenUTAU, and UTAU.

null 4 Jun 24, 2022
A CMake addon that avoids you writing boilerplate code for resource management.

SHader INJ(I)ector SHINJI (originally SHader INJector) is a CMake addon that avoids you writing boilerplate code for resource management and exposes s

Lorenzo Rutayisire 6 Mar 21, 2022
A CMake starter template using CPM

Cmake Starter About A lightweight Cmake project meant for a binary application (not a shared library), tests with catch2 are configured, CPM is the pa

Matt Williams 1 Jul 14, 2022
Non-intrusive CMake dependency management

cmodule Non-intrusive CMake dependency management. Normally CMake's find_package() looks for packages installed on host system (and compiled for host

scapix.com 14 Sep 29, 2022
Simple library for embedding static resources into C++ binaries using CMake

libromfs libromfs is an easy way to bundle resources directly into any C++ application and access them through a simple interface. The main advantage

WerWolv 28 Nov 4, 2022
Project to enable using CMake from a Maven build.

CMake-Maven-Project Introduction A Maven project for the CMake build system. It can be used by including it as a plugin within your Maven project's po

null 60 Nov 14, 2022
Autotools-style configure script wrapper around CMake

configure-cmake configure-cmake is an autotools-style configure script for CMake-based projects. People building software on Linux or BSD generally ex

Evan Nemerson 81 Nov 15, 2022