[EXPLORER_NEW]
[reactos.git] / CMakeLists.txt
index 6ffb68e..152d0c0 100644 (file)
@@ -1,11 +1,16 @@
 
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8.12)
 
 if(POLICY CMP0017)
     # Shadow cmake provided modules
     cmake_policy(SET CMP0017 OLD)
 endif()
 
+if(POLICY CMP0026)
+    # Allow use of the LOCATION property
+    cmake_policy(SET CMP0026 OLD)
+endif()
+
 project(REACTOS)
 
 # Versioning
@@ -25,6 +30,11 @@ set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
 set(CMAKE_COLOR_MAKEFILE OFF)
 #set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
+set(CMAKE_SKIP_INSTALL_RULES ON)
+
+if(NOT CMAKE_VERSION STREQUAL "2.8.12.1-ReactOS")
+    set(CMAKE_DISABLE_NINJA_DEPSLOG TRUE)
+endif()
 
 if(NOT ARCH)
     set(ARCH i386)
@@ -58,6 +68,9 @@ if(NOT CMAKE_CROSSCOMPILING)
         if(ARCH STREQUAL "i386")
             add_definitions(/D_X86_ /DWIN32 /D_WINDOWS)
         endif()
+        if(MSVC_VERSION GREATER 1699)
+            add_definitions(/D_ALLOW_KEYWORD_MACROS)
+        endif()
         add_definitions(/Dinline=__inline)
     else()
         add_compile_flags("-fshort-wchar -Wno-multichar")
@@ -65,13 +78,16 @@ if(NOT CMAKE_CROSSCOMPILING)
 
     include_directories(include/host)
 
+    if(NOT MSVC)
+        add_subdirectory(dll/win32/dbghelp)
+    endif()
     add_subdirectory(tools)
     add_subdirectory(lib)
 
     if(NOT MSVC)
-        export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+        export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
     else()
-        export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+        export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
     endif()
 
 else()
@@ -92,7 +108,7 @@ else()
     endif()
 
     # Default to Debug for the build type
-    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING 
+    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
 
     # Do some cleanup
@@ -126,8 +142,10 @@ else()
         add_definitions(-D_WINKD_=1)
     endif()
 
-    if(USE_PSEH3)
-        add_definitions(-D_USE_PSEH3=1)
+    if(CMAKE_VERSION STREQUAL "2.8.12.1-ReactOS")
+        set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
+    else()
+        set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
     endif()
 
     # Version Options
@@ -139,7 +157,7 @@ else()
 
     # Arch Options
     if(ARCH STREQUAL "i386")
-        add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
+        add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
     elseif(ARCH STREQUAL "amd64")
         add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
     elseif(ARCH STREQUAL "arm")
@@ -182,47 +200,24 @@ else()
     # We're using widl now for both MSVC and GCC builds
     include(cmake/widl-support.cmake)
 
-    if(MSVC AND USE_WDK_HEADERS)
-        include_directories(
-            include
-            $ENV{SDK_INC_PATH}
-            include/dxsdk
-            ${REACTOS_BINARY_DIR}/include
-            ${REACTOS_BINARY_DIR}/include/dxsdk
-            ${REACTOS_BINARY_DIR}/include/psdk
-            ${REACTOS_BINARY_DIR}/include/reactos
-            $ENV{CRT_INC_PATH}
-            $ENV{DDK_INC_PATH}
-            include/ndk
-            include/reactos
-            include/reactos/libs)
-    else()
-        include_directories(
-            include
-            include/psdk
-            include/dxsdk
-            ${REACTOS_BINARY_DIR}/include
-            ${REACTOS_BINARY_DIR}/include/dxsdk
-            ${REACTOS_BINARY_DIR}/include/psdk
-            ${REACTOS_BINARY_DIR}/include/reactos
-            include/crt
-            include/ddk
-            include/ndk
-            include/reactos
-            include/reactos/libs)
-    endif()
-
+    include_directories(
+        include
+        include/psdk
+        include/dxsdk
+        ${REACTOS_BINARY_DIR}/include
+        ${REACTOS_BINARY_DIR}/include/psdk
+        ${REACTOS_BINARY_DIR}/include/dxsdk
+        ${REACTOS_BINARY_DIR}/include/reactos
+        include/crt
+        include/ddk
+        include/ndk
+        include/reactos
+        include/reactos/libs)
 
     if(ARCH STREQUAL "arm")
         include_directories(${REACTOS_SOURCE_DIR}/include/reactos/arm)
     endif()
 
-    if(MSVC)
-        include_directories(include/crt/msc)
-    else()
-        include_directories(include/crt/mingw32)
-    endif()
-
     add_dependency_header()
 
     add_subdirectory(include/psdk)
@@ -231,7 +226,14 @@ else()
     add_subdirectory(include/reactos/mc)
     add_subdirectory(include/asm)
 
-    include(cmake/baseaddress.cmake)
+    if(NO_ROSSYM)
+        include(cmake/baseaddress_dwarf.cmake)
+    else()
+        include(cmake/baseaddress.cmake)
+    endif()
+
+    # For MSVC builds, this puts all debug symbols file in the same directory.
+    set(CMAKE_PDB_OUTPUT_DIRECTORY "${REACTOS_BINARY_DIR}/msvc_pdb")
 
     #begin with boot so reactos_cab target is defined before all other modules
     add_subdirectory(boot)
@@ -244,8 +246,12 @@ else()
     add_subdirectory(modules)
     add_subdirectory(ntoskrnl)
     add_subdirectory(subsystems)
+    add_subdirectory(tools/wpp)
     add_subdirectory(win32ss)
 
+    # Create {bootcd, livecd, bootcdregtest}.lst
+    create_iso_lists()
+
     file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
 
     add_dependency_footer()