blob: 384ada90662a092f82063a4aa6bc022afb62e447 (
plain)
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
|
set(TINY_CONVMEM_MCPC_ROOT "${PROJECT_SOURCE_DIR}/third_party/mcpc")
if(NOT EXISTS "${TINY_CONVMEM_MCPC_ROOT}/mcpc/mcpc.h")
message(FATAL_ERROR
"The vendored mcpc fork is missing from third_party/mcpc"
)
endif()
# The upstream CMake target at the imported revision is incomplete. This source
# list defines the project-maintained vendored fork build.
set(TINY_CONVMEM_MCPC_SOURCES
"${TINY_CONVMEM_MCPC_ROOT}/src/alloc.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/log.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/errcode.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/anydata.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/tool.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/rsc.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/prmpt.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/server.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/retbuf.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/ucbr.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/complt.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/serlz.c"
"${TINY_CONVMEM_MCPC_ROOT}/src/mjson.c"
)
add_library(mcpc STATIC ${TINY_CONVMEM_MCPC_SOURCES})
add_library(mcpc::mcpc ALIAS mcpc)
target_include_directories(mcpc
SYSTEM PUBLIC "${TINY_CONVMEM_MCPC_ROOT}"
PRIVATE "${TINY_CONVMEM_MCPC_ROOT}/src"
)
target_compile_features(mcpc PUBLIC c_std_17)
if(MSVC)
# These compatibility definitions affect mcpc's public headers as well as
# its implementation, so consumers must compile with the same view.
target_compile_definitions(mcpc PUBLIC
is_win=1
is_wincl=1
MCPC_C23PTCH_KW1
MCPC_C23PTCH_CKD1
MCPC_C23PTCH_UCHAR1
MCPC_C23GIVUP_FIXENUM
)
target_compile_options(mcpc PRIVATE /utf-8)
target_link_libraries(mcpc PUBLIC ws2_32)
else()
message(WARNING
"Only Windows/MSVC is currently verified. Other toolchains are future work."
)
endif()
|