2011-05-16 13:12:07 +00:00
|
|
|
|
2018-03-30 11:33:53 +00:00
|
|
|
cmake_minimum_required(VERSION 3.2.1)
|
|
|
|
cmake_policy(VERSION 3.2.1)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2018-05-11 03:57:10 +00: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()
|
|
|
|
|
2016-11-13 09:57:30 +00:00
|
|
|
if(POLICY CMP0058)
|
|
|
|
# Ninja requires custom command byproducts to be explicit
|
|
|
|
cmake_policy(SET CMP0058 OLD)
|
|
|
|
endif()
|
|
|
|
|
2019-02-03 11:57:20 +00:00
|
|
|
if(POLICY CMP0065)
|
|
|
|
# Do not add flags to export symbols from executables without the ENABLE_EXPORTS target property
|
|
|
|
cmake_policy(SET CMP0065 NEW)
|
|
|
|
endif()
|
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
project(REACTOS)
|
|
|
|
|
2011-06-13 10:36:40 +00:00
|
|
|
# Versioning
|
2016-04-20 12:36:25 +00:00
|
|
|
include(sdk/include/reactos/version.cmake)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
2019-03-20 13:19:48 +00:00
|
|
|
set(CMAKE_SHARED_MODULE_PREFIX "")
|
2011-05-16 13:12:07 +00:00
|
|
|
set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
|
|
|
|
set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
|
|
|
|
set(CMAKE_COLOR_MAKEFILE OFF)
|
2019-04-27 09:33:37 +00:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
|
2011-05-16 13:12:07 +00:00
|
|
|
#set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
|
|
|
|
|
|
|
if(NOT ARCH)
|
|
|
|
set(ARCH i386)
|
|
|
|
endif()
|
2012-08-27 18:58:27 +00: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 13:12:07 +00:00
|
|
|
string(TOLOWER ${ARCH} ARCH)
|
|
|
|
|
|
|
|
# Compile options
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/config.cmake)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/config-amd64.cmake)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/config-arm.cmake)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-13 10:36:40 +00:00
|
|
|
# Compiler flags handling
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/compilerflags.cmake)
|
2011-06-13 10:36:40 +00:00
|
|
|
|
2012-08-23 11:30:26 +00:00
|
|
|
add_definitions(-D__REACTOS__)
|
2018-12-09 16:51:50 +00:00
|
|
|
|
|
|
|
# Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
|
2019-04-27 09:33:37 +00:00
|
|
|
add_definitions(-DREACTOS_SOURCE_DIR="${REACTOS_SOURCE_DIR}")
|
|
|
|
add_definitions(-DREACTOS_BINARY_DIR="${REACTOS_BINARY_DIR}")
|
2018-12-09 16:51:50 +00:00
|
|
|
|
|
|
|
# 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 13:12:07 +00:00
|
|
|
|
2015-05-12 11:38:32 +00:00
|
|
|
if(MSVC_IDE)
|
|
|
|
add_compile_flags("/MP")
|
|
|
|
endif()
|
|
|
|
|
2015-08-27 23:00:49 +00:00
|
|
|
# Bison and Flex support
|
2016-05-20 16:06:48 +00:00
|
|
|
# include(sdk/cmake/bison-flex.cmake)
|
2015-08-27 23:00:49 +00:00
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
2018-10-01 11:07:44 +00:00
|
|
|
set(TOOLS_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
|
2011-05-16 13:12:07 +00:00
|
|
|
add_definitions(-DTARGET_${ARCH})
|
|
|
|
|
|
|
|
if(MSVC)
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2019-01-29 12:18:09 +00:00
|
|
|
add_definitions(/D_X86_ /D__i386__ /DWIN32 /D_WINDOWS)
|
2019-02-01 17:08:26 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
|
|
|
add_definitions(-D_AMD64_ -D__x86_64__ /DWIN32 -D_WINDOWS)
|
2011-06-22 11:31:01 +00:00
|
|
|
endif()
|
2014-05-19 20:28:35 +00:00
|
|
|
if(MSVC_VERSION GREATER 1699)
|
2014-05-18 14:39:03 +00:00
|
|
|
add_definitions(/D_ALLOW_KEYWORD_MACROS)
|
|
|
|
endif()
|
2017-10-27 21:18:01 +00:00
|
|
|
if(NOT USE_CLANG_CL)
|
|
|
|
# FIXME: Inspect
|
|
|
|
add_definitions(/Dinline=__inline)
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
2019-11-15 13:07:46 +00:00
|
|
|
add_subdirectory(sdk/include/host)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2013-07-20 11:07:30 +00:00
|
|
|
if(NOT MSVC)
|
|
|
|
add_subdirectory(dll/win32/dbghelp)
|
|
|
|
endif()
|
2016-04-20 12:36:25 +00:00
|
|
|
add_subdirectory(sdk/tools)
|
|
|
|
add_subdirectory(sdk/lib)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2018-10-01 11:07:44 +00:00
|
|
|
set(NATIVE_TARGETS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink utf16le xml2sdb)
|
|
|
|
if(NOT MSVC)
|
|
|
|
list(APPEND NATIVE_TARGETS rsym)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2018-10-01 11:07:44 +00:00
|
|
|
export(TARGETS ${NATIVE_TARGETS} FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
|
|
|
configure_file(sdk/cmake/host-tools.in ${CMAKE_BINARY_DIR}/TargetList.cmake)
|
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
else()
|
2018-10-01 11:07:44 +00:00
|
|
|
# Add host tools target
|
|
|
|
include(sdk/cmake/host-tools.cmake)
|
|
|
|
setup_host_tools()
|
|
|
|
|
2018-05-25 10:59:47 +00:00
|
|
|
# We don't need CMake importlib handling.
|
|
|
|
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2015-10-30 09:55:58 +00:00
|
|
|
# Print build type
|
|
|
|
message("-- Build Type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
|
2011-05-16 13:12:07 +00: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-07 23:22:38 +00:00
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
#useful stuff!
|
|
|
|
include(CMakeParseArguments)
|
2012-03-29 14:45:46 +00:00
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
if(DBG)
|
|
|
|
add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
|
2012-03-08 09:20:31 +00:00
|
|
|
else()
|
2012-03-08 09:18:28 +00:00
|
|
|
add_definitions(-DDBG=0)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(KDBG)
|
2019-08-17 16:20:51 +00:00
|
|
|
add_definitions(-DKDBG)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_WINKD_)
|
2019-08-17 16:20:51 +00:00
|
|
|
add_definitions(-D_WINKD_)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2015-08-28 09:24:39 +00:00
|
|
|
if(CMAKE_VERSION MATCHES "ReactOS")
|
2014-08-04 11:05:09 +00:00
|
|
|
set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
|
2014-02-13 21:42:05 +00:00
|
|
|
else()
|
2014-08-04 11:05:09 +00:00
|
|
|
set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
|
2014-02-13 21:42:05 +00:00
|
|
|
endif()
|
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
# Version Options
|
|
|
|
add_definitions(-DWINVER=0x502
|
|
|
|
-D_WIN32_IE=0x600
|
|
|
|
-D_WIN32_WINNT=0x502
|
|
|
|
-D_WIN32_WINDOWS=0x502
|
2019-04-29 07:56:29 +00:00
|
|
|
-D_SETUPAPI_VER=0x502
|
|
|
|
-DMINGW_HAS_SECURE_API=1)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
|
|
|
# Arch Options
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2017-10-27 21:18:01 +00:00
|
|
|
if(NOT USE_CLANG_CL)
|
|
|
|
add_definitions(-D_M_IX86)
|
|
|
|
endif()
|
|
|
|
add_definitions(-D_X86_ -D__i386__ -Di386)
|
2020-01-14 21:15:18 +00:00
|
|
|
if(SARCH STREQUAL "xbox")
|
|
|
|
add_definitions(-DSARCH_XBOX)
|
|
|
|
endif()
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-05-16 13:12:07 +00:00
|
|
|
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2011-05-16 13:12:07 +00:00
|
|
|
# _M_ARM is already defined by toolchain
|
2015-05-14 22:30:56 +00:00
|
|
|
add_definitions(-D_ARM_ -D__arm__ -DWIN32)
|
2015-04-11 14:03:19 +00:00
|
|
|
if(SARCH STREQUAL "omap-zoom2")
|
|
|
|
add_definitions(-D_ZOOM2_)
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Other
|
2019-05-25 10:22:04 +00:00
|
|
|
add_definitions(-D_NEW_DELETE_OPERATORS_)
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2011-05-16 13:12:07 +00:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-05-16 13:12:07 +00:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2015-04-11 14:03:19 +00:00
|
|
|
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
2012-03-29 14:45:46 +00:00
|
|
|
|
2011-09-03 23:05:09 +00:00
|
|
|
# Activate support for assembly source files
|
|
|
|
enable_language(ASM)
|
|
|
|
|
|
|
|
# Activate language support for resource files
|
|
|
|
enable_language(RC)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-02-27 22:46:20 +00:00
|
|
|
# Localization definitions
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/localization.cmake)
|
2012-02-27 22:46:20 +00:00
|
|
|
set(I18N_DEFS "")
|
|
|
|
# This will set I18N_DEFS for later use
|
|
|
|
set_i18n_language(${I18N_LANG})
|
|
|
|
|
2011-06-11 16:09:57 +00:00
|
|
|
# Compiler specific definitions and macros
|
|
|
|
if(MSVC)
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/msvc.cmake)
|
2011-06-11 16:09:57 +00:00
|
|
|
else()
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/gcc.cmake)
|
2011-06-11 16:09:57 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Generic macros
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/CMakeMacros.cmake)
|
2011-06-11 16:09:57 +00:00
|
|
|
|
|
|
|
# IDL macros for widl/midl
|
2012-08-01 23:25:06 +00:00
|
|
|
# We're using widl now for both MSVC and GCC builds
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/widl-support.cmake)
|
2011-06-11 16:09:57 +00:00
|
|
|
|
2013-07-14 21:00:42 +00:00
|
|
|
include_directories(
|
2016-04-20 12:36:25 +00: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-28 23:20:20 +00:00
|
|
|
${REACTOS_BINARY_DIR}/sdk/include/reactos/mc
|
2016-04-20 12:36:25 +00:00
|
|
|
sdk/include/crt
|
|
|
|
sdk/include/ddk
|
|
|
|
sdk/include/ndk
|
|
|
|
sdk/include/reactos
|
|
|
|
sdk/include/reactos/libs)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "arm")
|
2016-04-20 12:36:25 +00:00
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/arm)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_dependency_header()
|
|
|
|
|
2017-08-16 06:41:41 +00:00
|
|
|
add_subdirectory(sdk/include/ndk/tests)
|
2016-04-20 12:36:25 +00: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 13:12:07 +00:00
|
|
|
|
2014-10-11 13:36:08 +00:00
|
|
|
if(NO_ROSSYM)
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/baseaddress_dwarf.cmake)
|
2015-08-27 22:35:06 +00:00
|
|
|
elseif(MSVC)
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/baseaddress_msvc.cmake)
|
2014-10-11 13:36:08 +00:00
|
|
|
else()
|
2016-05-20 16:06:48 +00:00
|
|
|
include(sdk/cmake/baseaddress.cmake)
|
2014-10-11 13:36:08 +00:00
|
|
|
endif()
|
2013-07-14 21:00:42 +00:00
|
|
|
|
2013-06-05 17:57:13 +00: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 13:12:07 +00: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 12:36:25 +00:00
|
|
|
add_subdirectory(sdk/lib)
|
2011-05-16 13:12:07 +00:00
|
|
|
add_subdirectory(media)
|
|
|
|
add_subdirectory(modules)
|
|
|
|
add_subdirectory(ntoskrnl)
|
|
|
|
add_subdirectory(subsystems)
|
2016-04-20 12:36:25 +00:00
|
|
|
add_subdirectory(sdk/tools/wpp)
|
2012-04-01 17:27:38 +00:00
|
|
|
add_subdirectory(win32ss)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2015-03-29 11:38:05 +00:00
|
|
|
# Create the registry hives
|
|
|
|
create_registry_hives()
|
|
|
|
|
2013-07-21 13:33:03 +00:00
|
|
|
# Create {bootcd, livecd, bootcdregtest}.lst
|
|
|
|
create_iso_lists()
|
|
|
|
|
2016-04-20 12:36:25 +00:00
|
|
|
file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/sdk/include/reactos)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
|
|
|
add_dependency_footer()
|
|
|
|
endif()
|