mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[CMAKE]: Disable standard C libraries (WIP: Should add libgcc).
[CMAKE]: Set global linker flags we need for all libraries. [CMAKE]: Set specific NTDLL linker flag. Thanks to Amine for some of his help. svn path=/branches/cmake-bringup/; revision=48457
This commit is contained in:
parent
98c16868ae
commit
3930317e12
2 changed files with 24 additions and 10 deletions
|
@ -1,7 +1,3 @@
|
|||
|
||||
SET(CMAKE_C_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -Wl,--enable-stdcall-fixup -Wl,--kill-at -o <TARGET> <OBJECTS> ${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.def <LINK_LIBRARIES>")
|
||||
|
||||
add_definitions(-D__NTDLL__)
|
||||
add_definitions(-D_NTOSKRNL_)
|
||||
add_definitions(-DCRTDLL)
|
||||
|
@ -10,12 +6,26 @@ include_directories(BEFORE ./include)
|
|||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys)
|
||||
|
||||
file(GLOB_RECURSE SOURCE *.c)
|
||||
list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ldr/elf.c ${CMAKE_CURRENT_SOURCE_DIR}/dispatch/dispatch.c)
|
||||
list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/dispatch/amd64/stubs.c)
|
||||
list(REMOVE_ITEM SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ldr/elf.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch/dispatch.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch/amd64/stubs.c)
|
||||
file(GLOB_RECURSE ARCH_SOURCE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.s")
|
||||
|
||||
file(GLOB_RECURSE ARCH_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.c" "${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.s")
|
||||
add_library(ntdll SHARED
|
||||
${ARCH_SOURCE} ${SOURCE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.rc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ntdll.h.gch)
|
||||
|
||||
add_library(ntdll SHARED ${ARCH_SOURCE} ${SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.rc ${CMAKE_CURRENT_SOURCE_DIR}/include/ntdll.h.gch)
|
||||
target_link_libraries(ntdll rtl ntdllsys libcntpr pseh)
|
||||
set_target_properties(ntdll PROPERTIES LINK_FLAGS "-Wl,-entry,0")
|
||||
|
||||
target_link_libraries(ntdll ${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.def
|
||||
rtl
|
||||
ntdllsys
|
||||
libcntpr
|
||||
pseh)
|
||||
|
||||
add_pch(ntdll ${CMAKE_CURRENT_SOURCE_DIR}/include/ntdll.h ${SOURCE})
|
||||
add_dependencies(ntdll ntstatus version)
|
||||
add_dependencies(ntdll ntstatus version)
|
||||
|
|
|
@ -20,6 +20,10 @@ SET(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
|
|||
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
|
||||
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_BINARY_DIR}/include/reactos -i <SOURCE> -o <OBJECT> <DEFINES> -DRC_INVOKED")
|
||||
|
||||
# Use stdcall fixups, and don't link with anything by default unless we say so
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "") # We should add the environment libgcc here
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-stdcall-fixup -Wl,--kill-at -nodefaultlibs -nostdlib")
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# programs in the host environment
|
||||
|
|
Loading…
Reference in a new issue