CMake as a build tool ?

For code related discussions and questions
Post Reply
Vincent
Trained
Trained
Posts: 103
Joined: 06 Aug 2016, 17:24

CMake as a build tool ?

Post by Vincent »

Currently wz2100 is using autotools on Linux and Mac and a separate .sln for MSVC. Maintaining 2 build systems is usually quite tedious and is error prone, that's why a lots of c++ project use cmake.

A couple of weeks ago Microsoft announced the vcpkg project which is an "apt-get source" like tools : it fetches sources and their dependencies (as source too), build them and made the includes/binaries available system wide. It's heavily based on cmake (the build script is actually a cmake script) and it provides helpers to run vcpkg from any cmake script. This means that a project using cmake can automatically download and build dependency on windows which heavily simplifies the build process.

Currently some dependencies are not yet supported by vcpkg though : harfbuzz libtheora libvorbis qt5 and libintl are missing. I'm about to submit harfbuzz (I have an issue with the install part of the script) and I think it's not far fetched to ask user to download qt5 from qt website instead of building it from source (which is likely to take age) ; since libintl is widely used by open source project I'm expecting it to be provided in a near future. This means a cmake based script on windows would only have to build libtheora and libvorbis. I think this may be a viable way to proceed.

(I'm posting this here since I can't reply to #4500)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: CMake as a build tool ?

Post by Per »

I did write a cmake port at some point (probably lost it by now), but had issues getting the cross-compilation to work, as well as porting and adapting all the various hacks and workarounds for translations.

While I'm not opposed to changing, you need to be able to test both use cases provided currently by autoconf to do it - that is native compilation on linux, and cross-compilation from linux to windows (we currently use MXE for this). And know how the translation stuff works. It would be fairly complicated.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: CMake as a build tool ?

Post by cybersphinx »

Vincent wrote:Currently wz2100 is using autotools on Linux and Mac
Don't Macs use the xcode stuff in macosx/ anymore? And do cmake autogenerated Mac and Windows builds work well these days? I vaguely remember people being unsatisfied with that.
We want information... information... information.
Vincent
Trained
Trained
Posts: 103
Joined: 06 Aug 2016, 17:24

Re: CMake as a build tool ?

Post by Vincent »

What do you mean ? Windows and Linux build of cmake works for several project.
WZ2100 doesn't have a cmake build atm.
Vincent
Trained
Trained
Posts: 103
Joined: 06 Aug 2016, 17:24

Re: CMake as a build tool ?

Post by Vincent »

I made a cmake based build system in my master branch, I'd like to make it the default one for msvc based build with the help of vcpkg.
I ported almost all dependencies to vcpkg : gettext is the only missing package atm. The cmake built wz2100 is working but with no internationalization. It's easier to maintain cmake files than to manually modify msbuild ones. About internationalisation I have a vcpkg based libintl that I need to polish before submitting to vcpkg github. The Tools (msgfmt, xgettext) seem harder to port.

What made translations difficult to generate with cmake ? It looks like there is a macro available that can parse .po files :
https://cmake.org/cmake/help/v3.0/modul ... ttext.html
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: CMake as a build tool ?

Post by Per »

I don't remember. It has been a while. (Not sure if that macro existed back then.) However, we do some special magic on the data files to extract strings - that might give you some issues.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: CMake as a build tool ?

Post by cybersphinx »

AFAIR make only does the po → mo conversion (automatically) and string updating from source files (update-po); both are pretty essential though. String extraction from other files is in the po/update-{po.sh,custom.py} scripts.

Another make thing we use (for the buildbot) is "make distcheck", which makes a tarball and checks if that compiles (and then do the Windows cross-compile from that?).
We want information... information... information.
Post Reply