forked from Farama-Foundation/ViZDoom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
456 lines (364 loc) · 16.1 KB
/
CMakeLists.txt
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
cmake_minimum_required( VERSION 2.8 )
project(ViZDoom)
# Project version
#-----------------------------------------------------------------------------------------------------------------------
set(ViZDoom_MAJOR_VERSION 1)
set(ViZDoom_MINOR_VERSION 1)
set(ViZDoom_PATCH_VERSION 1)
set(ViZDoom_VERSION ${ViZDoom_MAJOR_VERSION}.${ViZDoom_MINOR_VERSION}.${ViZDoom_PATCH_VERSION})
set(ViZDoom_VERSION_STR ${ViZDoom_VERSION})
set(ViZDoom_VERSION_ID ${ViZDoom_MAJOR_VERSION}${ViZDoom_MINOR_VERSION}${ViZDoom_PATCH_VERSION})
# Building options
#-----------------------------------------------------------------------------------------------------------------------
option(BUILD_PYTHON "Build ViZDoom Python binding." OFF)
option(BUILD_PYTHON3 "Build ViZDoom Python3 binding instead of default Python2." OFF)
option(BUILD_LUA "Build ViZDoom Lua binding." OFF)
option(BUILD_LUA52 "Build ViZDoom Lua52 binding instead of default Lua51/LuaJIT." OFF) # TODO
option(BUILD_JAVA "Build ViZDoom Java binding." OFF)
# CMake options
#-----------------------------------------------------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
# System dependent settings
#-----------------------------------------------------------------------------------------------------------------------
if(UNIX)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
endif()
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
macro(get_WIN32_WINNT version)
if (WIN32 AND CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REPLACE "." "" ver ${ver})
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif()
endmacro()
get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver})
endif()
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif(APPLE)
# Compiler dependent settings
#-----------------------------------------------------------------------------------------------------------------------
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-fPIC")
endif()
if(MSVC)
string(REPLACE "/MD " "/MT " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REPLACE "/MD " "/MT " CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})
string(REPLACE "/MD " "/MT " CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
string(REPLACE "/MDd " "/MTd " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# Targets
#-----------------------------------------------------------------------------------------------------------------------
find_package(Boost COMPONENTS filesystem thread system date_time chrono regex iostreams REQUIRED)
find_package(Threads REQUIRED)
set(VIZDOOM_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(VIZDOOM_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(VIZDOOM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(VIZDOOM_LIB_SRC_DIR ${VIZDOOM_SRC_DIR}/lib)
set(VIZDOOM_LIB_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_LIB_SRC_DIR})
include_directories(${VIZDOOM_LIB_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
set(VIZDOOM_LIBS
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} )
if(UNIX AND NOT APPLE)
set(VIZDOOM_LIBS ${VIZDOOM_LIBS} rt)
endif()
configure_file (
"${VIZDOOM_LIB_SRC_DIR}/ViZDoomVersion.h.in"
"${VIZDOOM_LIB_SRC_DIR}/ViZDoomVersion.h"
)
configure_file (
"${VIZDOOM_SRC_DIR}/vizdoom/src/viz_version.h.in"
"${VIZDOOM_SRC_DIR}/vizdoom/src/viz_version.h"
)
file(GLOB VIZDOOM_LIB_SOURCES
${VIZDOOM_INCLUDE_DIR}/*.h
${VIZDOOM_LIB_SRC_DIR}/*.h
${VIZDOOM_LIB_SRC_DIR}/*.cpp)
add_library(libvizdoom_static STATIC ${VIZDOOM_LIB_SOURCES})
target_link_libraries (libvizdoom_static ${VIZDOOM_LIBS})
add_library(libvizdoom_shared SHARED ${VIZDOOM_LIB_SOURCES})
target_link_libraries (libvizdoom_shared ${VIZDOOM_LIBS})
set_target_properties(libvizdoom_static libvizdoom_shared
PROPERTIES
LINKER_LANGUAGE CXX
ARCHIVE_OUTPUT_DIRECTORY ${VIZDOOM_OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${VIZDOOM_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_OUTPUT_DIR}
OUTPUT_NAME vizdoom)
add_subdirectory(${VIZDOOM_SRC_DIR}/vizdoom)
# Python binding
#-----------------------------------------------------------------------------------------------------------------------
if(BUILD_PYTHON AND (NOT BUILD_PYTHON3))
find_package(PythonInterp 2 REQUIRED)
STRING( REGEX REPLACE "([0-9.]+)\\.[0-9]+" "\\1" python_version ${PYTHON_VERSION_STRING} )
find_package(PythonLibs ${python_version} REQUIRED)
find_package(Boost COMPONENTS python REQUIRED)
find_package(NumPy REQUIRED)
set(VIZDOOM_PYTHON2_OUTPUT_DIR ${VIZDOOM_OUTPUT_DIR}/python2)
set(VIZDOOM_PYTHON_SRC_DIR ${VIZDOOM_SRC_DIR}/lib_python)
set(VIZDOOM_PYTHON_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_PYTHON_SRC_DIR})
set(VIZDOOM_PYTHON_LIBS
${VIZDOOM_LIBS}
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
${NUMPY_LIBRARIES})
include_directories(${VIZDOOM_PYTHON_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${NUMPY_INCLUDES})
set(VIZDOOM_PYTHON_SOURCES
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomGamePython.h
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomGamePython.cpp
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomPythonModule.cpp)
if(WIN32)
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
endif()
python_add_module(libvizdoom_python ${VIZDOOM_PYTHON_SOURCES})
target_link_libraries (libvizdoom_python ${VIZDOOM_PYTHON_LIBS} libvizdoom_static)
set_target_properties(libvizdoom_python
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_PYTHON2_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_PYTHON2_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_PYTHON2_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_PYTHON2_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_PYTHON2_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${VIZDOOM_PYTHON2_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_PYTHON2_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_PYTHON2_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_PYTHON2_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_PYTHON2_OUTPUT_DIR}
OUTPUT_NAME vizdoom
PROJECT_LABEL "Python 2 ViZDoom binding")
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET libvizdoom_python
COMMAND ln -sf ${VIZDOOM_PYTHON2_OUTPUT_DIR}/vizdoom.so ${CMAKE_CURRENT_SOURCE_DIR}/examples/python/vizdoom.so
COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/examples/config/bots.cfg ${CMAKE_CURRENT_SOURCE_DIR}/examples/python/bots.cfg
COMMENT "Adding symlinks to vizdoom.so and bots.cfg in examples/python.")
endif()
endif()
if( BUILD_PYTHON3 )
find_package(PythonInterp 3 REQUIRED)
# 3.5.2 => 3.5
STRING( REGEX REPLACE "([0-9.]+)\\.[0-9]+" "\\1" python3_version ${PYTHON_VERSION_STRING} )
find_package(PythonLibs ${python3_version} REQUIRED)
find_package(Boost QUIET COMPONENTS python3-mt) # The name under OSX (macports)
if ( NOT Boost_python3-mt_FOUND )
find_package(Boost QUIET COMPONENTS python3)
if ( NOT Boost_python3_FOUND )
# 3.5 => 35 (at least on Ubuntu 16.04 the library is called libboost_python-py35.so)
STRING( REGEX REPLACE "\\." "" python3_version ${python3_version} )
find_package(Boost COMPONENTS python-py${python3_version} REQUIRED)
else()
MESSAGE("-- Cound not find Boost_python3-mt, Boost_python3 nor Boost_python-py${python3_version}.")
endif()
endif()
find_package(NumPy REQUIRED)
set(VIZDOOM_PYTHON3_OUTPUT_DIR ${VIZDOOM_OUTPUT_DIR}/python3)
set(VIZDOOM_PYTHON_SRC_DIR ${VIZDOOM_SRC_DIR}/lib_python)
set(VIZDOOM_PYTHON_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_PYTHON_SRC_DIR})
set(VIZDOOM_PYTHON3_LIBS
${VIZDOOM_LIBS}
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
${NUMPY_LIBRARIES})
include_directories(${VIZDOOM_PYTHON_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${NUMPY_INCLUDES})
set(VIZDOOM_PYTHON_SOURCES
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomGamePython.h
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomGamePython.cpp
${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomPythonModule.cpp)
if(WIN32)
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
endif()
python_add_module(libvizdoom_python3 ${VIZDOOM_PYTHON_SOURCES})
target_link_libraries (libvizdoom_python3 ${VIZDOOM_PYTHON3_LIBS} libvizdoom_static)
set_target_properties(libvizdoom_python3
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_PYTHON3_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_PYTHON3_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_PYTHON3_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_PYTHON3_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_PYTHON3_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${VIZDOOM_PYTHON3_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_PYTHON3_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_PYTHON3_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_PYTHON3_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_PYTHON3_OUTPUT_DIR}
OUTPUT_NAME vizdoom
PROJECT_LABEL "Python 3 ViZDoom binding")
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET libvizdoom_python3
COMMAND ln -sf ${VIZDOOM_PYTHON3_OUTPUT_DIR}/vizdoom.so ${CMAKE_CURRENT_SOURCE_DIR}/examples/python/vizdoom.so
COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/examples/config/bots.cfg ${CMAKE_CURRENT_SOURCE_DIR}/examples/python/bots.cfg
COMMENT "Adding symlinks to vizdoom.so and bots.cfg in examples/python.")
endif()
endif()
# Lua binding
#-----------------------------------------------------------------------------------------------------------------------
if(BUILD_LUA AND (NOT BUILD_LUA52))
# Use ViZDoom's custom version of luabind
#find_package(Luabind REQUIRED)
add_subdirectory(${VIZDOOM_SRC_DIR}/lib_lua/luabind)
find_package(Lua51 REQUIRED)
set(VIZDOOM_LUA_OUTPUT_DIR ${VIZDOOM_OUTPUT_DIR}/lua)
set(VIZDOOM_LUA_SRC_DIR ${VIZDOOM_SRC_DIR}/lib_lua)
set(VIZDOOM_LUA_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_LUA_SRC_DIR})
set(VIZDOOM_LUA_LIBS
${VIZDOOM_LIBS}
${Boost_LIBRARIES}
${LUA_LIBRARIES}
#${LUABIND_LIBRARIES}
${VIZDOOM_SRC_DIR}/lib_lua/luabind/src/libluabind.a)
include_directories(${VIZDOOM_LUA_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${LUA_INCLUDE_DIR}
#${LUABIND_INCLUDE_DIRS}
${VIZDOOM_SRC_DIR}/lib_lua/luabind)
set(VIZDOOM_LUA_SOURCES
${VIZDOOM_LUA_SRC_DIR}/ViZDoomGameLua.h
${VIZDOOM_LUA_SRC_DIR}/ViZDoomGameLua.cpp
${VIZDOOM_LUA_SRC_DIR}/ViZDoomLuaModule.cpp)
add_library(libvizdoom_lua SHARED ${VIZDOOM_LUA_SOURCES})
target_link_libraries (libvizdoom_lua ${VIZDOOM_LUA_LIBS} libvizdoom_static)
set_target_properties(libvizdoom_lua
PROPERTIES
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_LUA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_LUA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_LUA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_LUA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_LUA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${VIZDOOM_LUA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_LUA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_LUA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_LUA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_LUA_OUTPUT_DIR}
OUTPUT_NAME vizdoom
PROJECT_LABEL "Lua ViZDoom binding")
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET libvizdoom_lua
COMMAND ln -sf ../../vizdoom.so ${CMAKE_CURRENT_SOURCE_DIR}/examples/lua/vizdoom.so
COMMAND ln -sf ..//examples/config/bots.cfg ${CMAKE_CURRENT_SOURCE_DIR}/examples/lua/bots.cfg
COMMENT "Adding symlinks to vizdoom.so and bots.cfg in examples/lua.")
endif()
endif()
if(BUILD_LUA52)
#TODO
endif()
# Java binding
#-----------------------------------------------------------------------------------------------------------------------
if(BUILD_JAVA)
if (NOT DEFINED ENV{JAVA_HOME})
message(FATAL_ERROR "JAVA_HOME environment variable is not set.")
endif()
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
include(UseJava)
set(VIZDOOM_JAVA_OUTPUT_DIR ${VIZDOOM_OUTPUT_DIR}/java)
set(VIZDOOM_JAVA_SRC_DIR ${VIZDOOM_SRC_DIR}/lib_java)
set(VIZDOOM_JAVA_CLASSES_DIR ${VIZDOOM_JAVA_SRC_DIR}/java_classes)
set(VIZDOOM_JAVA_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_JAVA_SRC_DIR})
set(VIZDOOM_JAVA_LIBS
${VIZDOOM_LIBS}
${Java_LIBRARIES}
${JNI_LIBRARIES})
if( UNIX )
set(JNI_INCLUDE_DIR ${JNI_INCLUDE_DIR}
${_JAVA_HOME}/include
${_JAVA_HOME}/include/linux)
endif()
if( WIN32 )
set( JNI_INCLUDE_DIR ${JNI_INCLUDE_DIR}
${_JAVA_HOME}/include
${_JAVA_HOME}/include/win32 )
endif()
include_directories(${VIZDOOM_JAVA_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${Java_INCLUDE_DIRS}
${JNI_INCLUDE_DIR})
set(VIZDOOM_JAVA_SOURCES
${VIZDOOM_JAVA_SRC_DIR}/ViZDoomJava.h
${VIZDOOM_JAVA_SRC_DIR}/ViZDoomGameJava.h
${VIZDOOM_JAVA_SRC_DIR}/ViZDoomGameJava.cpp)
add_library(libvizdoom_java SHARED ${VIZDOOM_JAVA_SOURCES})
target_link_libraries (libvizdoom_java ${VIZDOOM_JAVA_LIBS} libvizdoom_static)
set_target_properties(libvizdoom_java
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_JAVA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_JAVA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_JAVA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_JAVA_OUTPUT_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_JAVA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${VIZDOOM_JAVA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_JAVA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_JAVA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_JAVA_OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_JAVA_OUTPUT_DIR}
OUTPUT_NAME vizdoom
PROJECT_LABEL "Java ViZDoom binding")
add_jar(libvizdoom_java_classes
${VIZDOOM_JAVA_CLASSES_DIR}/enums/AutomapMode.java
${VIZDOOM_JAVA_CLASSES_DIR}/enums/Button.java
${VIZDOOM_JAVA_CLASSES_DIR}/enums/GameVariable.java
${VIZDOOM_JAVA_CLASSES_DIR}/enums/Mode.java
${VIZDOOM_JAVA_CLASSES_DIR}/enums/ScreenFormat.java
${VIZDOOM_JAVA_CLASSES_DIR}/enums/ScreenResolution.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/FileDoesNotExistException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/MessageQueueException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/SharedMemoryException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/SignalException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/ViZDoomErrorException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/ViZDoomIsNotRunningException.java
${VIZDOOM_JAVA_CLASSES_DIR}/exceptions/ViZDoomUnexpectedExitException.java
${VIZDOOM_JAVA_CLASSES_DIR}/GameState.java
${VIZDOOM_JAVA_CLASSES_DIR}/Label.java
${VIZDOOM_JAVA_CLASSES_DIR}/DoomGame.java
OUTPUT_DIR ${VIZDOOM_JAVA_OUTPUT_DIR}
OUTPUT_NAME vizdoom
PROJECT_LABEL "ViZDoom Java classes")
endif()
# Freedoom 2 download
#-----------------------------------------------------------------------------------------------------------------------
#if( WIN32 )
# if(NOT EXISTS "${PROJECT_SOURCE_DIR}/scenarios/freedoom.zip")
# message("-- Downloading Freedoom WADs")
# message("-- Original Doom WADs can not be provided due to licences")
#
# file( DOWNLOAD https://github.com/freedoom/freedoom/releases/download/v0.10.1/freedoom-0.10.1.zip ${PROJECT_SOURCE_DIR}/scenarios/freedoom.zip SHOW_PROGRESS )
# endif()
#endif()
if(UNIX)
add_custom_target( freedoom2 ALL
COMMAND ./download_freedoom.sh
)
endif()