2024-11-30 00:36:33 +01:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
|
|
|
2023-06-17 01:44:38 +02:00
|
|
|
project(qcommon)
|
|
|
|
|
2023-08-19 23:07:12 +02:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER "3.12")
|
2023-06-18 12:18:10 +02:00
|
|
|
cmake_policy(SET CMP0076 NEW)
|
|
|
|
endif()
|
2023-06-17 01:44:38 +02:00
|
|
|
|
2023-06-19 23:32:34 +02:00
|
|
|
include("./q_version.cmake")
|
|
|
|
|
2023-06-17 01:44:38 +02:00
|
|
|
# Shared source files for modules
|
|
|
|
set(SOURCES_SHARED
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/class.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/con_set.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/con_timer.cpp"
|
2023-07-30 14:26:52 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/lightclass.cpp"
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/listener.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/lz77.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/mem_blockalloc.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/mem_tempalloc.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/q_math.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/q_shared.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/script.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/str.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/script/scriptexception.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/script/scriptvariable.cpp"
|
2023-06-17 01:44:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(qcommon INTERFACE)
|
2023-06-18 12:18:10 +02:00
|
|
|
target_sources(qcommon INTERFACE ${SOURCES_SHARED})
|
2023-09-04 22:19:01 +02:00
|
|
|
|
|
|
|
if(DEBUG_MEM_BLOCK)
|
|
|
|
target_compile_definitions(qcommon INTERFACE _DEBUG_MEMBLOCK=1)
|
|
|
|
endif()
|
|
|
|
|
2023-06-17 01:44:38 +02:00
|
|
|
target_include_directories(qcommon INTERFACE "../qcommon" "../script")
|
|
|
|
target_compile_features(qcommon INTERFACE cxx_nullptr)
|
|
|
|
target_compile_features(qcommon INTERFACE c_variadic_macros)
|
2023-06-19 23:32:34 +02:00
|
|
|
target_link_libraries(qcommon INTERFACE qcommon_version)
|
2023-06-19 19:57:50 +02:00
|
|
|
|
2023-06-17 01:44:38 +02:00
|
|
|
# Source files for standalone executable
|
|
|
|
set(SOURCES_COMMON
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/alias.c"
|
2023-06-29 21:28:19 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/bg_compat.cpp"
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_fencemask.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_load.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_patch.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_polylib.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_terrain.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_test.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_trace.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_trace_lbd.cpp"
|
2023-10-14 19:55:55 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cm_trace_obfuscation.cpp"
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cmd.c"
|
2024-09-22 16:03:02 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/common.c"
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/crc.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/cvar.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/files.cpp"
|
2024-09-24 22:25:33 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/ioapi.c"
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/huffman.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/md4.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/md5.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/memory.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/msg.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/net_chan.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/net_ip.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/q_math.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/q_shared.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/qcommon/unzip.c"
|
2023-06-17 01:44:38 +02:00
|
|
|
# Gamespy
|
2023-06-18 12:18:10 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/code/gamespy/sv_gamespy.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/gamespy/sv_gqueryreporting.c"
|
2023-06-17 01:44:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
add_subdirectory("../skeletor" "./skeletor")
|
|
|
|
add_subdirectory("../tiki" "./tiki")
|
|
|
|
|
|
|
|
add_library(qcommon_standalone INTERFACE)
|
2023-06-18 12:18:10 +02:00
|
|
|
target_sources(qcommon_standalone INTERFACE ${SOURCES_COMMON})
|
2023-06-17 01:44:38 +02:00
|
|
|
target_compile_definitions(qcommon_standalone INTERFACE APP_MODULE)
|
2023-08-16 13:16:04 +02:00
|
|
|
|
|
|
|
if(DEBUG_DROP_ASSERT)
|
|
|
|
target_compile_definitions(qcommon_standalone INTERFACE COM_ERROR_DROP_ASSERT)
|
|
|
|
endif()
|
|
|
|
|
2023-06-17 01:44:38 +02:00
|
|
|
target_compile_features(qcommon_standalone INTERFACE cxx_nullptr)
|
|
|
|
target_compile_features(qcommon_standalone INTERFACE c_variadic_macros)
|
2024-09-24 22:25:33 +02:00
|
|
|
target_link_libraries(qcommon_standalone INTERFACE omohtiki omohskeletor)
|
|
|
|
|
2024-10-07 20:51:23 +02:00
|
|
|
if(USE_INTERNAL_ZLIB)
|
|
|
|
add_library(zlib INTERFACE)
|
2024-09-24 22:25:33 +02:00
|
|
|
|
2024-10-07 20:51:23 +02:00
|
|
|
target_sources(zlib INTERFACE
|
|
|
|
# zlib
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/adler32.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/crc32.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/inffast.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/inflate.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/inftrees.c"
|
|
|
|
"${CMAKE_SOURCE_DIR}/code/zlib/zutil.c"
|
|
|
|
)
|
2024-09-24 22:25:33 +02:00
|
|
|
|
2024-10-07 20:51:23 +02:00
|
|
|
target_include_directories(zlib INTERFACE "${CMAKE_SOURCE_DIR}/code/zlib")
|
|
|
|
target_link_libraries(qcommon_standalone INTERFACE zlib)
|
|
|
|
else()
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
target_include_directories(qcommon INTERFACE ${ZLIB_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(qcommon_standalone INTERFACE ${ZLIB_LIBRARIES})
|
|
|
|
endif()
|