-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
83 lines (65 loc) · 2.07 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
cmake_minimum_required(VERSION 2.8)
add_executable(MacWifiINIT
sysmenu.cpp
Util.cpp
ShowInitIcon.c
resources.r
)
target_link_libraries(MacWifiINIT)
# See: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
SET(CMAKE_CXX_FLAGS "-Ofast")
set_target_properties(MacWifiINIT PROPERTIES
COMPILE_OPTIONS -ffunction-sections # make things smaller
# set a linker flag that says we want a flat piece
# of code in a data file, specify entry point,
# and add -Wl,-gc-sections to make things smaller.
LINK_FLAGS "-Wl,--mac-flat -Wl,-gc-sections"
)
# wrap the compiled INIT into a resource
add_custom_command(
OUTPUT MacWifiINIT.rsrc.bin
COMMAND ${REZ} -I ${REZ_INCLUDE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/resources.r
-o MacWifiINIT.rsrc.bin
DEPENDS MacWifiINIT resources.r
)
# Now build the application
add_application(MacWifi
MacWifi.cpp
resources.r
Modules/WifiModule.cpp
Modules/VM300.cpp
Modules/OpenWRT.cpp
Comms.cpp
Util.cpp
Prefs.cpp
# the separately compiled WDEF resource
${CMAKE_CURRENT_BINARY_DIR}/MacWifiINIT.rsrc.bin
TYPE "appe" # application extension
CREATOR "MWFI"
)
target_link_libraries(MacWifi MacHTTP MacTCPHelper gason iconv charset)
# again, add some options to make things smaller.
set_target_properties(MacWifi PROPERTIES COMPILE_OPTIONS -ffunction-sections)
set_target_properties(MacWifi PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
# MacWifi client library
add_library(MacWifiLib STATIC
MacWifiLib.cpp
)
install(TARGETS MacWifiLib
DESTINATION "lib"
)
install(FILES MacWifiLib.h WifiEvents.h
DESTINATION "include/macwifi"
)
set_target_properties(MacWifiLib PROPERTIES COMPILE_OPTIONS -ffunction-sections)
set_target_properties(MacWifiLib PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
add_application(MacWifiTest
MacWifiTest.cpp
MacWifiTest.r
Util.cpp
CONSOLE
)
target_link_libraries(MacWifiTest MacWifiLib)
set_target_properties(MacWifiTest PROPERTIES COMPILE_OPTIONS -ffunction-sections)
set_target_properties(MacWifiTest PROPERTIES LINK_FLAGS "-Wl,-gc-sections")