Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. cmake_minimum_required (VERSION 2.8)
  2. project (OpenRaider)
  3. # Version Number
  4. set (OpenRaider_VERSION_MAJOR 0)
  5. set (OpenRaider_VERSION_MINOR 1)
  6. set (OpenRaider_VERSION_MICRO 2)
  7. # Build Host
  8. set (OpenRaider_BUILD_HOST ${CMAKE_HOST_SYSTEM})
  9. # Apple specific bundling
  10. if (APPLE)
  11. # Mac Bundle Data
  12. set (MACOSX_BUNDLE_INFO_STRING "Open Tomb Raider Engine")
  13. set (MACOSX_BUNDLE_ICON_FILE "AppIcon")
  14. set (MACOSX_BUNDLE_GUI_IDENTIFIER "de.xythobuz.OpenRaider")
  15. set (MACOSX_BUNDLE_LONG_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
  16. set (MACOSX_BUNDLE_BUNDLE_NAME "OpenRaider")
  17. set (MACOSX_BUNDLE_SHORT_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
  18. set (MACOSX_BUNDLE_BUNDLE_VERSION "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
  19. set (MACOSX_BUNDLE_COPYRIGHT "2001 - 2014")
  20. # Copy Icon
  21. set (MAC_ICON "${PROJECT_SOURCE_DIR}/data/AppIcon.icns")
  22. set_source_files_properties(${MAC_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
  23. set (SRCS ${SRCS} ${MAC_ICON})
  24. endif (APPLE)
  25. # Configuration Header file
  26. configure_file (
  27. "${PROJECT_SOURCE_DIR}/include/Config.h.in"
  28. "${PROJECT_BINARY_DIR}/Config.h"
  29. )
  30. include_directories ("${PROJECT_BINARY_DIR}")
  31. # Executable, Source files
  32. add_executable (OpenRaider MACOSX_BUNDLE
  33. src/Camera.cpp
  34. src/Emitter.cpp
  35. src/GLString.cpp
  36. src/MatMath.cpp
  37. src/Matrix.cpp
  38. src/Mesh.cpp
  39. src/Network.cpp
  40. src/OpenRaider.cpp
  41. src/Particle.cpp
  42. src/Quaternion.cpp
  43. src/Render.cpp
  44. src/SDLSystem.cpp
  45. src/SkeletalModel.cpp
  46. src/Sound.cpp
  47. src/System.cpp
  48. src/Texture.cpp
  49. src/TombRaider.cpp
  50. src/Vector3d.cpp
  51. src/ViewVolume.cpp
  52. src/World.cpp
  53. src/tga.cpp
  54. ${SRCS}
  55. )
  56. # Default to Debug build
  57. set (CMAKE_BUILD_TYPE "Debug")
  58. # Flags for all builds
  59. set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
  60. set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_EMITTER")
  61. # Flags for Debug build
  62. set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
  63. set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DEXPERIMENTAL")
  64. # Flags for Releasae builds
  65. set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE}")
  66. # Apply Flags
  67. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenRaider_CXX_FLAGS}")
  68. set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
  69. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
  70. # Include directory
  71. include_directories ("${PROJECT_SOURCE_DIR}/include")
  72. # Include External Modules
  73. set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
  74. # Add SDL2 Library
  75. find_package (SDL2 REQUIRED)
  76. include_directories (${SDL2_INCLUDE_DIR})
  77. set (LIBS ${LIBS} ${SDL2_LIBRARY})
  78. # Add SDL2_ttf Library
  79. find_package (SDL2TTF REQUIRED)
  80. include_directories (${SDL2TTF_INCLUDE_DIR})
  81. set (LIBS ${LIBS} ${SDL2TTF_LIBRARY})
  82. # Add OpenGL Library
  83. find_package (OpenGL REQUIRED)
  84. include_directories (${OPENGL_INCLUDE_DIRS})
  85. set (LIBS ${LIBS} ${OPENGL_LIBRARIES})
  86. # Add OpenAL Library
  87. find_package (OpenAL REQUIRED)
  88. include_directories (${OPENAL_INCLUDE_DIRS})
  89. set (LIBS ${LIBS} ${OPENAL_LIBRARIES})
  90. # Add ALUT Library
  91. find_package (ALUT REQUIRED)
  92. include_directories (${ALUT_INCLUDE_DIRS})
  93. set (LIBS ${LIBS} ${ALUT_LIBRARIES})
  94. # Add Z Library
  95. find_package (ZLIB REQUIRED)
  96. include_directories (${ZLIB_INCLUDE_DIRS})
  97. set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
  98. # Link to all found libs
  99. target_link_libraries (OpenRaider ${LIBS})
  100. # Preparing the bundle on install
  101. # http://www.cmake.org/Wiki/BundleUtilitiesExample
  102. # Why does it even work?
  103. if (APPLE)
  104. set (plugin_dest_dir OpenRaider.app/Contents/MacOS)
  105. set (APPS "${PROJECT_BINARY_DIR}/OpenRaider.app")
  106. set (DIRS ${QT_LIBRARY_DIRS})
  107. install (CODE "
  108. file(GLOB_RECURSE PLUGINS
  109. \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
  110. include(BundleUtilities)
  111. fixup_bundle(\"${APPS}\" \"\${PLUGINS}\" \"${DIRS}\")
  112. " COMPONENT Runtime
  113. )
  114. endif (APPLE)