Difference between revisions of "How to build VCMI (macOS)"

From VCMI Project Wiki
Jump to: navigation, search
(Installing dependencies)
(Installing dependencies using Homebrew)
Line 25: Line 25:
 
===== Installing dependencies using Homebrew =====
 
===== Installing dependencies using Homebrew =====
 
<pre>
 
<pre>
brew install git cmake sdl2 sdl2_ttf sdl2_image boost ffmpeg
+
brew install git cmake sdl2 sdl2_ttf sdl2_image boost ffmpeg minizip
 
brew install sdl2_mixer --with-smpeg2
 
brew install sdl2_mixer --with-smpeg2
 
# Now install Qt5 for launcher
 
# Now install Qt5 for launcher

Revision as of 10:55, 13 August 2017

Installing dependencies

Installing Xcode

App Store -> Xcode Launch it after the installation to agree with it's license terms.

Alternatively Xcode can be downloaded from Apple Developers website. Registration is easier and every possible version is available: https://developer.apple.com/download/more/

Setting Xcode version Xcode

In case you have some weird CMake errors during generation attempts such as

CMake Error: Xcode 1.5 not supported.

You might need to specify installed version of Xcode:

sudo /usr/bin/xcode-select --switch /Users/admin/Downloads/Xcode.app

After that Cmake will be able to generate projects properly!

Installing Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing dependencies using Homebrew
brew install git cmake sdl2 sdl2_ttf sdl2_image boost ffmpeg minizip
brew install sdl2_mixer --with-smpeg2
# Now install Qt5 for launcher
brew install qt5
# Make sure to read brew output on Qt carefully
# It's will tell you how to add Qt to your $PATH environment variable
#
# Currently it's can be done like that
# echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile

Building VCMI in command line with Makefiles

Getting and configuring VCMI
# You can choose any directory
mkdir ~/DEV && cd ~/DEV
# Clone VCMI with all submodules
git clone -b develop --depth 1 --recursive  https://github.com/vcmi/vcmi.git
# Creating directory for building
mkdir cmake && cd cmake
cmake ../vcmi -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -Wno-devc

You can as well build VCMI without Qt5 or launcher by disabling it:

# But please don't do that unless you know what you're doing
cmake ../vcmi -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_LAUNCHER=0 -Wno-devc
Building and packaging VCMI
cd ~/DEV/cmake
# Start build using cmake
cmake --build . -- -j 4
# Or you can as well use simple
# make -j 4

# When build is completed you can trigger packaging into DMG
cpack
# After file named such as "vcmi-0.99.dmg" will be created
Running VCMI

You can run VCMI from DMG, but after "cpack" is finished you can run unpacked executables as well

Go to "build" and launch executable directly; alternatively

~/DEV/cmake/build/VCMI.app/Contents/MacOS/vcmilauncher
~/DEV/cmake/build/VCMI.app/Contents/MacOS/vcmiclient
~/DEV/cmake/build/VCMI.app/Contents/MacOS/vcmiserver