4464234276ceb11ae10af8363d1889b91319d544
[reactos.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 project(REACTOS)
3
4 add_definitions(-D__REACTOS__)
5
6 if(NOT CMAKE_CROSSCOMPILING)
7
8 add_definitions(-DTARGET_i386)
9 add_definitions(-fshort-wchar)
10
11 include_directories(${REACTOS_SOURCE_DIR}/tools/unicode)
12 include_directories(./include)
13 include_directories(./include/reactos)
14 include_directories(./include/reactos/wine)
15
16 add_subdirectory(tools)
17 add_subdirectory(lib)
18
19 export(TARGETS widl winebuild wmc wrc nci pefixup rsym FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
20
21 else()
22
23 # Activate support for asm source files
24 enable_language(ASM)
25
26 set(IMPORT_EXECUTABLES "${REACTOS_SOURCE_DIR}/build/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
27 include(${IMPORT_EXECUTABLES})
28
29 # Debug Options
30 add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE -DKDBG=1)
31
32 # Version Options
33 add_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502 -D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502)
34
35 # Arch Options
36 add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
37
38 # Other
39 add_definitions(-DUSE_COMPILER_EXCEPTIONS)
40 add_definitions(-D_USE_32BIT_TIME_T)
41
42 # Compiler Core
43 add_definitions(-gstabs+ -pipe -fms-extensions -fno-set-stack-executable)
44
45 # Tuning
46 add_definitions(-march=pentium -mtune=i686)
47
48 # Warnings
49 add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value)
50
51 # Optimizations
52 add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-optimize-sibling-calls)
53
54 include_directories(./include)
55 include_directories(./include/psdk)
56 include_directories(./include/dxsdk)
57 include_directories(${REACTOS_BINARY_DIR}/include/dxsdk)
58 include_directories(${REACTOS_BINARY_DIR}/include/psdk)
59 include_directories(${REACTOS_BINARY_DIR}/include/reactos)
60 include_directories(./include/crt)
61 include_directories(./include/crt/mingw32)
62 include_directories(./include/ddk)
63 include_directories(./include/ndk)
64 include_directories(./include/reactos)
65 include_directories(./include/reactos/libs)
66
67 add_subdirectory(include/psdk)
68 add_subdirectory(include/dxsdk)
69 add_subdirectory(include/reactos/mc)
70
71 add_subdirectory(base)
72 add_subdirectory(dll)
73 add_subdirectory(lib)
74
75 # nci generated intermediate files
76
77 set(nci_output
78 ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h
79 ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h
80 ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S
81 ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S
82 ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S
83 ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec
84 )
85
86 # stupid nci tool can't create folders itself, se we're gonna create them for it
87 set(nci_folders
88 ${CMAKE_CURRENT_BINARY_DIR}/dll/ntdll/def
89 ${CMAKE_CURRENT_BINARY_DIR}/lib/ntdllsys/ntdll
90 ${CMAKE_CURRENT_BINARY_DIR}/lib/win32ksys
91 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/include/internal
92 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/ex
93 ${CMAKE_CURRENT_BINARY_DIR}/subsystems/win32/win32k/include
94 )
95
96 file(MAKE_DIRECTORY ${nci_folders})
97
98 ADD_CUSTOM_COMMAND(
99 OUTPUT ${nci_output}
100 COMMAND native-nci -arch ${ARCH} ${REACTOS_SOURCE_DIR}/ntoskrnl/sysfuncs.lst ${REACTOS_SOURCE_DIR}/subsystems/win32/win32k/w32ksvc.db ${nci_output}
101 DEPENDS native-nci ${nci_folders}
102 )
103
104 SET_SOURCE_FILES_PROPERTIES(${nci_output} PROPERTIES GENERATED TRUE)
105
106 ADD_CUSTOM_TARGET(ntdll_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S)
107 ADD_CUSTOM_TARGET(win32k_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S)
108 ADD_CUSTOM_TARGET(ntsys_pspec ALL DEPENDS ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
109 ADD_CUSTOM_TARGET(kernel_napi ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h)
110 ADD_CUSTOM_TARGET(subsystem_napi ALL DEPENDS ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h)
111 ADD_CUSTOM_TARGET(kernel_zw ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S)
112
113 endif()
114