-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
106 lines (83 loc) · 2.79 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.22)
set(CMAKE_BUILD_TYPE Debug)
set(REMOTE-UI OFF)
project("plcemu")
find_library(CUNIT cunit)
find_library(YAML yaml)
if(NOT YAML)
message(FATAL ERROR ": YAML not found")
endif(NOT YAML)
if(${REMOTE-UI})
find_library(ZMQ zmq)
if(NOT ZMQ)
message(FATAL ERROR ": ZMQ not found, please build command line variation")
endif(NOT ZMQ)
endif(${REMOTE-UI})
find_library(PTHREAD pthread)
if(NOT PTHREAD)
message(FATAL ERROR "PTHREAD not found")
endif(NOT PTHREAD)
#find_library(NACS nacs-yml)
include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/cfg
${PROJECT_SOURCE_DIR}/src/ui
${PROJECT_SOURCE_DIR}/nacs/include
${PROJECT_SOURCE_DIR}/librelogic/include
)
link_directories(
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/ui
${PROJECT_BINARY_DIR}/nacs
${PROJECT_BINARY_DIR}/librelogic
)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/ui ${PROJECT_BINARY_DIR}/ui)
add_subdirectory(${PROJECT_SOURCE_DIR}/nacs ${PROJECT_BINARY_DIR}/nacs)
add_subdirectory(${PROJECT_SOURCE_DIR}/librelogic/src ${PROJECT_BINARY_DIR}/librelogic)
# test targets
if(CUNIT)
add_executable(test_app
${PROJECT_SOURCE_DIR}/tst/white/app/app-stubs.c
${PROJECT_SOURCE_DIR}/tst/white/app/ut-app.c
${PROJECT_SOURCE_DIR}/src/cfg/schema.c
${PROJECT_SOURCE_DIR}/src/ui/cli.c
${PROJECT_SOURCE_DIR}/src/app.c
)
target_link_libraries(
test_app PUBLIC ${CUNIT} ${YAML} -llogic -lnacs-yml -lgcov
)
add_dependencies(test_app nacs-yml logic)
endif(CUNIT)
#console version
add_executable(${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/src/cfg/schema.c
${PROJECT_SOURCE_DIR}/src/ui/cli.c
${PROJECT_SOURCE_DIR}/src/app.c
${PROJECT_SOURCE_DIR}/src/project.c
${PROJECT_SOURCE_DIR}/src/plcemu.c
${PROJECT_SOURCE_DIR}/src/util.c
)
add_dependencies(${PROJECT_NAME} nacs-yml logic)
if(${REMOTE-UI})
message("Building remote UI client...")
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ui-zmq)
target_link_libraries(
${PROJECT_NAME} PUBLIC ${YAML} ${ZMQ} -lnacs-yml -llogic -l${PROJECT_NAME}-ui-zmq -lm -lpthread
)
add_executable(cli
${PROJECT_SOURCE_DIR}/src/ui/cli-zmq.c
${PROJECT_SOURCE_DIR}/src/ui/cli.c
${PROJECT_SOURCE_DIR}/src/ui/ui-zmq.c
${PROJECT_SOURCE_DIR}/src/cfg/schema.c
${PROJECT_SOURCE_DIR}/src/util.c
)
target_link_libraries(
cli PUBLIC ${YAML} ${ZMQ} -lnacs-yml -lm -lpthread
)
else(${REMOTE-UI})
message("Building std client...")
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ui-std)
target_link_libraries(
${PROJECT_NAME} PUBLIC ${YAML} -llogic -lnacs-yml -l${PROJECT_NAME}-ui-std -lm -lpthread
)
endif(${REMOTE-UI})