@@ -4,105 +4,47 @@ add_custom_target(hermit_rs
4
4
COMMAND
5
5
cargo run --package=xtask --target -dir ${CMAKE_BINARY_DIR} /hermit_rs --
6
6
build --arch ${HERMIT_ARCH} --target -dir ${CMAKE_BINARY_DIR} /hermit_rs ${CARGO_BUILDTYPE_PARAMETER}
7
- --no -default-features --features pci,smp,acpi,newlib
7
+ --no -default-features --features pci,smp,acpi,newlib,tcp,dhcpv4
8
8
WORKING_DIRECTORY
9
9
${CMAKE_CURRENT_LIST_DIR} /../librs)
10
10
11
- set (LWIP_SRC lwip/src)
12
- add_kernel_module_sources("lwip" "${LWIP_SRC} /api/*.c" )
13
- add_kernel_module_sources("lwip" "${LWIP_SRC} /arch/*.c" )
14
- add_kernel_module_sources("lwip" "${LWIP_SRC} /core/*.c" )
15
- add_kernel_module_sources("lwip" "${LWIP_SRC} /core/ipv4/*.c" )
16
- add_kernel_module_sources("lwip" "${LWIP_SRC} /core/ipv6/*.c" )
17
- add_kernel_module_sources("lwip" "${LWIP_SRC} /netif/*.c" )
18
-
19
- get_kernel_modules(KERNEL_MODULES)
20
- foreach (MODULE ${KERNEL_MODULES} )
21
- get_kernel_module_sources(SOURCES ${MODULE} )
22
-
23
- # maintain list of all objects that will end up in libhermit.a
24
- list (APPEND KERNEL_OBJECTS $<TARGET_OBJECTS:${MODULE} >)
25
-
26
- add_library (${MODULE} OBJECT ${SOURCES} )
27
-
28
- # this is kernel code
29
- target_compile_definitions (${MODULE}
30
- PRIVATE -D__KERNEL__)
31
-
32
- target_compile_definitions (${MODULE}
33
- PRIVATE -DMAX_ARGC_ENVC=${MAX_ARGC_ENVC} )
34
-
35
- target_compile_options (${MODULE}
36
- PRIVATE ${HERMIT_KERNEL_FLAGS} )
37
-
38
- target_include_directories (${MODULE}
39
- PUBLIC ${HERMIT_KERNEL_INCLUDES} )
40
-
41
- # suppress all LwIP compiler warnings. Not our code, so we cannot fix
42
- if ("${MODULE} " STREQUAL "lwip" )
43
- target_compile_options (${MODULE}
44
- PRIVATE -w)
45
- endif ()
46
- endforeach ()
47
-
48
- # Build all kernel modules into a single static library.
49
- add_library (hermit-bootstrap STATIC ${KERNEL_OBJECTS} )
50
- set_target_properties (hermit-bootstrap PROPERTIES LINKER_LANGUAGE C)
51
- add_dependencies (hermit-bootstrap hermit_rs)
52
- set_target_properties (hermit-bootstrap PROPERTIES ARCHIVE_OUTPUT_NAME hermit)
53
-
54
- # Post-process the static library.
55
- add_custom_command (
56
- TARGET hermit-bootstrap POST_BUILD
57
-
58
- # Merge the Rust library into this static library.
59
- COMMAND
60
- ${CMAKE_AR} x ${HERMIT_RS}
61
- COMMAND
62
- ${CMAKE_AR} rcs $<TARGET_FILE:hermit-bootstrap> *.o
63
- COMMAND
64
- ${CMAKE_COMMAND} -E remove *.o
65
-
66
- # Convert the combined library to osabi "Standalone"
67
- COMMAND
68
- ${CMAKE_ELFEDIT} --output -osabi Standalone $<TARGET_FILE:hermit-bootstrap>
11
+ # Require hermit_rs to be built for hermit
12
+ add_custom_target (hermit
13
+ DEPENDS hermit_rs
69
14
70
15
# Copy libhermit.a into local prefix directory so that all subsequent
71
16
# targets can link against the freshly built version (as opposed to
72
17
# linking against the one supplied by the toolchain)
18
+
73
19
COMMAND
74
20
${CMAKE_COMMAND} -E make_directory ${LOCAL_PREFIX_ARCH_LIB_DIR}
75
21
COMMAND
76
- ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:hermit-bootstrap> ${LOCAL_PREFIX_ARCH_LIB_DIR} /
22
+ ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR} /hermit_rs/ ${HERMIT_ARCH} /release/libhermit.a ${LOCAL_PREFIX_ARCH_LIB_DIR} /
77
23
78
24
# and also copy headers into local prefix
79
25
COMMAND
80
26
${CMAKE_COMMAND} -E make_directory ${LOCAL_PREFIX_ARCH_INCLUDE_DIR} /hermit
81
27
COMMAND
82
28
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR} /include /hermit/*.h ${LOCAL_PREFIX_ARCH_INCLUDE_DIR} /hermit/)
83
29
84
- # Deploy libhermit.a and headers for package creation
85
- install (TARGETS hermit-bootstrap
86
- DESTINATION ${HERMIT_ARCH} -hermit/lib
87
- COMPONENT bootstrap)
88
-
89
- install (DIRECTORY include /hermit
90
- DESTINATION ${HERMIT_ARCH} -hermit/include /
91
- COMPONENT bootstrap
92
- FILES_MATCHING PATTERN *.h)
93
-
94
30
# Provide custom target to only install libhermit without its runtimes which is
95
31
# needed during the compilation of the cross toolchain
96
- add_custom_target (hermit-bootstrap -install
32
+ add_custom_target (hermit_rs -install
97
33
DEPENDS
98
- hermit-bootstrap
34
+ hermit_rs
99
35
COMMAND
100
36
${CMAKE_COMMAND}
101
- -DCMAKE_INSTALL_COMPONENT=bootstrap
37
+ -DCMAKE_INSTALL_COMPONENT=hermit_rs
102
38
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
103
- -P cmake_install.cmake)
104
-
105
- # The target 'hermit' includes the HermitCore kernel and several runtimes.
106
- # Applications should depend on this target if they link against HermitCore.
107
- add_custom_target (hermit
108
- DEPENDS hermit-bootstrap)
39
+ -P cmake_install.cmake
40
+ )
41
+
42
+ # Install libhermit.a and headers
43
+ install (FILES ${HERMIT_RS}
44
+ DESTINATION ${HERMIT_ARCH} -hermit/lib
45
+ COMPONENT bootstrap)
46
+
47
+ install (DIRECTORY include /hermit
48
+ DESTINATION ${HERMIT_ARCH} -hermit/include /
49
+ COMPONENT bootstrap
50
+ FILES_MATCHING PATTERN *.h)
0 commit comments