2023-05-13 22:22:00 +00:00
|
|
|
set(DCOMMON_SOURCES
|
2022-07-20 04:51:05 +00:00
|
|
|
"AMFDeserialize.cpp"
|
2023-05-13 22:22:00 +00:00
|
|
|
"AmfSerialize.cpp"
|
2022-07-16 23:24:16 +00:00
|
|
|
"BinaryIO.cpp"
|
|
|
|
"dConfig.cpp"
|
|
|
|
"Diagnostics.cpp"
|
2023-10-21 23:31:55 +00:00
|
|
|
"Logger.cpp"
|
2024-01-02 03:50:00 +00:00
|
|
|
"Game.cpp"
|
2022-07-16 23:24:16 +00:00
|
|
|
"GeneralUtils.cpp"
|
|
|
|
"LDFFormat.cpp"
|
|
|
|
"Metrics.cpp"
|
|
|
|
"NiPoint3.cpp"
|
|
|
|
"NiQuaternion.cpp"
|
2023-10-09 20:31:43 +00:00
|
|
|
"Demangler.cpp"
|
2022-10-24 22:20:36 +00:00
|
|
|
"ZCompression.cpp"
|
|
|
|
"BrickByBrickFix.cpp"
|
2022-11-27 11:59:59 +00:00
|
|
|
"BinaryPathFinder.cpp"
|
2022-12-05 08:57:58 +00:00
|
|
|
"FdbToSqlite.cpp"
|
2022-10-24 22:20:36 +00:00
|
|
|
)
|
2022-07-16 23:24:16 +00:00
|
|
|
|
2024-01-19 16:18:36 +00:00
|
|
|
# Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible.
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set_source_files_properties("FdbToSqlite.cpp" PROPERTIES COMPILE_FLAGS "-Wno-stringop-overflow")
|
|
|
|
endif()
|
|
|
|
|
2022-11-01 18:21:26 +00:00
|
|
|
add_subdirectory(dClient)
|
|
|
|
|
|
|
|
foreach(file ${DCOMMON_DCLIENT_SOURCES})
|
|
|
|
set(DCOMMON_SOURCES ${DCOMMON_SOURCES} "dClient/${file}")
|
|
|
|
endforeach()
|
|
|
|
|
2022-07-16 23:24:16 +00:00
|
|
|
add_library(dCommon STATIC ${DCOMMON_SOURCES})
|
2024-03-06 02:13:24 +00:00
|
|
|
target_include_directories(dCommon
|
|
|
|
PUBLIC "." "dClient" "dEnums"
|
|
|
|
PRIVATE
|
|
|
|
"${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase"
|
|
|
|
"${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase/ITables"
|
|
|
|
"${PROJECT_SOURCE_DIR}/dDatabase/CDClientDatabase"
|
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/include"
|
|
|
|
)
|
2022-07-16 23:24:16 +00:00
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
find_package(ZLIB REQUIRED)
|
2022-09-06 03:28:47 +00:00
|
|
|
elseif (WIN32)
|
|
|
|
include(FetchContent)
|
|
|
|
|
2024-12-04 22:38:05 +00:00
|
|
|
set(WITH_GTEST OFF CACHE BOOL "" FORCE)
|
|
|
|
set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
|
2022-09-06 03:28:47 +00:00
|
|
|
# TODO Keep an eye on the zlib repository for an update to disable testing. Don't forget to update CMakePresets
|
|
|
|
FetchContent_Declare(
|
|
|
|
zlib
|
2024-12-04 22:38:05 +00:00
|
|
|
URL https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.zip
|
|
|
|
URL_HASH MD5=2cf9199fb785ea579a2a9905a75c38b3
|
2022-09-06 03:28:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Disable warning about no project version.
|
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
|
|
|
|
# Disable warning about the minimum version of cmake used for bcrypt being deprecated in the future
|
|
|
|
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(zlib)
|
|
|
|
|
|
|
|
set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
|
|
|
|
add_library(ZLIB::ZLIB ALIAS zlib)
|
|
|
|
else ()
|
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
|
|
|
"This platform does not have a way to use zlib.\nCreate an issue on GitHub with your build system so it can be configured."
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2024-03-06 02:13:24 +00:00
|
|
|
target_link_libraries(dCommon
|
|
|
|
PRIVATE ZLIB::ZLIB bcrypt tinyxml2
|
|
|
|
INTERFACE dDatabase)
|