author | Ryan C. Gordon <icculus@icculus.org> |
Fri, 01 May 2015 01:12:48 -0400 | |
changeset 9580 | d37ef6990bf9 |
parent 9571 | 5e3a1adadfbb |
child 9717 | 45a632fd9d83 |
permissions | -rw-r--r-- |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1 |
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
2 |
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
3 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
4 |
|
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
5 |
cmake_minimum_required(VERSION 2.8) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
6 |
project(SDL2 C) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
7 |
include(CheckFunctionExists) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
8 |
include(CheckLibraryExists) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
9 |
include(CheckIncludeFiles) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
10 |
include(CheckIncludeFile) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
11 |
include(CheckSymbolExists) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
12 |
include(CheckCSourceRuns) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
13 |
include(CheckCCompilerFlag) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
14 |
include(CheckTypeSize) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
15 |
include(CheckStructHasMember) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
16 |
include(CMakeDependentOption) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
17 |
include(FindPkgConfig) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
18 |
set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
19 |
include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
20 |
include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
21 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
22 |
# General settings |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
23 |
# Edit include/SDL_version.h and change the version, then: |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
24 |
# SDL_MICRO_VERSION += 1; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
25 |
# SDL_INTERFACE_AGE += 1; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
26 |
# SDL_BINARY_AGE += 1; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
27 |
# if any functions have been added, set SDL_INTERFACE_AGE to 0. |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
28 |
# if backwards compatibility has been broken, |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
29 |
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
30 |
set(SDL_MAJOR_VERSION 2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
31 |
set(SDL_MINOR_VERSION 0) |
9121
00d99eff96a6
Updated version to 2.0.4
Sam Lantinga <slouken@libsdl.org>
parents:
9112
diff
changeset
|
32 |
set(SDL_MICRO_VERSION 4) |
00d99eff96a6
Updated version to 2.0.4
Sam Lantinga <slouken@libsdl.org>
parents:
9112
diff
changeset
|
33 |
set(SDL_INTERFACE_AGE 0) |
00d99eff96a6
Updated version to 2.0.4
Sam Lantinga <slouken@libsdl.org>
parents:
9112
diff
changeset
|
34 |
set(SDL_BINARY_AGE 4) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
35 |
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
36 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
37 |
# Calculate a libtool-like version number |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
38 |
math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
39 |
math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") |
8203
5c9ac454116e
Fix Cmake so generated SOname matches autoconf's #.
Edward Rudd <urkle@outoforder.cc>
parents:
8197
diff
changeset
|
40 |
math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}") |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
41 |
set(LT_REVISION "${SDL_INTERFACE_AGE}") |
7525
e5ae3502a25e
Fixed bug 1743 - CMake produces libraries with wrong filename/SONAME
Sam Lantinga <slouken@libsdl.org>
parents:
7427
diff
changeset
|
42 |
set(LT_RELEASE "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}") |
8203
5c9ac454116e
Fix Cmake so generated SOname matches autoconf's #.
Edward Rudd <urkle@outoforder.cc>
parents:
8197
diff
changeset
|
43 |
set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") |
5c9ac454116e
Fix Cmake so generated SOname matches autoconf's #.
Edward Rudd <urkle@outoforder.cc>
parents:
8197
diff
changeset
|
44 |
|
5c9ac454116e
Fix Cmake so generated SOname matches autoconf's #.
Edward Rudd <urkle@outoforder.cc>
parents:
8197
diff
changeset
|
45 |
message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}") |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
46 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
47 |
# General settings & flags |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
48 |
set(LIBRARY_OUTPUT_DIRECTORY "build") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
49 |
# Check for 64 or 32 bit |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
50 |
set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
51 |
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
52 |
set(ARCH_64 TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
53 |
set(PROCESSOR_ARCH "x64") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
54 |
else() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
55 |
set(ARCH_64 FALSE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
56 |
set(PROCESSOR_ARCH "x86") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
57 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
58 |
set(LIBNAME SDL2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
59 |
if(NOT LIBTYPE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
60 |
set(LIBTYPE SHARED) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
61 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
62 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
63 |
# Get the platform |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
64 |
if(WIN32) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
65 |
if(NOT WINDOWS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
66 |
set(WINDOWS TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
67 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
68 |
elseif(UNIX AND NOT APPLE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
69 |
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
70 |
set(LINUX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
71 |
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
72 |
set(FREEBSD TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
73 |
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
74 |
set(NETBSD TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
75 |
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
76 |
set(OPENBSD TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
77 |
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
78 |
set(GNU TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
79 |
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
80 |
set(BSDI TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
81 |
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
82 |
set(FREEBSD TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
83 |
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
84 |
set(SYSV5 TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
85 |
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
86 |
set(SOLARIS TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
87 |
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
88 |
set(HPUX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
89 |
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
90 |
set(AIX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
91 |
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
92 |
set(MINIX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
93 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
94 |
elseif(APPLE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
95 |
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
96 |
set(DARWIN TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
97 |
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
98 |
set(MACOSX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
99 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
100 |
# TODO: iOS? |
7981
6d538bc1b395
Renamed things named after BeOS to be named after Haiku instead.
Ryan C. Gordon <icculus@icculus.org>
parents:
7977
diff
changeset
|
101 |
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") |
6d538bc1b395
Renamed things named after BeOS to be named after Haiku instead.
Ryan C. Gordon <icculus@icculus.org>
parents:
7977
diff
changeset
|
102 |
message_error("BeOS support has been removed as of SDL 2.0.2.") |
6d538bc1b395
Renamed things named after BeOS to be named after Haiku instead.
Ryan C. Gordon <icculus@icculus.org>
parents:
7977
diff
changeset
|
103 |
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*") |
6d538bc1b395
Renamed things named after BeOS to be named after Haiku instead.
Ryan C. Gordon <icculus@icculus.org>
parents:
7977
diff
changeset
|
104 |
set(HAIKU TRUE) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
105 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
106 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
107 |
# Don't mistake osx for unix |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
108 |
if(UNIX AND NOT APPLE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
109 |
set(UNIX_SYS ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
110 |
else() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
111 |
set(UNIX_SYS OFF) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
112 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
113 |
|
7426
e36a759d3bb1
CMake project should enable pthreads for Mac OS X by default.
Ryan C. Gordon <icculus@icculus.org>
parents:
7395
diff
changeset
|
114 |
if(UNIX OR APPLE) |
e36a759d3bb1
CMake project should enable pthreads for Mac OS X by default.
Ryan C. Gordon <icculus@icculus.org>
parents:
7395
diff
changeset
|
115 |
set(UNIX_OR_MAC_SYS ON) |
e36a759d3bb1
CMake project should enable pthreads for Mac OS X by default.
Ryan C. Gordon <icculus@icculus.org>
parents:
7395
diff
changeset
|
116 |
else() |
e36a759d3bb1
CMake project should enable pthreads for Mac OS X by default.
Ryan C. Gordon <icculus@icculus.org>
parents:
7395
diff
changeset
|
117 |
set(UNIX_OR_MAC_SYS OFF) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
118 |
endif() |
7426
e36a759d3bb1
CMake project should enable pthreads for Mac OS X by default.
Ryan C. Gordon <icculus@icculus.org>
parents:
7395
diff
changeset
|
119 |
|
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
120 |
if (UNIX_OR_MAC_SYS AND NOT EMSCRIPTEN) # JavaScript does not yet have threading support, so disable pthreads when building for Emscripten. |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
121 |
set(SDL_PTHREADS_ENABLED_BY_DEFAULT ON) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
122 |
else() |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
123 |
set(SDL_PTHREADS_ENABLED_BY_DEFAULT OFF) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
124 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
125 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
126 |
# Default option knobs |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
127 |
if(APPLE OR ARCH_64) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
128 |
set(OPT_DEF_SSEMATH ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
129 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
130 |
if(UNIX OR MINGW OR MSYS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
131 |
set(OPT_DEF_LIBC ON) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
132 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
133 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
134 |
# Compiler info |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
135 |
if(CMAKE_COMPILER_IS_GNUCC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
136 |
set(USE_GCC TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
137 |
set(OPT_DEF_ASM TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
138 |
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
139 |
set(USE_CLANG TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
140 |
set(OPT_DEF_ASM TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
141 |
elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
142 |
set(OPT_DEF_ASM TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
143 |
#set(CMAKE_C_FLAGS "/ZI /WX- / |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
144 |
else() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
145 |
set(OPT_DEF_ASM FALSE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
146 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
147 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
148 |
# Default flags, if not set otherwise |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
149 |
if("$ENV{CFLAGS}" STREQUAL "") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
150 |
if(USE_GCC OR USE_CLANG) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
151 |
set(CMAKE_C_FLAGS "-g -O3") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
152 |
endif() |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
153 |
else() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
154 |
set(CMAKE_C_FLAGS "$ENV{CFLAGS}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
155 |
list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
156 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
157 |
if(NOT ("$ENV{CFLAGS}" STREQUAL "")) # Hackish, but does the trick on Win32 |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
158 |
list(APPEND EXTRA_LDFLAGS "$ENV{LDFLAGS}") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
159 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
160 |
|
8136
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
161 |
if(MSVC) |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
162 |
option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
163 |
if(FORCE_STATIC_VCRT) |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
164 |
foreach(flag_var |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
165 |
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
166 |
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
167 |
if(${flag_var} MATCHES "/MD") |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
168 |
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
169 |
endif() |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
170 |
endforeach() |
8136
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
171 |
endif() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
172 |
endif() |
8136
175cac5d90a6
Some CMake fixes for static linking on Windows from the OpenFL project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8133
diff
changeset
|
173 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
174 |
# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config, |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
175 |
# etc. are created correctly. |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
176 |
set(SDL_LIBS "-lSDL2") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
177 |
set(SDL_CFLAGS "") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
178 |
|
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
179 |
# Emscripten toolchain has a nonempty default value for this, and the checks |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
180 |
# in this file need to change that, so remember the original value, and |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
181 |
# restore back to that afterwards. For check_function_exists() to work in |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
182 |
# Emscripten, this value must be at its default value. |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
183 |
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
184 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
185 |
if(CYGWIN) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
186 |
# We build SDL on cygwin without the UNIX emulation layer |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
187 |
include_directories("-I/usr/include/mingw") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
188 |
set(CMAKE_REQUIRED_FLAGS "-mno-cygwin") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
189 |
check_c_source_compiles("int main(int argc, char **argv) {}" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
190 |
HAVE_GCC_NO_CYGWIN) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
191 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
192 |
if(HAVE_GCC_NO_CYGWIN) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
193 |
list(APPEND EXTRA_LDFLAGS "-mno-cygwin") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
194 |
list(APPEND SDL_LIBS "-mno-cygwin") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
195 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
196 |
set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
197 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
198 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
199 |
add_definitions(-DUSING_GENERATED_CONFIG_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
200 |
# General includes |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
201 |
include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
202 |
|
9279
e1d1b6479a14
CMake: Minor cleanup up on the new SDL_*_ENABLED_BY_DEFAULT vars.
Ryan C. Gordon <icculus@icculus.org>
parents:
9278
diff
changeset
|
203 |
# All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so |
e1d1b6479a14
CMake: Minor cleanup up on the new SDL_*_ENABLED_BY_DEFAULT vars.
Ryan C. Gordon <icculus@icculus.org>
parents:
9278
diff
changeset
|
204 |
# you only need to have a platform override them if they are disabling. |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
205 |
set(OPT_DEF_ASM TRUE) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
206 |
if(EMSCRIPTEN) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
207 |
# Set up default values for the currently supported set of subsystems: |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
208 |
# Emscripten/Javascript does not have assembly support, a dynamic library |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
209 |
# loading architecture, low-level CPU inspection or multithreading. |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
210 |
set(OPT_DEF_ASM FALSE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
211 |
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
212 |
set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
213 |
set(SDL_THREADS_ENABLED_BY_DEFAULT OFF) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
214 |
set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
215 |
set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
216 |
set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
217 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
218 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
219 |
set(SDL_SUBSYSTEMS |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
220 |
Atomic Audio Video Render Events Joystick Haptic Power Threads Timers |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
221 |
File Loadso CPUinfo Filesystem Dlopen) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
222 |
foreach(_SUB ${SDL_SUBSYSTEMS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
223 |
string(TOUPPER ${_SUB} _OPT) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
224 |
if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
225 |
set(SDL_${_OPT}_ENABLED_BY_DEFAULT ON) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
226 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
227 |
option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ${SDL_${_OPT}_ENABLED_BY_DEFAULT}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
228 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
229 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
230 |
option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
231 |
#set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
232 |
set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
233 |
set_option(GCC_ATOMICS "Use gcc builtin atomics" ${USE_GCC}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
234 |
set_option(ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
235 |
set_option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
236 |
set_option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
237 |
set_option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
238 |
set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
239 |
set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
240 |
set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
241 |
set_option(DISKAUDIO "Support the disk writer audio driver" ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
242 |
set_option(DUMMYAUDIO "Support the dummy audio driver" ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
243 |
set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
244 |
dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
245 |
set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) |
9466
510c9a2f0951
CMake: Dependency variable for FUSIONSOUND_SHARED was wrong (thanks, Kaleb!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9431
diff
changeset
|
246 |
dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
247 |
set_option(VIDEO_DUMMY "Use dummy video driver" ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
248 |
set_option(VIDEO_OPENGL "Include OpenGL support" ON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
249 |
set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON) |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
250 |
set_option(PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
251 |
dep_option(PTHREADS_SEM "Use pthread semaphores" ON "PTHREADS" OFF) |
9431
a9c73f29a15e
Better fixes for CMake subsystem enabling (thanks, Sebastian!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9414
diff
changeset
|
252 |
set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOPEN_ENABLED_BY_DEFAULT}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
253 |
set_option(OSS "Support the OSS audio API" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
254 |
set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
255 |
dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
256 |
set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
257 |
dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
258 |
set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
259 |
dep_option(PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "PULSEAUDIO" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
260 |
set_option(ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
261 |
dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
262 |
set_option(NAS "Support the NAS audio API" ${UNIX_SYS}) |
8118
f0b6338dc866
Fixed dynamic loading of NAS in CMake project.
Ryan C. Gordon <icculus@icculus.org>
parents:
8094
diff
changeset
|
263 |
set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS}) |
7367
d6eabafa8776
Added an SDL2 OpenBSD sndio(7) audio target.
Ryan C. Gordon <icculus@icculus.org>
parents:
6774
diff
changeset
|
264 |
set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
265 |
set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
266 |
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
267 |
set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
268 |
set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS}) |
8680
eb1281b43b5d
Re-enable Mir/Wayland support now that 2.0.3 has been released.
Brandon Schaefer <brandon.schaefer@canonical.com>
parents:
8606
diff
changeset
|
269 |
set_option(VIDEO_WAYLAND "Use Wayland video driver" ${UNIX_SYS}) |
9409
9df20f292907
CMake project files no longer force you to link against Wayland or Mir libs.
Ryan C. Gordon <icculus@icculus.org>
parents:
9408
diff
changeset
|
270 |
dep_option(WAYLAND_SHARED "Dynamically load Wayland support" ON "VIDEO_WAYLAND" OFF) |
9df20f292907
CMake project files no longer force you to link against Wayland or Mir libs.
Ryan C. Gordon <icculus@icculus.org>
parents:
9408
diff
changeset
|
271 |
dep_option(VIDEO_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "VIDEO_WAYLAND" OFF) |
8680
eb1281b43b5d
Re-enable Mir/Wayland support now that 2.0.3 has been released.
Brandon Schaefer <brandon.schaefer@canonical.com>
parents:
8606
diff
changeset
|
272 |
set_option(VIDEO_MIR "Use Mir video driver" ${UNIX_SYS}) |
9409
9df20f292907
CMake project files no longer force you to link against Wayland or Mir libs.
Ryan C. Gordon <icculus@icculus.org>
parents:
9408
diff
changeset
|
273 |
dep_option(MIR_SHARED "Dynamically load Mir support" ON "VIDEO_MIR" OFF) |
9077
28e6de55eb07
Fixed bug 2683 - Raspberry PI support using CMake
Sam Lantinga <slouken@libsdl.org>
parents:
9075
diff
changeset
|
274 |
set_option(VIDEO_RPI "Use Raspberry Pi video driver" ${UNIX_SYS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
275 |
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
276 |
set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
277 |
foreach(_SUB ${SDL_X11_OPTIONS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
278 |
string(TOUPPER "VIDEO_X11_${_SUB}" _OPT) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
279 |
dep_option(${_OPT} "Enable ${_SUB} support" ON "VIDEO_X11" OFF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
280 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
281 |
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
282 |
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
283 |
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) |
9164
494876610c49
Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
9127
diff
changeset
|
284 |
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
285 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
286 |
# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
287 |
# The options below are for compatibility to configure's default behaviour. |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
288 |
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
289 |
set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
290 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
291 |
# General source files |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
292 |
file(GLOB SOURCE_FILES |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
293 |
${SDL2_SOURCE_DIR}/src/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
294 |
${SDL2_SOURCE_DIR}/src/atomic/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
295 |
${SDL2_SOURCE_DIR}/src/audio/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
296 |
${SDL2_SOURCE_DIR}/src/cpuinfo/*.c |
8094
9efaae827924
Implemented the Dynamic API magic.
Ryan C. Gordon <icculus@icculus.org>
parents:
8090
diff
changeset
|
297 |
${SDL2_SOURCE_DIR}/src/dynapi/*.c |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
298 |
${SDL2_SOURCE_DIR}/src/events/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
299 |
${SDL2_SOURCE_DIR}/src/file/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
300 |
${SDL2_SOURCE_DIR}/src/libm/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
301 |
${SDL2_SOURCE_DIR}/src/render/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
302 |
${SDL2_SOURCE_DIR}/src/render/*/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
303 |
${SDL2_SOURCE_DIR}/src/stdlib/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
304 |
${SDL2_SOURCE_DIR}/src/thread/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
305 |
${SDL2_SOURCE_DIR}/src/timer/*.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
306 |
${SDL2_SOURCE_DIR}/src/video/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
307 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
308 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
309 |
if(ASSERTIONS STREQUAL "auto") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
310 |
# Do nada - use optimization settings to determine the assertion level |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
311 |
elseif(ASSERTIONS STREQUAL "disabled") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
312 |
set(SDL_DEFAULT_ASSERT_LEVEL 0) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
313 |
elseif(ASSERTIONS STREQUAL "release") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
314 |
set(SDL_DEFAULT_ASSERT_LEVEL 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
315 |
elseif(ASSERTIONS STREQUAL "enabled") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
316 |
set(SDL_DEFAULT_ASSERT_LEVEL 2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
317 |
elseif(ASSERTIONS STREQUAL "paranoid") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
318 |
set(SDL_DEFAULT_ASSERT_LEVEL 3) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
319 |
else() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
320 |
message_error("unknown assertion level") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
321 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
322 |
set(HAVE_ASSERTIONS ${ASSERTIONS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
323 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
324 |
# Compiler option evaluation |
7999
2c9aedfba740
Fixed bug 2238 - Enable GCC atomics for clang
Sam Lantinga <slouken@libsdl.org>
parents:
7981
diff
changeset
|
325 |
if(USE_GCC OR USE_CLANG) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
326 |
if(DEPENDENCY_TRACKING) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
327 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
328 |
#if !defined(__GNUC__) || __GNUC__ < 3 |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
329 |
#error Dependency tracking requires GCC 3.0 or newer |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
330 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
331 |
int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
332 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
333 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
334 |
if(GCC_ATOMICS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
335 |
check_c_source_compiles("int main(int argc, char **argv) { |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
336 |
int a; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
337 |
void *x, *y, *z; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
338 |
__sync_lock_test_and_set(&a, 4); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
339 |
__sync_lock_test_and_set(&x, y); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
340 |
__sync_fetch_and_add(&a, 1); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
341 |
__sync_bool_compare_and_swap(&a, 5, 10); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
342 |
__sync_bool_compare_and_swap(&x, y, z); }" HAVE_GCC_ATOMICS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
343 |
if(NOT HAVE_GCC_ATOMICS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
344 |
check_c_source_compiles("int main(int argc, char **argv) { |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
345 |
int a; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
346 |
__sync_lock_test_and_set(&a, 1); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
347 |
__sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
348 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
349 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
350 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
351 |
set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
352 |
check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
353 |
HAVE_GCC_PREFERRED_STACK_BOUNDARY) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
354 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
355 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
356 |
set(CMAKE_REQUIRED_FLAGS "-fvisibility=hidden -Werror") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
357 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
358 |
#if !defined(__GNUC__) || __GNUC__ < 4 |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
359 |
#error SDL only uses visibility attributes in GCC 4 or newer |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
360 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
361 |
int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
362 |
if(HAVE_GCC_FVISIBILITY) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
363 |
list(APPEND EXTRA_CFLAGS "-fvisibility=hidden") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
364 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
365 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
366 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
367 |
check_c_compiler_flag(-Wall HAVE_GCC_WALL) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
368 |
if(HAVE_GCC_WALL) |
9081
39eb61ccbc82
cmake: add -Wall/-Wshadow to GCC compilation flags
Sam Lantinga <slouken@libsdl.org>
parents:
9080
diff
changeset
|
369 |
list(APPEND EXTRA_CFLAGS "-Wall") |
7981
6d538bc1b395
Renamed things named after BeOS to be named after Haiku instead.
Ryan C. Gordon <icculus@icculus.org>
parents:
7977
diff
changeset
|
370 |
if(HAIKU) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
371 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
372 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
373 |
endif() |
9081
39eb61ccbc82
cmake: add -Wall/-Wshadow to GCC compilation flags
Sam Lantinga <slouken@libsdl.org>
parents:
9080
diff
changeset
|
374 |
check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW) |
39eb61ccbc82
cmake: add -Wall/-Wshadow to GCC compilation flags
Sam Lantinga <slouken@libsdl.org>
parents:
9080
diff
changeset
|
375 |
if(HAVE_GCC_WSHADOW) |
39eb61ccbc82
cmake: add -Wall/-Wshadow to GCC compilation flags
Sam Lantinga <slouken@libsdl.org>
parents:
9080
diff
changeset
|
376 |
list(APPEND EXTRA_CFLAGS "-Wshadow") |
39eb61ccbc82
cmake: add -Wall/-Wshadow to GCC compilation flags
Sam Lantinga <slouken@libsdl.org>
parents:
9080
diff
changeset
|
377 |
endif() |
9082
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
378 |
|
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
379 |
set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") |
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
380 |
check_c_compiler_flag("" HAVE_NO_UNDEFINED) |
9083
029f8d643dbe
Reset CMAKE_REQUIRED_FLAGS after test
Sam Lantinga <slouken@libsdl.org>
parents:
9082
diff
changeset
|
381 |
set(CMAKE_REQUIRED_FLAGS) |
9082
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
382 |
if(HAVE_NO_UNDEFINED) |
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
383 |
list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") |
22232029f074
cmake: add -Wl,--no-undefined to GCC linker flags
Sam Lantinga <slouken@libsdl.org>
parents:
9081
diff
changeset
|
384 |
endif() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
385 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
386 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
387 |
if(ASSEMBLY) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
388 |
if(USE_GCC OR USE_CLANG) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
389 |
set(SDL_ASSEMBLY_ROUTINES 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
390 |
# TODO: Those all seem to be quite GCC specific - needs to be |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
391 |
# reworked for better compiler support |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
392 |
set(HAVE_ASSEMBLY TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
393 |
if(MMX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
394 |
set(CMAKE_REQUIRED_FLAGS "-mmmx") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
395 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
396 |
#ifdef __MINGW32__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
397 |
#include <_mingw.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
398 |
#ifdef __MINGW64_VERSION_MAJOR |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
399 |
#include <intrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
400 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
401 |
#include <mmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
402 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
403 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
404 |
#include <mmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
405 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
406 |
#ifndef __MMX__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
407 |
#error Assembler CPP flag not enabled |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
408 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
409 |
int main(int argc, char **argv) { }" HAVE_MMX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
410 |
if(HAVE_MMX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
411 |
list(APPEND EXTRA_CFLAGS "-mmmx") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
412 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
413 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
414 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
415 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
416 |
if(3DNOW) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
417 |
set(CMAKE_REQUIRED_FLAGS "-m3dnow") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
418 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
419 |
#include <mm3dnow.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
420 |
#ifndef __3dNOW__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
421 |
#error Assembler CPP flag not enabled |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
422 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
423 |
int main(int argc, char **argv) { |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
424 |
void *p = 0; |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
425 |
_m_prefetch(p); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
426 |
}" HAVE_3DNOW) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
427 |
if(HAVE_3DNOW) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
428 |
list(APPEND EXTRA_CFLAGS "-m3dnow") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
429 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
430 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
431 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
432 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
433 |
if(SSE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
434 |
set(CMAKE_REQUIRED_FLAGS "-msse") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
435 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
436 |
#ifdef __MINGW32__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
437 |
#include <_mingw.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
438 |
#ifdef __MINGW64_VERSION_MAJOR |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
439 |
#include <intrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
440 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
441 |
#include <xmmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
442 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
443 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
444 |
#include <xmmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
445 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
446 |
#ifndef __SSE__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
447 |
#error Assembler CPP flag not enabled |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
448 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
449 |
int main(int argc, char **argv) { }" HAVE_SSE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
450 |
if(HAVE_SSE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
451 |
list(APPEND EXTRA_CFLAGS "-msse") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
452 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
453 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
454 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
455 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
456 |
if(SSE2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
457 |
set(CMAKE_REQUIRED_FLAGS "-msse2") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
458 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
459 |
#ifdef __MINGW32__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
460 |
#include <_mingw.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
461 |
#ifdef __MINGW64_VERSION_MAJOR |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
462 |
#include <intrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
463 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
464 |
#include <emmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
465 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
466 |
#else |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
467 |
#include <emmintrin.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
468 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
469 |
#ifndef __SSE2__ |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
470 |
#error Assembler CPP flag not enabled |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
471 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
472 |
int main(int argc, char **argv) { }" HAVE_SSE2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
473 |
if(HAVE_SSE2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
474 |
list(APPEND EXTRA_CFLAGS "-msse2") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
475 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
476 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
477 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
478 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
479 |
if(SSEMATH) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
480 |
if(SSE OR SSE2) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
481 |
if(USE_GCC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
482 |
list(APPEND EXTRA_CFLAGS "-mfpmath=387") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
483 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
484 |
set(HAVE_SSEMATH TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
485 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
486 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
487 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
488 |
if(ALTIVEC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
489 |
set(CMAKE_REQUIRED_FLAGS "-maltivec") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
490 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
491 |
#include <altivec.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
492 |
vector unsigned int vzero() { |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
493 |
return vec_splat_u32(0); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
494 |
} |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
495 |
int main(int argc, char **argv) { }" HAVE_ALTIVEC_H_HDR) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
496 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
497 |
vector unsigned int vzero() { |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
498 |
return vec_splat_u32(0); |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
499 |
} |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
500 |
int main(int argc, char **argv) { }" HAVE_ALTIVEC) |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
501 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
502 |
if(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
503 |
set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
504 |
list(APPEND EXTRA_CFLAGS "-maltivec") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
505 |
set(SDL_ALTIVEC_BLITTERS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
506 |
if(HAVE_ALTIVEC_H_HDR) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
507 |
set(HAVE_ALTIVEC_H 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
508 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
509 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
510 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
511 |
elseif(MSVC_VERSION GREATER 1500) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
512 |
# TODO: SDL_cpuinfo.h needs to support the user's configuration wish |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
513 |
# for MSVC - right now it is always activated |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
514 |
if(NOT ARCH_64) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
515 |
set(HAVE_MMX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
516 |
set(HAVE_3DNOW TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
517 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
518 |
set(HAVE_SSE TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
519 |
set(HAVE_SSE2 TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
520 |
set(SDL_ASSEMBLY_ROUTINES 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
521 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
522 |
# TODO: |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
523 |
#else() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
524 |
# if(USE_GCC OR USE_CLANG) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
525 |
# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
526 |
# endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
527 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
528 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
529 |
# TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
530 |
# anything. |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
531 |
if(LIBC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
532 |
if(WINDOWS AND NOT MINGW) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
533 |
set(HAVE_LIBC TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
534 |
foreach(_HEADER stdio.h string.h ctype.h math.h) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
535 |
string(TOUPPER "HAVE_${_HEADER}" _UPPER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
536 |
string(REPLACE "." "_" _HAVE_H ${_UPPER}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
537 |
set(${_HAVE_H} 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
538 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
539 |
set(HAVE_SIGNAL_H 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
540 |
foreach(_FN |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
541 |
malloc calloc realloc free qsort abs memset memcpy memmove memcmp |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
542 |
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
543 |
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp |
8056
abd9434c5d3e
Hook up SDL_acos and SDL_asin properly.
Ryan C. Gordon <icculus@icculus.org>
parents:
8032
diff
changeset
|
544 |
_stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos |
9080
2e4e71ec140f
Removed SDL_round() because the license wasn't compatible with zlib
Sam Lantinga <slouken@libsdl.org>
parents:
9077
diff
changeset
|
545 |
cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
546 |
string(TOUPPER ${_FN} _UPPER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
547 |
set(HAVE_${_UPPER} 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
548 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
549 |
if(NOT CYGWIN AND NOT MINGW) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
550 |
set(HAVE_ALLOCA 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
551 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
552 |
set(HAVE_M_PI 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
553 |
add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
554 |
set(STDC_HEADERS 1) |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
555 |
else() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
556 |
set(HAVE_LIBC TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
557 |
check_include_file(sys/types.h HAVE_SYS_TYPES_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
558 |
foreach(_HEADER |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
559 |
stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
560 |
strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
561 |
string(TOUPPER "HAVE_${_HEADER}" _UPPER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
562 |
string(REPLACE "." "_" _HAVE_H ${_UPPER}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
563 |
check_include_file("${_HEADER}" ${_HAVE_H}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
564 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
565 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
566 |
check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" STDC_HEADERS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
567 |
check_type_size("size_t" SIZEOF_SIZE_T) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
568 |
check_symbol_exists(M_PI math.h HAVE_M_PI) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
569 |
# TODO: refine the mprotect check |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
570 |
check_c_source_compiles("#include <sys/types.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
571 |
#include <sys/mman.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
572 |
int main() { }" HAVE_MPROTECT) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
573 |
foreach(_FN |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
574 |
strtod malloc calloc realloc free getenv setenv putenv unsetenv |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
575 |
qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
576 |
strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
577 |
_uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
578 |
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp |
8090
0098d4459b7a
We don't need to check for snprintf() anymore, we don't use it.
Ryan C. Gordon <icculus@icculus.org>
parents:
8089
diff
changeset
|
579 |
vsscanf vsnprintf fseeko fseeko64 sigaction setjmp |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
580 |
nanosleep sysconf sysctlbyname |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
581 |
) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
582 |
string(TOUPPER ${_FN} _UPPER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
583 |
set(_HAVEVAR "HAVE_${_UPPER}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
584 |
check_function_exists("${_FN}" ${_HAVEVAR}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
585 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
586 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
587 |
check_library_exists(m pow "" HAVE_LIBM) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
588 |
if(HAVE_LIBM) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
589 |
set(CMAKE_REQUIRED_LIBRARIES m) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
590 |
foreach(_FN |
9080
2e4e71ec140f
Removed SDL_round() because the license wasn't compatible with zlib
Sam Lantinga <slouken@libsdl.org>
parents:
9077
diff
changeset
|
591 |
atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin |
9414
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
592 |
sinf sqrt sqrtf tan tanf acos asin) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
593 |
string(TOUPPER ${_FN} _UPPER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
594 |
set(_HAVEVAR "HAVE_${_UPPER}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
595 |
check_function_exists("${_FN}" ${_HAVEVAR}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
596 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
597 |
set(CMAKE_REQUIRED_LIBRARIES) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
598 |
list(APPEND EXTRA_LIBS m) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
599 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
600 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
601 |
check_library_exists(iconv iconv_open "" HAVE_LIBICONV) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
602 |
if(HAVE_LIBICONV) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
603 |
list(APPEND EXTRA_LIBS iconv) |
9414
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
604 |
set(HAVE_ICONV 1) |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
605 |
endif() |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
606 |
|
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
607 |
if(NOT APPLE) |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
608 |
check_include_file(alloca.h HAVE_ALLOCA_H) |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
609 |
check_function_exists(alloca HAVE_ALLOCA) |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
610 |
else() |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
611 |
set(HAVE_ALLOCA_H 1) |
669bf9fb901e
Several corrections to the CMake project files (thanks, Ozkan!).
Ryan C. Gordon <icculus@icculus.org>
parents:
9411
diff
changeset
|
612 |
set(HAVE_ALLOCA 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
613 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
614 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
615 |
check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
616 |
endif() |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
617 |
else() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
618 |
if(WINDOWS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
619 |
set(HAVE_STDARG_H 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
620 |
set(HAVE_STDDEF_H 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
621 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
622 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
623 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
624 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
625 |
# Enable/disable various subsystems of the SDL library |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
626 |
foreach(_SUB ${SDL_SUBSYSTEMS}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
627 |
string(TOUPPER ${_SUB} _OPT) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
628 |
if(NOT SDL_${_OPT}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
629 |
set(SDL_${_OPT}_DISABLED 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
630 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
631 |
endforeach() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
632 |
if(SDL_JOYSTICK) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
633 |
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
634 |
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
635 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
636 |
if(SDL_HAPTIC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
637 |
if(NOT SDL_JOYSTICK) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
638 |
# Haptic requires some private functions from the joystick subsystem. |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
639 |
message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
640 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
641 |
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
642 |
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
643 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
644 |
if(SDL_POWER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
645 |
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
646 |
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
647 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
648 |
# TODO: in configure.in, the test for LOADSO and SDL_DLOPEN is a bit weird: |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
649 |
# if LOADSO is not wanted, SDL_LOADSO_DISABLED is set |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
650 |
# If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(), |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
651 |
# SDL_LOADSO_DISABLED will not be set, regardless of the LOADSO settings |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
652 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
653 |
# General SDL subsystem options, valid for all platforms |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
654 |
if(SDL_AUDIO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
655 |
# CheckDummyAudio/CheckDiskAudio - valid for all platforms |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
656 |
if(DUMMYAUDIO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
657 |
set(SDL_AUDIO_DRIVER_DUMMY 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
658 |
file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
659 |
set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
660 |
set(HAVE_DUMMYAUDIO TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
661 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
662 |
if(DISKAUDIO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
663 |
set(SDL_AUDIO_DRIVER_DISK 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
664 |
file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
665 |
set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
666 |
set(HAVE_DISKAUDIO TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
667 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
668 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
669 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
670 |
if(SDL_DLOPEN) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
671 |
# Relevant for Unix/Darwin only |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
672 |
if(UNIX OR APPLE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
673 |
CheckDLOPEN() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
674 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
675 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
676 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
677 |
if(SDL_VIDEO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
678 |
if(VIDEO_DUMMY) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
679 |
set(SDL_VIDEO_DRIVER_DUMMY 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
680 |
file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
681 |
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
682 |
set(HAVE_VIDEO_DUMMY TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
683 |
set(HAVE_SDL_VIDEO TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
684 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
685 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
686 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
687 |
# Platform-specific options and settings |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
688 |
if(EMSCRIPTEN) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
689 |
# Hide noisy warnings that intend to aid mostly during initial stages of porting a new |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
690 |
# project. Uncomment at will for verbose cross-compiling -I/../ path info. |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
691 |
add_definitions(-Wno-warn-absolute-paths) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
692 |
if(SDL_AUDIO) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
693 |
set(SDL_AUDIO_DRIVER_EMSCRIPTEN 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
694 |
file(GLOB EM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/emscripten/*.c) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
695 |
set(SOURCE_FILES ${SOURCE_FILES} ${EM_AUDIO_SOURCES}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
696 |
set(HAVE_SDL_AUDIO TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
697 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
698 |
if(SDL_FILESYSTEM) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
699 |
set(SDL_FILESYSTEM_EMSCRIPTEN 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
700 |
file(GLOB EM_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/emscripten/*.c) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
701 |
set(SOURCE_FILES ${SOURCE_FILES} ${EM_FILESYSTEM_SOURCES}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
702 |
set(HAVE_SDL_FILESYSTEM TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
703 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
704 |
if(SDL_JOYSTICK) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
705 |
set(SDL_JOYSTICK_EMSCRIPTEN 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
706 |
file(GLOB EM_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/emscripten/*.c) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
707 |
set(SOURCE_FILES ${SOURCE_FILES} ${EM_JOYSTICK_SOURCES}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
708 |
set(HAVE_SDL_JOYSTICK TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
709 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
710 |
if(SDL_POWER) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
711 |
set(SDL_POWER_EMSCRIPTEN 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
712 |
file(GLOB EM_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/emscripten/*.c) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
713 |
set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
714 |
set(HAVE_SDL_POWER TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
715 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
716 |
if(SDL_VIDEO) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
717 |
set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
718 |
file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
719 |
set(SOURCE_FILES ${SOURCE_FILES} ${EM_VIDEO_SOURCES}) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
720 |
set(HAVE_SDL_VIDEO TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
721 |
|
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
722 |
#enable gles |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
723 |
if(VIDEO_OPENGLES) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
724 |
set(SDL_VIDEO_OPENGL_EGL 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
725 |
set(HAVE_VIDEO_OPENGLES TRUE) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
726 |
set(SDL_VIDEO_OPENGL_ES2 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
727 |
set(SDL_VIDEO_RENDER_OGL_ES2 1) |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
728 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
729 |
endif() |
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
730 |
elseif(UNIX AND NOT APPLE) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
731 |
if(SDL_AUDIO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
732 |
if(SYSV5 OR SOLARIS OR HPUX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
733 |
set(SDL_AUDIO_DRIVER_SUNAUDIO 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
734 |
file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
735 |
set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
736 |
set(HAVE_SDL_AUDIO TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
737 |
elseif(NETBSD OR OPENBSD) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
738 |
set(SDL_AUDIO_DRIVER_BSD 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
739 |
file(GLOB BSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/bsd/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
740 |
set(SOURCE_FILES ${SOURCE_FILES} ${BSD_AUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
741 |
set(HAVE_SDL_AUDIO TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
742 |
elseif(AIX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
743 |
set(SDL_AUDIO_DRIVER_PAUDIO 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
744 |
file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
745 |
set(SOURCE_FILES ${SOURCE_FILES} ${AIX_AUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
746 |
set(HAVE_SDL_AUDIO TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
747 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
748 |
CheckOSS() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
749 |
CheckALSA() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
750 |
CheckPulseAudio() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
751 |
CheckESD() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
752 |
CheckARTS() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
753 |
CheckNAS() |
7367
d6eabafa8776
Added an SDL2 OpenBSD sndio(7) audio target.
Ryan C. Gordon <icculus@icculus.org>
parents:
6774
diff
changeset
|
754 |
CheckSNDIO() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
755 |
CheckFusionSound() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
756 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
757 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
758 |
if(SDL_VIDEO) |
9077
28e6de55eb07
Fixed bug 2683 - Raspberry PI support using CMake
Sam Lantinga <slouken@libsdl.org>
parents:
9075
diff
changeset
|
759 |
# Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! |
28e6de55eb07
Fixed bug 2683 - Raspberry PI support using CMake
Sam Lantinga <slouken@libsdl.org>
parents:
9075
diff
changeset
|
760 |
CheckRPI() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
761 |
CheckX11() |
8153
3e43c73ac79b
Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
8137
diff
changeset
|
762 |
CheckMir() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
763 |
CheckDirectFB() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
764 |
CheckOpenGLX11() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
765 |
CheckOpenGLESX11() |
8062 | 766 |
CheckWayland() |
9164
494876610c49
Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
9127
diff
changeset
|
767 |
CheckVivante() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
768 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
769 |
|
6729
fdaeea9e7567
Removed old Linux joystick API (/dev/js*).
Ryan C. Gordon <icculus@icculus.org>
parents:
6674
diff
changeset
|
770 |
if(LINUX) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
771 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
772 |
#include <linux/input.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
773 |
#ifndef EVIOCGNAME |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
774 |
#error EVIOCGNAME() ioctl not available |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
775 |
#endif |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
776 |
int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS) |
7903
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
777 |
|
8032
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
778 |
check_c_source_compiles(" |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
779 |
#include <linux/kd.h> |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
780 |
#include <linux/keyboard.h> |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
781 |
|
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
782 |
int main(int argc, char **argv) |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
783 |
{ |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
784 |
struct kbentry kbe; |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
785 |
kbe.kb_table = KG_CTRL; |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
786 |
ioctl(0, KDGKBENT, &kbe); |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
787 |
}" HAVE_INPUT_KD) |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
788 |
|
7903
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
789 |
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) |
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
790 |
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) |
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
791 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
792 |
if(HAVE_INPUT_EVENTS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
793 |
set(SDL_INPUT_LINUXEV 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
794 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
795 |
|
6729
fdaeea9e7567
Removed old Linux joystick API (/dev/js*).
Ryan C. Gordon <icculus@icculus.org>
parents:
6674
diff
changeset
|
796 |
if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
797 |
set(SDL_HAPTIC_LINUX 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
798 |
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
799 |
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
800 |
set(HAVE_SDL_HAPTIC TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
801 |
endif() |
6734
7fdaee2be782
Updated Linux joystick code to support hotplug, GUIDs, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
6729
diff
changeset
|
802 |
|
8032
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
803 |
if(HAVE_INPUT_KD) |
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
804 |
set(SDL_INPUT_LINUXKD 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
805 |
endif() |
8032
e2096994e8b8
Fixes #2271, Add KD detection under CMake by Scott Percival
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8031
diff
changeset
|
806 |
|
6734
7fdaee2be782
Updated Linux joystick code to support hotplug, GUIDs, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
6729
diff
changeset
|
807 |
check_include_file("libudev.h" HAVE_LIBUDEV_H) |
6774
ad8522052ce6
Replaced Gnome screensaver hack with D-Bus messages to org.gnome.ScreenSaver.
Ryan C. Gordon <icculus@icculus.org>
parents:
6734
diff
changeset
|
808 |
|
ad8522052ce6
Replaced Gnome screensaver hack with D-Bus messages to org.gnome.ScreenSaver.
Ryan C. Gordon <icculus@icculus.org>
parents:
6734
diff
changeset
|
809 |
# !!! FIXME: this needs pkg-config to find the include path, I think. |
ad8522052ce6
Replaced Gnome screensaver hack with D-Bus messages to org.gnome.ScreenSaver.
Ryan C. Gordon <icculus@icculus.org>
parents:
6734
diff
changeset
|
810 |
check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
811 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
812 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
813 |
if(INPUT_TSLIB) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
814 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
815 |
#include \"tslib.h\" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
816 |
int main(int argc, char** argv) { }" HAVE_INPUT_TSLIB) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
817 |
if(HAVE_INPUT_TSLIB) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
818 |
set(SDL_INPUT_TSLIB 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
819 |
list(APPEND EXTRA_LIBS ts) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
820 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
821 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
822 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
823 |
if(SDL_JOYSTICK) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
824 |
CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
825 |
if(LINUX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
826 |
set(SDL_JOYSTICK_LINUX 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
827 |
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
828 |
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
829 |
set(HAVE_SDL_JOYSTICK TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
830 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
831 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
832 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
833 |
CheckPTHREAD() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
834 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
835 |
if(CLOCK_GETTIME) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
836 |
check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
837 |
if(FOUND_CLOCK_GETTIME) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
838 |
list(APPEND EXTRA_LIBS rt) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
839 |
set(HAVE_CLOCK_GETTIME 1) |
9277
f0bd40782fc7
CMake: Replace "else(condition)" with "else()", etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
9164
diff
changeset
|
840 |
else() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
841 |
check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
842 |
if(FOUND_CLOCK_GETTIME) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
843 |
set(HAVE_CLOCK_GETTIME 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
844 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
845 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
846 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
847 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
848 |
check_include_file(linux/version.h HAVE_LINUX_VERSION_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
849 |
if(HAVE_LINUX_VERSION_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
850 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
851 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
852 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
853 |
if(SDL_POWER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
854 |
if(LINUX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
855 |
set(SDL_POWER_LINUX 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
856 |
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
857 |
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
858 |
set(HAVE_SDL_POWER TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
859 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
860 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
861 |
|
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
862 |
if(SDL_FILESYSTEM) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
863 |
set(SDL_FILESYSTEM_UNIX 1) |
7867
d9d50f52a686
Fixed bug 2061 - SDL_filesystem API not built using cmake
Sam Lantinga <slouken@libsdl.org>
parents:
7803
diff
changeset
|
864 |
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) |
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
865 |
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
866 |
set(HAVE_SDL_FILESYSTEM TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
867 |
endif() |
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
868 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
869 |
if(SDL_TIMERS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
870 |
set(SDL_TIMER_UNIX 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
871 |
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
872 |
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
873 |
set(HAVE_SDL_TIMERS TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
874 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
875 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
876 |
if(RPATH) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
877 |
set(SDL_RLD_FLAGS "") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
878 |
if(BSDI OR FREEBSD OR LINUX OR NETBSD) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
879 |
set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
880 |
elseif(SOLARIS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
881 |
set(SDL_RLD_FLAGS "-R\${libdir}") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
882 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
883 |
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
884 |
set(HAVE_RPATH TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
885 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
886 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
887 |
elseif(WINDOWS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
888 |
find_program(WINDRES windres) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
889 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
890 |
check_c_source_compiles(" |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
891 |
#include <windows.h> |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
892 |
int main(int argc, char **argv) { }" HAVE_WIN32_CC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
893 |
|
7903
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
894 |
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) |
4d3e6191c807
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
Sam Lantinga <slouken@libsdl.org>
parents:
7867
diff
changeset
|
895 |
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
896 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
897 |
# Check for DirectX |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
898 |
if(DIRECTX) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
899 |
if("$ENV{DXSDK_DIR}" STREQUAL "") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
900 |
message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
901 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
902 |
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
903 |
check_include_file(d3d9.h HAVE_D3D_H) |
8591
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
904 |
check_include_file(d3d11_1.h HAVE_D3D11_H) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
905 |
check_include_file(ddraw.h HAVE_DDRAW_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
906 |
check_include_file(dsound.h HAVE_DSOUND_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
907 |
check_include_file(dinput.h HAVE_DINPUT_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
908 |
check_include_file(xaudio2.h HAVE_XAUDIO2_H) |
9073
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
909 |
check_include_file(xinput.h HAVE_XINPUT_H) |
8751
e8c61640668d
Fix build on Windows targets without dxgi.h, like MingW32.
Ryan C. Gordon <icculus@icculus.org>
parents:
8680
diff
changeset
|
910 |
check_include_file(dxgi.h HAVE_DXGI_H) |
8591
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
911 |
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
912 |
set(HAVE_DIRECTX TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
913 |
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
914 |
link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
915 |
include_directories($ENV{DXSDK_DIR}\\Include) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
916 |
endif() |
9278
8900afb78a19
Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
9277
diff
changeset
|
917 |
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
918 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
919 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
920 |
if(SDL_AUDIO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
921 |
set(SDL_AUDIO_DRIVER_WINMM 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
922 |
file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
923 |
set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
924 |
set(HAVE_SDL_AUDIO TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
925 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
926 |
if(HAVE_DSOUND_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
927 |
set(SDL_AUDIO_DRIVER_DSOUND 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
928 |
file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
929 |
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
930 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
931 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
932 |
if(HAVE_XAUDIO2_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
933 |
set(SDL_AUDIO_DRIVER_XAUDIO2 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
934 |
file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
935 |
set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES}) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
936 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
937 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
938 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
939 |
if(SDL_VIDEO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
940 |
# requires SDL_LOADSO on Windows (IME, DX, etc.) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
941 |
if(NOT SDL_LOADSO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
942 |
message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
943 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
944 |
set(SDL_VIDEO_DRIVER_WINDOWS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
945 |
file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
946 |
set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
947 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
948 |
if(RENDER_D3D AND HAVE_D3D_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
949 |
set(SDL_VIDEO_RENDER_D3D 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
950 |
set(HAVE_RENDER_D3D TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
951 |
endif() |
8591
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
952 |
if(RENDER_D3D AND HAVE_D3D11_H) |
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
953 |
set(SDL_VIDEO_RENDER_D3D11 1) |
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
954 |
set(HAVE_RENDER_D3D TRUE) |
2228ae5a3ac6
Converted David Ludwig's D3D11 renderer to C and optimized it.
Sam Lantinga <slouken@libsdl.org>
parents:
8303
diff
changeset
|
955 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
956 |
set(HAVE_SDL_VIDEO TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
957 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
958 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
959 |
if(SDL_THREADS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
960 |
set(SDL_THREAD_WINDOWS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
961 |
set(SOURCE_FILES ${SOURCE_FILES} |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
962 |
${SDL2_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
963 |
${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syssem.c |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
964 |
${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systhread.c |
7395
c1b80390a820
Added src/thread/windows/SDL_systls.c to CMakeLists.txt (thanks, Charles!).
Ryan C. Gordon <icculus@icculus.org>
parents:
7367
diff
changeset
|
965 |
${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
966 |
${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
967 |
set(HAVE_SDL_THREADS TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
968 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
969 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
970 |
if(SDL_POWER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
971 |
set(SDL_POWER_WINDOWS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
972 |
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
973 |
set(HAVE_SDL_POWER TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
974 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
975 |
|
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
976 |
if(SDL_FILESYSTEM) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
977 |
set(SDL_FILESYSTEM_WINDOWS 1) |
8031
edf58197a910
Fixes #2272, typo in CMakeLists.txt (thanks Boris Bendovsky!)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
7999
diff
changeset
|
978 |
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) |
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
979 |
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
980 |
set(HAVE_SDL_FILESYSTEM TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
981 |
endif() |
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
982 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
983 |
# Libraries for Win32 native and MinGW |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
984 |
list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
985 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
986 |
# TODO: in configure.in the check for timers is set on |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
987 |
# cygwin | mingw32* - does this include mingw32CE? |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
988 |
if(SDL_TIMERS) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
989 |
set(SDL_TIMER_WINDOWS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
990 |
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
991 |
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
992 |
set(HAVE_SDL_TIMERS TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
993 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
994 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
995 |
if(SDL_LOADSO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
996 |
set(SDL_LOADSO_WINDOWS 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
997 |
file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
998 |
set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
999 |
set(HAVE_SDL_LOADSO TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1000 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1001 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1002 |
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1003 |
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1004 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1005 |
if(SDL_VIDEO) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1006 |
if(VIDEO_OPENGL) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1007 |
set(SDL_VIDEO_OPENGL 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1008 |
set(SDL_VIDEO_OPENGL_WGL 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1009 |
set(SDL_VIDEO_RENDER_OGL 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1010 |
set(HAVE_VIDEO_OPENGL TRUE) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1011 |
endif() |
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1012 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1013 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1014 |
if(SDL_JOYSTICK) |
9073
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1015 |
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1016 |
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1017 |
if(HAVE_DINPUT_H) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1018 |
set(SDL_JOYSTICK_DINPUT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1019 |
list(APPEND EXTRA_LIBS dinput8 dxguid dxerr) |
9073
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1020 |
endif() |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1021 |
if(HAVE_XINPUT_H) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1022 |
set(SDL_JOYSTICK_XINPUT 1) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1023 |
endif() |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1024 |
if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1025 |
set(SDL_JOYSTICK_WINMM 1) |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1026 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1027 |
set(HAVE_SDL_JOYSTICK TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1028 |
|
9073
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1029 |
if(SDL_HAPTIC) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1030 |
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1031 |
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1032 |
if(HAVE_DINPUT_H) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1033 |
set(SDL_HAPTIC_DINPUT 1) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1034 |
endif() |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1035 |
if(HAVE_XINPUT_H) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1036 |
set(SDL_HAPTIC_XINPUT 1) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1037 |
endif() |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1038 |
set(HAVE_SDL_HAPTIC TRUE) |
98d13a381299
Fixed building on Windows with CMake
Sam Lantinga <slouken@libsdl.org>
parents:
8910
diff
changeset
|
1039 |
endif() |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1040 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1041 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1042 |
file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1043 |
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1044 |
if(MINGW OR CYGWIN) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1045 |
list(APPEND EXTRA_LIBS mingw32) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1046 |
list(APPEND EXTRA_LDFLAGS "-mwindows") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1047 |
set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1048 |
list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") |
8137
6dbd80731aa0
Move to no-argument version of "endif()" in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents:
8136
diff
changeset
|
1049 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1050 |
elseif(APPLE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1051 |
# TODO: rework this for proper MacOS X, iOS and Darwin support |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1052 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1053 |
# Requires the darwin file implementation |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1054 |
if(SDL_FILE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1055 |
file(GLOB EXTRA_SOURCES ${PROJECT_SOURCE_DIR}/src/file/cocoa/*.m) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1056 |
set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1057 |
set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1058 |
set(HAVE_SDL_FILE TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1059 |
set(SDL_FRAMEWORK_COCOA 1) |
9112
345a7d41dda9
Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Sam Lantinga <slouken@libsdl.org>
parents:
9093
diff
changeset
|
1060 |
set(SDL_FRAMEWORK_COREVIDEO 1) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1061 |
else() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1062 |
message_error("SDL_FILE must be enabled to build on MacOS X") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1063 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1064 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1065 |
if(SDL_AUDIO) |
9312
705bdbbb1f37
Fixed bug 2807 - Not using CoreAudio on OS X when built via CMake
Felix H. Dahlke <fhd@ubercode.de>
parents:
9279
diff
changeset
|
1066 |
set(SDL_AUDIO_DRIVER_COREAUDIO 1) |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1067 |
file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1068 |
set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1069 |
set(HAVE_SDL_AUDIO TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1070 |
set(SDL_FRAMEWORK_COREAUDIO 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1071 |
set(SDL_FRAMEWORK_AUDIOUNIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1072 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1073 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1074 |
if(SDL_JOYSTICK) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1075 |
set(SDL_JOYSTICK_IOKIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1076 |
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1077 |
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1078 |
set(HAVE_SDL_JOYSTICK TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1079 |
set(SDL_FRAMEWORK_IOKIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1080 |
set(SDL_FRAMEWORK_FF 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1081 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1082 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1083 |
if(SDL_HAPTIC) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1084 |
set(SDL_HAPTIC_IOKIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1085 |
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1086 |
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1087 |
set(HAVE_SDL_HAPTIC TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1088 |
set(SDL_FRAMEWORK_IOKIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1089 |
set(SDL_FRAMEWORK_FF 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1090 |
if(NOT SDL_JOYSTICK) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1091 |
message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled") |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1092 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1093 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1094 |
|
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1095 |
if(SDL_POWER) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1096 |
set(SDL_POWER_MACOSX 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1097 |
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1098 |
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1099 |
set(HAVE_SDL_POWER TRUE) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1100 |
set(SDL_FRAMEWORK_CARBON 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1101 |
set(SDL_FRAMEWORK_IOKIT 1) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1102 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1103 |
|
8133
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1104 |
if(SDL_TIMERS) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1105 |
set(SDL_TIMER_UNIX 1) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1106 |
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1107 |
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1108 |
set(HAVE_SDL_TIMERS TRUE) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1109 |
endif(SDL_TIMERS) |
f24acf2403c0
CMake: Enable missing timer subsystem on Mac OS X and Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents:
8126
diff
changeset
|
1110 |
|
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1111 |
if(SDL_FILESYSTEM) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1112 |
set(SDL_FILESYSTEM_COCOA 1) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1113 |
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) |
8248
427d0a6f5af7
CMake: Fixed build on Mac OS X.
Ryan C. Gordon <icculus@icculus.org>
parents:
8203
diff
changeset
|
1114 |
set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) |
7667
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1115 |
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1116 |
set(HAVE_SDL_FILESYSTEM TRUE) |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1117 |
endif() |
be1cc6f55840
Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.
Ryan C. Gordon <icculus@icculus.org>
parents:
7666
diff
changeset
|
1118 |
|
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1119 |
# Actually load the frameworks at the end so we don't duplicate include. |
9112
345a7d41dda9
Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Sam Lantinga <slouken@libsdl.org>
parents:
9093
diff
changeset
|
1120 |
if(SDL_FRAMEWORK_COREVIDEO) |
345a7d41dda9
Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Sam Lantinga <slouken@libsdl.org>
parents:
9093
diff
changeset
|
1121 |
find_library(COREVIDEO CoreVideo) |
345a7d41dda9
Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Sam Lantinga <slouken@libsdl.org>
parents:
9093
diff
changeset
|
1122 |
list(APPEND EXTRA_LIBS ${COREVIDEO}) |
345a7d41dda9
Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Sam Lantinga <slouken@libsdl.org>
parents:
9093
diff
changeset
|
1123 |
endif() |
6674
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1124 |
if(SDL_FRAMEWORK_COCOA) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1125 |
find_library(COCOA_LIBRARY Cocoa) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1126 |
list(APPEND EXTRA_LIBS ${COCOA_LIBRARY}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1127 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1128 |
if(SDL_FRAMEWORK_IOKIT) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1129 |
find_library(IOKIT IOKit) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1130 |
list(APPEND EXTRA_LIBS ${IOKIT}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1131 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1132 |
if(SDL_FRAMEWORK_FF) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1133 |
find_library(FORCEFEEDBACK ForceFeedback) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1134 |
list(APPEND EXTRA_LIBS ${FORCEFEEDBACK}) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1135 |
endif() |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1136 |
if(SDL_FRAMEWORK_CARBON) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|
1137 |
find_library(CARBON_LIBRARY Carbon) |
45a21e50ba5e
Adds CMake build system by Marcus Von Appen (bug #1597)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff
changeset
|