CMakeLists.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. cmake_minimum_required (VERSION 2.8)
  2. IF(APPLE)
  3. # SET(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
  4. SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
  5. ENDIF()
  6. project(Amnesia)
  7. SET(VERSION "1.0.3")
  8. OPTION(USERDIR_RESOURCES "Allow using local userdirectory resources" OFF)
  9. IF("${CMAKE_SYSTEM}" MATCHES "Linux")
  10. SET(LINUX ON)
  11. ENDIF()
  12. OPTION(FORCE32 "Force a 32bit compile on 64bit" OFF)
  13. if (APPLE)
  14. SET(FORCE32 ON)
  15. endif()
  16. IF(FORCE32)
  17. if(APPLE)
  18. SET(CMAKE_OSX_ARCHITECTURES "i386")
  19. else()
  20. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
  21. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
  22. endif()
  23. ENDIF()
  24. IF(LINUX)
  25. if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT(FORCE32) )
  26. set(BIN_LIBROOT "linux64")
  27. set(CMAKE_EXECUTABLE_SUFFIX ".bin.x86_64")
  28. set(BIN_RPATH "\$ORIGIN/lib64")
  29. else()
  30. set(BIN_LIBROOT "linux")
  31. set(CMAKE_EXECUTABLE_SUFFIX ".bin.x86")
  32. set(BIN_RPATH "\$ORIGIN/lib")
  33. endif()
  34. set(CMAKE_SKIP_BUILD_RPATH TRUE)
  35. set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
  36. set(CMAKE_INSTALL_RPATH ${BIN_RPATH})
  37. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  38. ELSEIF(APPLE)
  39. SET(BIN_LIBROOT "macosx")
  40. SET(BIN_RPATH "@executable_path/../Frameworks")
  41. set(CMAKE_SKIP_BUILD_RPATH TRUE)
  42. set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
  43. set(CMAKE_INSTALL_RPATH ${BIN_RPATH})
  44. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  45. ENDIF()
  46. SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
  47. # silence some annoying warnings
  48. add_definitions(
  49. -fno-strict-aliasing
  50. -Wno-switch
  51. -Wno-reorder
  52. -Wno-unused-variable
  53. -Wno-unused-function
  54. )
  55. set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2013 Frictional Games")
  56. add_subdirectory(HPL2/core core)
  57. if(USERDIR_RESOURCES)
  58. add_definitions(
  59. -DUSERDIR_RESOURCES
  60. )
  61. endif()
  62. add_subdirectory(Game/src/game game)
  63. IF(APPLE)
  64. add_subdirectory(Game/src/launcher-macosx launcher)
  65. ELSE()
  66. add_subdirectory(Game/src/launcher launcher)
  67. ENDIF()
  68. add_custom_target(BuildGame)
  69. add_dependencies(BuildGame Amnesia Launcher)
  70. add_custom_Target(BuildSteamGame)
  71. add_dependencies(BuildSteamGame AmnesiaSteam Launcher)