summaryrefslogtreecommitdiff
path: root/Userland/Utilities/CMakeLists.txt
blob: a90eec55376acfb0b630e0496c44985c1ff14dad (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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
file(GLOB CMD_SOURCES  CONFIGURE_DEPENDS "*.cpp")
list(APPEND SPECIAL_TARGETS test install)
list(APPEND REQUIRED_TARGETS
    arp base64 basename cat chmod chown clear comm cp cut date dd df diff dirname dmesg du echo env expr false fgrep
    file find grep groups head host hostname id ifconfig kill killall ln logout ls mkdir mount mv nproc
    pgrep pidof ping pmap ps readlink realpath reboot rm rmdir route seq shutdown sleep sort stat stty su tail test
    touch tr true umount uname uniq uptime w wc which whoami xargs yes less
)
list(APPEND RECOMMENDED_TARGETS
    adjtime aplay abench asctl bt checksum chres cksum copy fortune gunzip gzip init install keymap lsirq lsof lspci man mknod mktemp
    nc netstat notify ntpquery open pape passwd pls printf pro shot tar tt unzip zip
)

# FIXME: Support specifying component dependencies for utilities (e.g. WebSocket for telws)

foreach(CMD_SRC ${CMD_SOURCES})
    get_filename_component(CMD_NAME ${CMD_SRC} NAME_WE)
    if (CMD_NAME IN_LIST SPECIAL_TARGETS)
        set(TARGET_NAME "${CMD_NAME}-bin")
    else()
        set(TARGET_NAME "${CMD_NAME}")
    endif()
    if(CMD_NAME IN_LIST REQUIRED_TARGETS)
        serenity_component(
            ${CMD_NAME}
            REQUIRED
            TARGETS ${TARGET_NAME}
        )
    elseif(CMD_NAME IN_LIST RECOMMENDED_TARGETS)
        serenity_component(
            ${CMD_NAME}
            RECOMMENDED
            TARGETS ${TARGET_NAME}
        )
    else()
        serenity_component(
            ${CMD_NAME}
            TARGETS ${TARGET_NAME}
        )
    endif()
    if (CMD_NAME IN_LIST SPECIAL_TARGETS)
        add_executable(${TARGET_NAME} ${CMD_SRC})
        target_link_libraries(${TARGET_NAME} LibCore LibMain)
        install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin)
        install(CODE "file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME}-bin ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME})")
    else()
        add_executable(${CMD_NAME} ${CMD_SRC})
        set_target_properties(${CMD_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE)
        target_link_libraries(${CMD_NAME} LibCore)
        install(TARGETS ${CMD_NAME} RUNTIME DESTINATION bin OPTIONAL)
    endif()
endforeach()

if (ENABLE_JAKT)
    add_executable(hello-jakt hello-world.cpp)
    compile_jakt(hello-world.jakt)
    target_link_libraries(hello-jakt LibC)
    set_target_properties(hello-jakt PROPERTIES EXCLUDE_FROM_ALL TRUE)
    install(TARGETS hello-jakt RUNTIME DESTINATION bin OPTIONAL)
    serenity_component(
        hello-jakt
        RECOMMENDED
        TARGETS hello-jakt
    )
endif()

install(CODE "file(CREATE_LINK grep ${CMAKE_INSTALL_PREFIX}/bin/egrep SYMBOLIC)")
install(CODE "file(CREATE_LINK grep ${CMAKE_INSTALL_PREFIX}/bin/rgrep SYMBOLIC)")

target_link_libraries(abench LibAudio LibMain LibCore)
target_link_libraries(adjtime LibMain)
target_link_libraries(allocate LibMain)
target_link_libraries(aplay LibAudio LibMain)
target_link_libraries(arp LibMain)
target_link_libraries(asctl LibAudio LibMain)
target_link_libraries(base64 LibMain)
target_link_libraries(basename LibMain)
target_link_libraries(beep LibMain)
target_link_libraries(blockdev LibMain)
target_link_libraries(bt LibSymbolication LibMain)
target_link_libraries(cal LibMain)
target_link_libraries(cat LibMain)
target_link_libraries(checksum LibCrypto LibMain)
target_link_libraries(chgrp LibMain)
target_link_libraries(chmod LibMain)
target_link_libraries(chown LibMain)
target_link_libraries(chres LibGUI LibMain)
target_link_libraries(cksum LibCrypto LibMain)
target_link_libraries(clear LibMain)
target_link_libraries(cmp LibMain)
target_link_libraries(comm LibMain)
target_link_libraries(config LibConfig LibMain)
target_link_libraries(copy LibGUI LibMain)
target_link_libraries(cp LibMain)
target_link_libraries(cpp-lexer LibCpp LibMain)
target_link_libraries(cpp-parser LibCpp LibMain)
target_link_libraries(cpp-preprocessor LibCpp LibMain)
target_link_libraries(cut LibMain)
target_link_libraries(date LibMain)
target_link_libraries(dd LibMain)
target_link_libraries(df LibMain)
target_link_libraries(diff LibDiff LibMain)
target_link_libraries(dirname LibMain)
target_link_libraries(disasm LibX86 LibMain)
target_link_libraries(disk_benchmark LibMain)
target_link_libraries(dmesg LibMain)
target_link_libraries(du LibMain)
target_link_libraries(echo LibMain)
target_link_libraries(edid-dump LibMain LibEDID)
target_link_libraries(env LibMain)
target_link_libraries(errno LibMain)
target_link_libraries(expr LibRegex LibMain)
target_link_libraries(false LibMain)
target_link_libraries(fdtdump LibDeviceTree LibMain)
target_link_libraries(fgrep LibMain)
target_link_libraries(file LibGfx LibIPC LibCompress LibMain)
target_link_libraries(find LibMain)
target_link_libraries(flock LibMain)
target_link_libraries(fortune LibMain)
target_link_libraries(functrace LibDebug LibX86 LibMain)
target_link_libraries(gml-format LibGUI LibMain)
target_link_libraries(grep LibRegex LibMain)
target_link_libraries(gron LibMain)
target_link_libraries(groupadd LibMain)
target_link_libraries(groupdel LibMain)
target_link_libraries(groups LibMain)
target_link_libraries(gunzip LibCompress LibMain)
target_link_libraries(gzip LibCompress LibMain)
target_link_libraries(head LibMain)
target_link_libraries(headless-browser LibCore LibGemini LibGfx LibHTTP LibWeb LibWebSocket LibMain)
target_link_libraries(hexdump LibMain)
target_link_libraries(host LibMain)
target_link_libraries(hostname LibMain)
target_link_libraries(id LibMain)
target_link_libraries(ifconfig LibMain)
target_link_libraries(ini LibMain)
target_link_libraries(install-bin LibMain)
target_link_libraries(jp LibMain)
target_link_libraries(js LibJS LibLine LibMain LibTextCodec)
link_with_unicode_data(js)
target_link_libraries(kcov-example LibMain)
target_link_libraries(keymap LibKeyboard LibMain)
target_link_libraries(kill LibMain)
target_link_libraries(killall LibCore LibMain)
target_link_libraries(less LibMain)
target_link_libraries(ln LibMain)
target_link_libraries(logout LibMain)
target_link_libraries(ls LibMain)
target_link_libraries(lscpu LibMain)
target_link_libraries(lsirq LibMain)
target_link_libraries(lsof LibMain)
target_link_libraries(lspci LibPCIDB LibMain)
target_link_libraries(lsusb LibUSBDB LibMain)
target_link_libraries(man LibMarkdown LibMain)
target_link_libraries(markdown-check LibMarkdown LibMain)
target_link_libraries(matroska LibMain LibVideo)
target_link_libraries(md LibMarkdown LibMain)
target_link_libraries(mkdir LibMain)
target_link_libraries(mkfifo LibMain)
target_link_libraries(mknod LibMain)
target_link_libraries(mktemp LibMain)
target_link_libraries(mv LibMain)
target_link_libraries(mount LibMain)
target_link_libraries(nc LibMain)
target_link_libraries(netstat LibMain)
target_link_libraries(nl LibMain)
target_link_libraries(notify LibGUI LibMain)
target_link_libraries(nproc LibMain)
target_link_libraries(ntpquery LibMain)
target_link_libraries(open LibDesktop LibMain)
target_link_libraries(pape LibGUI LibMain)
target_link_libraries(passwd LibCrypt LibMain)
target_link_libraries(paste LibGUI LibCore LibMain)
target_link_libraries(pathchk LibMain)
target_link_libraries(pgrep LibRegex LibMain)
target_link_libraries(pidof LibMain)
target_link_libraries(ping LibMain)
target_link_libraries(pls LibCrypt LibMain)
target_link_libraries(pmap LibMain)
target_link_libraries(pmemdump LibMain)
target_link_libraries(printf LibMain)
target_link_libraries(pro LibMain LibProtocol)
target_link_libraries(profile LibMain)
target_link_libraries(ps LibMain)
target_link_libraries(purge LibMain)
target_link_libraries(pwd LibMain)
target_link_libraries(readelf LibMain)
target_link_libraries(readlink LibMain)
target_link_libraries(realpath LibMain)
target_link_libraries(reboot LibMain)
target_link_libraries(rev LibMain)
target_link_libraries(rm LibMain)
target_link_libraries(rmdir LibMain)
target_link_libraries(route LibMain)
target_link_libraries(run-tests LibRegex LibCoredump LibMain)
target_link_libraries(seq LibMain)
target_link_libraries(shot LibGUI LibMain)
target_link_libraries(shuf LibMain)
target_link_libraries(shutdown LibMain)
target_link_libraries(sleep LibMain)
target_link_libraries(sort LibMain)
target_link_libraries(sql LibLine LibMain LibSQL LibIPC)
target_link_libraries(stat LibMain)
target_link_libraries(strace LibMain)
target_link_libraries(stty LibMain)
target_link_libraries(su LibCrypt LibMain)
target_link_libraries(sync LibMain)
target_link_libraries(syscall LibMain)
target_link_libraries(sysctl LibMain)
target_link_libraries(tac LibMain)
target_link_libraries(tail LibMain)
target_link_libraries(tar LibMain LibArchive LibCompress)
target_link_libraries(tee LibMain)
target_link_libraries(telws LibProtocol LibLine LibMain)
target_link_libraries(test-bindtodevice LibMain)
target_link_libraries(test-fuzz LibCore LibGemini LibGfx LibHTTP LibIPC LibJS LibMarkdown LibShell LibMain)
target_link_libraries(test-imap LibIMAP LibMain)
target_link_libraries(test-pthread LibThreading LibMain)
target_link_libraries(test-unveil LibMain)
target_link_libraries(test_env LibMain)
target_link_libraries(timezone LibMain)
target_link_libraries(top LibMain)
target_link_libraries(touch LibMain)
target_link_libraries(tr LibMain)
target_link_libraries(traceroute LibMain)
target_link_libraries(tree LibMain)
target_link_libraries(true LibMain)
target_link_libraries(truncate LibMain)
target_link_libraries(tt LibPthread LibMain)
target_link_libraries(tty LibMain)
target_link_libraries(umount LibMain)
target_link_libraries(uname LibMain)
target_link_libraries(uniq LibMain)
target_link_libraries(unzip LibArchive LibCompress LibMain)
target_link_libraries(update-cpp-test-results LibCpp LibCore LibMain)
target_link_libraries(uptime LibMain)
target_link_libraries(useradd LibMain)
target_link_libraries(userdel LibMain)
target_link_libraries(usermod LibMain)
target_link_libraries(utmpupdate LibMain)
target_link_libraries(w LibMain)
target_link_libraries(wasm LibMain LibWasm LibLine)
target_link_libraries(watch LibMain)
target_link_libraries(wc LibMain)
target_link_libraries(which LibMain)
target_link_libraries(whoami LibMain)
target_link_libraries(wsctl LibGUI LibMain)
target_link_libraries(xargs LibMain)
target_link_libraries(xml LibMain LibXML)
target_link_libraries(yes LibMain)
target_link_libraries(zip LibArchive LibCompress LibCrypto LibMain)