The International Simutrans Forum


Author Topic: CMake build support  (Read 1634 times)

0 Members and 1 Guest are viewing this topic.

Offline ceeac

  • Devotee
  • *
  • Posts: 139
CMake build support
« on: August 05, 2018, 08:50:34 AM »
This patch is a work-in-progress attempt to provide support for building Simutrans with CMake.

Currently this patch only works on Linux, not on Windows or macOS.
What should work:
  • Support for clang and gcc compilers
  • Building Simutrans
  • Building makeobj
  • Building nettool
  • Using CCache to speed up compilation (if available)
  • Automatically selecting a suitable graphics backend based on installed libraries (can be overridden manually)
  • Freetype support
  • MiniUPNP support
  • Automatically pulling revision information from git or svn
  • Profiling information support (-DPROFILE)
There is also a github branch available:

Instructions for building (with the patch applied):
Code: [Select]
mkdir build
cd build
cmake ..

Instructions for building from git:
Code: [Select]
git clone simutrans
cd simutrans
git checkout cmake
mkdir build
cd build
cmake ..

Please test and provide feedback.  :)

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5643
  • Languages: EN, NO
Re: CMake build support
« Reply #1 on: August 05, 2018, 11:04:15 AM »
We're having trouble keeping the current Makefile system working on all platforms, and keeping the Makefile and Visual Studio projects synchronized. Yet another build system in parallel is not what we need. If the build system's dependencies are rather small and can generate the Visual Studio project from some cross-platform model, it sounds promising as a complete replacement for what we got.

Personally, I've always had trouble getting cmake to work on mingw.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10005
  • Languages: De,EN,JP
Re: CMake build support
« Reply #2 on: August 05, 2018, 10:57:55 PM »
There is an autoconf working for mingw and linux (and possibly even MacOS, if someone would give feedback). I have no experience with cmake, and I am not sure how easy this is to install. Currently the MSVC is maintained seperately from the rest, and if thing could get streamlines, it would be really nice. But my past experience made me very cautious on portability promises.

I think Dwachs uses clang, and I think no changes are needed to the makefile. I could also use our makefile for the nightly crosscompilation, so it seems quite robust and tolerates even old-stable debian (what my server runs).

Cmake would need to fulfill all this. But then it could be of great help. I may test it given time later in August.