diff --git a/cmake/Modules/freeminer_src.cmake b/cmake/Modules/freeminer_src.cmake index 937777105..2626489f2 100644 --- a/cmake/Modules/freeminer_src.cmake +++ b/cmake/Modules/freeminer_src.cmake @@ -1,5 +1,8 @@ # == freeminer: + +find_package(MsgPack REQUIRED) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") OPTION(ENABLE_SCTP "Enable SCTP networking (EXPERIMENTAL)" 0) OPTION(USE_MULTI "Enable MT+ENET+WSS networking" 1) @@ -110,7 +113,7 @@ if(ENABLE_OSMIUM AND (OSMIUM_INCLUDE_DIR OR EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/e set(BUILD_EXAMPLES 0 CACHE INTERNAL "") set(BUILD_BENCHMARKS 0 CACHE INTERNAL "") - if (NOT OSMIUM_INCLUDE_DIR AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/libosmium/CMakeLists.txt) + if (NOT OSMIUM_INCLUDE_DIR) add_subdirectory(external/libosmium) set(OSMIUM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/libosmium/include) include_directories(BEFORE SYSTEM ${OSMIUM_INCLUDE_DIR}) @@ -128,6 +131,34 @@ if(ENABLE_OSMIUM AND (OSMIUM_INCLUDE_DIR OR EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/e endif() endif() +option(ENABLE_ICONV "Enable utf8 convert via iconv " FALSE) + +if(ENABLE_ICONV) + find_package(Iconv) + if(ICONV_INCLUDE_DIR) + set(USE_ICONV 1) + message(STATUS "iconv.h found: ${ICONV_INCLUDE_DIR}") + else() + message(STATUS "iconv.h NOT found") + endif() +endif() + +if(NOT USE_ICONV) + set(USE_ICONV 0) +endif() + +#option(ENABLE_MANDELBULBER "Use Mandelbulber source to generate more fractals in math mapgen" OFF) +set(USE_MANDELBULBER 1) +#find_package(Mandelbulber) + +option(ENABLE_IPV4_DEFAULT "Do not use ipv6 dual socket " FALSE) +if(ENABLE_IPV4_DEFAULT) + set(USE_IPV4_DEFAULT 1) +else() + set(USE_IPV4_DEFAULT 0) +endif() + + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${CMAKE_VERSION} VERSION_GREATER "3.11.0") set(USE_DEBUG_DUMP ON CACHE BOOL "") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64b405488..521d0353f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,5 @@ project(freeminer) -include(freeminer_src) - - INCLUDE(CheckTypeSize) INCLUDE(CheckIncludeFiles) INCLUDE(CheckLibraryExists) @@ -44,8 +41,6 @@ endif() # Set some random things default to not being visible in the GUI mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) -find_package(MsgPack REQUIRED) - if(NOT (BUILD_CLIENT OR BUILD_SERVER OR NO_BUILD)) message(WARNING "Neither BUILD_CLIENT nor BUILD_SERVER is set! Setting BUILD_SERVER=true") set(BUILD_SERVER TRUE) @@ -84,22 +79,6 @@ else() mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR) endif() -option(ENABLE_ICONV "Enable utf8 convert via iconv " FALSE) - -if(ENABLE_ICONV) - find_package(Iconv) - if(ICONV_INCLUDE_DIR) - set(USE_ICONV 1) - message(STATUS "iconv.h found: ${ICONV_INCLUDE_DIR}") - else() - message(STATUS "iconv.h NOT found") - endif() -endif() - -if(NOT USE_ICONV) - set(USE_ICONV 0) -endif() - if(NOT USE_CURL) if(BUILD_CLIENT) message(WARNING "cURL is required to load the server list") @@ -265,17 +244,6 @@ else(USE_PROMETHEUS) message(STATUS "Prometheus client disabled.") endif(USE_PROMETHEUS) -#option(ENABLE_MANDELBULBER "Use Mandelbulber source to generate more fractals in math mapgen" OFF) -set(USE_MANDELBULBER 1) -#find_package(Mandelbulber) - -option(ENABLE_IPV4_DEFAULT "Do not use ipv6 dual socket " FALSE) -if(ENABLE_IPV4_DEFAULT) - set(USE_IPV4_DEFAULT 1) -else() - set(USE_IPV4_DEFAULT 0) -endif() - OPTION(ENABLE_SPATIAL "Enable SpatialIndex AreaStore backend" TRUE) set(USE_SPATIAL FALSE) @@ -417,6 +385,8 @@ endif() check_include_files(endian.h HAVE_ENDIAN_H) +include(freeminer_src) + if((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND EXISTS "${PROJECT_SOURCE_DIR}/cmake_config.h") message(FATAL_ERROR "You are doing an out-of-tree build, but build artifacts are left in-tree. This will break the build!") endif()