Author: sir_richard Date: Wed Aug 4 14:29:24 2010 New Revision: 48457
URL: http://svn.reactos.org/svn/reactos?rev=48457&view=rev Log: [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.
Modified: branches/cmake-bringup/dll/ntdll/CMakeLists.txt branches/cmake-bringup/toolchain-mingw32.cmake
Modified: branches/cmake-bringup/dll/ntdll/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/dll/ntdll/CMakeLis... ============================================================================== --- branches/cmake-bringup/dll/ntdll/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/dll/ntdll/CMakeLists.txt [iso-8859-1] Wed Aug 4 14:29:24 2010 @@ -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(${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)
Modified: branches/cmake-bringup/toolchain-mingw32.cmake URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/toolchain-mingw32.... ============================================================================== --- branches/cmake-bringup/toolchain-mingw32.cmake [iso-8859-1] (original) +++ branches/cmake-bringup/toolchain-mingw32.cmake [iso-8859-1] Wed Aug 4 14:29:24 2010 @@ -20,6 +20,10 @@ 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