mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* preparation update boost build stacktrace * if worldsave i/o operations fail core terminates directly, allow exceptions in SaveContext deconstructor to prevent this * link with boost stackstrace * print exception backtrace when buffering fails * replaced other forced backtraces with actuals * test throw * revert test throw * register terminate handler and print stacktrace unsure if it collides with the other signals register * StreamSaver can terminate in the deconstructor added PolCore().last_worldsave which returns the gameclock of the last successfull world save. SaveWorldState() can now return error "Failed to save world" if the first critical part fails. Since the second part runs async you have to check the new PolCore member when the last successfull save was. * fixed cppdap checkout * catch exceptions in the deconstructor and do not rethrow during stack unwinding * fix mac build * fix apple builds * helper lambda to get rid of repeating try/catch blocks per datafile try to set promise in exception cases to guarantee the set moved account storage into parallel tasks, comment about extra thread is no longer valid. * centralized stacktrace renamed polcore member * extended comment for clarification * docs
136 lines
4.7 KiB
CMake
136 lines
4.7 KiB
CMake
message("* libboost")
|
|
set (BOOST_SOURCE_DIR "${POL_EXT_LIB_DIR}/boost_1_87_0")
|
|
set (BOOST_STAGE_LIB_DIR "${BOOST_SOURCE_DIR}/stage/lib")
|
|
|
|
if (clang)
|
|
set (BOOST_TOOLSET "clang")
|
|
elseif (gcc)
|
|
set (BOOST_TOOLSET "gcc")
|
|
elseif (msvc)
|
|
if (MSVC_TOOLSET_VERSION EQUAL 140)
|
|
set (BOOST_TOOLSET "msvc") # VS 2015 (14.0)
|
|
elseif(MSVC_TOOLSET_VERSION EQUAL 141)
|
|
set(BOOST_TOOLSET "msvc-14.1") # VS 2017 (15.0)
|
|
elseif(MSVC_TOOLSET_VERSION EQUAL 142)
|
|
set(BOOST_TOOLSET "msvc-14.2") # VS 2019 (16.0)
|
|
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 143)
|
|
set(BOOST_TOOLSET "msvc-14.3") # VS 2022 (17.0)
|
|
endif()
|
|
endif()
|
|
|
|
#if (NOT DEFINED BOOST_TOOLSET)
|
|
# message(FATAL_ERROR "Unknown boost toolset to build")
|
|
#endif()
|
|
set (BOOST_ARC "")
|
|
if (${windows})
|
|
set (BOOST_CONFIGURE_COMMAND "bootstrap.bat")
|
|
set (BOOST_BUILD_COMMAND "b2.exe")
|
|
set (BOOST_STACKTRACE_LIB2 "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_windbg.lib")
|
|
set (BOOST_STACKTRACE_LIB "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_from_exception.lib")
|
|
if (msvc)
|
|
set (BOOST_CXX_FLAGS "/MT -DBOOST_STACKTRACE_LINK")
|
|
else()
|
|
set (BOOST_CXX_FLAGS "-fms-runtime-lib=static -DBOOST_STACKTRACE_LINK")
|
|
endif()
|
|
else()
|
|
set (BOOST_CONFIGURE_COMMAND "./bootstrap.sh")
|
|
set (BOOST_BUILD_COMMAND "./b2")
|
|
set (BOOST_STACKTRACE_LIB2 "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_backtrace.a")
|
|
set (BOOST_STACKTRACE_LIB "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_from_exception.a" )
|
|
|
|
set (BOOST_CXX_FLAGS "-DBOOST_STACKTRACE_LINK")
|
|
if (clang)
|
|
set (BOOST_STACKTRACE_LIB2 "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_addr2line.a")
|
|
endif()
|
|
if (APPLE)
|
|
foreach(OSX_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES})
|
|
set (BOOST_CXX_FLAGS "${BOOST_CXX_FLAGS} -arch ${OSX_ARCHITECTURE}")
|
|
endforeach()
|
|
set (BOOST_ARC "architecture=arm+x86")
|
|
set (BOOST_STACKTRACE_LIB "${BOOST_STAGE_LIB_DIR}/libboost_stacktrace_basic.a")
|
|
set (BOOST_STACKTRACE_LIB2 "")
|
|
endif()
|
|
endif()
|
|
|
|
set(boost_needs_extract FALSE)
|
|
set(boost_needs_build FALSE)
|
|
if (NOT EXISTS "${BOOST_SOURCE_DIR}/boost")
|
|
message(" - will extract")
|
|
ExternalProject_Add(libboost_ext
|
|
URL "https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.bz2"
|
|
SOURCE_DIR "${BOOST_SOURCE_DIR}"
|
|
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} --with-toolset=${BOOST_TOOLSET}
|
|
BUILD_COMMAND ""
|
|
INSTALL_COMMAND ""
|
|
URL_HASH SHA256=af57be25cb4c4f4b413ed692fe378affb4352ea50fbe294a11ef548f4d527d89
|
|
BUILD_BYPRODUCTS "${BOOST_SOURCE_DIR}"
|
|
LOG_DOWNLOAD 1
|
|
LOG_CONFIGURE 1
|
|
BUILD_IN_SOURCE 1
|
|
LOG_OUTPUT_ON_FAILURE 1
|
|
DOWNLOAD_EXTRACT_TIMESTAMP 1
|
|
EXCLUDE_FROM_ALL 1
|
|
)
|
|
set_target_properties (libboost_ext PROPERTIES FOLDER 3rdParty)
|
|
set(boost_needs_extract TRUE)
|
|
else()
|
|
message(" - will not extract")
|
|
endif()
|
|
|
|
if(NOT EXISTS ${BOOST_STACKTRACE_LIB})
|
|
message(" - will build in ${BOOST_SOURCE_DIR} toolset=${BOOST_TOOLSET} cxxflags=${BOOST_CXX_FLAGS}")
|
|
ExternalProject_Add(boost_build
|
|
SOURCE_DIR ${BOOST_SOURCE_DIR}
|
|
INSTALL_COMMAND ""
|
|
CONFIGURE_COMMAND ""
|
|
DOWNLOAD_COMMAND ""
|
|
BUILD_COMMAND ${BOOST_BUILD_COMMAND} cxxflags=${BOOST_CXX_FLAGS} cflags=${BOOST_CXX_FLAGS} address-model=${ARCH_BITS} toolset=${BOOST_TOOLSET} ${BOOST_ARC} variant=release link=static runtime-link=static --layout=system --with-stacktrace stage
|
|
BUILD_BYPRODUCTS ${BOOST_STACKTRACE_LIB} ${BOOST_STACKTRACE_LIB2}
|
|
LOG_BUILD 1
|
|
BUILD_IN_SOURCE 1
|
|
LOG_OUTPUT_ON_FAILURE 1
|
|
)
|
|
if (boost_needs_extract)
|
|
add_dependencies(boost_build libboost_ext)
|
|
endif()
|
|
set_target_properties (boost_build PROPERTIES FOLDER 3rdParty)
|
|
set(boost_needs_build TRUE)
|
|
else()
|
|
message(" - will not build")
|
|
endif()
|
|
|
|
# imported target to add include/lib dir and additional dependencies
|
|
add_library(libboost_headers INTERFACE IMPORTED)
|
|
set_target_properties(libboost_headers PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES ${BOOST_SOURCE_DIR}
|
|
)
|
|
if (boost_needs_extract)
|
|
add_dependencies(libboost_headers libboost_ext)
|
|
endif()
|
|
|
|
add_library(libboost_stacktrace STATIC IMPORTED)
|
|
set_target_properties(libboost_stacktrace PROPERTIES
|
|
IMPORTED_LOCATION ${BOOST_STACKTRACE_LIB}
|
|
IMPORTED_IMPLIB ${BOOST_STACKTRACE_LIB}
|
|
INTERFACE_INCLUDE_DIRECTORIES ${BOOST_SOURCE_DIR}
|
|
INTERFACE_COMPILE_DEFINITIONS BOOST_STACKTRACE_LINK
|
|
FOLDER 3rdParty
|
|
)
|
|
if (${windows})
|
|
set_property(TARGET libboost_stacktrace APPEND
|
|
PROPERTY INTERFACE_LINK_LIBRARIES
|
|
dbgeng
|
|
ole32
|
|
${BOOST_STACKTRACE_LIB2}
|
|
)
|
|
else()
|
|
set_property(TARGET libboost_stacktrace APPEND
|
|
PROPERTY INTERFACE_LINK_LIBRARIES
|
|
${BOOST_STACKTRACE_LIB2}
|
|
dl
|
|
$<$<NOT:$<PLATFORM_ID:Darwin>>:backtrace>
|
|
)
|
|
endif()
|
|
if (boost_needs_build)
|
|
add_dependencies(libboost_stacktrace boost_build)
|
|
endif()
|