-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
CMakeLists.txt
168 lines (154 loc) · 3.83 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
cmake_minimum_required(VERSION 2.8.12)
project(ipctool C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "-std=gnu99")
cmake_policy(SET CMP0069 NEW)
if(NOT BUILD_SHARED_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_C_FLAGS "-static ${CMAKE_C_FLAGS}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -s -Os -ffunction-sections -Wl,--gc-sections -DNDEBUG -Wextra")
else()
if(BUILD_SHARED_LIBS)
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -O1 -g -fno-omit-frame-pointer")
endif()
endif()
if(NOT SKIP_VERSION)
set(VERSION_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c)
# Add a custom command that produces version.c, plus a dummy output that's not
# actually produced, in order to force version.cmake to always be re-run
# before the build
add_custom_command(
OUTPUT ${VERSION_SRC} ${CMAKE_CURRENT_BINARY_DIR}/_version.c
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
else()
add_definitions(-DSKIP_VERSION)
endif()
include_directories(./src/)
set(COMMON_LIB_SRC
src/chipid.c
src/chipid.h
src/cjson/cJSON.c
src/cjson/cJSON.h
src/hal/allwinner.c
src/hal/allwinner.h
src/hal/bcm.c
src/hal/bcm.h
src/hal/common.c
src/hal/common.h
src/hal/fh.c
src/hal/fh.h
src/hal/gm.c
src/hal/gm.h
src/hal/hisi/hal_hisi.c
src/hal/hisi/hal_hisi.h
src/hal/hisi/ispreg.c
src/hal/ingenic.c
src/hal/ingenic.h
src/hal/novatek.c
src/hal/novatek.h
src/hal/rockchip.c
src/hal/rockchip.h
src/hal/sstar.c
src/hal/sstar.h
src/hal/tegra.c
src/hal/tegra.h
src/hal/xilinx.c
src/hal/xilinx.h
src/hal/xm.c
src/hal/xm.h
src/hwinfo.c
src/hwinfo.h
src/mmap.h
src/sensors.c
src/sensors.h
src/tools.c
src/tools.h
src/version.h)
set(IPCTOOL_SRC
src/backup.c
src/backup.h
src/dns.c
src/dns.h
src/ethernet.c
src/ethernet.h
src/fake_symbols.c
src/firmware.c
src/firmware.h
src/hal/hisi/ethernet.c
src/hal/hisi/ethernet.h
src/hal/hisi/ispreg.c
src/hal/hisi/ispreg.h
src/hal/hisi/ptrace.c
src/hal/hisi/ptrace.h
src/hashtable.c
src/hashtable.h
src/http.c
src/http.h
src/i2cspi.c
src/i2cspi.h
src/main.c
src/mtd.c
src/mtd.h
src/network.c
src/network.h
src/ptrace.c
src/ptrace.h
src/ram.c
src/ram.h
src/reginfo.c
src/reginfo.h
src/sha1.c
src/sha1.h
src/snstool.c
src/snstool.h
#src/stack.c
src/uboot.c
src/uboot.h
src/watchdog.c
src/watchdog.h
src/cjson/cJSON.c
src/cjson/cJSON.h
src/cjson/cYAML.c
src/cjson/cYAML.h
src/boards/anjoy.c
src/boards/anjoy.h
src/boards/buildroot.c
src/boards/buildroot.h
src/boards/common.c
src/boards/common.h
src/boards/hankvision.c
src/boards/hankvision.h
src/boards/linux.c
src/boards/linux.h
src/boards/openwrt.c
src/boards/openwrt.h
src/boards/ruision.c
src/boards/ruision.h
src/boards/xm.c
src/boards/xm.h
src/boards/sstar.c
src/boards/sstar.h
${VERSION_SRC})
set(CYAML_TEST_SRC
src/cjson/cYAML_test.c
src/cjson/cJSON.c
src/cjson/cJSON.h
src/cjson/cYAML.c
src/cjson/cYAML.h)
add_library(ipchw STATIC ${COMMON_LIB_SRC})
target_compile_definitions(ipchw PUBLIC STANDALONE_LIBRARY)
target_link_libraries(ipchw m)
if(NOT ONLY_LIBRARY)
add_executable(ipctool ${IPCTOOL_SRC} ${COMMON_LIB_SRC})
target_link_libraries(ipctool m)
install(TARGETS ipctool RUNTIME DESTINATION /usr/bin/)
add_executable(ipcinfo example/ipcinfo.c src/tools.c ${VERSION_SRC})
target_include_directories(ipcinfo PUBLIC include)
target_link_libraries(ipcinfo ipchw)
install(TARGETS ipcinfo RUNTIME DESTINATION /usr/bin/)
add_executable(cYAML_test ${CYAML_TEST_SRC})
endif()