Skip to content

Commit

Permalink
Merge pull request #42 from mygizli04/master
Browse files Browse the repository at this point in the history
Making MacOS build more "Double click and it builds for you"
  • Loading branch information
WAUthethird authored Sep 23, 2020
2 parents d9c520f + 099b569 commit f24118b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 29 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Though Marble Marcher CE is a largely finished game, there are still several imp
### MacOS
On macOS these can be conveniently installed using [HomeBrew](https://brew.sh):

`brew install cmake eigen sfml anttweakbar`
`brew install cmake eigen sfml anttweakbar glew glm`

The version of SFML required is 2.5.1 or newer. It has come to my attention that HomeBrew does now have this version (unlike when these instructions where first written) so installing via HomeBrew should work but you can still [download manually](https://www.sfml-dev.org/download/sfml/2.5.1/) if you wish and install using [these instructions](https://www.sfml-dev.org/tutorials/2.5/start-osx.php). You must install the Frameworks option not the dylib option or the build script may fail.
**Note that if HomeBrew installed a version of SFML older than 2.5.1 for some reason or you wish to install manually, you must remove the version of SFML that Brew installed using `brew remove sfml`.**
Expand All @@ -141,16 +141,19 @@ However, `anttweakbar` is on the AUR. Clone and build it yourself, or use and AU
### MacOS
#### Build Script
**Note for the current version: the macOS build is not yet entirely working properly so revert to the previous prerelease as required. SFML is properly included but as of yet, AntTweakBar is not so this executable will not work on machines without it installed.**
Simply run `./macOSBuild.sh`. This will generate the full Application bundle that can be used like any other application. It can even be used on systems without SFML as SFML is included in the bundle and the binary is relinked to these versions. Currently the script will only do the relinking part properly if you use SFML 2.5.1 specifically however it is planned to allow for any version. If you have another version, the script will still work, the app just won't work on a machine without SFML.
Simply run `./macOSBuildExec.sh` ( You can alternatively use macOSBuildBundle which is the old version of the script, which will generate a full .app file instead of a normal unix executable). This will generate the MarbleMarcher executable that can be used like any other application. It can even be used on systems without SFML as SFML is included in the bundle and the binary is relinked to these versions (As stated above it currently does not work on systems without AntTweakBar installed). Currently the script will only do the relinking part properly if you use SFML 2.5.1 specifically however it is planned to allow for any version. If you have another version, the script will still work, the app just won't work on a machine without SFML.
#### Manual
Due to macOS being unable to find GLM_INCLUDE_DIR it is now assumed to be ./glm . In order for this method to work, GLM should now be manually installed into that directory.
* `wget https://github.com/g-truc/glm/releases/download/0.9.9.8/glm-0.9.9.8.zip`
* `unzip ./glm-0.9.9.8.zip`
* `mkdir build && cd build`
* `cmake ..`
* `cmake -DCMAKE_CXX_FLAGS="-I/usr/local/include" ..`
* If you use `vcpkg`, add the flag `-DCMAKE_TOOLCHAIN_FILE=[path/to/vcpkg]/scripts/buildsystems/vcpkg.cmake`
* `cd ..`
* `cmake --build build`

Note that this just builds a binary and not an Application bundle like you might be used to seeing. To run properly, you must move the binary (which, after building, is `build/MarbleMarcher`) to the same folder as the assets folder. It is not recommended to build the Application bundle manually so no instructions for that are provided however you may peek in `macOSBuild.sh` to see how it is done.
Note that this just builds a binary and not an Application bundle like you might be used to seeing. To run properly, you must move the binary (which, after building, is `build/MarbleMarcher`). It is not recommended to build the Application bundle manually so no instructions for that are provided however you may peek in `macOSBuildBundle.sh` to see how it is done.

Alternatively, one can use the platform-dependent build system, for example `Make`:

Expand Down
26 changes: 0 additions & 26 deletions macOSBuild.sh

This file was deleted.

25 changes: 25 additions & 0 deletions macOSBuildBundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
echo This script will install brew and various libraries required for the build. Wait 5 seconds if you allow us to install files into your computer.
sleep 5

which -s brew
if [[ $? != 0 ]] ; then
brewinstalled=0
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

brew install cmake eigen sfml anttweakbar glm glew

cd "$(dirname "$0")"
wget https://github.com/g-truc/glm/releases/download/0.9.9.8/glm-0.9.9.8.zip
unzip glm-0.9.9.8.zip

mkdir build && cd build
cmake ..
cmake -DCMAKE_CXX_FLAGS="-I/usr/local/include" ..
cd ..
cmake --build build

cd build
echo cd "$(dirname "$0")" > MarbleMarcher.sh
echo ./MarbleMarcher >> MarbleMarcher.sh
./MarbleMarcher
28 changes: 28 additions & 0 deletions macOSBuildExec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#I wanted the compliation to be more "You just launch the script and it works" so, it's just a improved version of the manual method.

#The script installs glm manually into the working directory, because for some weird reason cmake can just never find the file. If it's against the license agreements ( the GLM this script downloads is licensed under a modified version of MIT https://github.com/g-truc/glm/blob/master/copying.txt so it SHOULD be ok. ) please let me know.

echo This script will install brew and various libraries required for the build. Wait 5 seconds if you allow us to install files into your computer.
sleep 5

which -s brew
if [[ $? != 0 ]] ; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

brew install cmake eigen sfml anttweakbar glm glew

cd "$(dirname "$0")"
wget https://github.com/g-truc/glm/releases/download/0.9.9.8/glm-0.9.9.8.zip
unzip glm-0.9.9.8.zip

mkdir build && cd build
cmake ..
cmake -DCMAKE_CXX_FLAGS="-I/usr/local/include" ..
cd ..
cmake --build build

cd build
echo cd "$(dirname "$0")" > MarbleMarcher.sh
echo ./MarbleMarcher >> MarbleMarcher.sh
./MarbleMarcher

0 comments on commit f24118b

Please sign in to comment.