CMakeLists.txt 2.6 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. # Set a default build type if none was specified
  20. set(default_build_type "Release")
  21. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  22. set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
  23. STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
  24. message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
  25. endif()
  26. #
  27. # Prevent building in the source directory by default
  28. #
  29. if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR )
  30. message( FATAL_ERROR
  31. "Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
  32. "Example: (build in subdir 'build' and install to source dir)\n"
  33. " rm -f CMakeCache.txt\n"
  34. " mkdir build\n"
  35. " cd build\n"
  36. " cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\n"
  37. " make install\n"
  38. " cd ..\n"
  39. " rm -rf build\n")
  40. endif()
  41. if(WIN32)
  42. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  43. endif()
  44. # Configure C++ Standard
  45. set(CMAKE_CXX_STANDARD 14)
  46. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  47. # Set build directories
  48. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
  49. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
  50. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  51. # For windows, we need to copy scripts over
  52. if (WIN32)
  53. endif()
  54. add_subdirectory(db)
  55. add_subdirectory(conf)
  56. add_subdirectory(3rdparty)
  57. add_subdirectory(src)
  58. add_subdirectory(tools)