From 3930317e127d324cae9dc3ed4396c01f402821be Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 4 Aug 2010 14:29:24 +0000 Subject: [PATCH] [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 --- dll/ntdll/CMakeLists.txt | 30 ++++++++++++++++++++---------- toolchain-mingw32.cmake | 4 ++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt index e2b79082a7f..0b872a0e400 100644 --- a/dll/ntdll/CMakeLists.txt +++ b/dll/ntdll/CMakeLists.txt @@ -1,7 +1,3 @@ - -SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -Wl,--enable-stdcall-fixup -Wl,--kill-at -o ${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.def ") - 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) \ No newline at end of file +add_dependencies(ntdll ntstatus version) diff --git a/toolchain-mingw32.cmake b/toolchain-mingw32.cmake index abbc90feaaa..4f4b7aa0f78 100644 --- a/toolchain-mingw32.cmake +++ b/toolchain-mingw32.cmake @@ -20,6 +20,10 @@ SET(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc) SET(CMAKE_ASM_COMPILE_OBJECT " -x assembler-with-cpp -o -D__ASM__ -c ") SET(CMAKE_RC_COMPILE_OBJECT " -O coff -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_BINARY_DIR}/include/reactos -i -o -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