Author: tkreuzer
Date: Sun Sep 19 20:06:02 2010
New Revision: 48821
URL:
http://svn.reactos.org/svn/reactos?rev=48821&view=rev
Log:
[CMAKE]
- Add support for gui configurable options
- globalize compiler specific cmake files
- Add compiler specific macros set_entrypoint, set_module_type
Added:
branches/cmake-bringup/config.cmake
Modified:
branches/cmake-bringup/CMakeLists.txt
branches/cmake-bringup/gcc.cmake
branches/cmake-bringup/msc.cmake
Modified: branches/cmake-bringup/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/CMakeLists.txt?re…
==============================================================================
--- branches/cmake-bringup/CMakeLists.txt [iso-8859-1] (original)
+++ branches/cmake-bringup/CMakeLists.txt [iso-8859-1] Sun Sep 19 20:06:02 2010
@@ -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 @@
if(NOT CMAKE_CROSSCOMPILING)
add_definitions(-DTARGET_i386)
-add_definitions(-fshort-wchar)
include_directories(${REACTOS_SOURCE_DIR}/tools/unicode)
include_directories(include)
@@ -27,15 +37,13 @@
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)
@@ -45,11 +53,6 @@
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})
@@ -161,3 +164,4 @@
add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
endif()
+
Added: branches/cmake-bringup/config.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/config.cmake?rev=…
==============================================================================
--- branches/cmake-bringup/config.cmake (added)
+++ branches/cmake-bringup/config.cmake [iso-8859-1] Sun Sep 19 20:06:02 2010
@@ -1,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."
+)
+
Modified: branches/cmake-bringup/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/gcc.cmake?rev=488…
==============================================================================
--- branches/cmake-bringup/gcc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/gcc.cmake [iso-8859-1] Sun Sep 19 20:06:02 2010
@@ -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()
+
Modified: branches/cmake-bringup/msc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/msc.cmake?rev=488…
==============================================================================
--- branches/cmake-bringup/msc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/msc.cmake [iso-8859-1] Sun Sep 19 20:06:02 2010
@@ -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()