summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: 7b4d025b027336b0220602769ff846934e103af7 (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
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../vendor/bandit)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../vendor/fmt)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../vendor/pcg-cpp/include)

# Add subdirectories
ADD_SUBDIRECTORY (squelch)

# Sources (vendor)
SET(SRCS_VENDOR
  ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/cppformat/format.cc)

# Sources (common)
SET(SRCS_COMMON
  birth.cc
  bldg.cc
  cave.cc
  cmd1.cc
  cmd2.cc
  cmd3.cc
  cmd4.cc
  cmd5.cc
  cmd6.cc
  cmd7.cc
  corrupt.cc
  device_allocation.cc
  dice.cc
  dungeon.cc
  files.cc
  gen_evol.cc
  gen_maze.cc
  generate.cc
  gods.cc
  help.cc
  hiscore.cc
  hooks.cc
  init1.cc
  init2.cc
  joke.cc
  levels.cc
  loadsave.cc
  lua_bind.cc
  melee1.cc
  melee2.cc
  messages.cc
  mimic.cc
  modules.cc
  monster_spell.cc
  monster_type.cc
  monster1.cc
  monster2.cc
  monster3.cc
  notes.cc
  object1.cc
  object2.cc
  object_filter.cc
  object_flag_meta.cc
  options.cc
  powers.cc
  q_betwen.cc
  q_bounty.cc
  q_dragons.cc
  q_eol.cc
  q_evil.cc
  q_fireprof.cc
  q_god.cc
  q_god.cc
  q_haunted.cc
  q_hobbit.cc
  q_invas.cc
  q_library.cc
  q_main.cc
  q_narsil.cc
  q_nazgul.cc
  q_nirna.cc
  q_one.cc
  q_poison.cc
  q_rand.cc
  q_shroom.cc
  q_spider.cc
  q_thief.cc
  q_thrain.cc
  q_troll.cc
  q_ultrae.cc
  q_ultrag.cc
  q_wight.cc
  q_wolves.cc
  quark.cc
  quest.cc
  randart.cc
  range.cc
  skills.cc
  spell_type.cc
  spells1.cc
  spells2.cc
  spells3.cc
  spells4.cc
  spells5.cc
  spells6.cc
  squeltch.cc
  store.cc
  tables.cc
  traps.cc
  util.cc
  variable.cc
  wild.cc
  wizard2.cc
  seed.cc
  xtra1.cc
  xtra2.cc
  z-form.c
  z-rand.cc
  z-term.c
  z-util.c
)

# Sources (TEST)
SET(SRCS_TESTS
  ../tests/get_level_device.cc
  ../tests/harness.cc
  ../tests/lua_get_level.cc
  ../tests/flag_set.cc
)

ADD_LIBRARY(game
  ${SRCS_COMMON} ${SRCS_VENDOR}
)

ADD_LIBRARY(game_main
  main.cc)

# Need a few additional source files for Windows.
IF(WIN32)
  SET(SRCS ${SRCS} main-win.c)
  # Resource files require a little workaround.
  IF(MINGW)
    # Workaround for resource compilation for mingw on CMake.
    # See http://www.cmake.org/Bug/view.php?id=4068
    ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/angband_rc.o
                       COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR}
                                           -i${CMAKE_CURRENT_SOURCE_DIR}/angband.rc
                                           -o ${CMAKE_CURRENT_BINARY_DIR}/angband_rc.o)
    SET(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/angband_rc.o)
  ELSE(MINGW)
    SET(SRCS ${SRCS} angband.rc)
  ENDIF(MINGW)
  # Executable for Win32
  ADD_EXECUTABLE(tome-win WIN32 main-win.c)
  TARGET_LINK_LIBRARIES(tome-win game squelch ${LIBS} winmm wsock32)
  INSTALL(TARGETS tome-win RUNTIME DESTINATION bin)
ENDIF(WIN32)

# tome executables
IF(X11_FOUND)
  INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
  ADD_EXECUTABLE(tome-x11 main-x11.c)
  TARGET_LINK_LIBRARIES(tome-x11 game game_main squelch ${LIBS} ${X11_LIBRARIES})
  INSTALL(TARGETS tome-x11 RUNTIME DESTINATION bin)
ENDIF()

IF(SDL_FOUND AND SDLIMAGE_FOUND AND SDLTTF_FOUND)
  INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ${SDLTTF_INCLUDE_DIR})
  ADD_EXECUTABLE(tome-sdl main-sdl.c)
  TARGET_LINK_LIBRARIES(tome-sdl game game_main squelch ${LIBS} ${SDLIMAGE_LIBRARY} ${SDLTTF_LIBRARY} ${SDL_LIBRARY} m)
  INSTALL(TARGETS tome-sdl RUNTIME DESTINATION bin)
ENDIF()

IF(CURSES_FOUND)
  INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR})
  ADD_EXECUTABLE(tome-gcu main-gcu.c)
  TARGET_LINK_LIBRARIES(tome-gcu game game_main squelch ${LIBS} ${CURSES_LIBRARIES})
  INSTALL(TARGETS tome-gcu RUNTIME DESTINATION bin)
ENDIF()

IF(GTK2_FOUND)
  INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
  ADD_EXECUTABLE(tome-gtk2 main-gtk2.c)
  TARGET_LINK_LIBRARIES(tome-gtk2 game game_main squelch ${LIBS} ${GTK2_LIBRARIES})
  INSTALL(TARGETS tome-gtk2 RUNTIME DESTINATION bin)
ENDIF()

# test harness executable
ADD_EXECUTABLE(harness ${SRCS_TESTS})
TARGET_LINK_LIBRARIES(harness game squelch ${LIBS})