summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: c71cf44827491c046dc3b0057f48d5cac0ed8c38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Project definition.
PROJECT (tome2)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

# Default flags.
IF(CMAKE_COMPILER_IS_GNUCC)
  # Let's set sensible options.
  SET(CMAKE_C_FLAGS         "${CMAKE_C_FLAGS} -pipe -Wall -Wno-unused-value")
  SET(CMAKE_C_FLAGS_RELEASE "-O2")
  SET(CMAKE_C_FLAGS_DEBUG   "-O1 -g")
ENDIF()

# Add definitions.
ADD_DEFINITIONS(-DUSE_EGO_GRAPHICS)
ADD_DEFINITIONS(-DUSE_TRANSPARENCY)
ADD_DEFINITIONS(-DSUPPORT_GAMMA)
ADD_DEFINITIONS(-DUSE_PRECISE_CMOVIE)
ADD_DEFINITIONS(-DUSE_UNIXSOCK)

#
# X11 support (OPTIONAL)
#
FIND_PACKAGE(X11)
IF(X11_FOUND)
  # Add X11 flags/options
  ADD_DEFINITIONS(-DUSE_X11)
  INCLUDE_DIRECTORIES(${X11_INCLUDE_DIRS})
  SET(LIBS ${LIBS} ${X11_LIBRARIES})
ENDIF()

#
# SDL support (OPTIONAL)
#
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
  # Add SDL flags/options
  ADD_DEFINITIONS(-DUSE_SDL)
  INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
  SET(LIBS ${LIBS} ${SDL_LIBRARY})
  # SDL_image is also required
  FIND_PACKAGE(SDL_image REQUIRED)
  IF(SDLIMAGE_FOUND)
    INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
    SET(LIBS ${LIBS} ${SDLIMAGE_LIBRARY})
  ENDIF()
  # SDL_ttf is also required
  FIND_PACKAGE(SDL_ttf REQUIRED)
  IF(SDLTTF_FOUND)
    INCLUDE_DIRECTORIES(${SDLTTF_INCLUDE_DIR})
    SET(LIBS ${LIBS} ${SDLTTF_LIBRARY})
  ENDIF()
ENDIF()

#
# Curses support (OPTIONAL)
#
FIND_PACKAGE(Curses)
IF(CURSES_FOUND)
  # Add Curses flags/options
  ADD_DEFINITIONS(-DUSE_GCU)
  INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR})
  SET(LIBS ${LIBS} ${CURSES_LIBRARIES})
ENDIF()

# Add the source subdirectory.
ADD_SUBDIRECTORY (src)