[WIN32K]
[reactos.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 project(REACTOS)
3
4 # Compile options
5 include(config.cmake)
6
7 # Compiler specific definitions and macros
8 if(MSVC)
9 include(msc.cmake)
10 else()
11 include(gcc.cmake)
12 endif(MSVC)
13
14 # Generic macros
15 include(CMakeMacros.cmake)
16
17 set(CMAKE_INCLUDE_CURRENT_DIR ON)
18 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
19 set(CMAKE_SHARED_LIBRARY_PREFIX "")
20
21 set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
22 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
23
24 set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
25
26 add_definitions(-D__REACTOS__)
27
28 if(NOT CMAKE_CROSSCOMPILING)
29
30 add_definitions(-DTARGET_i386)
31
32 include_directories(
33 ${REACTOS_SOURCE_DIR}/tools/unicode
34 include
35 include/host
36 include/reactos
37 include/reactos/wine
38 ${REACTOS_BINARY_DIR}/include)
39
40 add_subdirectory(tools)
41 add_subdirectory(lib)
42
43 if(NOT MSVC)
44 export(TARGETS widl winebuild nci buildno gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
45 else()
46 export(TARGETS winebuild nci buildno gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
47 endif()
48
49 else()
50
51 #Some cleanup
52 file(REMOVE
53 ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
54 ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
55 ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
56 ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
57 ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
58 ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
59
60 #Some useful variables
61 set(LIVECD_DIR "${REACTOS_BINARY_DIR}/boot/livecd")
62 set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
63
64 # Activate support for assembly source files
65 enable_language(ASM)
66
67 # Activate language support for resource files
68 enable_language(RC)
69
70 if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
71 set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
72 endif()
73
74 set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
75 include(${IMPORT_EXECUTABLES})
76
77 add_definitions(-DDBG=${DBG} -DKDBG=${KDBG})
78
79 if(DBG)
80 add_definitions(-D_SEH_ENABLE_TRACE)
81 endif(DBG)
82
83 if(DBG OR KDBG)
84 set(DBG_OR_KDBG true)
85 endif(DBG OR KDBG)
86
87 # Version Options
88 add_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502 -D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502)
89
90 # Arch Options
91 add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
92
93 # Other
94 add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
95
96 include_directories(
97 include
98 include/psdk
99 include/dxsdk
100 ${REACTOS_BINARY_DIR}/include
101 ${REACTOS_BINARY_DIR}/include/dxsdk
102 ${REACTOS_BINARY_DIR}/include/psdk
103 ${REACTOS_BINARY_DIR}/include/reactos
104 include/crt
105 include/ddk
106 include/ndk
107 include/reactos
108 include/reactos/libs)
109
110 if(MSVC)
111 include_directories(include/crt/msc)
112 else()
113 include_directories(include/crt/mingw32)
114 endif(MSVC)
115
116 add_subdirectory(include/psdk)
117 add_subdirectory(include/dxsdk)
118 add_subdirectory(include/reactos/idl)
119 add_subdirectory(include/reactos/wine)
120 add_subdirectory(include/reactos/mc)
121 add_subdirectory(include/asm)
122
123 include(baseaddress.cmake)
124
125 add_subdirectory(base)
126 add_subdirectory(boot)
127 add_subdirectory(dll)
128 add_subdirectory(drivers)
129 add_subdirectory(hal)
130 add_subdirectory(lib)
131 add_subdirectory(media)
132 add_subdirectory(ntoskrnl)
133 add_subdirectory(subsystems)
134
135 # nci generated intermediate files
136
137 list(APPEND nci_output
138 ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h
139 ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h
140 ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S
141 ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S
142 ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S
143 ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
144
145 list(APPEND nci_folders
146 ${CMAKE_CURRENT_BINARY_DIR}/dll/ntdll/def
147 ${CMAKE_CURRENT_BINARY_DIR}/lib/ntdllsys/ntdll
148 ${CMAKE_CURRENT_BINARY_DIR}/lib/win32ksys
149 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/include/internal
150 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/ex
151 ${CMAKE_CURRENT_BINARY_DIR}/subsystems/win32/win32k/include)
152
153 file(MAKE_DIRECTORY ${nci_folders})
154
155 add_custom_command(
156 OUTPUT ${nci_output}
157 COMMAND native-nci -arch ${ARCH} ${REACTOS_SOURCE_DIR}/ntoskrnl/sysfuncs.lst ${REACTOS_SOURCE_DIR}/subsystems/win32/win32k/w32ksvc.db ${nci_output}
158 DEPENDS native-nci ${nci_folders})
159
160 set_source_files_properties(${nci_output} PROPERTIES GENERATED TRUE)
161
162 add_custom_target(ntdll_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S)
163 add_custom_target(win32k_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S)
164 add_custom_target(ntsys_pspec ALL DEPENDS ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
165 add_custom_target(kernel_napi ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h)
166 add_custom_target(subsystem_napi ALL DEPENDS ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h)
167 add_custom_target(kernel_zw ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S)
168
169 file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
170
171 add_custom_command(
172 OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
173 COMMAND native-buildno ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
174 DEPENDS ${REACTOS_SOURCE_DIR}/include/reactos/version.h)
175
176 add_custom_target(buildno_header ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
177
178 file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib)
179
180 list(APPEND OUTPUT_FILES
181 ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib8gen.c
182 ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib16gen.c
183 ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib32gen.c)
184
185 add_custom_command(
186 OUTPUT ${OUTPUT_FILES}
187 COMMAND native-gendib ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib
188 DEPENDS native-gendib)
189
190 add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
191
192 #bootcd and livecd
193 include(ros_cd.cmake)
194
195 endif()