mirror of
https://github.com/reactos/reactos.git
synced 2024-08-03 01:50:57 +00:00
[CMAKE]
- Add support for gui configurable options - globalize compiler specific cmake files - Add compiler specific macros set_entrypoint, set_module_type svn path=/branches/cmake-bringup/; revision=48821
This commit is contained in:
parent
e00685d331
commit
aefbd32d48
|
@ -1,6 +1,17 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
project(REACTOS)
|
||||
|
||||
# Compile options
|
||||
include(config.cmake)
|
||||
|
||||
# Compiler specific definitions and macros
|
||||
if(MSVC)
|
||||
include(msc.cmake)
|
||||
else()
|
||||
include(gcc.cmake)
|
||||
endif(MSVC)
|
||||
|
||||
# Generic macros
|
||||
include(CMakeMacros.cmake)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
@ -15,7 +26,6 @@ add_definitions(-D__REACTOS__)
|
|||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
add_definitions(-DTARGET_i386)
|
||||
add_definitions(-fshort-wchar)
|
||||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/tools/unicode)
|
||||
include_directories(include)
|
||||
|
@ -27,16 +37,14 @@ include_directories(${REACTOS_BINARY_DIR}/include)
|
|||
add_subdirectory(tools)
|
||||
add_subdirectory(lib)
|
||||
|
||||
if(NOT MSVC)
|
||||
export(TARGETS widl winebuild nci buildno gendib cdmake FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
else()
|
||||
export(TARGETS winebuild nci buildno gendib cdmake FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
if(MSVC)
|
||||
include(msc.cmake)
|
||||
else()
|
||||
include(gcc.cmake)
|
||||
endif(MSVC)
|
||||
|
||||
# Activate support for assembly source files
|
||||
enable_language(ASM)
|
||||
|
||||
|
@ -46,11 +54,6 @@ enable_language(RC)
|
|||
set(IMPORT_EXECUTABLES "${REACTOS_SOURCE_DIR}/build/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
|
||||
include(${IMPORT_EXECUTABLES})
|
||||
|
||||
# Debug Options
|
||||
set(_WINKD_ 0)
|
||||
set(KDBG 1)
|
||||
set(DBG 1)
|
||||
|
||||
add_definitions(-DDBG=${DBG} -DKDBG=${KDBG})
|
||||
|
||||
if(DBG MATCHES 1)
|
||||
|
@ -161,3 +164,4 @@ add_custom_command(
|
|||
add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
|
||||
|
||||
endif()
|
||||
|
||||
|
|
60
config.cmake
Normal file
60
config.cmake
Normal file
|
@ -0,0 +1,60 @@
|
|||
|
||||
set(SARCH "pc" CACHE STRING
|
||||
"Sub-architecture to build for. Specify one of: xbox"
|
||||
)
|
||||
|
||||
set(OARCH "pentium" CACHE STRING
|
||||
"Generate instructions for this CPU type. Specify one of:
|
||||
native, i386, i486, pentium, pentium-mmx, pentiumpro, i686,
|
||||
pentium2, pentium3, pentium-m, pentium4, prescott, nocona,
|
||||
core2, k6, k6-2, athlon, athlon-xp, opteron, opteron-sse3,
|
||||
barcelona, winchip-c6, winchip2, c3, c3-2, geode"
|
||||
)
|
||||
|
||||
set(TUNE "i686" CACHE STRING
|
||||
"Which CPU ReactOS should be optimized for."
|
||||
)
|
||||
|
||||
set (OPTIMIZE "1" CACHE STRING
|
||||
"What level of optimisation to use.
|
||||
0 = off
|
||||
1 = Default option, optimize for size (-Os) with some additional options
|
||||
2 = -Os
|
||||
3 = -O1
|
||||
4 = -O2
|
||||
5 = -O3"
|
||||
)
|
||||
|
||||
set(DBG 1 CACHE BOOL
|
||||
"Whether to compile for debugging."
|
||||
)
|
||||
|
||||
set(KDBG 1 CACHE BOOL
|
||||
"Whether to compile in the integrated kernel debugger."
|
||||
)
|
||||
|
||||
set(GDB 0 CACHE BOOL
|
||||
"Whether to compile for debugging with GDB.
|
||||
If you don't use GDB, don't enable this."
|
||||
)
|
||||
|
||||
set(_WINKD_ 0 CACHE BOOL
|
||||
"Whether to compile with the KD protocol."
|
||||
)
|
||||
|
||||
set(_ELF_ 0 CACHE BOOL
|
||||
"Whether to compile support for ELF files.
|
||||
Do not enable unless you know what you're doing."
|
||||
)
|
||||
|
||||
set(NSWPAT 0 CACHE BOOL
|
||||
"Whether to compile apps/libs with features covered software patents or not.
|
||||
If you live in a country where software patents are valid/apply, don't
|
||||
enable this (except they/you purchased a license from the patent owner).
|
||||
This settings is disabled (0) by default."
|
||||
)
|
||||
|
||||
set(BUILD_MP 1 CACHE BOOL
|
||||
"Whether to compile the multi processor versions for ntoskrnl and hal."
|
||||
)
|
||||
|
79
gcc.cmake
79
gcc.cmake
|
@ -1,25 +1,54 @@
|
|||
|
||||
# Linking
|
||||
link_directories("${REACTOS_SOURCE_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--kill-at -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds")
|
||||
|
||||
# Compiler Core
|
||||
add_definitions(-pipe -fms-extensions)
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
|
||||
# Debugging (Note: DWARF-4 on 4.5.1 when we ship)
|
||||
add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types)
|
||||
|
||||
# Tuning
|
||||
add_definitions(-march=pentium -mtune=i686)
|
||||
|
||||
# Warnings
|
||||
add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value -Winvalid-pch)
|
||||
|
||||
# Optimizations
|
||||
add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
|
||||
|
||||
# C++ Flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
|
||||
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
add_definitions(-fshort-wchar)
|
||||
|
||||
|
||||
else()
|
||||
|
||||
# Linking
|
||||
link_directories("${REACTOS_SOURCE_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--kill-at -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds")
|
||||
|
||||
# Compiler Core
|
||||
add_definitions(-pipe -fms-extensions)
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
|
||||
# Debugging (Note: DWARF-4 on 4.5.1 when we ship)
|
||||
add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types)
|
||||
|
||||
# Tuning
|
||||
add_definitions(-march=pentium -mtune=i686)
|
||||
|
||||
# Warnings
|
||||
add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value -Winvalid-pch)
|
||||
|
||||
# Optimizations
|
||||
add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
|
||||
|
||||
# C++ Flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
|
||||
|
||||
# Macros
|
||||
macro(set_entrypoint MODULE ENTRYPOINT)
|
||||
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-Wl,-entry,_${ENTRYPOINT}")
|
||||
endmacro()
|
||||
|
||||
macro(add_importlibs MODULE)
|
||||
FOREACH(LIB ${ARGN})
|
||||
target_link_libraries(${MODULE} ${LIB}.a)
|
||||
ENDFOREACH()
|
||||
endmacro()
|
||||
|
||||
macro(set_module_type MODULE TYPE)
|
||||
target_link_libraries(calc mingw_wmain mingw_common)
|
||||
if(${TYPE} MATCHES win32gui)
|
||||
set_entrypoint(${MODULE} wWinMainCRTStartup)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
endif()
|
||||
|
||||
|
|
36
msc.cmake
36
msc.cmake
|
@ -1,3 +1,33 @@
|
|||
|
||||
add_definitions(/GS- /Zl /Zi)
|
||||
add_definitions(-Dinline=__inline -D__STDC__=1)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
|
||||
add_definitions(-D__i386__)
|
||||
endif()
|
||||
|
||||
add_definitions(-Dinline=__inline)
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
|
||||
|
||||
else()
|
||||
|
||||
add_definitions(/GS- /Zl /Zi)
|
||||
add_definitions(-Dinline=__inline -D__STDC__=1)
|
||||
|
||||
macro(set_entrypoint MODULE ENTRYPOINT)
|
||||
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "/ENTRY:${ENTRYPOINT}")
|
||||
endmacro()
|
||||
|
||||
macro(add_importlibs MODULE)
|
||||
FOREACH(LIB ${ARGN})
|
||||
target_link_libraries(${MODULE} ${LIB}.LIB)
|
||||
ENDFOREACH()
|
||||
endmacro()
|
||||
|
||||
macro(set_module_type MODULE TYPE)
|
||||
if (${TYPE} MATCHES win32gui)
|
||||
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "/subsystem:windows")
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue