Skip to content

Commit

Permalink
Ver. 1.12 Added the build files I use to build all platforms on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
sparker256 committed May 11, 2018
1 parent cff4f7e commit 607c7ca
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
51 changes: 51 additions & 0 deletions Make_MacOnLinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#
# This shell script creates a fat XPlane-plugin
# (see http://www.xsquawkbox.net/xpsdk/mediawiki/BuildInstall#Fat_Plugins)
# for Windows, Linux and MacOS, all in 32 and 64 bits
#
# The script runs on a Linux host and cross-compiles the plugin for
# all the mentioned architectures. It has been tested on a Fedora 22
# x86_64 system.
#
# There is quite a number of prerequisites that must be installed
# in order for this script to run:
#
# Prerequisite to build X-Plane plugins:
# - X-Plane SDK available at http://www.xsquawkbox.net/xpsdk/mediawiki/Download
# [Make sure to use a version >=2.1.1 for 64 bit compatibility!,
# I used 2.1.3. Download it and unzip it in THIS folder,
# which will actually populate the SDK directory.]
#
#
# Build system for MACOS target:
# - osxcross [(https://github.com/tpoechtrager/osxcross)
# with OSX SDK installed (see osxcross README file)
# This will give you a bit of work, since it will
# recompile the clang compiler on linux. But it
# actually works!]
#

# CHANGE THIS: define location and version of OSX SDK installed
# with osxcross.
# OSXSDK=~/src/osxcross/target/SDK/MacOSX10.10.sdk
OSXSDK=~/X-Plane_OsxCrossBuild/osxcross/target/SDK/MacOSX10.11.sdk


# echo commands
set -x

# set name and location of output directory
TARGETDIR=release

# create output directory structure
# rm -rf $TARGETDIR
mkdir -p $TARGETDIR/Xbtn2cmd/mac_x64


# build hybrid OSX xchecklist mac_x64 version
make -f Makefile_xbtn2cmd_1020_mac_x64 clean
OS=MACOSX CC=o64-clang++ SDK=$OSXSDK TARGET=$TARGETDIR/Xbtn2cmd/mac_x64/Xbtn2cmd.xpl make -f Makefile_xbtn2cmd_mac_x64

# clean up
make -f Makefile_xbtn2cmd_mac_x64 clean
50 changes: 50 additions & 0 deletions Makefile_xbtn2cmd_mac_x64
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This makefile has been modified to accept
# external environment variables


OS ?= MACOSX


ifeq ($(OS), MACOSX)
CC ?= gcc-4.2
DEFINES += -DAPL=1 -DIBM=0 -DLIN=0 -DXPLM200 -DXPLM210 -DXPLM300 -DXPLM301
SDK ?= /Developer/SDKs/MacOSX10.5.sdk
#ARCH = -arch i386 -mmacosx-version-min=10.5
ARCH ?= -arch i386 -arch x86_64 -mmacosx-version-min=10.5
INC += -I../SDK/CHeaders/XPLM
INC += -I../SDK/CHeaders/Widgets
#INC += -Ihidapi/hidapi
CFLAGS += -Wall -O2 $(ARCH) -D$(OS) -isysroot $(SDK) $(INC) -fvisibility=hidden
LDFLAGS += $(ARCH) -isysroot $(SDK)
LDDYNFLAGS += -bundle -undefined dynamic_lookup -single_module
LIBS += -framework IOKit -framework CoreFoundation -framework OpenGL
TARGET ?= mac.xpl
endif


all:Xbtn2cmd.xpl

OBJS = Xbtn2cmd.o gui_window.o inireader.o readinifile.o


Xbtn2cmd.xpl: $(OBJS)
$(CC) $(LDFLAGS) $(LDDYNFLAGS) $(OBJS) -o Xbtn2cmd.xpl $(LIBS)
cp Xbtn2cmd.xpl $(TARGET)

Xbtn2cmd.o: src/Xbtn2cmd.cpp
$(CC) -c -pipe $(CFLAGS) $(SDK) $(INC) $(DEFINES) -o Xbtn2cmd.o src/Xbtn2cmd.cpp

gui_window.o: src/gui_window.cpp
$(CC) -c -pipe $(CFLAGS) $(SDK) $(INC) $(DEFINES) -o gui_window.o src/gui_window.cpp


inireader.o: src/inireader.cpp
$(CC) -c -pipe $(CFLAGS) $(SDK) $(INC) $(DEFINES) -o inireader.o src/inireader.cpp


readinifile.o: src/readinifile.cpp
$(CC) -c -pipe $(CFLAGS) $(SDK) $(INC) $(DEFINES) -o readinifile.o src/readinifile.cpp


clean:
rm -f *.o Xbtn2cmd.xpl
9 changes: 9 additions & 0 deletions buildGithubXbtn2cmd_lin_win_mac_OnLinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
#
cd X-Plane_Github_Plugins/xbtn2cmd &&
./build_lin_win &&
./Make_MacOnLinux &&

exec $SHELL
#

26 changes: 26 additions & 0 deletions build_lin_win
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
make distclean >/dev/null
rm -rf release
mkdir -p release/Xbtn2cmd/lin_x64 &&
mkdir -p release/Xbtn2cmd/win_x64 &&


qmake -spec linux-g++-4.8-64 Xbtn2cmd_lin_x64.pro && make &&
cp plugin_lin_x64/liblin.xpl.so release/Xbtn2cmd/lin_x64/Xbtn2cmd.xpl
if [ $? != 0 ] ; then
exit
fi

make distclean >/dev/null
qmake -spec win32-g++ Xbtn2cmd_win_x64.pro && qmake -set CROSS_COMPILE x86_64-w64-mingw32- && make &&
cp plugin_win_x64/release/win.xpl1.dll release/Xbtn2cmd/win_x64/Xbtn2cmd.xpl
if [ $? != 0 ] ; then
exit
fi


make distclean >/dev/null

#

0 comments on commit 607c7ca

Please sign in to comment.