PageRenderTime 43ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/neo/CMakeLists.txt

https://github.com/angjminer/dhewm3
CMake | 835 lines | 731 code | 80 blank | 24 comment | 38 complexity | 492cb8cab44351d556ebd43550080dd1 MD5 | raw file
Possible License(s): Unlicense, CC0-1.0, GPL-2.0, GPL-3.0
  1. project(dhewm3)
  2. cmake_minimum_required(VERSION 2.6)
  3. # TODO
  4. # osx: place game .dylib's in the bundle (next to the binary)
  5. # osx: -weak_framework ?
  6. # maybe add these as options:
  7. # TARGET_MONO
  8. # SETUP
  9. # SDK -D_D3SDK
  10. # don't add these as options, but document them?
  11. # IDNET_HOST -DIDNET_HOST=\\"%s\\"' % IDNET_HOST
  12. # DEBUG_MEMORY -DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE
  13. # LIBC_MALLOC -DUSE_LIBC_MALLOC=0
  14. # ID_NOLANADDRESS -DID_NOLANADDRESS
  15. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sys/cmake")
  16. set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
  17. include(CheckCXXCompilerFlag)
  18. include(CheckFunctionExists)
  19. include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS)
  20. option(CORE "Build the core" ON)
  21. option(BASE "Build the base game code" ON)
  22. option(D3XP "Build the d3xp game code" ON)
  23. option(DEDICATED "Build the dedicated server" OFF)
  24. option(ONATIVE "Optimize for the host CPU" OFF)
  25. option(SDL2 "Use SDL2 instead of SDL1.2" OFF)
  26. if(NOT CMAKE_SYSTEM_PROCESSOR)
  27. message(FATAL_ERROR "No target CPU architecture set")
  28. endif()
  29. if(NOT CMAKE_SYSTEM_NAME)
  30. message(FATAL_ERROR "No target OS set")
  31. endif()
  32. # target cpu
  33. set(cpu ${CMAKE_SYSTEM_PROCESSOR})
  34. if(cpu STREQUAL "powerpc")
  35. set(cpu "ppc")
  36. elseif(cpu MATCHES "i.86")
  37. set(cpu "x86")
  38. endif()
  39. if(MSVC AND CMAKE_CL_64)
  40. set(cpu "amd64")
  41. endif()
  42. # target os
  43. if(APPLE)
  44. set(os "macosx")
  45. else()
  46. string(TOLOWER "${CMAKE_SYSTEM_NAME}" os)
  47. endif()
  48. # build type
  49. if(NOT CMAKE_BUILD_TYPE)
  50. set(CMAKE_BUILD_TYPE "RelWithDebInfo")
  51. endif()
  52. # precompiled libraries from the dhewm3-libs repo
  53. if(DHEWM3LIBS)
  54. if(CMAKE_CROSSCOMPILING)
  55. set(CMAKE_FIND_ROOT_PATH ${DHEWM3LIBS})
  56. else()
  57. set(ENV{CMAKE_PREFIX_PATH} ${DHEWM3LIBS})
  58. endif()
  59. # these are too stupid, give them a hint
  60. set(ENV{OPENALDIR} ${DHEWM3LIBS})
  61. set(ENV{SDLDIR} ${DHEWM3LIBS})
  62. set(ENV{SDL2DIR} ${DHEWM3LIBS})
  63. endif()
  64. # libs
  65. find_package(ZLIB REQUIRED)
  66. include_directories(${ZLIB_INCLUDE_DIRS})
  67. find_package(JPEG REQUIRED)
  68. include_directories(${JPEG_INCLUDE_DIR})
  69. set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR})
  70. set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY})
  71. CHECK_FUNCTION_EXISTS("jpeg_mem_src" HAVE_JPEG_MEM_SRC)
  72. find_package(OGG REQUIRED)
  73. include_directories(${OGG_INCLUDE_DIR})
  74. find_package(Vorbis REQUIRED)
  75. include_directories(${VORBIS_INCLUDE_DIR})
  76. find_package(VorbisFile REQUIRED)
  77. include_directories(${VORBISFILE_INCLUDE_DIR})
  78. find_package(OpenAL REQUIRED)
  79. include_directories(${OPENAL_INCLUDE_DIR})
  80. if (SDL2)
  81. # skip SDL2main
  82. if(APPLE OR WIN32)
  83. set(SDL2_BUILDING_LIBRARY TRUE)
  84. endif()
  85. find_package(SDL2 REQUIRED)
  86. include_directories(${SDL2_INCLUDE_DIR})
  87. set(SDLx_LIBRARY ${SDL2_LIBRARY})
  88. else()
  89. # skip SDLmain
  90. if(APPLE OR WIN32)
  91. set(SDL_BUILDING_LIBRARY TRUE)
  92. endif()
  93. find_package(SDL REQUIRED)
  94. include_directories(${SDL_INCLUDE_DIR})
  95. set(SDLx_LIBRARY ${SDL_LIBRARY})
  96. endif()
  97. find_package(CURL QUIET)
  98. if(CURL_FOUND)
  99. set(ID_ENABLE_CURL ON)
  100. include_directories(${CURL_INCLUDE_DIR})
  101. else()
  102. message(STATUS "libcurl not found, server downloads won't be available")
  103. set(ID_ENABLE_CURL OFF)
  104. set(CURL_LIBRARY "")
  105. endif()
  106. # compiler specific flags
  107. if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
  108. add_definitions(-pipe)
  109. add_definitions(-Wall)
  110. if(NOT CMAKE_CROSSCOMPILING AND ONATIVE)
  111. add_definitions(-march=native)
  112. elseif(NOT APPLE AND cpu STREQUAL "x86")
  113. add_definitions(-march=pentium3)
  114. endif()
  115. set(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O1")
  116. set(CMAKE_C_FLAGS_DEBUGALL "-g -ggdb -D_DEBUG")
  117. set(CMAKE_C_FLAGS_PROFILE "-g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer")
  118. set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
  119. set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
  120. set(CMAKE_C_FLAGS_MINSIZEREL "-Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
  121. set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
  122. set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})
  123. add_definitions(-fno-strict-aliasing)
  124. CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
  125. if(NOT cxx_has_fvisibility)
  126. message(FATAL_ERROR "Compiler does not support -fvisibility")
  127. endif()
  128. add_definitions(-fvisibility=hidden)
  129. # TODO fix these warnings
  130. add_definitions(-Wno-sign-compare)
  131. add_definitions(-Wno-switch)
  132. add_definitions(-Wno-format-security)
  133. CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
  134. if(cxx_has_Woverload_virtual)
  135. add_definitions(-Woverloaded-virtual)
  136. endif()
  137. if(APPLE)
  138. add_definitions(-DMACOS_X=1)
  139. if(cpu STREQUAL "x86_64")
  140. add_definitions(-arch x86_64 -mmacosx-version-min=10.6)
  141. set(ldflags "${ldflags} -arch x86_64 -mmacosx-version-min=10.6")
  142. elseif(cpu STREQUAL "x86")
  143. CHECK_CXX_COMPILER_FLAG("-arch i386" cxx_has_arch_i386)
  144. if(cxx_has_arch_i386)
  145. add_definitions(-arch i386)
  146. set(ldflags "${ldflags} -arch i386")
  147. endif()
  148. add_definitions(-mmacosx-version-min=10.4)
  149. set(ldflags "${ldflags} -mmacosx-version-min=10.4")
  150. elseif(cpu STREQUAL "ppc")
  151. CHECK_CXX_COMPILER_FLAG("-arch ppc" cxx_has_arch_ppc)
  152. if(cxx_has_arch_ppc)
  153. add_definitions(-arch ppc)
  154. set(ldflags "${ldflags} -arch ppc")
  155. endif()
  156. add_definitions(-mmacosx-version-min=10.4)
  157. set(ldflags "${ldflags} -mmacosx-version-min=10.4")
  158. else()
  159. message(FATAL_ERROR "Unsupported CPU architecture for OSX")
  160. endif()
  161. set(sys_libs ${sys_libs} "-framework Carbon -framework Cocoa -framework IOKit")
  162. elseif(WIN32)
  163. set(ldflags "${ldflags} -static-libgcc -static-libstdc++")
  164. else()
  165. if(os STREQUAL "linux")
  166. set(sys_libs ${sys_libs} dl)
  167. endif()
  168. endif()
  169. elseif(MSVC)
  170. add_definitions(/W4)
  171. add_definitions(/wd4100) # unreferenced formal parameter
  172. add_definitions(/wd4127) # conditional expression is constant
  173. add_definitions(/wd4244) # possible loss of data
  174. add_definitions(/wd4245) # signed/unsigned mismatch
  175. add_definitions(/wd4267) # possible loss of data
  176. add_definitions(/wd4714) # 'function' marked as __forceinline not inlined
  177. add_definitions(/wd4996) # 'function': was declared deprecated
  178. add_definitions(/wd4068) # unknown pragma
  179. add_definitions(-D_ALLOW_KEYWORD_MACROS) # because of the "#define private public" and "#define protected public" in TypeInfo.cpp
  180. set(CMAKE_C_FLAGS_DEBUG "-D_DEBUG /Od /Zi /MDd")
  181. set(CMAKE_C_FLAGS_RELEASE "/Ox /Oy /MD")
  182. set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ox /Oy /Zi /MD")
  183. set(CMAKE_C_FLAGS_MINSIZEREL "/Ox /Oy /Os /MD")
  184. else()
  185. message(FATAL_ERROR "Unsupported compiler")
  186. endif()
  187. set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
  188. set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
  189. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
  190. set(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
  191. # mingw and msvc
  192. if(WIN32)
  193. add_definitions(-DWINVER=0x0501)
  194. add_definitions(-D_WIN32_WINNT=0x0501)
  195. set(sys_libs ${sys_libs}
  196. winmm
  197. iphlpapi
  198. wsock32
  199. )
  200. endif()
  201. # fallback for cmake versions without GNUInstallDirs
  202. if(GNUINSTALLDIRS MATCHES "NOTFOUND")
  203. set(CMAKE_INSTALL_BINDIR "bin"
  204. CACHE PATH "user executables (bin)")
  205. set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}"
  206. CACHE PATH "object code libraries (lib${LIB_SUFFIX})")
  207. set(CMAKE_INSTALL_DATAROOTDIR "share"
  208. CACHE PATH "read-only architecture-independent data root (share)")
  209. set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}"
  210. CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
  211. mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_DATAROOTDIR CMAKE_INSTALL_DATADIR)
  212. foreach(dir BINDIR LIBDIR DATAROOTDIR DATADIR)
  213. if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
  214. set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
  215. else()
  216. set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
  217. endif()
  218. endforeach()
  219. endif()
  220. set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")
  221. set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}/dhewm3")
  222. set(datadir "${CMAKE_INSTALL_FULL_DATADIR}/dhewm3")
  223. configure_file(
  224. "${CMAKE_SOURCE_DIR}/config.h.in"
  225. "${CMAKE_BINARY_DIR}/config.h"
  226. )
  227. message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}-${cpu}")
  228. if(NOT APPLE AND NOT WIN32)
  229. message(STATUS "The install target will use the following directories:")
  230. message(STATUS " Binary directory: ${bindir}")
  231. message(STATUS " Library directory: ${libdir}")
  232. message(STATUS " Data directory: ${datadir}")
  233. endif()
  234. set(src_renderer
  235. renderer/jpeg_memory_src.cpp
  236. renderer/Cinematic.cpp
  237. renderer/GuiModel.cpp
  238. renderer/Image_files.cpp
  239. renderer/Image_init.cpp
  240. renderer/Image_load.cpp
  241. renderer/Image_process.cpp
  242. renderer/Image_program.cpp
  243. renderer/Interaction.cpp
  244. renderer/Material.cpp
  245. renderer/MegaTexture.cpp
  246. renderer/Model.cpp
  247. renderer/ModelDecal.cpp
  248. renderer/ModelManager.cpp
  249. renderer/ModelOverlay.cpp
  250. renderer/Model_beam.cpp
  251. renderer/Model_ase.cpp
  252. renderer/Model_liquid.cpp
  253. renderer/Model_lwo.cpp
  254. renderer/Model_ma.cpp
  255. renderer/Model_md3.cpp
  256. renderer/Model_md5.cpp
  257. renderer/Model_prt.cpp
  258. renderer/Model_sprite.cpp
  259. renderer/RenderEntity.cpp
  260. renderer/RenderSystem.cpp
  261. renderer/RenderSystem_init.cpp
  262. renderer/RenderWorld.cpp
  263. renderer/RenderWorld_demo.cpp
  264. renderer/RenderWorld_load.cpp
  265. renderer/RenderWorld_portals.cpp
  266. renderer/VertexCache.cpp
  267. renderer/draw_arb2.cpp
  268. renderer/draw_common.cpp
  269. renderer/tr_backend.cpp
  270. renderer/tr_deform.cpp
  271. renderer/tr_font.cpp
  272. renderer/tr_guisurf.cpp
  273. renderer/tr_light.cpp
  274. renderer/tr_lightrun.cpp
  275. renderer/tr_main.cpp
  276. renderer/tr_orderIndexes.cpp
  277. renderer/tr_polytope.cpp
  278. renderer/tr_render.cpp
  279. renderer/tr_rendertools.cpp
  280. renderer/tr_shadowbounds.cpp
  281. renderer/tr_stencilshadow.cpp
  282. renderer/tr_subview.cpp
  283. renderer/tr_trace.cpp
  284. renderer/tr_trisurf.cpp
  285. renderer/tr_turboshadow.cpp
  286. )
  287. set(src_framework
  288. framework/CVarSystem.cpp
  289. framework/CmdSystem.cpp
  290. framework/Common.cpp
  291. framework/Compressor.cpp
  292. framework/Console.cpp
  293. framework/DemoFile.cpp
  294. framework/DeclAF.cpp
  295. framework/DeclEntityDef.cpp
  296. framework/DeclFX.cpp
  297. framework/DeclManager.cpp
  298. framework/DeclParticle.cpp
  299. framework/DeclPDA.cpp
  300. framework/DeclSkin.cpp
  301. framework/DeclTable.cpp
  302. framework/EditField.cpp
  303. framework/EventLoop.cpp
  304. framework/File.cpp
  305. framework/FileSystem.cpp
  306. framework/KeyInput.cpp
  307. framework/UsercmdGen.cpp
  308. framework/Session_menu.cpp
  309. framework/Session.cpp
  310. framework/async/AsyncClient.cpp
  311. framework/async/AsyncNetwork.cpp
  312. framework/async/AsyncServer.cpp
  313. framework/async/MsgChannel.cpp
  314. framework/async/NetworkSystem.cpp
  315. framework/async/ServerScan.cpp
  316. framework/minizip/ioapi.c
  317. framework/minizip/unzip.cpp
  318. )
  319. set(src_cm
  320. cm/CollisionModel_contacts.cpp
  321. cm/CollisionModel_contents.cpp
  322. cm/CollisionModel_debug.cpp
  323. cm/CollisionModel_files.cpp
  324. cm/CollisionModel_load.cpp
  325. cm/CollisionModel_rotate.cpp
  326. cm/CollisionModel_trace.cpp
  327. cm/CollisionModel_translate.cpp
  328. )
  329. set(src_dmap
  330. tools/compilers/dmap/dmap.cpp
  331. tools/compilers/dmap/facebsp.cpp
  332. tools/compilers/dmap/gldraw.cpp
  333. tools/compilers/dmap/glfile.cpp
  334. tools/compilers/dmap/leakfile.cpp
  335. tools/compilers/dmap/map.cpp
  336. tools/compilers/dmap/optimize.cpp
  337. tools/compilers/dmap/output.cpp
  338. tools/compilers/dmap/portals.cpp
  339. tools/compilers/dmap/shadowopt3.cpp
  340. tools/compilers/dmap/tritjunction.cpp
  341. tools/compilers/dmap/tritools.cpp
  342. tools/compilers/dmap/ubrush.cpp
  343. tools/compilers/dmap/usurface.cpp
  344. )
  345. set(src_aas
  346. tools/compilers/aas/AASBuild.cpp
  347. tools/compilers/aas/AASBuild_file.cpp
  348. tools/compilers/aas/AASBuild_gravity.cpp
  349. tools/compilers/aas/AASBuild_ledge.cpp
  350. tools/compilers/aas/AASBuild_merge.cpp
  351. tools/compilers/aas/AASCluster.cpp
  352. tools/compilers/aas/AASFile.cpp
  353. tools/compilers/aas/AASFile_optimize.cpp
  354. tools/compilers/aas/AASFile_sample.cpp
  355. tools/compilers/aas/AASReach.cpp
  356. tools/compilers/aas/AASFileManager.cpp
  357. tools/compilers/aas/Brush.cpp
  358. tools/compilers/aas/BrushBSP.cpp
  359. )
  360. set(src_roq
  361. tools/compilers/roqvq/NSBitmapImageRep.cpp
  362. tools/compilers/roqvq/codec.cpp
  363. tools/compilers/roqvq/roq.cpp
  364. tools/compilers/roqvq/roqParam.cpp
  365. )
  366. set(src_renderbump
  367. tools/compilers/renderbump/renderbump.cpp
  368. )
  369. set(src_snd
  370. sound/snd_cache.cpp
  371. sound/snd_decoder.cpp
  372. sound/snd_efxfile.cpp
  373. sound/snd_emitter.cpp
  374. sound/snd_shader.cpp
  375. sound/snd_system.cpp
  376. sound/snd_wavefile.cpp
  377. sound/snd_world.cpp
  378. )
  379. set(src_ui
  380. ui/BindWindow.cpp
  381. ui/ChoiceWindow.cpp
  382. ui/DeviceContext.cpp
  383. ui/EditWindow.cpp
  384. ui/FieldWindow.cpp
  385. ui/GameBearShootWindow.cpp
  386. ui/GameBustOutWindow.cpp
  387. ui/GameSSDWindow.cpp
  388. ui/GuiScript.cpp
  389. ui/ListGUI.cpp
  390. ui/ListWindow.cpp
  391. ui/MarkerWindow.cpp
  392. ui/RegExp.cpp
  393. ui/RenderWindow.cpp
  394. ui/SimpleWindow.cpp
  395. ui/SliderWindow.cpp
  396. ui/UserInterface.cpp
  397. ui/Window.cpp
  398. ui/Winvar.cpp
  399. )
  400. set(src_tools
  401. tools/guied/GEWindowWrapper_stub.cpp
  402. )
  403. set(src_idlib
  404. idlib/bv/Bounds.cpp
  405. idlib/bv/Frustum.cpp
  406. idlib/bv/Sphere.cpp
  407. idlib/bv/Box.cpp
  408. idlib/geometry/DrawVert.cpp
  409. idlib/geometry/Winding2D.cpp
  410. idlib/geometry/Surface_SweptSpline.cpp
  411. idlib/geometry/Winding.cpp
  412. idlib/geometry/Surface.cpp
  413. idlib/geometry/Surface_Patch.cpp
  414. idlib/geometry/TraceModel.cpp
  415. idlib/geometry/JointTransform.cpp
  416. idlib/hashing/CRC32.cpp
  417. idlib/hashing/MD4.cpp
  418. idlib/hashing/MD5.cpp
  419. idlib/math/Angles.cpp
  420. idlib/math/Lcp.cpp
  421. idlib/math/Math.cpp
  422. idlib/math/Matrix.cpp
  423. idlib/math/Ode.cpp
  424. idlib/math/Plane.cpp
  425. idlib/math/Pluecker.cpp
  426. idlib/math/Polynomial.cpp
  427. idlib/math/Quat.cpp
  428. idlib/math/Rotation.cpp
  429. idlib/math/Simd.cpp
  430. idlib/math/Simd_Generic.cpp
  431. idlib/math/Simd_AltiVec.cpp
  432. idlib/math/Simd_MMX.cpp
  433. idlib/math/Simd_3DNow.cpp
  434. idlib/math/Simd_SSE.cpp
  435. idlib/math/Simd_SSE2.cpp
  436. idlib/math/Simd_SSE3.cpp
  437. idlib/math/Vector.cpp
  438. idlib/BitMsg.cpp
  439. idlib/LangDict.cpp
  440. idlib/Lexer.cpp
  441. idlib/Lib.cpp
  442. idlib/containers/HashIndex.cpp
  443. idlib/Dict.cpp
  444. idlib/Str.cpp
  445. idlib/Parser.cpp
  446. idlib/MapFile.cpp
  447. idlib/CmdArgs.cpp
  448. idlib/Token.cpp
  449. idlib/Base64.cpp
  450. idlib/Timer.cpp
  451. idlib/Heap.cpp
  452. )
  453. set(src_game
  454. game/AF.cpp
  455. game/AFEntity.cpp
  456. game/Actor.cpp
  457. game/Camera.cpp
  458. game/Entity.cpp
  459. game/BrittleFracture.cpp
  460. game/Fx.cpp
  461. game/GameEdit.cpp
  462. game/Game_local.cpp
  463. game/Game_network.cpp
  464. game/Item.cpp
  465. game/IK.cpp
  466. game/Light.cpp
  467. game/Misc.cpp
  468. game/Mover.cpp
  469. game/Moveable.cpp
  470. game/MultiplayerGame.cpp
  471. game/Player.cpp
  472. game/PlayerIcon.cpp
  473. game/PlayerView.cpp
  474. game/Projectile.cpp
  475. game/Pvs.cpp
  476. game/SecurityCamera.cpp
  477. game/SmokeParticles.cpp
  478. game/Sound.cpp
  479. game/Target.cpp
  480. game/Trigger.cpp
  481. game/Weapon.cpp
  482. game/WorldSpawn.cpp
  483. game/ai/AAS.cpp
  484. game/ai/AAS_debug.cpp
  485. game/ai/AAS_pathing.cpp
  486. game/ai/AAS_routing.cpp
  487. game/ai/AI.cpp
  488. game/ai/AI_events.cpp
  489. game/ai/AI_pathing.cpp
  490. game/ai/AI_Vagary.cpp
  491. game/gamesys/DebugGraph.cpp
  492. game/gamesys/Class.cpp
  493. game/gamesys/Event.cpp
  494. game/gamesys/SaveGame.cpp
  495. game/gamesys/SysCmds.cpp
  496. game/gamesys/SysCvar.cpp
  497. game/gamesys/TypeInfo.cpp
  498. game/anim/Anim.cpp
  499. game/anim/Anim_Blend.cpp
  500. game/anim/Anim_Import.cpp
  501. game/anim/Anim_Testmodel.cpp
  502. game/script/Script_Compiler.cpp
  503. game/script/Script_Interpreter.cpp
  504. game/script/Script_Program.cpp
  505. game/script/Script_Thread.cpp
  506. game/physics/Clip.cpp
  507. game/physics/Force.cpp
  508. game/physics/Force_Constant.cpp
  509. game/physics/Force_Drag.cpp
  510. game/physics/Force_Field.cpp
  511. game/physics/Force_Spring.cpp
  512. game/physics/Physics.cpp
  513. game/physics/Physics_AF.cpp
  514. game/physics/Physics_Actor.cpp
  515. game/physics/Physics_Base.cpp
  516. game/physics/Physics_Monster.cpp
  517. game/physics/Physics_Parametric.cpp
  518. game/physics/Physics_Player.cpp
  519. game/physics/Physics_RigidBody.cpp
  520. game/physics/Physics_Static.cpp
  521. game/physics/Physics_StaticMulti.cpp
  522. game/physics/Push.cpp
  523. )
  524. set(src_d3xp
  525. d3xp/AF.cpp
  526. d3xp/AFEntity.cpp
  527. d3xp/Actor.cpp
  528. d3xp/Camera.cpp
  529. d3xp/Entity.cpp
  530. d3xp/BrittleFracture.cpp
  531. d3xp/Fx.cpp
  532. d3xp/GameEdit.cpp
  533. d3xp/Game_local.cpp
  534. d3xp/Game_network.cpp
  535. d3xp/Item.cpp
  536. d3xp/IK.cpp
  537. d3xp/Light.cpp
  538. d3xp/Misc.cpp
  539. d3xp/Mover.cpp
  540. d3xp/Moveable.cpp
  541. d3xp/MultiplayerGame.cpp
  542. d3xp/Player.cpp
  543. d3xp/PlayerIcon.cpp
  544. d3xp/PlayerView.cpp
  545. d3xp/Projectile.cpp
  546. d3xp/Pvs.cpp
  547. d3xp/SecurityCamera.cpp
  548. d3xp/SmokeParticles.cpp
  549. d3xp/Sound.cpp
  550. d3xp/Target.cpp
  551. d3xp/Trigger.cpp
  552. d3xp/Weapon.cpp
  553. d3xp/WorldSpawn.cpp
  554. d3xp/ai/AAS.cpp
  555. d3xp/ai/AAS_debug.cpp
  556. d3xp/ai/AAS_pathing.cpp
  557. d3xp/ai/AAS_routing.cpp
  558. d3xp/ai/AI.cpp
  559. d3xp/ai/AI_events.cpp
  560. d3xp/ai/AI_pathing.cpp
  561. d3xp/ai/AI_Vagary.cpp
  562. d3xp/gamesys/DebugGraph.cpp
  563. d3xp/gamesys/Class.cpp
  564. d3xp/gamesys/Event.cpp
  565. d3xp/gamesys/SaveGame.cpp
  566. d3xp/gamesys/SysCmds.cpp
  567. d3xp/gamesys/SysCvar.cpp
  568. d3xp/gamesys/TypeInfo.cpp
  569. d3xp/anim/Anim.cpp
  570. d3xp/anim/Anim_Blend.cpp
  571. d3xp/anim/Anim_Import.cpp
  572. d3xp/anim/Anim_Testmodel.cpp
  573. d3xp/script/Script_Compiler.cpp
  574. d3xp/script/Script_Interpreter.cpp
  575. d3xp/script/Script_Program.cpp
  576. d3xp/script/Script_Thread.cpp
  577. d3xp/physics/Clip.cpp
  578. d3xp/physics/Force.cpp
  579. d3xp/physics/Force_Constant.cpp
  580. d3xp/physics/Force_Drag.cpp
  581. d3xp/physics/Force_Field.cpp
  582. d3xp/physics/Force_Spring.cpp
  583. d3xp/physics/Physics.cpp
  584. d3xp/physics/Physics_AF.cpp
  585. d3xp/physics/Physics_Actor.cpp
  586. d3xp/physics/Physics_Base.cpp
  587. d3xp/physics/Physics_Monster.cpp
  588. d3xp/physics/Physics_Parametric.cpp
  589. d3xp/physics/Physics_Player.cpp
  590. d3xp/physics/Physics_RigidBody.cpp
  591. d3xp/physics/Physics_Static.cpp
  592. d3xp/physics/Physics_StaticMulti.cpp
  593. d3xp/physics/Push.cpp
  594. d3xp/Grabber.cpp
  595. d3xp/physics/Force_Grab.cpp
  596. )
  597. set(src_core
  598. ${src_renderer}
  599. ${src_framework}
  600. ${src_cm}
  601. ${src_dmap}
  602. ${src_aas}
  603. ${src_roq}
  604. ${src_renderbump}
  605. ${src_snd}
  606. ${src_ui}
  607. ${src_tools}
  608. )
  609. set(src_stub_openal sys/stub/openal_stub.cpp)
  610. set(src_stub_gl sys/stub/stub_gl.cpp)
  611. if(APPLE)
  612. set(OSX_RESOURCE_FILES
  613. "${CMAKE_SOURCE_DIR}/sys/osx/Doom3.icns"
  614. "${CMAKE_SOURCE_DIR}/sys/osx/Doom 3.rsrc"
  615. )
  616. set_source_files_properties(${OSX_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
  617. set(src_sys_base
  618. sys/cpu.cpp
  619. sys/threads.cpp
  620. sys/events.cpp
  621. sys/sys_local.cpp
  622. sys/posix/posix_net.cpp
  623. sys/posix/posix_main.cpp
  624. )
  625. set(src_sys_core
  626. sys/glimp.cpp
  627. sys/osx/DOOMController.mm
  628. sys/osx/macosx_misc.mm
  629. sys/osx/SDLMain.m
  630. ${OSX_RESOURCE_FILES}
  631. )
  632. elseif(WIN32)
  633. set(src_sys_base
  634. sys/cpu.cpp
  635. sys/threads.cpp
  636. sys/events.cpp
  637. sys/sys_local.cpp
  638. sys/win32/win_input.cpp
  639. sys/win32/win_main.cpp
  640. sys/win32/win_net.cpp
  641. sys/win32/win_shared.cpp
  642. sys/win32/win_syscon.cpp
  643. sys/win32/SDL_win32_main.c
  644. )
  645. set(src_sys_core
  646. sys/glimp.cpp
  647. )
  648. else()
  649. set(src_sys_base
  650. sys/cpu.cpp
  651. sys/threads.cpp
  652. sys/events.cpp
  653. sys/sys_local.cpp
  654. sys/posix/posix_net.cpp
  655. sys/posix/posix_main.cpp
  656. sys/linux/main.cpp
  657. )
  658. set(src_sys_core
  659. sys/glimp.cpp
  660. )
  661. endif()
  662. include_directories(${CMAKE_BINARY_DIR})
  663. include_directories(${CMAKE_SOURCE_DIR})
  664. add_library(idlib STATIC ${src_idlib})
  665. if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MINGW)
  666. set_target_properties(idlib PROPERTIES COMPILE_FLAGS "-fPIC")
  667. endif()
  668. if(CORE)
  669. add_executable(dhewm3 WIN32 MACOSX_BUNDLE
  670. ${src_core}
  671. ${src_sys_base}
  672. ${src_sys_core}
  673. )
  674. set_target_properties(dhewm3 PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__")
  675. set_target_properties(dhewm3 PROPERTIES LINK_FLAGS "${ldflags}")
  676. set_target_properties(dhewm3 PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist)
  677. target_link_libraries(dhewm3
  678. idlib
  679. ${OPENAL_LIBRARY}
  680. ${OGG_LIBRARIES}
  681. ${VORBISFILE_LIBRARIES}
  682. ${VORBIS_LIBRARIES}
  683. ${CURL_LIBRARY}
  684. ${JPEG_LIBRARY}
  685. ${ZLIB_LIBRARY}
  686. ${SDLx_LIBRARY}
  687. ${sys_libs}
  688. )
  689. if(NOT APPLE AND NOT WIN32)
  690. install(TARGETS dhewm3
  691. RUNTIME DESTINATION "${bindir}"
  692. LIBRARY DESTINATION "${libdir}"
  693. ARCHIVE DESTINATION "${libdir}"
  694. )
  695. endif()
  696. endif()
  697. if(DEDICATED)
  698. add_executable(dhewm3ded WIN32 MACOSX_BUNDLE
  699. ${src_core}
  700. ${src_stub_openal}
  701. ${src_stub_gl}
  702. ${src_sys_base}
  703. )
  704. set_target_properties(dhewm3ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED;__DOOM_DLL__")
  705. set_target_properties(dhewm3ded PROPERTIES LINK_FLAGS "${ldflags}")
  706. target_link_libraries(dhewm3ded
  707. idlib
  708. ${VORBISFILE_LIBRARIES}
  709. ${VORBIS_LIBRARIES}
  710. ${CURL_LIBRARY}
  711. ${JPEG_LIBRARY}
  712. ${ZLIB_LIBRARY}
  713. ${SDLx_LIBRARY}
  714. ${sys_libs}
  715. )
  716. if(NOT APPLE AND NOT WIN32)
  717. install(TARGETS dhewm3ded
  718. RUNTIME DESTINATION "${bindir}"
  719. LIBRARY DESTINATION "${libdir}"
  720. ARCHIVE DESTINATION "${libdir}"
  721. )
  722. endif()
  723. endif()
  724. if(BASE)
  725. add_library(base SHARED ${src_game})
  726. set_target_properties(base PROPERTIES PREFIX "")
  727. set_target_properties(base PROPERTIES COMPILE_DEFINITIONS "GAME_DLL")
  728. set_target_properties(base PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/game")
  729. set_target_properties(base PROPERTIES LINK_FLAGS "${ldflags}")
  730. set_target_properties(base PROPERTIES INSTALL_NAME_DIR "@executable_path")
  731. target_link_libraries(base idlib)
  732. if(NOT APPLE AND NOT WIN32)
  733. install(TARGETS base
  734. RUNTIME DESTINATION "${bindir}"
  735. LIBRARY DESTINATION "${libdir}"
  736. ARCHIVE DESTINATION "${libdir}"
  737. )
  738. endif()
  739. endif()
  740. if(D3XP)
  741. add_library(d3xp SHARED ${src_d3xp})
  742. set_target_properties(d3xp PROPERTIES PREFIX "")
  743. set_target_properties(d3xp PROPERTIES COMPILE_DEFINITIONS "GAME_DLL;_D3XP;CTF")
  744. set_target_properties(d3xp PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/d3xp")
  745. set_target_properties(d3xp PROPERTIES LINK_FLAGS "${ldflags}")
  746. set_target_properties(d3xp PROPERTIES INSTALL_NAME_DIR "@executable_path")
  747. target_link_libraries(d3xp idlib)
  748. if(NOT APPLE AND NOT WIN32)
  749. install(TARGETS d3xp
  750. RUNTIME DESTINATION "${bindir}"
  751. LIBRARY DESTINATION "${libdir}"
  752. ARCHIVE DESTINATION "${libdir}"
  753. )
  754. endif()
  755. endif()