We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1597 - CMake-based build system for SDL2
Summary: CMake-based build system for SDL2
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-08 01:29 UTC by Marcus von Appen
Modified: 2012-11-16 04:24 UTC (History)
2 users (show)

See Also:


Attachments
Patch file for SDL HG, apply with patch -p1 < cmake_20120827.diff (86.89 KB, patch)
2012-09-08 01:29 UTC, Marcus von Appen
Details | Diff
Updated patch file for SDL HG, apply with patch -p1 < cmake_20120919.diff (85.35 KB, patch)
2012-09-19 01:24 UTC, Marcus von Appen
Details | Diff
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121020.diff (85.32 KB, patch)
2012-10-20 02:09 UTC, Marcus von Appen
Details | Diff
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121116.diff (85.54 KB, patch)
2012-11-15 23:27 UTC, Marcus von Appen
Details | Diff
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121116_1.diff (85.61 KB, patch)
2012-11-15 23:35 UTC, Marcus von Appen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus von Appen 2012-09-08 01:29:21 UTC
Created attachment 945 [details]
Patch file for SDL HG, apply with patch -p1 < cmake_20120827.diff

Based on the discussion of http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-August/085408.html, I created a CMake-based build system for SDL2, which can be used as replacement or alternative to the autotools-based building for SDL2, as described in http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-August/085504.html.

The build system has been tested sucessfully with FreeBSD, various Linux distributions, VS.NET 2010, MinGW and Msys, on 64-bit and 32-bit platforms. Also, it was reported to work for XCode.

It does not alter any existing configuration and hence can live side-by-side with the existing projects and build systems, that currently exist.
Comment 1 Marcus von Appen 2012-09-19 01:24:04 UTC
Created attachment 950 [details]
Updated patch file for SDL HG, apply with patch -p1 < cmake_20120919.diff

This removes the recently dropped Windows CE support code portions and fixes a minor issue with building only the static OR shared library.
Comment 2 Marcus von Appen 2012-10-20 02:09:59 UTC
Created attachment 976 [details]
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121020.diff

This adds the libm/* source code files to the project to reflect recent change for the MinGW ABI compatibility as of rev:dccafb0699dc (http://hg.libsdl.org/SDL/rev/dccafb0699dc)
Comment 3 Alex Barry 2012-10-23 09:17:21 UTC
To incorporate cygwin with gcc >= 4.0, I changed CMakeLists.txt with the following (sorry, no patch...does this make me a bad person?) [changes lines 147-153]:

if(CYGWIN)
  if(CMAKE_C_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
    include_directories("-I/usr/include/mingw")
    list(APPEND EXTRA_LDFLAGS "-mno-cygwin")
    set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw")
    list(APPEND SDL_LIBS "-mno-cygwin")
  endif(CMAKE_C_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
endif(CYGWIN)
Comment 4 Gabriel Jacobo 2012-11-15 03:14:05 UTC
Sam gave the go ahead, so I can apply this on the official repository if you'd like, can you update the patch and let me know?
Comment 5 Marcus von Appen 2012-11-15 23:27:27 UTC
Created attachment 990 [details]
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121116.diff

Find attached the most recent patch, which incorporates a change for cygwin as discussed in http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-October/086177.html
Comment 6 Marcus von Appen 2012-11-15 23:35:55 UTC
Created attachment 991 [details]
Updated patch file for SDL HG, apply with patch -p1 < cmake_20121116_1.diff

Support the latest changes to the file size API as of http://hg.libsdl.org/SDL/rev/b716011e53ce
Comment 7 Gabriel Jacobo 2012-11-16 04:24:40 UTC
http://hg.libsdl.org/SDL/rev/45a21e50ba5e

I added a README.cmake file and changed the in source build error to be a bit more descriptive. In my Ubuntu 12.04 system it seems to work great, awesome job!