File: CMakeLists.txt

package info (click to toggle)
openmohaa 0.82.1%2Bdfsg-1
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 34,192 kB
  • sloc: cpp: 315,720; ansic: 275,789; sh: 312; xml: 246; asm: 141; makefile: 7
file content (131 lines) | stat: -rw-r--r-- 4,643 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
cmake_minimum_required(VERSION 3.12)

project(qcommon)

if(${CMAKE_VERSION} VERSION_GREATER "3.12")
	cmake_policy(SET CMP0076 NEW)
endif()

include("./q_version.cmake")

# Shared source files for modules
set(SOURCES_SHARED_UBER
	"${CMAKE_SOURCE_DIR}/code/qcommon/class.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/con_set.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/con_timer.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/delegate.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/lightclass.cpp"
	"${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/script.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/str.cpp"
	"${CMAKE_SOURCE_DIR}/code/script/scriptexception.cpp"
	"${CMAKE_SOURCE_DIR}/code/script/scriptvariable.cpp"
)

add_library(qcommon_uber INTERFACE)
target_sources(qcommon_uber INTERFACE ${SOURCES_SHARED_UBER})
target_compile_features(qcommon_uber INTERFACE cxx_nullptr)
target_include_directories(qcommon_uber INTERFACE "../qcommon" "../script")

if(DEBUG_MEM_BLOCK)
	target_compile_definitions(qcommon_uber INTERFACE _DEBUG_MEMBLOCK=1)
endif()

set(SOURCES_SHARED
	"${CMAKE_SOURCE_DIR}/code/qcommon/q_math.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/q_shared.c"
)

add_library(qcommon_shared INTERFACE)
target_sources(qcommon_shared INTERFACE ${SOURCES_SHARED})
target_compile_features(qcommon_shared INTERFACE c_variadic_macros)
target_include_directories(qcommon_shared INTERFACE "../qcommon")
target_link_libraries(qcommon_shared INTERFACE qcommon_version)

add_library(qcommon INTERFACE)
target_link_libraries(qcommon INTERFACE qcommon_shared qcommon_uber)

# Source files for standalone executable
set(SOURCES_COMMON
	"${CMAKE_SOURCE_DIR}/code/qcommon/alias.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/bg_compat.cpp"
	"${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"
	"${CMAKE_SOURCE_DIR}/code/qcommon/cm_trace_obfuscation.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/cmd.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/common.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/crc.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/cvar.c"
	"${CMAKE_SOURCE_DIR}/code/qcommon/files.cpp"
	"${CMAKE_SOURCE_DIR}/code/qcommon/ioapi.c"
	"${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"
	# Gamespy
	"${CMAKE_SOURCE_DIR}/code/gamespy/q_gamespy.c"
)

add_subdirectory("../skeletor" "./skeletor")
add_subdirectory("../tiki" "./tiki")
add_subdirectory("../curl" "./curl")

add_library(qcommon_standalone INTERFACE)
target_sources(qcommon_standalone INTERFACE ${SOURCES_COMMON})
target_compile_definitions(qcommon_standalone INTERFACE APP_MODULE)

if(DEBUG_DROP_ASSERT)
    target_compile_definitions(qcommon_standalone INTERFACE COM_ERROR_DROP_ASSERT)
endif()

target_compile_features(qcommon_standalone INTERFACE cxx_nullptr)
target_compile_features(qcommon_standalone INTERFACE c_variadic_macros)
target_link_libraries(qcommon_standalone INTERFACE omohtiki omohskeletor)

if(USE_INTERNAL_ZLIB)
    set(SOURCES_ZLIB_DIR "../thirdparty/zlib-1.3.1")
	add_library(zlib INTERFACE)

	target_sources(zlib INTERFACE
		# zlib
		"${SOURCES_ZLIB_DIR}/adler32.c"
		"${SOURCES_ZLIB_DIR}/crc32.c"
		"${SOURCES_ZLIB_DIR}/inffast.c"
		"${SOURCES_ZLIB_DIR}/inflate.c"
		"${SOURCES_ZLIB_DIR}/inftrees.c"
		"${SOURCES_ZLIB_DIR}/zutil.c"
	)

	target_include_directories(zlib INTERFACE "${SOURCES_ZLIB_DIR}")
	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()

#
# Unit tests
#

enable_testing()

add_executable(test_lz77 tests/test_lz77.cpp lz77.cpp q_shared.c common_light.c)
target_link_libraries(test_lz77 INTERFACE testing)
add_test(NAME test_lz77 COMMAND test_lz77)
set_tests_properties(test_lz77 PROPERTIES TIMEOUT 15)