https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5cadc268ef4056b6ce082…
commit 5cadc268ef4056b6ce08283b5d95604e37e02f27
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Aug 21 21:17:05 2022 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Aug 22 22:08:02 2022 +0200
[BOOT][SDK:CMLIB] Compile a CMLIB for FreeLdr / NT bootloader with correct
definitions. (#4619)
This also allows using the CMLIB with any reduced functionality
that could be required at boot-time.
---
boot/environ/CMakeLists.txt | 4 ++--
boot/freeldr/freeldr/CMakeLists.txt | 2 +-
sdk/lib/cmlib/CMakeLists.txt | 9 ++++++++-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/boot/environ/CMakeLists.txt b/boot/environ/CMakeLists.txt
index 3874ed3f031..5406e4f7f08 100644
--- a/boot/environ/CMakeLists.txt
+++ b/boot/environ/CMakeLists.txt
@@ -101,7 +101,7 @@ endif()
set_entrypoint(bootmgfw EfiEntry)
-target_link_libraries(bootmgfw bootlib cportlib cmlib blrtl libcntpr)
+target_link_libraries(bootmgfw bootlib cportlib blcmlib blrtl libcntpr)
# dynamic analysis switches
if(STACK_PROTECTOR)
@@ -149,7 +149,7 @@ else()
set_entrypoint(rosload OslMain)
endif()
-target_link_libraries(rosload bootlib cportlib cmlib blrtl libcntpr)
+target_link_libraries(rosload bootlib cportlib blcmlib blrtl libcntpr)
# dynamic analysis switches
if(STACK_PROTECTOR)
diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt
index c00416befbc..a295c481202 100644
--- a/boot/freeldr/freeldr/CMakeLists.txt
+++ b/boot/freeldr/freeldr/CMakeLists.txt
@@ -293,7 +293,7 @@ if(ARCH STREQUAL "i386")
target_link_libraries(freeldr_pe mini_hal)
endif()
-target_link_libraries(freeldr_pe freeldr_common cportlib cmlib blrtl libcntpr)
+target_link_libraries(freeldr_pe freeldr_common cportlib blcmlib blrtl libcntpr)
# dynamic analysis switches
if(STACK_PROTECTOR)
diff --git a/sdk/lib/cmlib/CMakeLists.txt b/sdk/lib/cmlib/CMakeLists.txt
index bcd2b6b5142..2ed0bc304b1 100644
--- a/sdk/lib/cmlib/CMakeLists.txt
+++ b/sdk/lib/cmlib/CMakeLists.txt
@@ -1,6 +1,5 @@
add_definitions(
- -D_BLDR_
-D_NTSYSTEM_
-DNASSERT)
@@ -19,10 +18,18 @@ list(APPEND SOURCE
cmlib.h)
if(CMAKE_CROSSCOMPILING)
+ # CMLIB for NT bootloader
+ add_library(blcmlib ${SOURCE})
+ target_compile_definitions(blcmlib PRIVATE _BLDR_)
+ add_dependencies(blcmlib bugcodes xdk)
+ add_pch(blcmlib cmlib.h SOURCE)
+
+ # CMLIB for NT kernel
add_library(cmlib ${SOURCE})
add_dependencies(cmlib bugcodes xdk)
add_pch(cmlib cmlib.h SOURCE)
else()
+ # CMLIB for host-tools
add_definitions(
-D__NO_CTYPE_INLINES
-DCMLIB_HOST)