CMakeLists.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. cmake_minimum_required(VERSION 3.11)
  2. project(rAthena)
  3. # Configure CMake Modules
  4. list(APPEND CMAKE_MODULE_PATH
  5. "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmake"
  6. "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")
  7. # options
  8. set(PACKETVER 20211103 CACHE STRING "Sets the PACKETVER define of the servers (see src/common/mmo.hpp)")
  9. option(ENABLE_PRERENEWAL "Whether or not to enable Pre-renewal (default=OFF)" OFF)
  10. option(ENABLE_WEB_SERVER "Build web-server (default=ON)" ON)
  11. option(ENABLE_RDTSC "Enable RDTSC instruction as a timing source (default=OFF)" OFF)
  12. option(ENABLE_EXTRA_DEBUG_CODE "Enable extra debug code (default=OFF)" OFF)
  13. option(ENABLE_MEMMGR "Enable memory manager (default=ON)" ON)
  14. # TODO(vstumpf): If no one uses this, we can just remove it
  15. # set(ENABLE_MEMORY "system" CACHE STRING "Enable memory library (default=system)")
  16. option(ENABLE_PROFILER "Enable profiler (default=OFF)" OFF)
  17. option(ENABLE_EXTRA_BUILDBOT_CODE "Enable extra buildbot code (default=OFF)" OFF)
  18. option(ENABLE_EPOLL "Use epoll instead of select (default=OFF)" OFF)
  19. option(ENABLE_VIP "Enable VIP system (default=OFF)" OFF)
  20. # Set a default build type if none was specified
  21. set(default_build_type "Release")
  22. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  23. set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
  24. STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
  25. message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
  26. endif()
  27. #
  28. # Prevent building in the source directory by default
  29. #
  30. if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR )
  31. message( FATAL_ERROR
  32. "Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
  33. "Example: (build in subdir 'build' and install to source dir)\n"
  34. " rm -f CMakeCache.txt\n"
  35. " mkdir build\n"
  36. " cd build\n"
  37. " cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\n"
  38. " make install\n"
  39. " cd ..\n"
  40. " rm -rf build\n")
  41. endif()
  42. if(WIN32)
  43. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  44. endif()
  45. # Configure C++ Standard
  46. set(CMAKE_CXX_STANDARD 17)
  47. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  48. # Set build directories
  49. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
  50. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
  51. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  52. add_subdirectory(db)
  53. add_subdirectory(conf)
  54. add_subdirectory(3rdparty)
  55. add_subdirectory(src)
  56. add_subdirectory(tools)
  57. add_custom_target(server
  58. DEPENDS login-server char-server map-server web-server scripts
  59. )