CMakeLists.txt 2.3 KB

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