Skip to content

Commit

Permalink
Merge pull request #80 from nevkontakte/master
Browse files Browse the repository at this point in the history
Overhaul FWL build process using GitHub actions automation
  • Loading branch information
sparker256 authored Nov 6, 2021
2 parents cb6509f + edf7229 commit b32fdbd
Show file tree
Hide file tree
Showing 36 changed files with 301 additions and 2,578 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CMake

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
release:
type: [created, edited]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v2

- name: "Windows: Configure environment"
if: runner.os == 'Windows'
shell: bash
run: |
# Select MinGW toolchain instead of the default MSVC.
echo "CMAKE_GENERATOR=MinGW Makefiles" >> $GITHUB_ENV
- name: "Linux: Install dependency libraries"
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends freeglut3-dev libudev-dev libopenal-dev
- name: Configure CMake
working-directory: ${{github.workspace}}/src
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
working-directory: ${{github.workspace}}/src
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

- uses: actions/upload-artifact@v2
with:
name: binaries
path: ${{github.workspace}}/build/*.xpl
if-no-files-found: error

package:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v2
with:
name: binaries
path: FlyWithLua/64

- uses: actions/upload-artifact@v2
with:
name: FlyWithLua_plugin
path: |
${{github.workspace}}/FlyWithLua*
if-no-files-found: error

- name: Create plugin archive
if: github.event_name == 'release'
run: zip -r FlyWithLua_all_platforms.zip FlyWithLua/

- name: Upload binaries to release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: FlyWithLua_all_platforms.zip
tag: ${{ github.ref }}
overwrite: true
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions FlyWithLua/64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.xpl
Binary file removed FlyWithLua/64/lin.xpl
Binary file not shown.
Binary file removed FlyWithLua/64/mac.xpl
Binary file not shown.
Binary file removed FlyWithLua/64/win.xpl
Binary file not shown.
187 changes: 171 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FlyWithLua for X-Plane 11
=========================
# FlyWithLua for X-Plane 11

[![Build Status](https://travis-ci.org/X-Friese/FlyWithLua.svg)](https://travis-ci.org/X-Friese/FlyWithLua)
[![CMake](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml/badge.svg)](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml)

This is the official source code repository for the FlyWithLua plugin project.

Expand All @@ -13,20 +12,176 @@ You will find a binary version ready to use in X-Plane 9 or 10 in the [download

The new versions are X-Plane 11 only and the binary is also in the [download area of x-plane.org](https://forums.x-plane.org/index.php?/files/file/38445-flywithlua-ng-next-generation-edition-for-x-plane-11-win-lin-mac/).

If you want to grab a most nightly binary, just copy the subfolder `FlyWithLua` into your X-Plane's plugin folder.
If you want to grab a most nightly binary, just download `FlyWithLua_plugin.zip` from the most recent [GitHub Actions build](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml?query=branch%3Amaster) and unpack it into your X-Plane's plugin folder.

Copyright (c) 2012 Carsten Lynker
> Copyright (c) 2012 Carsten Lynker
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software
> and associated documentation files (the "Software"), to deal in the Software without restriction,
> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
> and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
> subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
> TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN THE SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
## Building FlyWithLua from source

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
### On windows

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
1. Install required software using [Chocolatey](https://chocolatey.org/) using admin command prompt:

```
choco install git cmake
choco install mingw --version 8.1.0
```
You can also install the same programs manually if you prefer.
2. Checkout and configure the project:
```
git clone https://github.com/X-Friese/FlyWithLua.git
cd FlyWithLua
cmake -G "MinGW Makefiles" -S .\src -B .\build -DCMAKE_BUILD_TYPE=RelWithDebInfo
```
3. Build the project and copy the plugin DLL into the appropriate directory:
```
cmake --build .\build
cp .\build\win.xpl .\FlyWithLua\64\
```
### On Ubuntu:
1. Install required software:
```
sudo apt-get install -y --no-install-recommends build-essential cmake git freeglut3-dev libudev-dev libopenal-dev

```
2. Checkout and configure the project:
```
git clone https://github.com/X-Friese/FlyWithLua.git
cd FlyWithLua
cmake -S ./src -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo
```
3. Build the project and copy the plugin DLL into the appropriate directory:
```
cmake --build ./build
cp ./build/lin.xpl ./FlyWithLua/64
```
### On OS X:
1. Install XCode, Git, CMake (Homebrew can be convenient for this).
2. Checkout and configure the project:
```
git clone https://github.com/X-Friese/FlyWithLua.git
cd FlyWithLua
cmake -S ./src -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo
```
3. Build the project and copy the plugin DLL into the appropriate directory:
```
cmake --build ./build
cp ./build/mac.xpl ./FlyWithLua/64
```
### Additional tips
<details>
<summary>How to cross-compile FlyWithLua on Ubuntu for Windows and OS X</summary>
Note: this is documented just in case, but generally is not recommended. Using native builds and/or GitHub Actions workflow is more convenient and less prone to errors and bugs.
Install cross-compiling toolchains:
```
# Install Windows cross-compiling toolchain (MinGW).
sudo apt-get install -y --no-install-recommends mingw-w64 g++-mingw-w64 && apt-get clean

# Install OS X cross-compiling toolchain (clang).
apt-get install -y --no-install-recommends clang curl && apt-get clean
#Build arguments
OSXCROSS_REPO="tpoechtrager/osxcross"
OSXCROSS_REVISION="f4ba4facae996b3b14d89eb62c0384564f7368b5"
DARWIN_SDK_VERSION="10.11"
DARWIN_SDK_URL="https://github.com/apriorit/osxcross-sdks/raw/master/MacOSX10.11.sdk.tar.xz"
CROSSBUILD=1

mkdir -p "/tmp/osxcross" \
&& cd "/tmp/osxcross" \
&& curl -sSLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \
&& tar --strip=1 -xzf osxcross.tar.gz \
&& rm -f osxcross.tar.gz \
&& curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \
"${DARWIN_SDK_URL}" \
&& UNATTENDED=1 JOBS=4 SDK_VERSION=${DARWIN_SDK_VERSION} ./build.sh \
&& mv target /usr/osxcross \
&& mv tools /usr/osxcross/ \
&& rm -rf "/usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr/share/man"

export PATH="$PATH:/usr/osxcross/bin"
```
Build FlyWithLua:
```
git clone https://github.com/X-Friese/FlyWithLua.git
cd FlyWithLua

# For Windows:
cmake -S ./src -B ./build-win -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=src/Toolchain-mingw-w64-x86-64.cmake
cmake --build ./build-win

# For OS X:
cmake -S ./src -B ./build-mac -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=src/Toolchain-ubuntu-osxcross-10.11.cmake -DCMAKE_FIND_ROOT_PATH=/usr/osxcross/SDK/MacOSX10.11.sdk/
cmake --build ./build-mac
```
</details>
<details>
<summary>How to create Code Blocks Project From CmakeLists.txt File</summary>
- First you will need to install MinGW-64, Cmake, CodeBlocks and Git.
- Create a CodeBlocks Projects folder like this.
- `mkdir CodeBlocksProjects`
- `cd D:\CodeBlocksProjects`
- `git clone https://github.com/X-Friese/FlyWithLua.git`
- `cd FlyWithLua/src`
- `mkdir build`
- `cd build`
- `cmake -G "CodeBlocks - MinGW Makefiles" ..`
- Open CodeBlocks and use "Open an existing project" browsing to "FlyWithLua/src/build/FlyWithLua.cbp" and click on the Open button.
At that point you should be able to build FlwWithLua.
</details>
<details>
<summary>How To Build Using QT Creator From the CmakeLists.txt File</summary>
- Create a QT Creator Projects folder like this.
- `mkdir QTCreatorProjects`
- `cd D:\QTCreatorProjects`
- `git clone https://github.com/X-Friese/FlyWithLua.git`
- Using QT Creator use "File" > "Open File or Project" and browse to "FlyWithLua/src/CMakeLists.txt" then click on the "Open" button.
At that point you should be able to build FlyWithLua.
</details>
23 changes: 0 additions & 23 deletions buildFlyWithLua_NG

This file was deleted.

1 change: 0 additions & 1 deletion docker/.gitignore

This file was deleted.

54 changes: 0 additions & 54 deletions docker/Dockerfile

This file was deleted.

Loading

0 comments on commit b32fdbd

Please sign in to comment.