summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: b73f9797fb75e8af321ae7b9552cfc6616eef53a (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
###########################################
#                                         #
#  (C) 2016 Alexander Golubev             #
#  fatzer2 (AT) gmail.com                 #
#                                         #
#  Improvements and feedback are welcome  #
#                                         #
#  This file is released under GPL >= 2   #
#                                         #
###########################################


##### set project version ########################

include( TDEVersion )
cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} )
tde_set_project_version( )


##### general package setup

project( tdegames )


##### include essential cmake modules

include( FindPkgConfig )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckSymbolExists )
include( CheckCXXSourceCompiles )


##### include our cmake modules

include( TDEMacros )


##### setup install paths

include( TDESetupPaths )
tde_setup_paths( )


##### optional stuff

option( WITH_ALL_OPTIONS    "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS           "Enable aRts support"                               ${WITH_ALL_OPTIONS} )

######################## options comments #############################
#                                                                     #
#  WITH_ARTS affects kbounce if disabled the game will have no sound  #
#                                                                     #
#  ARTS is required to build kolf and kasteroids                      #
#                                                                     #
#######################################################################


##### user requested modules 

option( BUILD_ALL          "Build all"           OFF )
option( BUILD_LIBTDEGAMES  "Build libtdegames"   ${BUILD_ALL} )
option( BUILD_ATLANTIK     "Build atlantik"      ${BUILD_ALL} )
option( BUILD_DOC          "Build documentation" ${BUILD_ALL} )
option( BUILD_KASTEROIDS   "Build kasteroids"    ${BUILD_ALL} )
option( BUILD_KATOMIC      "Build katomic"       ${BUILD_ALL} )
option( BUILD_KBACKGAMMON  "Build kbackgammon"   ${BUILD_ALL} )
option( BUILD_KBATTLESHIP  "Build kbattleship"   ${BUILD_ALL} )
option( BUILD_KBLACKBOX    "Build kblackbox"     ${BUILD_ALL} )
option( BUILD_KBOUNCE      "Build kbounce"       ${BUILD_ALL} )
option( BUILD_KENOLABA     "Build kenolaba"      ${BUILD_ALL} )
option( BUILD_KFOULEGGS    "Build kfouleggs"     ${BUILD_ALL} )
option( BUILD_KGOLDRUNNER  "Build kgoldrunner"   ${BUILD_ALL} )
option( BUILD_KJUMPINGCUBE "Build kjumpingcube"  ${BUILD_ALL} )
option( BUILD_KLICKETY     "Build klickety"      ${BUILD_ALL} )
option( BUILD_KLINES       "Build klines"        ${BUILD_ALL} )
option( BUILD_KMAHJONGG    "Build kmahjongg"     ${BUILD_ALL} )
option( BUILD_KMINES       "Build kmines"        ${BUILD_ALL} )
option( BUILD_KNETWALK     "Build knetwalk"      ${BUILD_ALL} )
option( BUILD_KOLF         "Build kolf"          ${BUILD_ALL} )
option( BUILD_KONQUEST     "Build konquest"      ${BUILD_ALL} )
option( BUILD_KPAT         "Build kpat"          ${BUILD_ALL} )
option( BUILD_KPOKER       "Build kpoker"        ${BUILD_ALL} )
option( BUILD_KREVERSI     "Build kreversi"      ${BUILD_ALL} )
option( BUILD_KSAME        "Build ksame"         ${BUILD_ALL} )
option( BUILD_KSHISEN      "Build kshisen"       ${BUILD_ALL} )
option( BUILD_KSIRTET      "Build ksirtet"       ${BUILD_ALL} )
option( BUILD_KSMILETRIS   "Build ksmiletris"    ${BUILD_ALL} )
option( BUILD_KSNAKE       "Build ksnake"        ${BUILD_ALL} )
option( BUILD_KSOKOBAN     "Build ksokoban"      ${BUILD_ALL} )
option( BUILD_KSPACEDUEL   "Build kspaceduel"    ${BUILD_ALL} )
option( BUILD_KTRON        "Build ktron"         ${BUILD_ALL} )
option( BUILD_KTUBERLING   "Build ktuberling"    ${BUILD_ALL} )
option( BUILD_LSKAT        "Build lskat"         ${BUILD_ALL} )
option( BUILD_TWIN4        "Build twin4"         ${BUILD_ALL} )
option( BUILD_TDEFIFTEEN   "Build tdefifteen"    ${BUILD_ALL} )


##### configure checks

include( ConfigureChecks.cmake )


###### global compiler settings

add_definitions( -DHAVE_CONFIG_H )

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )

if( WITH_TEST )
  enable_testing()
endif( WITH_TEST )


##### add apidox targets

add_custom_target( apidox
  COMMAND ${CMAKE_COMMAND} -E env
    "TQTDOCDIR=/usr/share/tqt3/doc/html"
    "DOXDATA=${HTML_INSTALL_DIR}/en/common"
    ${CMAKE_SOURCE_DIR}/admin/doxygen.sh
    --no-modulename
    ${CMAKE_SOURCE_DIR}
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.html' |
    xargs -r sed -i 's|${CMAKE_BINARY_DIR}/apidocs|${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs|g'
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.tag' |
    xargs -r sed -i 's|${CMAKE_SOURCE_DIR}/|${PROJECT_NAME}/|g'
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

add_custom_target( install-apidox
  COMMAND ${CMAKE_COMMAND} -E echo Apidox installed in ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
)

install( CODE "
  if( EXISTS ${CMAKE_BINARY_DIR}/apidocs )
    file(
      INSTALL ${CMAKE_BINARY_DIR}/apidocs/
      DESTINATION ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
      PATTERN doxygen_sqlite3.db EXCLUDE
      PATTERN installdox-slow EXCLUDE
    )
  endif()"
)


##### tdegames directories

tde_conditional_add_subdirectory( BUILD_LIBTDEGAMES  libtdegames  )
tde_conditional_add_subdirectory( BUILD_ATLANTIK     atlantik     )
tde_conditional_add_subdirectory( BUILD_DOC          doc          )
tde_conditional_add_subdirectory( BUILD_KASTEROIDS   kasteroids   )
tde_conditional_add_subdirectory( BUILD_KATOMIC      katomic      )
tde_conditional_add_subdirectory( BUILD_KBACKGAMMON  kbackgammon  )
tde_conditional_add_subdirectory( BUILD_KBATTLESHIP  kbattleship  )
tde_conditional_add_subdirectory( BUILD_KBLACKBOX    kblackbox    )
tde_conditional_add_subdirectory( BUILD_KBOUNCE      kbounce      )
tde_conditional_add_subdirectory( BUILD_KENOLABA     kenolaba     )
tde_conditional_add_subdirectory( BUILD_KFOULEGGS    kfouleggs    )
tde_conditional_add_subdirectory( BUILD_KGOLDRUNNER  kgoldrunner  )
tde_conditional_add_subdirectory( BUILD_KJUMPINGCUBE kjumpingcube )
tde_conditional_add_subdirectory( BUILD_KLICKETY     klickety     )
tde_conditional_add_subdirectory( BUILD_KLINES       klines       )
tde_conditional_add_subdirectory( BUILD_KMAHJONGG    kmahjongg    )
tde_conditional_add_subdirectory( BUILD_KMINES       kmines       )
tde_conditional_add_subdirectory( BUILD_KNETWALK     knetwalk     )
tde_conditional_add_subdirectory( BUILD_KOLF         kolf         )
tde_conditional_add_subdirectory( BUILD_KONQUEST     konquest     )
tde_conditional_add_subdirectory( BUILD_KPAT         kpat         )
tde_conditional_add_subdirectory( BUILD_KPOKER       kpoker       )
tde_conditional_add_subdirectory( BUILD_KREVERSI     kreversi     )
tde_conditional_add_subdirectory( BUILD_KSAME        ksame        )
tde_conditional_add_subdirectory( BUILD_KSHISEN      kshisen      )
tde_conditional_add_subdirectory( BUILD_KSIRTET      ksirtet      )
tde_conditional_add_subdirectory( BUILD_KSMILETRIS   ksmiletris   )
tde_conditional_add_subdirectory( BUILD_KSNAKE       ksnake       )
tde_conditional_add_subdirectory( BUILD_KSOKOBAN     ksokoban     )
tde_conditional_add_subdirectory( BUILD_KSPACEDUEL   kspaceduel   )
tde_conditional_add_subdirectory( BUILD_KTRON        ktron        )
tde_conditional_add_subdirectory( BUILD_KTUBERLING   ktuberling   )
tde_conditional_add_subdirectory( BUILD_LSKAT        lskat        )
tde_conditional_add_subdirectory( BUILD_TWIN4        twin4        )
tde_conditional_add_subdirectory( BUILD_TDEFIFTEEN   tdefifteen   )

if( BUILD_KSIRTET OR BUILD_KFOULEGGS OR BUILD_KLICKETY )
    add_subdirectory( libksirtet )
endif()


##### write configure files

configure_file( config.h.cmake config.h @ONLY )