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

From VCMI Project Wiki
Jump to: navigation, search
(Change categories structure)
(Replaced content with "{{Template:MovedToWebpage|https://vcmi.eu/developers/Building_macOS/}}")
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Installing dependencies =
+
{{Template:MovedToWebpage|https://vcmi.eu/developers/Building_macOS/}}
===== 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
 
<pre>
 
CMake Error: Xcode 1.5 not supported.
 
</pre>
 
You might need to specify installed version of Xcode:
 
<pre>
 
sudo /usr/bin/xcode-select --switch /Users/admin/Downloads/Xcode.app
 
</pre>
 
After that Cmake will be able to generate projects properly!
 
 
 
===== Installing [https://brew.sh/ Homebrew] =====
 
<pre>
 
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 
</pre>
 
 
 
===== Installing dependencies using Homebrew =====
 
<pre>
 
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
 
</pre>
 
 
 
= Building VCMI in command line with Makefiles =
 
===== Getting and configuring VCMI =====
 
<pre>
 
# 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
 
</pre>
 
You can as well build VCMI without Qt5 or launcher by disabling it:
 
<pre>
 
# 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
 
</pre>
 
 
 
===== Building and packaging VCMI =====
 
<pre>
 
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
 
</pre>
 
 
 
= Building VCMI with Xcode =
 
 
 
= Building VCMI with Qt Creator =
 
 
 
= Running VCMI =
 
You can run VCMI from DMG, but it's will also work from your IDE be it Xcode or Qt Creator.
 
 
 
Alternatively you can run binaries directly from "bin" directory:
 
<pre>
 
~/DEV/cmake/bin/vcmilauncher
 
~/DEV/cmake/bin/vcmiclient
 
~/DEV/cmake/bin/vcmiserver
 
</pre>
 
CMake include commands to copy all needed assets from source directory into "bin" on each build. They'll work when you build from Xcode too.
 
 
 
'''Be aware you still need directories "Data", "Mp3" and "Maps" from Heroes 3 game assets in VCMI app data directory:'''
 
<pre>
 
~/Library/Application\ Support/vcmi/
 
</pre>
 

Latest revision as of 16:08, 16 July 2024

Logo256.png    Page moved to VCMI-Homepage