- Add all publicly available information about the spoolsv RPC interface of Windows...
[reactos.git] / reactos / 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 project(REACTOS)
15
16 # Versioning
17 include(include/reactos/version.cmake)
18
19 # Don't escape preprocessor definition values added via add_definitions
20 cmake_policy(SET CMP0005 OLD)
21 cmake_policy(SET CMP0002 NEW)
22 if(POLICY CMP0018)
23 cmake_policy(SET CMP0018 OLD)
24 endif()
25
26 set(CMAKE_INCLUDE_CURRENT_DIR ON)
27 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
28 set(CMAKE_SHARED_LIBRARY_PREFIX "")
29 set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
30 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
31 set(CMAKE_COLOR_MAKEFILE OFF)
32 #set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
33 set(CMAKE_SKIP_INSTALL_RULES ON)
34
35 if(NOT CMAKE_VERSION STREQUAL "2.8.12.1-ReactOS")
36 set(CMAKE_DISABLE_NINJA_DEPSLOG TRUE)
37 endif()
38
39 if(NOT ARCH)
40 set(ARCH i386)
41 endif()
42 # Now the ARCH variable will be in lowercase.
43 # It is needed because STREQUAL comparison
44 # is case-sensitive.
45 # See http://cmake.3232098.n2.nabble.com/Case-insensitive-string-compare-td7580269.html
46 # for more information.
47 string(TOLOWER ${ARCH} ARCH)
48
49 # Compile options
50 if(ARCH STREQUAL "i386")
51 include(cmake/config.cmake)
52 elseif(ARCH STREQUAL "amd64")
53 include(cmake/config-amd64.cmake)
54 elseif(ARCH STREQUAL "arm")
55 include(cmake/config-arm.cmake)
56 endif()
57
58 # Compiler flags handling
59 include(cmake/compilerflags.cmake)
60
61 add_definitions(-D__REACTOS__)
62
63 if(NOT CMAKE_CROSSCOMPILING)
64
65 add_definitions(-DTARGET_${ARCH})
66
67 if(MSVC)
68 if(ARCH STREQUAL "i386")
69 add_definitions(/D_X86_ /DWIN32 /D_WINDOWS)
70 endif()
71 if(MSVC_VERSION GREATER 1699)
72 add_definitions(/D_ALLOW_KEYWORD_MACROS)
73 endif()
74 add_definitions(/Dinline=__inline)
75 else()
76 add_compile_flags("-fshort-wchar -Wno-multichar")
77 endif()
78
79 include_directories(include/host)
80
81 if(NOT MSVC)
82 add_subdirectory(dll/win32/dbghelp)
83 endif()
84 add_subdirectory(tools)
85 add_subdirectory(lib)
86
87 if(NOT MSVC)
88 export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
89 else()
90 export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
91 endif()
92
93 else()
94
95 # adjust the default behaviour of the FIND_XXX() commands:
96 # search headers and libraries in the target environment, search
97 # programs in the host environment
98 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
99 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
100 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
101
102 #useful stuff!
103 include(CMakeParseArguments)
104
105 # Default to Debug for the build type
106 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
107 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
108
109 # Do some cleanup
110 file(REMOVE
111 ${REACTOS_BINARY_DIR}/dependencies.graphml
112 ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
113 ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
114 ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
115 ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
116 ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
117 ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
118
119 if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
120 set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
121 endif()
122
123 set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
124 include(${IMPORT_EXECUTABLES})
125
126 if(DBG)
127 add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
128 else()
129 add_definitions(-DDBG=0)
130 endif()
131
132 if(KDBG)
133 add_definitions(-DKDBG=1)
134 endif()
135
136 if(_WINKD_)
137 add_definitions(-D_WINKD_=1)
138 endif()
139
140 if(CMAKE_VERSION MATCHES "ReactOS" AND MSVC_VERSION LESS 1900)
141 set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
142 else()
143 set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
144 endif()
145
146 # Version Options
147 add_definitions(-DWINVER=0x502
148 -D_WIN32_IE=0x600
149 -D_WIN32_WINNT=0x502
150 -D_WIN32_WINDOWS=0x502
151 -D_SETUPAPI_VER=0x502)
152
153 # Arch Options
154 if(ARCH STREQUAL "i386")
155 add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
156 elseif(ARCH STREQUAL "amd64")
157 add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
158 elseif(ARCH STREQUAL "arm")
159 # _M_ARM is already defined by toolchain
160 add_definitions(-D_ARM_ -D__arm__)
161 if(SARCH STREQUAL "omap-zoom2")
162 add_definitions(-D_ZOOM2_)
163 endif()
164 endif()
165
166 # Other
167 if(ARCH STREQUAL "i386")
168 add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
169 elseif(ARCH STREQUAL "amd64")
170 add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
171 elseif(ARCH STREQUAL "arm")
172 add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
173 endif()
174
175 # Activate support for assembly source files
176 enable_language(ASM)
177
178 # Activate language support for resource files
179 enable_language(RC)
180
181 # Localization definitions
182 include(cmake/localization.cmake)
183 set(I18N_DEFS "")
184 # This will set I18N_DEFS for later use
185 set_i18n_language(${I18N_LANG})
186
187 # Compiler specific definitions and macros
188 if(MSVC)
189 include(cmake/msvc.cmake)
190 else()
191 include(cmake/gcc.cmake)
192 endif()
193
194 # Generic macros
195 include(cmake/CMakeMacros.cmake)
196
197 # IDL macros for widl/midl
198 # We're using widl now for both MSVC and GCC builds
199 include(cmake/widl-support.cmake)
200
201 include_directories(
202 include
203 include/psdk
204 include/dxsdk
205 ${REACTOS_BINARY_DIR}/include
206 ${REACTOS_BINARY_DIR}/include/psdk
207 ${REACTOS_BINARY_DIR}/include/dxsdk
208 ${REACTOS_BINARY_DIR}/include/reactos
209 include/crt
210 include/ddk
211 include/ndk
212 include/reactos
213 include/reactos/libs)
214
215 if(ARCH STREQUAL "arm")
216 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/arm)
217 endif()
218
219 add_dependency_header()
220
221 add_subdirectory(include/psdk)
222 add_subdirectory(include/dxsdk)
223 add_subdirectory(include/reactos/wine)
224 add_subdirectory(include/reactos/mc)
225 add_subdirectory(include/asm)
226
227 if(NO_ROSSYM)
228 include(cmake/baseaddress_dwarf.cmake)
229 else()
230 include(cmake/baseaddress.cmake)
231 endif()
232
233 # For MSVC builds, this puts all debug symbols file in the same directory.
234 set(CMAKE_PDB_OUTPUT_DIRECTORY "${REACTOS_BINARY_DIR}/msvc_pdb")
235
236 #begin with boot so reactos_cab target is defined before all other modules
237 add_subdirectory(boot)
238 add_subdirectory(base)
239 add_subdirectory(dll)
240 add_subdirectory(drivers)
241 add_subdirectory(hal)
242 add_subdirectory(lib)
243 add_subdirectory(media)
244 add_subdirectory(modules)
245 add_subdirectory(ntoskrnl)
246 add_subdirectory(subsystems)
247 add_subdirectory(temp)
248 add_subdirectory(tools/wpp)
249 add_subdirectory(win32ss)
250
251 # Create the registry hives
252 create_registry_hives()
253
254 # Create {bootcd, livecd, bootcdregtest}.lst
255 create_iso_lists()
256
257 file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
258
259 add_dependency_footer()
260 endif()