CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. cmake_minimum_required(VERSION 2.8)
  2. project(GamePlay-deps)
  3. IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
  4. SET(LINUX 1)
  5. ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
  6. if(NOT ANDROID AND NOT IOS)
  7. # Skip any introspection for cross-compiling targets
  8. include(${PROJECT_SOURCE_DIR}/cmake/TargetArch.cmake)
  9. set(ARCH "unknown")
  10. target_architecture(ARCH)
  11. endif(NOT ANDROID AND NOT IOS)
  12. set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/out/external-deps")
  13. if(NOT ANDROID AND NOT IOS)
  14. # Android and iOS toolchains will set their own output path
  15. IF(APPLE)
  16. set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/out/external-deps/lib/macosx/${ARCH}")
  17. ELSE()
  18. string(TOLOWER ${CMAKE_SYSTEM_NAME} LOWER_SYSTEM_NAME)
  19. set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/out/external-deps/lib/${LOWER_SYSTEM_NAME}/${ARCH}")
  20. ENDIF(APPLE)
  21. endif(NOT ANDROID AND NOT IOS)
  22. IF(NOT WIN32)
  23. # For Windows, let the user pick since we need to generate both Debug and
  24. # Release variants of all the libs.
  25. SET(CMAKE_BUILD_TYPE "Release")
  26. ENDIF(NOT WIN32)
  27. file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH})
  28. message(STATUS "Directory: ${LIBRARY_OUTPUT_PATH}")
  29. add_subdirectory(libjson-7.6.1)
  30. add_subdirectory(tinyxml2-2.1.0)
  31. add_subdirectory(lua-5.2.3)
  32. if (NOT APPLE)
  33. add_subdirectory(openal-1.16.0)
  34. endif(NOT APPLE)
  35. if (NOT APPLE AND NOT ANDROID)
  36. add_subdirectory(glew-1.10.0)
  37. endif (NOT APPLE AND NOT ANDROID)
  38. # zlib must be built before png and curl
  39. add_subdirectory(zlib-1.2.8)
  40. add_subdirectory(png-1.6.15)
  41. if(NOT WIN32 AND BUILD_EXTRA_LIBS)
  42. add_subdirectory(curl-7.39.0)
  43. endif(NOT WIN32 AND BUILD_EXTRA_LIBS)
  44. # Ogg needs to be built before vorbis
  45. add_subdirectory(ogg-1.3.2)
  46. add_subdirectory(vorbis-1.3.4)
  47. add_subdirectory(bullet-2.82-r2704)
  48. add_subdirectory(base64-1.0.0)
  49. set(BUILD_TARGETS
  50. BulletDynamics
  51. LinearMath
  52. BulletCollision
  53. vorbisfile
  54. vorbisenc
  55. vorbis
  56. ogg
  57. png_static
  58. zlibstatic
  59. lua
  60. tinyxml2static
  61. json
  62. base64
  63. )
  64. if (NOT APPLE)
  65. list(APPEND BUILD_TARGETS GLEW)
  66. IF(WIN32)
  67. list(APPEND BUILD_TARGETS OpenAL32)
  68. ELSE(WIN32)
  69. list(APPEND BUILD_TARGETS openal)
  70. ENDIF(WIN32)
  71. endif(NOT APPLE)
  72. IF(BUILD_EXTRA_LIBS)
  73. if(NOT WIN32)
  74. list(APPEND BUILD_TARGETS libcurl)
  75. endif(NOT WIN32)
  76. ENDIF(BUILD_EXTRA_LIBS)
  77. if(WIN32)
  78. set(GAMEPLAY_DEPS gameplay-deps.lib)
  79. else(WIN32)
  80. set(GAMEPLAY_DEPS libgameplay-deps.a)
  81. endif(WIN32)
  82. if(LINUX OR ANDROID)
  83. add_custom_command(
  84. OUTPUT ${GAMEPLAY_DEPS}
  85. COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/gnu-amalgamate.sh ${CMAKE_AR} ${LIBRARY_OUTPUT_PATH}
  86. )
  87. elseif(APPLE)
  88. add_custom_command(
  89. OUTPUT ${GAMEPLAY_DEPS}
  90. COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/xcode-amalgamate.sh ${LIBRARY_OUTPUT_PATH}
  91. )
  92. else()
  93. # Windows
  94. add_custom_command(
  95. OUTPUT ${GAMEPLAY_DEPS}
  96. COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/msvc-amalgamate.bat ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}
  97. )
  98. endif(LINUX OR ANDROID)
  99. add_custom_target(gameplay-deps ALL DEPENDS ${GAMEPLAY_DEPS})
  100. add_dependencies(gameplay-deps ${BUILD_TARGETS})
  101. SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LIBRARY_OUTPUT_PATH}/${GAMEPLAY_DEPS})