DarkRadiant - Compiling in macOS: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
TODO
{{infobox|text=Note that Mac OS X support is still kind of "beta" at this stage. If you are able to test and/or help in this area, please stop by in the [https://forums.thedarkmod.com/ forums].}}
 
At the current point there's no Bundle or Installer for DarkRadiant yet, so one needs to compile the application themselves. The following info has been gathered in OS X El Capitan. Depending on your OS X version the steps might differ a bit.
 
I managed to compile and run the application, but there are a few things not fully working, like the tabs in the Group Dialog, and the XY view was not refreshing itself correctly - that might be due to my poor Mac environment though.
 
== Install Xcode ==
In my case I went with an Xcode version that was supported in El Capitan, which happened to be Xcode 8 and something. I think you're able to obtain this through the App Store, but there are dmg files floating available for download as well. The Xcode installation will give you the necessary C++ compilers and libraries.
 
== Install MacPorts ==
DarkRadiant depends on a couple of open source libraries that are not available by default on Mac OS X, but they have been packaged by the MacPorts folks. Get the MacPorts suitable for your OS X version from their website: https://distfiles.macports.org/MacPorts/
 
Once installed, open a fresh Terminal (Open Finder > Applications > Utilities > Terminal) and let MacPorts update its port library:
sudo port -v selfupdate
 
== Install required Libraries ==
Next up, get the libraries for DarkRadiant through the MacPorts command line tool <tt>port</tt>
sudo port install jpeg wxwidgets-3.0 pkgconfig libsigcxx2 freetype ftgl glew boost libxml2 freealut libvorbis libogg openal
Answer Yes if any of these prompts you whether you want to install any dependencies for these.
 
== Download the Code ==
Open the Terminal (if you haven't already) and head to your home folder to download the DarkRadiant source code:
cd ~
git clone https://github.com/codereader/DarkRadiant.git
 
== Compile the Xcode Project ==
Start Xcode and open the project file in <tt>tools/xcode/DarkRadiant.xcodeproj</tt>. Compilation is supposed to work out of the box, so hit Command-B (⌘-B) to start the build process. (It might be a good idea to check whether you're building a Debug or a Release build beforehand, by accessing the Schemes dropdown menu in the tool bar (Right-click the schemes menu and hit "Edit Scheme...", there's a dropdown box in that dialog.)
 
Once completed, the output binary (including the .app file) will be located in a folder similar to this:
~/Library/Developer/Xcode/DerivedData/DarkRadiant-somethingsomething/Build/Products/Release
The <tt>DarkRadiant.app</tt> is a portable package that can be launched right away. You can copy it to some other location just as fine. (Note: there's a post-compilation script configured in the Xcode project that will copy and setup the dependency libraries DarkRadiant is using).
 
== Alternative: Configure and Make ==
Alternatively, you can make use of the automake scripts, as used in Linux. For this step you'll need to autotools, so get them through MacPorts:
sudo port install automake autoconf libtool
Change to the folder DarkRadiant was cloned to (this is <tt>~/DarkRadiant</tt> if you ran <tt>git clone</tt> in your home folder) and type this to configure the build:
cd ~/DarkRadiant
./autogen.sh
./configure --enable-darkmod-plugins CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" --with-wx-config=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config
Since MacPorts is installing its libraries in the /opt/local tree, one needs to pass the include and libs folder paths to the configure script. The wx-config application is not available in the PATH, that's why the <tt>--with-wx-config</tt> argument has to be specified as well. Once the configure script has successfully finished, type
make --jobs=2
make install
to start compilation. If you don't want <tt>make install</tt> to place DarkRadiant into /usr/local, add a <tt>--prefix</tt> argument to the <tt>configure</tt> script above.
Cross your fingers and wait for the build to finish without errors, then start the application by typing
/usr/local/bin/darkradiant
in the Terminal.


{{coding}}
{{coding}}
{{darkradiant|sort=Compilation}}
{{darkradiant|sort=Compilation}}

Latest revision as of 10:00, 12 January 2020

Note that Mac OS X support is still kind of "beta" at this stage. If you are able to test and/or help in this area, please stop by in the forums.

At the current point there's no Bundle or Installer for DarkRadiant yet, so one needs to compile the application themselves. The following info has been gathered in OS X El Capitan. Depending on your OS X version the steps might differ a bit.

I managed to compile and run the application, but there are a few things not fully working, like the tabs in the Group Dialog, and the XY view was not refreshing itself correctly - that might be due to my poor Mac environment though.

Install Xcode

In my case I went with an Xcode version that was supported in El Capitan, which happened to be Xcode 8 and something. I think you're able to obtain this through the App Store, but there are dmg files floating available for download as well. The Xcode installation will give you the necessary C++ compilers and libraries.

Install MacPorts

DarkRadiant depends on a couple of open source libraries that are not available by default on Mac OS X, but they have been packaged by the MacPorts folks. Get the MacPorts suitable for your OS X version from their website: https://distfiles.macports.org/MacPorts/

Once installed, open a fresh Terminal (Open Finder > Applications > Utilities > Terminal) and let MacPorts update its port library:

sudo port -v selfupdate

Install required Libraries

Next up, get the libraries for DarkRadiant through the MacPorts command line tool port

sudo port install jpeg wxwidgets-3.0 pkgconfig libsigcxx2 freetype ftgl glew boost libxml2 freealut libvorbis libogg openal

Answer Yes if any of these prompts you whether you want to install any dependencies for these.

Download the Code

Open the Terminal (if you haven't already) and head to your home folder to download the DarkRadiant source code:

cd ~
git clone https://github.com/codereader/DarkRadiant.git

Compile the Xcode Project

Start Xcode and open the project file in tools/xcode/DarkRadiant.xcodeproj. Compilation is supposed to work out of the box, so hit Command-B (⌘-B) to start the build process. (It might be a good idea to check whether you're building a Debug or a Release build beforehand, by accessing the Schemes dropdown menu in the tool bar (Right-click the schemes menu and hit "Edit Scheme...", there's a dropdown box in that dialog.)

Once completed, the output binary (including the .app file) will be located in a folder similar to this:

~/Library/Developer/Xcode/DerivedData/DarkRadiant-somethingsomething/Build/Products/Release

The DarkRadiant.app is a portable package that can be launched right away. You can copy it to some other location just as fine. (Note: there's a post-compilation script configured in the Xcode project that will copy and setup the dependency libraries DarkRadiant is using).

Alternative: Configure and Make

Alternatively, you can make use of the automake scripts, as used in Linux. For this step you'll need to autotools, so get them through MacPorts:

sudo port install automake autoconf libtool 

Change to the folder DarkRadiant was cloned to (this is ~/DarkRadiant if you ran git clone in your home folder) and type this to configure the build:

cd ~/DarkRadiant
./autogen.sh
./configure --enable-darkmod-plugins CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" --with-wx-config=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config

Since MacPorts is installing its libraries in the /opt/local tree, one needs to pass the include and libs folder paths to the configure script. The wx-config application is not available in the PATH, that's why the --with-wx-config argument has to be specified as well. Once the configure script has successfully finished, type

make --jobs=2
make install

to start compilation. If you don't want make install to place DarkRadiant into /usr/local, add a --prefix argument to the configure script above. Cross your fingers and wait for the build to finish without errors, then start the application by typing

/usr/local/bin/darkradiant

in the Terminal.