diff --git a/cmake_configure.cmake b/cmake_configure.cmake index 15826dbe..6626c050 100644 --- a/cmake_configure.cmake +++ b/cmake_configure.cmake @@ -38,6 +38,25 @@ else() message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.") endif() +if(FILESYSTEM_LIBRARY STREQUAL "CXX17") + target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=0") +elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS") + target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=1") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_link_libraries(rw_interface INTERFACE "stdc++fs") + endif() +elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST") + find_package(Boost COMPONENTS system filesystem REQUIRED) + target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=2") + target_include_directories(rw_interface INTERFACE ${Boost_INCLUDE_DIRS}) + target_link_libraries(rw_interface INTERFACE + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ) +else() + message(FATAL_ERROR "Illegal FILESYSTEM_LIBRARY option. (was '${FILESYSTEM_LIBRARY}')") +endif() + if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) target_compile_options(rw_interface INTERFACE "-Wno-gnu-array-member-paren-init") endif() diff --git a/cmake_options.cmake b/cmake_options.cmake index 6d122135..541748dd 100644 --- a/cmake_options.cmake +++ b/cmake_options.cmake @@ -11,6 +11,9 @@ option(TESTS_NODATA "Build tests for no-data testing") set(FAILED_CHECK_ACTION "IGNORE" CACHE STRING "What action to perform on a failed RW_CHECK (in debug mode)") set_property(CACHE FAILED_CHECK_ACTION PROPERTY STRINGS "IGNORE" "ABORT" "BREAKPOINT") +set(FILESYSTEM_LIBRARY "BOOST" CACHE STRING "Which filesystem library to use") +set_property(CACHE FILESYSTEM_LIBRARY PROPERTY STRINGS "CXX17" "CXXTS" "BOOST") + set(BIN_DIR "bin" CACHE STRING "Prefix subdirectory to put the binaries in.") set(DOC_DIR "share/doc/openrw" CACHE STRING "Prefix subdirectory to put the documentation in.") diff --git a/rwengine/src/engine/SaveGame.cpp b/rwengine/src/engine/SaveGame.cpp index 7bea4cde..f2ab4995 100644 --- a/rwengine/src/engine/SaveGame.cpp +++ b/rwengine/src/engine/SaveGame.cpp @@ -11,8 +11,7 @@ #include