No Description
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 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. cmake_minimum_required(VERSION 2.6)
  2. project(otclient)
  3. set(VERSION "0.6.6")
  4. option(FRAMEWORK_SOUND "Use SOUND " ON)
  5. option(FRAMEWORK_GRAPHICS "Use GRAPHICS " ON)
  6. option(FRAMEWORK_XML "Use XML " ON)
  7. option(FRAMEWORK_NET "Use NET " ON)
  8. option(FRAMEWORK_SQL "Use SQL" OFF)
  9. include(src/framework/CMakeLists.txt)
  10. include(src/client/CMakeLists.txt)
  11. # functions map for reading backtraces
  12. if(NOT APPLE)
  13. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-Map=${PROJECT_NAME}.map")
  14. endif()
  15. option(USE_PCH "Use precompiled header (speed up compile)" OFF)
  16. set(executable_SOURCES
  17. src/main.cpp
  18. )
  19. # add executable icon for win32 platforms
  20. if(WIN32)
  21. add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
  22. COMMAND ${CMAKE_RC_COMPILER}
  23. -I${CMAKE_CURRENT_SOURCE_DIR}/src
  24. -i${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc
  25. -o ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o)
  26. set(executable_SOURCES ${executable_SOURCES} otcicon.o)
  27. endif()
  28. add_definitions(-D"VERSION=\\"${VERSION}\\"")
  29. # add client executable
  30. add_executable(${PROJECT_NAME} ${framework_SOURCES} ${client_SOURCES} ${executable_SOURCES})
  31. target_link_libraries(${PROJECT_NAME} ${framework_LIBRARIES})
  32. if(USE_PCH)
  33. include(cotire)
  34. cotire(${PROJECT_NAME})
  35. message(STATUS "Use precompiled header: ON")
  36. else()
  37. message(STATUS "Use precompiled header: OFF")
  38. endif()
  39. # installation
  40. set(DATA_INSTALL_DIR share/${PROJECT_NAME})
  41. install(TARGETS ${PROJECT_NAME}
  42. RUNTIME DESTINATION bin
  43. LIBRARY DESTINATION lib
  44. ARCHIVE DESTINATION lib)
  45. install(FILES README.md BUGS LICENSE AUTHORS init.lua ${PROJECT_NAME}rc.lua DESTINATION ${DATA_INSTALL_DIR})
  46. install(DIRECTORY data modules DESTINATION ${DATA_INSTALL_DIR} PATTERN ".git" EXCLUDE)
  47. # add "make run"
  48. add_custom_target(run COMMAND ${PROJECT_NAME} DEPENDS ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_PROJECT_DIR})