- add_custom_command(
- OUTPUT ${REACTOS_BINARY_DIR}/dll/ntdll/ntsys.a
- COMMAND ${MINGW_PREFIX}gcc ${CMAKE_C_FLAGS} -xc -E ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec > ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.spec
- COMMAND native-winebuild -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.stubs.c --pedll ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.spec --filename ntdll.dll
- COMMAND ${MINGW_PREFIX}gcc -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.stubs.o ${CMAKE_C_FLAGS} -c ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.stubs.c
- COMMAND native-winebuild -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.auto.def --def -E ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.spec --filename ntdll.dll
- COMMAND ${MINGW_PREFIX}dlltool --def ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.auto.def --kill-at --output-lib ${REACTOS_BINARY_DIR}/dll/ntdll/ntsys.a
- COMMAND ${MINGW_PREFIX}ar -rc ${REACTOS_BINARY_DIR}/dll/ntdll/ntsys.a ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys_ntsys.stubs.o
- DEPENDS native-winebuild
- )
- set_source_files_properties(${REACTOS_BINARY_DIR}/dll/ntdll/ntsys.a PROPERTIES GENERATED TRUE)
- add_custom_target(ntsys ALL DEPENDS ${REACTOS_BINARY_DIR}/dll/ntdll/ntsys.a)
- add_dependencies(ntsys ntsys_pspec)
- include_directories(BEFORE include)
- include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/subsys)
- add_definitions(-D__NTDLL__)
- add_definitions(-D_NTOSKRNL_)
- add_definitions(-DCRTDLL)
- get_directory_property(defines COMPILE_DEFINITIONS)
- foreach(arg ${defines})
- set(result_defs "${result_defs} -D${arg}")
- endforeach(arg ${defines})
- set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> ${result_defs} -D__ASM__ <FLAGS> -c <SOURCE>")
- SET(CMAKE_C_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> -o ${REACTOS_BINARY_DIR}/dll/ntdll/ntdll.dll --Wl,--entry,0 --Wl,--image-base,0x7c900000 --Wl,-disable-stdcall-fixup --Wl,-file-alignment,0x1000 --Wl,-section-alignment,0x1000 --Wl,--shared --Wl,--exclude-all-symbols e:/rosbe/i386/lib/gcc/mingw32/4.4.3/libgcc.a ${REACTOS_BINARY_DIR}/lib/rtl/librtl.a ${REACTOS_BINARY_DIR}/lib/ntdllsys/libntdllsys.a ${REACTOS_BINARY_DIR}/lib/sdk/crt/liblibcntpr.a ${REACTOS_BINARY_DIR}/lib/pseh/libpseh.a ${REACTOS_BINARY_DIR}/lib/debugsup/debugsup_ntdll.a <OBJECTS>")
- add_custom_command(
- OUTPUT ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.stubs.c ${REACTOS_BINARY_DIR}/dll/ntdll/ntdll.exp
- COMMAND ${MINGW_PREFIX}gcc -I${REACTOS_BINARY_DIR}/include -xc -E ${REACTOS_SOURCE_DIR}/dll/ntdll/def/ntdll.rc
- COMMAND native-wrc -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.res -I${REACTOS_SOURCE_DIR}/dll/ntdll/def -I${REACTOS_SOURCE_DIR}/dll/ntdll/include -I${REACTOS_BINARY_DIR}/dll/ntdll -I${REACTOS_SOURCE_DIR}/include/reactos/subsys --nostdinc
- COMMAND ${MINGW_PREFIX}windres -i ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.res -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.coff -J res -O coff
- COMMAND ${MINGW_PREFIX}gcc -xc -E ${REACTOS_SOURCE_DIR}/dll/ntdll/def/ntdll.pspec > ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.spec
- COMMAND native-winebuild -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.stubs.c --pedll ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.spec --filename ntdll.dll
- COMMAND native-winebuild -o ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.auto.def --def -E ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.spec --filename ntdll.dll
- COMMAND ${MINGW_PREFIX}dlltool --def ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.auto.def --kill-at --output-exp=${REACTOS_BINARY_DIR}/dll/ntdll/ntdll.exp
- DEPENDS native-wrc native-winebuild
- )
- set_source_files_properties(${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.stubs.c ${REACTOS_BINARY_DIR}/dll/ntdll/ntdll.exp PROPERTIES GENERATED TRUE)
- file(GLOB_RECURSE ARCH_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.c" "${CMAKE_CURRENT_SOURCE_DIR}/dispatch/${ARCH}/*.s")
- file(GLOB_RECURSE SOURCE *.c)
- list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ldr/elf.c)
- if(NOT ARCH MATCHES amd64)
- list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/dispatch/amd64/stubs.c)
- endif()
- add_library(ntdll SHARED ${ARCH_SOURCE} ${SOURCE} ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntdll_ntdll.stubs.c)
- set_target_properties(ntdll PROPERTIES PREFIX "")
- target_link_libraries(ntdll rtl ntdllsys libcntpr pseh debugsup_ntdll)
- add_dependencies(ntdll ntstatus version)