[WKSSVC] Implements NetrWorkstationStatisticsGet().
[reactos.git] / CMakeLists.txt
1
2 cmake_minimum_required(VERSION 2.8.12)
3
4 if(POLICY CMP0017)
5 # Shadow cmake provided modules
6 cmake_policy(SET CMP0017 OLD)
7 endif()
8
9 if(POLICY CMP0026)
10 # Allow use of the LOCATION property
11 cmake_policy(SET CMP0026 OLD)
12 endif()
13
14 if(POLICY CMP0051)
15 # List TARGET_OBJECTS in SOURCES target property
16 cmake_policy(SET CMP0051 NEW)
17 endif()
18
19 if(POLICY CMP0058)
20 # Ninja requires custom command byproducts to be explicit
21 cmake_policy(SET CMP0058 OLD)
22 endif()
23
24 project(REACTOS)
25
26 # Versioning
27 include(sdk/include/reactos/version.cmake)
28
29 # Don't escape preprocessor definition values added via add_definitions
30 cmake_policy(SET CMP0005 OLD)
31 cmake_policy(SET CMP0002 NEW)
32 if(POLICY CMP0018)
33 cmake_policy(SET CMP0018 OLD)
34 endif()
35
36 set(CMAKE_INCLUDE_CURRENT_DIR ON)
37 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
38 set(CMAKE_SHARED_LIBRARY_PREFIX "")
39 set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
40 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
41 set(CMAKE_COLOR_MAKEFILE OFF)
42 #set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
43
44 if(NOT DEFINED NEW_STYLE_BUILD)
45 set(NEW_STYLE_BUILD TRUE)
46 endif()
47
48 if(NOT ARCH)
49 set(ARCH i386)
50 endif()
51 # Now the ARCH variable will be in lowercase.
52 # It is needed because STREQUAL comparison
53 # is case-sensitive.
54 # See http://cmake.3232098.n2.nabble.com/Case-insensitive-string-compare-td7580269.html
55 # for more information.
56 string(TOLOWER ${ARCH} ARCH)
57
58 # Compile options
59 if(ARCH STREQUAL "i386")
60 include(sdk/cmake/config.cmake)
61 elseif(ARCH STREQUAL "amd64")
62 include(sdk/cmake/config-amd64.cmake)
63 elseif(ARCH STREQUAL "arm")
64 include(sdk/cmake/config-arm.cmake)
65 endif()
66
67 # Compiler flags handling
68 include(sdk/cmake/compilerflags.cmake)
69
70 add_definitions(-D__REACTOS__)
71
72 if(MSVC_IDE)
73 add_compile_flags("/MP")
74 endif()
75
76 # We don't need CMake importlib handling.
77 # FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.
78 if(NOT MSVC_IDE)
79 unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
80 endif()
81
82 # Bison and Flex support
83 # include(sdk/cmake/bison-flex.cmake)
84
85 if(NOT CMAKE_CROSSCOMPILING)
86
87 if(NEW_STYLE_BUILD)
88 set(TOOLS_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
89 endif()
90
91 add_definitions(-DTARGET_${ARCH})
92
93 if(MSVC)
94 if(ARCH STREQUAL "i386")
95 add_definitions(/D_X86_ /DWIN32 /D_WINDOWS)
96 endif()
97 if(MSVC_VERSION GREATER 1699)
98 add_definitions(/D_ALLOW_KEYWORD_MACROS)
99 endif()
100 add_definitions(/Dinline=__inline)
101 endif()
102
103 include_directories(sdk/include/host)
104
105 if(NOT MSVC)
106 add_subdirectory(dll/win32/dbghelp)
107 endif()
108 add_subdirectory(sdk/tools)
109 add_subdirectory(sdk/lib)
110
111 if(NOT NEW_STYLE_BUILD)
112 if(NOT MSVC)
113 export(TARGETS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc rsym mkshelllink utf16le xml2sdb FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
114 else()
115 export(TARGETS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink utf16le xml2sdb FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
116 endif()
117 endif()
118
119 else()
120
121 if(NEW_STYLE_BUILD)
122 include(sdk/cmake/host-tools.cmake)
123 endif()
124
125 # Print build type
126 message("-- Build Type: ${CMAKE_BUILD_TYPE}")
127
128 # adjust the default behaviour of the FIND_XXX() commands:
129 # search headers and libraries in the target environment, search
130 # programs in the host environment
131 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
132 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
133 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
134
135 #useful stuff!
136 include(CMakeParseArguments)
137
138 # Do some cleanup
139 file(REMOVE
140 ${REACTOS_BINARY_DIR}/dependencies.graphml
141 ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
142 ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
143 ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
144 ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
145 ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
146 ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
147
148 if(NOT NEW_STYLE_BUILD)
149 if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
150 set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
151 endif()
152 set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
153 include(${IMPORT_EXECUTABLES})
154 endif()
155
156 if(DBG)
157 add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
158 else()
159 add_definitions(-DDBG=0)
160 endif()
161
162 if(KDBG)
163 add_definitions(-DKDBG=1)
164 endif()
165
166 if(_WINKD_)
167 add_definitions(-D_WINKD_=1)
168 endif()
169
170 if(CMAKE_VERSION MATCHES "ReactOS")
171 set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
172 else()
173 set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
174 endif()
175
176 # Version Options
177 add_definitions(-DWINVER=0x502
178 -D_WIN32_IE=0x600
179 -D_WIN32_WINNT=0x502
180 -D_WIN32_WINDOWS=0x502
181 -D_SETUPAPI_VER=0x502)
182
183 # Arch Options
184 if(ARCH STREQUAL "i386")
185 add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
186 elseif(ARCH STREQUAL "amd64")
187 add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
188 elseif(ARCH STREQUAL "arm")
189 # _M_ARM is already defined by toolchain
190 add_definitions(-D_ARM_ -D__arm__ -DWIN32)
191 if(SARCH STREQUAL "omap-zoom2")
192 add_definitions(-D_ZOOM2_)
193 endif()
194 endif()
195
196 # Other
197 if(ARCH STREQUAL "i386")
198 add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
199 elseif(ARCH STREQUAL "amd64")
200 add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
201 elseif(ARCH STREQUAL "arm")
202 add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
203 endif()
204
205 # Activate support for assembly source files
206 enable_language(ASM)
207
208 # Activate language support for resource files
209 enable_language(RC)
210
211 # Localization definitions
212 include(sdk/cmake/localization.cmake)
213 set(I18N_DEFS "")
214 # This will set I18N_DEFS for later use
215 set_i18n_language(${I18N_LANG})
216
217 # Compiler specific definitions and macros
218 if(MSVC)
219 include(sdk/cmake/msvc.cmake)
220 else()
221 include(sdk/cmake/gcc.cmake)
222 endif()
223
224 # Generic macros
225 include(sdk/cmake/CMakeMacros.cmake)
226
227 # IDL macros for widl/midl
228 # We're using widl now for both MSVC and GCC builds
229 include(sdk/cmake/widl-support.cmake)
230
231 include_directories(
232 sdk/include
233 sdk/include/psdk
234 sdk/include/dxsdk
235 ${REACTOS_BINARY_DIR}/sdk/include
236 ${REACTOS_BINARY_DIR}/sdk/include/psdk
237 ${REACTOS_BINARY_DIR}/sdk/include/dxsdk
238 ${REACTOS_BINARY_DIR}/sdk/include/ddk
239 ${REACTOS_BINARY_DIR}/sdk/include/reactos
240 ${REACTOS_BINARY_DIR}/sdk/include/reactos/mc
241 sdk/include/crt
242 sdk/include/ddk
243 sdk/include/ndk
244 sdk/include/reactos
245 sdk/include/reactos/libs)
246
247 if(ARCH STREQUAL "arm")
248 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/arm)
249 endif()
250
251 add_dependency_header()
252
253 add_subdirectory(sdk/include/ndk/tests)
254 add_subdirectory(sdk/include/xdk)
255 add_subdirectory(sdk/include/psdk)
256 add_subdirectory(sdk/include/dxsdk)
257 add_subdirectory(sdk/include/reactos/wine)
258 add_subdirectory(sdk/include/reactos/mc)
259 add_subdirectory(sdk/include/asm)
260
261 if(NO_ROSSYM)
262 include(sdk/cmake/baseaddress_dwarf.cmake)
263 elseif(MSVC)
264 include(sdk/cmake/baseaddress_msvc.cmake)
265 else()
266 include(sdk/cmake/baseaddress.cmake)
267 endif()
268
269 # For MSVC builds, this puts all debug symbols file in the same directory.
270 set(CMAKE_PDB_OUTPUT_DIRECTORY "${REACTOS_BINARY_DIR}/msvc_pdb")
271
272 #begin with boot so reactos_cab target is defined before all other modules
273 add_subdirectory(boot)
274 add_subdirectory(base)
275 add_subdirectory(dll)
276 add_subdirectory(drivers)
277 add_subdirectory(hal)
278 add_subdirectory(sdk/lib)
279 add_subdirectory(media)
280 add_subdirectory(modules)
281 add_subdirectory(ntoskrnl)
282 add_subdirectory(subsystems)
283 add_subdirectory(sdk/tools/wpp)
284 add_subdirectory(win32ss)
285
286 # Create the registry hives
287 create_registry_hives()
288
289 # Create {bootcd, livecd, bootcdregtest}.lst
290 create_iso_lists()
291
292 file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/sdk/include/reactos)
293
294 add_dependency_footer()
295 endif()