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