Code Monkey home page Code Monkey logo

x-plane-plugin-cross-compile-showcase's Introduction

X-Plane cross-compile example with zig

This project is meant to showcase how to use the zig toolchain to cross-compile a plugin for X-Plane 12 on Linux/Ubuntu.

The script compiles plugins for

  • Windows x86
  • Linux x86
  • Mac Universal - x86 + ARM

This showcase is based on the Menu SDK Sample from the X-Plane developer documentation. To support cross-compiling for Macs based on the M1/M2 processors (ARM64), the project is using the X-Plane beta SDK supporting the new 4.0 API and ARM64 Macs.

Install

Install zig using snap

https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager

sudo snap install zig --classic --beta
sudo apt install make

Install cctools-port

https://github.com/tpoechtrager/cctools-port

This project is being used to create the Universal (fat) binary for Mac Intel/ARM64. In order to compile the project, we need a clang/clang++ compiler. Zig is LLVM based and provides this capability. For the cctools-port to compile/install we need the configure script to find the clang/clang++ compiler. We are doing this by creating 2 scripts

cat <<EOF > /usr/bin/clang
#!/bin/bash

zig cc "\$@"
EOF

cat <<EOF > /usr/bin/clang++
#!/bin/bash

zig c++ "\$@"
EOF

sudo chmod 755 /usr/bin/clang
sudo chmod 755 /usr/bin/clang++
git clone https://github.com/tpoechtrager/cctools-port.git
cd cctools-port/cctools
./configure
make
sudo make install

Usage

make

You will find the resulting plugin in build/X-Plane-Menu-SDK-Sample. To install it, move the directory to your X-Plane installation into the X-Plane 12/Resources/plugins directory.

x-plane-plugin-cross-compile-showcase's People

Contributors

ralphzimmermann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.