2011-05-16 21:12:07 +08:00
|
|
|
|
2018-03-30 19:33:53 +08:00
|
|
|
cmake_minimum_required(VERSION 3.2.1)
|
|
|
|
cmake_policy(VERSION 3.2.1)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2018-05-11 11:57:10 +08:00
|
|
|
if(NOT CMAKE_VERSION MATCHES "ReactOS")
|
|
|
|
message(WARNING "Building with \"${CMAKE_COMMAND}\", which is not the custom CMake included in RosBE, might cause build issues...")
|
|
|
|
endif()
|
|
|
|
|
2018-03-30 19:33:53 +08:00
|
|
|
# Don't escape preprocessor definition values added via add_definitions
|
|
|
|
cmake_policy(SET CMP0005 OLD)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2018-03-30 19:33:53 +08:00
|
|
|
# Honor CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
|
|
|
|
cmake_policy(SET CMP0018 OLD)
|
2015-08-09 17:50:46 +08:00
|
|
|
|
2016-11-13 17:57:30 +08:00
|
|
|
if(POLICY CMP0058)
|
|
|
|
# Ninja requires custom command byproducts to be explicit
|
|
|
|
cmake_policy(SET CMP0058 OLD)
|
|
|
|
endif()
|
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
project(REACTOS)
|
|
|
|
|
2011-06-13 18:36:40 +08:00
|
|
|
# Versioning
|
2016-04-20 20:36:25 +08:00
|
|
|
include(sdk/include/reactos/version.cmake)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
|
|
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)
|
|
|
|
|
2015-09-07 00:44:30 +08:00
|
|
|
if(NOT DEFINED NEW_STYLE_BUILD)
|
2015-10-18 19:29:34 +08:00
|
|
|
set(NEW_STYLE_BUILD TRUE)
|
2015-09-07 00:44:30 +08:00
|
|
|
endif()
|
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
if(NOT ARCH)
|
|
|
|
set(ARCH i386)
|
|
|
|
endif()
|
2012-08-28 02:58:27 +08:00
|
|
|
# Now the ARCH variable will be in lowercase.
|
|
|
|
# It is needed because STREQUAL comparison
|
|
|
|
# is case-sensitive.
|
|
|
|
# See http://cmake.3232098.n2.nabble.com/Case-insensitive-string-compare-td7580269.html
|
|
|
|
# for more information.
|
2011-05-16 21:12:07 +08:00
|
|
|
string(TOLOWER ${ARCH} ARCH)
|
|
|
|
|
|
|
|
# Compile options
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "i386")
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/config.cmake)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/config-amd64.cmake)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/config-arm.cmake)
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
2011-06-13 18:36:40 +08:00
|
|
|
# Compiler flags handling
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/compilerflags.cmake)
|
2011-06-13 18:36:40 +08:00
|
|
|
|
2012-08-23 19:30:26 +08:00
|
|
|
add_definitions(-D__REACTOS__)
|
2018-12-10 00:51:50 +08:00
|
|
|
|
|
|
|
# Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
|
|
|
|
add_definitions(-DREACTOS_SOURCE_DIR="\\\"${REACTOS_SOURCE_DIR}\\\"")
|
|
|
|
add_definitions(-DREACTOS_BINARY_DIR="\\\"${REACTOS_BINARY_DIR}\\\"")
|
|
|
|
|
|
|
|
# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
|
|
|
|
file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
|
|
|
|
add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]")
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2015-05-12 19:38:32 +08:00
|
|
|
if(MSVC_IDE)
|
|
|
|
add_compile_flags("/MP")
|
|
|
|
endif()
|
|
|
|
|
2015-08-28 07:00:49 +08:00
|
|
|
# Bison and Flex support
|
2016-05-21 00:06:48 +08:00
|
|
|
# include(sdk/cmake/bison-flex.cmake)
|
2015-08-28 07:00:49 +08:00
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
|
2015-09-07 00:44:30 +08:00
|
|
|
if(NEW_STYLE_BUILD)
|
|
|
|
set(TOOLS_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
add_definitions(-DTARGET_${ARCH})
|
|
|
|
|
|
|
|
if(MSVC)
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "i386")
|
2012-06-24 00:09:11 +08:00
|
|
|
add_definitions(/D_X86_ /DWIN32 /D_WINDOWS)
|
2011-06-22 19:31:01 +08:00
|
|
|
endif()
|
2014-05-20 04:28:35 +08:00
|
|
|
if(MSVC_VERSION GREATER 1699)
|
2014-05-18 22:39:03 +08:00
|
|
|
add_definitions(/D_ALLOW_KEYWORD_MACROS)
|
|
|
|
endif()
|
2017-10-28 05:18:01 +08:00
|
|
|
if(NOT USE_CLANG_CL)
|
|
|
|
# FIXME: Inspect
|
|
|
|
add_definitions(/Dinline=__inline)
|
|
|
|
endif()
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
2016-04-20 20:36:25 +08:00
|
|
|
include_directories(sdk/include/host)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2013-07-20 19:07:30 +08:00
|
|
|
if(NOT MSVC)
|
|
|
|
add_subdirectory(dll/win32/dbghelp)
|
|
|
|
endif()
|
2016-04-20 20:36:25 +08:00
|
|
|
add_subdirectory(sdk/tools)
|
|
|
|
add_subdirectory(sdk/lib)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2015-09-07 00:44:30 +08:00
|
|
|
if(NOT NEW_STYLE_BUILD)
|
|
|
|
if(NOT MSVC)
|
2017-01-25 06:53:20 +08:00
|
|
|
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- )
|
2015-09-07 00:44:30 +08:00
|
|
|
else()
|
2017-01-25 06:53:20 +08:00
|
|
|
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- )
|
2015-09-07 00:44:30 +08:00
|
|
|
endif()
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
else()
|
2018-05-25 18:59:47 +08:00
|
|
|
# We don't need CMake importlib handling.
|
|
|
|
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2015-09-07 00:44:30 +08:00
|
|
|
if(NEW_STYLE_BUILD)
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/host-tools.cmake)
|
2015-09-07 00:44:30 +08:00
|
|
|
endif()
|
|
|
|
|
2015-10-30 17:55:58 +08:00
|
|
|
# Print build type
|
|
|
|
message("-- Build Type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
# adjust the default behaviour of the FIND_XXX() commands:
|
|
|
|
# search headers and libraries in the target environment, search
|
|
|
|
# programs in the host environment
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
2011-06-08 07:22:38 +08:00
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
#useful stuff!
|
|
|
|
include(CMakeParseArguments)
|
2012-03-29 22:45:46 +08:00
|
|
|
|
2015-09-07 00:44:30 +08:00
|
|
|
if(NOT NEW_STYLE_BUILD)
|
|
|
|
if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
|
|
|
|
set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
|
|
|
|
endif()
|
|
|
|
set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
|
|
|
|
include(${IMPORT_EXECUTABLES})
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(DBG)
|
|
|
|
add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
|
2012-03-08 17:20:31 +08:00
|
|
|
else()
|
2012-03-08 17:18:28 +08:00
|
|
|
add_definitions(-DDBG=0)
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(KDBG)
|
|
|
|
add_definitions(-DKDBG=1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_WINKD_)
|
|
|
|
add_definitions(-D_WINKD_=1)
|
|
|
|
endif()
|
|
|
|
|
2015-08-28 17:24:39 +08:00
|
|
|
if(CMAKE_VERSION MATCHES "ReactOS")
|
2014-08-04 19:05:09 +08:00
|
|
|
set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
|
2014-02-14 05:42:05 +08:00
|
|
|
else()
|
2014-08-04 19:05:09 +08:00
|
|
|
set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
|
2014-02-14 05:42:05 +08:00
|
|
|
endif()
|
|
|
|
|
2011-05-16 21:12:07 +08:00
|
|
|
# Version Options
|
|
|
|
add_definitions(-DWINVER=0x502
|
|
|
|
-D_WIN32_IE=0x600
|
|
|
|
-D_WIN32_WINNT=0x502
|
|
|
|
-D_WIN32_WINDOWS=0x502
|
|
|
|
-D_SETUPAPI_VER=0x502)
|
|
|
|
|
|
|
|
# Arch Options
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "i386")
|
2017-10-28 05:18:01 +08:00
|
|
|
if(NOT USE_CLANG_CL)
|
|
|
|
add_definitions(-D_M_IX86)
|
|
|
|
endif()
|
|
|
|
add_definitions(-D_X86_ -D__i386__ -Di386)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-05-16 21:12:07 +08:00
|
|
|
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2011-05-16 21:12:07 +08:00
|
|
|
# _M_ARM is already defined by toolchain
|
2015-05-15 06:30:56 +08:00
|
|
|
add_definitions(-D_ARM_ -D__arm__ -DWIN32)
|
2015-04-11 22:03:19 +08:00
|
|
|
if(SARCH STREQUAL "omap-zoom2")
|
|
|
|
add_definitions(-D_ZOOM2_)
|
|
|
|
endif()
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Other
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "i386")
|
2011-05-16 21:12:07 +08:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-05-16 21:12:07 +08:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2015-04-11 22:03:19 +08:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
2012-03-29 22:45:46 +08:00
|
|
|
|
2011-09-04 07:05:09 +08:00
|
|
|
# Activate support for assembly source files
|
|
|
|
enable_language(ASM)
|
|
|
|
|
|
|
|
# Activate language support for resource files
|
|
|
|
enable_language(RC)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2012-02-28 06:46:20 +08:00
|
|
|
# Localization definitions
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/localization.cmake)
|
2012-02-28 06:46:20 +08:00
|
|
|
set(I18N_DEFS "")
|
|
|
|
# This will set I18N_DEFS for later use
|
|
|
|
set_i18n_language(${I18N_LANG})
|
|
|
|
|
2011-06-12 00:09:57 +08:00
|
|
|
# Compiler specific definitions and macros
|
|
|
|
if(MSVC)
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/msvc.cmake)
|
2011-06-12 00:09:57 +08:00
|
|
|
else()
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/gcc.cmake)
|
2011-06-12 00:09:57 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Generic macros
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/CMakeMacros.cmake)
|
2011-06-12 00:09:57 +08:00
|
|
|
|
|
|
|
# IDL macros for widl/midl
|
2012-08-02 07:25:06 +08:00
|
|
|
# We're using widl now for both MSVC and GCC builds
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/widl-support.cmake)
|
2011-06-12 00:09:57 +08:00
|
|
|
|
2013-07-15 05:00:42 +08:00
|
|
|
include_directories(
|
2016-04-20 20:36:25 +08:00
|
|
|
sdk/include
|
|
|
|
sdk/include/psdk
|
|
|
|
sdk/include/dxsdk
|
|
|
|
${REACTOS_BINARY_DIR}/sdk/include
|
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/psdk
|
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/dxsdk
|
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/ddk
|
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/reactos
|
2016-09-29 07:20:20 +08:00
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/reactos/mc
|
2016-04-20 20:36:25 +08:00
|
|
|
sdk/include/crt
|
|
|
|
sdk/include/ddk
|
|
|
|
sdk/include/ndk
|
|
|
|
sdk/include/reactos
|
|
|
|
sdk/include/reactos/libs)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "arm")
|
2016-04-20 20:36:25 +08:00
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/arm)
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_dependency_header()
|
|
|
|
|
2017-08-16 14:41:41 +08:00
|
|
|
add_subdirectory(sdk/include/ndk/tests)
|
2016-04-20 20:36:25 +08:00
|
|
|
add_subdirectory(sdk/include/xdk)
|
|
|
|
add_subdirectory(sdk/include/psdk)
|
|
|
|
add_subdirectory(sdk/include/dxsdk)
|
|
|
|
add_subdirectory(sdk/include/reactos/wine)
|
|
|
|
add_subdirectory(sdk/include/reactos/mc)
|
|
|
|
add_subdirectory(sdk/include/asm)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2014-10-11 21:36:08 +08:00
|
|
|
if(NO_ROSSYM)
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/baseaddress_dwarf.cmake)
|
2015-08-28 06:35:06 +08:00
|
|
|
elseif(MSVC)
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/baseaddress_msvc.cmake)
|
2014-10-11 21:36:08 +08:00
|
|
|
else()
|
2016-05-21 00:06:48 +08:00
|
|
|
include(sdk/cmake/baseaddress.cmake)
|
2014-10-11 21:36:08 +08:00
|
|
|
endif()
|
2013-07-15 05:00:42 +08:00
|
|
|
|
2013-06-06 01:57:13 +08:00
|
|
|
# For MSVC builds, this puts all debug symbols file in the same directory.
|
|
|
|
set(CMAKE_PDB_OUTPUT_DIRECTORY "${REACTOS_BINARY_DIR}/msvc_pdb")
|
2011-05-16 21:12:07 +08:00
|
|
|
|
|
|
|
#begin with boot so reactos_cab target is defined before all other modules
|
|
|
|
add_subdirectory(boot)
|
|
|
|
add_subdirectory(base)
|
|
|
|
add_subdirectory(dll)
|
|
|
|
add_subdirectory(drivers)
|
|
|
|
add_subdirectory(hal)
|
2016-04-20 20:36:25 +08:00
|
|
|
add_subdirectory(sdk/lib)
|
2011-05-16 21:12:07 +08:00
|
|
|
add_subdirectory(media)
|
|
|
|
add_subdirectory(modules)
|
|
|
|
add_subdirectory(ntoskrnl)
|
|
|
|
add_subdirectory(subsystems)
|
2016-04-20 20:36:25 +08:00
|
|
|
add_subdirectory(sdk/tools/wpp)
|
2012-04-02 01:27:38 +08:00
|
|
|
add_subdirectory(win32ss)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2015-03-29 19:38:05 +08:00
|
|
|
# Create the registry hives
|
|
|
|
create_registry_hives()
|
|
|
|
|
2013-07-21 21:33:03 +08:00
|
|
|
# Create {bootcd, livecd, bootcdregtest}.lst
|
|
|
|
create_iso_lists()
|
|
|
|
|
2016-04-20 20:36:25 +08:00
|
|
|
file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/sdk/include/reactos)
|
2011-05-16 21:12:07 +08:00
|
|
|
|
|
|
|
add_dependency_footer()
|
|
|
|
endif()
|