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 3016 - Cmake windows build fails (2.0.4 RC1)
Summary: Cmake windows build fails (2.0.4 RC1)
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 2.1
Hardware: x86 Windows Vista
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4
Depends on:
Blocks:
 
Reported: 2015-06-15 13:29 UTC by DarioOO
Modified: 2015-12-31 07:33 UTC (History)
1 user (show)

See Also:


Attachments
cmake fixes for mingw (1.96 KB, patch)
2015-06-17 09:43 UTC, Ozkan Sezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DarioOO 2015-06-15 13:29:23 UTC
COMPILER VERSIONS CHECKED:

-GCC 4.6 to 4.9
-Emscripten latest stable
-Clang all versions 

CMAKE VERSIONS TRIED:
- All versions above 2.8 (so from 2.8.0 up to 2.8.12)

WAS THAT WORKING WITH PREVIOUS RELEASE (2.0.3)?
-Yes

IS THAT WORKING NOW (2.0.4 RC1) ? 
-No

STEPS TO REPRODUCE THE PROBLEM:
- use cmake-gui on windows with any of the above compilers

STEPS TO REPRODUCE THE PROBLEM 2:
- use SDL2 as subfolder of your project (the following code would suffice)

=============================== START OF CMAKE CODE

#the following code works nice with release 2.0.3
add_subdirectory( ${SDL2_DIRECTORY} ${CMAKE_BINARY_DIR}/SDL2) #fail here


=============================== END OF CMAKE CODE
Comment 1 Sam Lantinga 2015-06-16 06:37:59 UTC
Ryan, can you look at this for 2.0.4 release?

Thanks!
Comment 2 Ozkan Sezer 2015-06-17 09:43:58 UTC
Created attachment 2185 [details]
cmake fixes for mingw

I hope the attached patch helps. Tested by cross compiling on linux
with toolchain files for x86 and x64, using cmake-2.8.12.1, against
mingw-w64 v1.0.10 crt and headers, and gcc-4.5.4. Changelog:
- ignore DXSDK_DIR for mingw environment
- use dxerr8 instead of dxerr for mingw.
Comment 3 Ryan C. Gordon 2015-06-19 02:36:17 UTC
(In reply to Ozkan Sezer from comment #2)
> I hope the attached patch helps. Tested by cross compiling on linux
> with toolchain files for x86 and x64, using cmake-2.8.12.1, against
> mingw-w64 v1.0.10 crt and headers, and gcc-4.5.4. Changelog:
> - ignore DXSDK_DIR for mingw environment
> - use dxerr8 instead of dxerr for mingw.

This patch is https://hg.libsdl.org/SDL/rev/cf4d3ee2b37b, thanks!

Leaving this open so I can look at the add_subdirectory() problem.

--ryan.
Comment 4 DarioOO 2015-06-19 06:16:38 UTC
In theory adding as subdirectory is the same as standalone build (infact after pulling your patch it just compile again :) ).

It can be tremendously usefull adding dependencies as subdirectory because you can quickly get any patch for dependencies of your project (just like I did right now) and recompile changed parts with minimum effort. The only potential problem are CACHE variables with same name (however cache variables should be prefixed to avoid that). 

This approach even allows to do further customization of dependencies without even requiring to change build scripts (in example: propagate PROJECT_SSE3 flag from your main project to sdl's "SDL2_SSE3")

Instead of compiling N separate dependencies and configure them for each kind of build/target you need, you just compile your project and dependencies automatically get builded with proper configuration. It even permitt do to cross-project unity builds (manually or using libraries like "cotire") producing ablazing fast executables wich would be a nice plus for SDL2 ;)
Comment 5 Ryan C. Gordon 2015-12-31 07:33:36 UTC
I _think_ this bug is good to go now, so I'm marking it RESOLVED. But please reopen if this is still causing problems!

--ryan.