Skip to content

Compiling Wagic with CMake

Xawotihs edited this page Jun 6, 2016 · 1 revision

Compiling wagic with CMake is currently only possible in the "cmake" branch until it gets merged on the "master" branch. Using this method enable using the same files to generate the project files for all compiling platforms and all cross-compiling targets.

Getting the sources of the cmake branch

git clone https://github.com/WagicProject/wagic.git myWagic
cd myWagic
git fetch
git checkout cmake
git submodule update --init --recursive

Getting CMake

You can always download CMake for Linux, Macosx and Windows here. Depending on your platform, you could probably use your package manager (Linux) or brew (Macosx) to install CMake.

Getting the tools required to build

Install Android NDK, Android SDK and ANT for Android flavor. Install PSP SDK for the PSP flavor.

On Linux

Be sure to have all the usual dev stuff (make, gcc, ...). Install Qt5 packages or download Qt5 SDK for the Qt flavor.

On Macosx

Install brew and Qt5 for the Qt flavor. Install brew and theos iOS toolchain for the iOS flavor.

On Windows

Install Visual studio for the Windows flavor.

Using CMake to generate the project files and build Wagic in command line

In the Wagic project directory

On Linux for PSP

mkdir build_psp
cd build_psp
cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeModules/psp.toolchain.cmake ..
make -j4
cd ..

On Linux for Android

mkdir build_android
cd build_android
cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeModules/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=android-10 ..
make -j4
cd ..

On Linux or Macosx for Linux or Macosx based on Qt

mkdir build_qt_widget
cd build_qt_widget
cmake -Dbackend_qt_widget=ON -Dbackend_qt_console=OFF ..
make -j4 wagic
cd ..

On Linux or Macosx for Linux or Macosx based on SDL

mkdir build_SDL
cd build_SDL
cmake -Dbackend_sdl=ON ..
make -j4 wagic
cd ..

On Macosx for iOS based on Theos alternative toolchain

cmake -DCMAKE_TOOLCHAIN_FILE=CMakeModules/ios-theos.toolchain.cmake -DTHEOS_PATH=theos .
cp projects/mtg/iOS/control .
make -j4 -f makefile.ios package

On Windows for Windows

cmake -Dbackend_sdl=ON ..
msbuild .\wagic.sln /p:Configuration=Release