Author: akhaldi
Date: Mon Dec 27 20:10:40 2010
New Revision: 50171
URL:
http://svn.reactos.org/svn/reactos?rev=50171&view=rev
Log:
[CMAKE]
- Improve amd64 toolchain support.
Added:
branches/cmake-bringup/config-amd64.cmake
Modified:
branches/cmake-bringup/CMakeLists.txt
branches/cmake-bringup/CMakeMacros.cmake
branches/cmake-bringup/gcc.cmake
branches/cmake-bringup/toolchain-mingw32.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] Mon Dec 27 20:10:40 2010
@@ -3,48 +3,56 @@
project(REACTOS)
# Compile options
-include(config.cmake)
+if(ARCH MATCHES i386)
+ include(config.cmake)
+elseif(ARCH MATCHES amd64)
+ include(config-amd64.cmake)
+endif()
if(NOT CMAKE_CROSSCOMPILING)
-add_definitions(-DTARGET_i386)
-if(MSVC)
-add_definitions(-Dinline=__inline)
-endif()
-
-include_directories(
- ${REACTOS_SOURCE_DIR}/tools/unicode
- include
- include/host
- include/reactos
- include/reactos/wine
- ${REACTOS_BINARY_DIR}/include)
-
-add_subdirectory(tools)
-add_subdirectory(lib)
-
-if(NOT MSVC)
-export(TARGETS widl nci buildno gendib cabman cdmake mkhive spec2def geninc FILE
${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+ if(ARCH MATCHES i386)
+ add_definitions(-DTARGET_i386)
+ if(MSVC)
+ add_definitions(-Dinline=__inline)
+ endif()
+ elseif(ARCH MATCHES amd64)
+ add_definitions(-DTARGET_amd64)
+ endif()
+
+ include_directories(
+ ${REACTOS_SOURCE_DIR}/tools/unicode
+ include
+ include/host
+ include/reactos
+ include/reactos/wine
+ ${REACTOS_BINARY_DIR}/include)
+
+ add_subdirectory(tools)
+ add_subdirectory(lib)
+
+ if(NOT MSVC)
+ export(TARGETS widl nci buildno gendib cabman cdmake mkhive spec2def geninc FILE
${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+ else()
+ export(TARGETS nci buildno gendib cabman cdmake mkhive spec2def geninc FILE
${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+ endif()
+
else()
-export(TARGETS nci buildno gendib cabman cdmake mkhive spec2def geninc FILE
${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
-endif()
-
-else()
-
-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})
+
+ 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})
endif(NOT CMAKE_CROSSCOMPILING)
# Compiler specific definitions and macros
if(MSVC)
-include(msc.cmake)
+ include(msc.cmake)
else()
-include(gcc.cmake)
+ include(gcc.cmake)
endif(MSVC)
# Generic macros
@@ -65,147 +73,154 @@
if(CMAKE_CROSSCOMPILING)
-#Some cleanup
-file(REMOVE
- ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
- ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
- ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
- ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
- ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
- ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
-
-#Some useful variables
-set(LIVECD_DIR "${REACTOS_BINARY_DIR}/boot/livecd")
-set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
-
-# Activate support for assembly source files
-enable_language(ASM)
-
-# Activate language support for resource files
-enable_language(RC)
-
-
-if(DBG)
-add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
-else()
-add_definitions(-DDBG=0)
-endif(DBG)
-
-if(KDBG)
-add_definitions(-DKDBG=1)
-else()
-add_definitions(-DKDBG=0)
-endif(KDBG)
-
-# Version Options
-add_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502
-D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502)
-
-# Arch Options
-add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
-
-# Other
-add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
-
-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)
-
-if(MSVC)
-include_directories(include/crt/msc)
-else()
-include_directories(include/crt/mingw32)
-endif(MSVC)
-
-add_subdirectory(include/psdk)
-add_subdirectory(include/dxsdk)
-add_subdirectory(include/reactos/idl)
-add_subdirectory(include/reactos/wine)
-add_subdirectory(include/reactos/mc)
-add_subdirectory(include/asm)
-
-include(baseaddress.cmake)
-
-add_subdirectory(base)
-add_subdirectory(boot)
-add_subdirectory(dll)
-add_subdirectory(drivers)
-add_subdirectory(hal)
-add_subdirectory(lib)
-add_subdirectory(media)
-add_subdirectory(modules)
-add_subdirectory(ntoskrnl)
-add_subdirectory(subsystems)
-
-# nci generated intermediate files
-
-list(APPEND nci_output
- ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h
- ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h
- ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S
- ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S
- ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S
- ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
-
-list(APPEND nci_folders
- ${CMAKE_CURRENT_BINARY_DIR}/dll/ntdll/def
- ${CMAKE_CURRENT_BINARY_DIR}/lib/ntdllsys/ntdll
- ${CMAKE_CURRENT_BINARY_DIR}/lib/win32ksys
- ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/include/internal
- ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/ex
- ${CMAKE_CURRENT_BINARY_DIR}/subsystems/win32/win32k/include)
-
-file(MAKE_DIRECTORY ${nci_folders})
-
-add_custom_command(
- OUTPUT ${nci_output}
- COMMAND native-nci -arch ${ARCH} ${REACTOS_SOURCE_DIR}/ntoskrnl/sysfuncs.lst
${REACTOS_SOURCE_DIR}/subsystems/win32/win32k/w32ksvc.db ${nci_output}
- DEPENDS native-nci ${nci_folders})
-
-set_source_files_properties(${nci_output} PROPERTIES GENERATED TRUE)
-
-add_custom_target(ntdll_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S)
-add_custom_target(win32k_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S)
-add_custom_target(ntsys_pspec ALL DEPENDS
${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
-add_custom_target(kernel_napi ALL DEPENDS
${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h)
-add_custom_target(subsystem_napi ALL DEPENDS
${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h)
-add_custom_target(kernel_zw ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S)
-
-file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
-
-add_custom_command(
- OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
- COMMAND native-buildno ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
- DEPENDS ${REACTOS_SOURCE_DIR}/include/reactos/version.h)
-
-add_custom_target(buildno_header ALL DEPENDS
${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
-
-file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib)
-
-list(APPEND OUTPUT_FILES
- ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib8gen.c
- ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib16gen.c
- ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib32gen.c)
-
-add_custom_command(
- OUTPUT ${OUTPUT_FILES}
- COMMAND native-gendib ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib
- DEPENDS native-gendib)
-
-add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
-
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
-
-#bootcd and livecd
-include(ros_cd.cmake)
+ #Some cleanup
+ file(REMOVE
+ ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
+ ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
+ ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
+ ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
+ ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
+ ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
+
+ #Some useful variables
+ set(LIVECD_DIR "${REACTOS_BINARY_DIR}/boot/livecd")
+ set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
+
+ # Activate support for assembly source files
+ enable_language(ASM)
+
+ # Activate language support for resource files
+ enable_language(RC)
+
+ if(DBG)
+ add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
+ else()
+ add_definitions(-DDBG=0)
+ endif()
+
+ if(KDBG)
+ add_definitions(-DKDBG=1)
+ else()
+ add_definitions(-DKDBG=0)
+ endif()
+
+ # Version Options
+ add_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502
-D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502)
+
+ # Arch Options
+ if(ARCH MATCHES i386)
+ add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
+ elseif(ARCH MATCHES amd64)
+ add_definitions(-D_M_AMD64 -D_AMD64_ -D_M_AXP64 -D__x86_64__ -D_WIN64)
+ endif()
+
+ # Other
+ if(ARCH MATCHES i386)
+ add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
+ elseif(ARCH MATCHES amd64)
+ add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
+ endif()
+
+ 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)
+
+ if(MSVC)
+ include_directories(include/crt/msc)
+ else()
+ include_directories(include/crt/mingw32)
+ endif()
+
+ add_subdirectory(include/psdk)
+ add_subdirectory(include/dxsdk)
+ add_subdirectory(include/reactos/idl)
+ add_subdirectory(include/reactos/wine)
+ add_subdirectory(include/reactos/mc)
+ add_subdirectory(include/asm)
+
+ include(baseaddress.cmake)
+
+ add_subdirectory(base)
+ add_subdirectory(boot)
+ add_subdirectory(dll)
+ add_subdirectory(drivers)
+ add_subdirectory(hal)
+ add_subdirectory(lib)
+ add_subdirectory(media)
+ add_subdirectory(modules)
+ add_subdirectory(ntoskrnl)
+ add_subdirectory(subsystems)
+
+ # nci generated intermediate files
+
+ list(APPEND nci_output
+ ${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h
+ ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h
+ ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S
+ ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S
+ ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S
+ ${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
+
+ list(APPEND nci_folders
+ ${CMAKE_CURRENT_BINARY_DIR}/dll/ntdll/def
+ ${CMAKE_CURRENT_BINARY_DIR}/lib/ntdllsys/ntdll
+ ${CMAKE_CURRENT_BINARY_DIR}/lib/win32ksys
+ ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/include/internal
+ ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl/ex
+ ${CMAKE_CURRENT_BINARY_DIR}/subsystems/win32/win32k/include)
+
+ file(MAKE_DIRECTORY ${nci_folders})
+
+ add_custom_command(
+ OUTPUT ${nci_output}
+ COMMAND native-nci -arch ${ARCH} ${REACTOS_SOURCE_DIR}/ntoskrnl/sysfuncs.lst
${REACTOS_SOURCE_DIR}/subsystems/win32/win32k/w32ksvc.db ${nci_output}
+ DEPENDS native-nci ${nci_folders})
+
+ set_source_files_properties(${nci_output} PROPERTIES GENERATED TRUE)
+
+ add_custom_target(ntdll_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/ntdllsys/ntdll.S)
+ add_custom_target(win32k_S ALL DEPENDS ${REACTOS_BINARY_DIR}/lib/win32ksys/win32k.S)
+ add_custom_target(ntsys_pspec ALL DEPENDS
${REACTOS_BINARY_DIR}/dll/ntdll/def/ntsys.pspec)
+ add_custom_target(kernel_napi ALL DEPENDS
${REACTOS_BINARY_DIR}/ntoskrnl/include/internal/napi.h)
+ add_custom_target(subsystem_napi ALL DEPENDS
${REACTOS_BINARY_DIR}/subsystems/win32/win32k/include/napi.h)
+ add_custom_target(kernel_zw ALL DEPENDS ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S)
+
+ file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
+
+ add_custom_command(
+ OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
+ COMMAND native-buildno ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
+ DEPENDS ${REACTOS_SOURCE_DIR}/include/reactos/version.h)
+
+ add_custom_target(buildno_header ALL DEPENDS
${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
+
+ file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib)
+
+ list(APPEND OUTPUT_FILES
+ ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib8gen.c
+ ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib16gen.c
+ ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib/dib32gen.c)
+
+ add_custom_command(
+ OUTPUT ${OUTPUT_FILES}
+ COMMAND native-gendib ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib
+ DEPENDS native-gendib)
+
+ add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
+
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
+
+ #bootcd and livecd
+ include(ros_cd.cmake)
endif()
Modified: branches/cmake-bringup/CMakeMacros.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/CMakeMacros.cmake…
==============================================================================
--- branches/cmake-bringup/CMakeMacros.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/CMakeMacros.cmake [iso-8859-1] Mon Dec 27 20:10:40 2010
@@ -241,10 +241,15 @@
macro(add_idl_interface IDL_FILE)
custom_incdefs()
+ if(ARCH MATCHES i386)
+ set(platform_flags "-m32 --win32")
+ elseif(ARCH MATCHES amd64)
+ set(platform_flags "-m64 --win64")
+ endif()
get_filename_component(FILE ${IDL_FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c
- COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} -m32 --win32 -u -U
${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}
+ COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${platform_flags} -u -U
${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}
DEPENDS ${IDL_FILE})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c PROPERTIES
GENERATED TRUE)
endmacro()
Added: branches/cmake-bringup/config-amd64.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/config-amd64.cmak…
==============================================================================
--- branches/cmake-bringup/config-amd64.cmake (added)
+++ branches/cmake-bringup/config-amd64.cmake [iso-8859-1] Mon Dec 27 20:10:40 2010
@@ -1,0 +1,43 @@
+
+set(SARCH "" CACHE STRING
+"Sub-architecture to build for.")
+
+set(OARCH "athlon64" CACHE STRING
+"Generate instructions for this CPU type. Specify one of:
+ k8 opteron athlon64 athlon-fx")
+
+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 TRUE CACHE BOOL
+"Whether to compile for debugging.")
+
+set(KDBG FALSE CACHE BOOL
+"Whether to compile in the integrated kernel debugger.")
+
+set(GDB FALSE CACHE BOOL
+"Whether to compile for debugging with GDB.
+If you don't use GDB, don't enable this.")
+
+set(_WINKD_ TRUE CACHE BOOL
+"Whether to compile with the KD protocol.")
+
+set(_ELF_ FALSE CACHE BOOL
+"Whether to compile support for ELF files.
+Do not enable unless you know what you're doing.")
+
+set(NSWPAT FALSE 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(USERMODE TRUE CACHE BOOL
+"Whether to compile any usermode parts. This is while kernel mode is under
+ heavy development and usermode part not relevant for bootcd.")
Modified: branches/cmake-bringup/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/gcc.cmake?rev=501…
==============================================================================
--- branches/cmake-bringup/gcc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/gcc.cmake [iso-8859-1] Mon Dec 27 20:10:40 2010
@@ -24,16 +24,29 @@
add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none
-feliminate-unused-debug-types)
# Tuning
-add_definitions(-march=pentium -mtune=i686)
+if(ARCH MATCHES i386)
+ add_definitions(-march=${OARCH} -mtune=${TUNE})
+elseif(ARCH MATCHES amd64)
+ add_definitions(-march=${OARCH})
+endif()
# 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)
+if(ARCH MATCHES i386)
+ add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer
-mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
+elseif(ARCH MATCHES amd64)
+ add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer
-mpreferred-stack-boundary=4)
+endif()
+
+# Other
+if(ARCH MATCHES amd64)
+add_definitions(-U_X86_ -UWIN32)
+endif()
# Macros
-MACRO(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename)
+macro(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename)
# Add the precompiled header to the build
get_filename_component(FILE ${_header_filename} NAME)
set(_gch_filename "${_target_name}_${FILE}.gch")
@@ -43,7 +56,7 @@
get_directory_property(DIRINC INCLUDE_DIRECTORIES)
foreach(item ${DIRINC})
list(APPEND ${_out_compile_flags} -I${item})
- endforeach(item)
+ endforeach()
# This is a particular bit of undocumented/hacky magic I'm quite proud of
get_directory_property(_compiler_flags DEFINITIONS)
@@ -55,11 +68,11 @@
if (_target_defs)
foreach(item ${_target_defs})
list(APPEND ${_out_compile_flags} -D${item})
- endforeach(item)
- endif()
-ENDMACRO(_PCH_GET_COMPILE_FLAGS)
-
-MACRO(add_pch _target_name _header_filename _src_list)
+ endforeach()
+ endif()
+endmacro()
+
+macro(add_pch _target_name _header_filename _src_list)
get_filename_component(FILE ${_header_filename} NAME)
set(_gch_filename "${_target_name}_${FILE}.gch")
list(APPEND ${_src_list} ${_gch_filename})
@@ -69,7 +82,7 @@
OUTPUT ${_gch_filename}
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args}
DEPENDS ${_header_filename})
-ENDMACRO(add_pch _target_name _header_filename _src_list)
+endmacro()
macro(add_linkerflag MODULE _flag)
set(NEW_LINKER_FLAGS ${_flag})
@@ -99,11 +112,10 @@
macro(set_module_type MODULE TYPE)
add_dependencies(${MODULE} psdk buildno_header)
-
if(${IS_CPP})
- target_link_libraries(${MODULE} stlport -lsupc++ -lgcc)
- endif()
-
+ target_link_libraries(${MODULE} stlport -lsupc++ -lgcc)
+ endif()
+
if(${TYPE} MATCHES nativecui)
set_subsystem(${MODULE} native)
set_entrypoint(${MODULE} NtProcessStartup@4)
@@ -115,7 +127,7 @@
else()
target_link_libraries(${MODULE} mingw_wmain)
endif(NOT IS_UNICODE)
- target_link_libraries(${MODULE} mingw_common)
+ target_link_libraries(${MODULE} mingw_common)
elseif(${TYPE} MATCHES win32cui)
set_subsystem(${MODULE} console)
set_entrypoint(${MODULE} mainCRTStartup)
@@ -124,15 +136,15 @@
else()
target_link_libraries(${MODULE} mingw_wmain)
endif(NOT IS_UNICODE)
- target_link_libraries(${MODULE} mingw_common)
+ target_link_libraries(${MODULE} mingw_common)
elseif(${TYPE} MATCHES win32dll)
set_entrypoint(${MODULE} DllMainCRTStartup@12)
target_link_libraries(${MODULE} mingw_dllmain mingw_common)
- if(DEFINED baseaddress_${MODULE})
- set_image_base(${MODULE} ${baseaddress_${MODULE}})
- else()
- message(STATUS "${MODULE} has no base address")
- endif()
+ if(DEFINED baseaddress_${MODULE})
+ set_image_base(${MODULE} ${baseaddress_${MODULE}})
+ else()
+ message(STATUS "${MODULE} has no base address")
+ endif()
elseif(${TYPE} MATCHES win32ocx)
set_entrypoint(${MODULE} DllMainCRTStartup@12)
target_link_libraries(${MODULE} mingw_dllmain mingw_common)
@@ -142,14 +154,14 @@
target_link_libraries(${MODULE} mingw_dllmain mingw_common)
set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl")
elseif(${TYPE} MATCHES kernelmodedriver)
- set_target_properties(${MODULE} PROPERTIES LINK_FLAGS
"-Wl,--exclude-all-symbols -Wl,-file-alignment=0x1000
-Wl,-section-alignment=0x1000" SUFFIX ".sys")
- set_entrypoint(${MODULE} DriverEntry@8)
- set_subsystem(${MODULE} native)
+ set_target_properties(${MODULE} PROPERTIES LINK_FLAGS
"-Wl,--exclude-all-symbols -Wl,-file-alignment=0x1000
-Wl,-section-alignment=0x1000" SUFFIX ".sys")
+ set_entrypoint(${MODULE} DriverEntry@8)
+ set_subsystem(${MODULE} native)
set_image_base(${MODULE} 0x00010000)
- add_dependencies(${MODULE} bugcodes)
+ add_dependencies(${MODULE} bugcodes)
elseif(${TYPE} MATCHES nativedll)
set_subsystem(${MODULE} native)
- else()
+ else()
message(FATAL_ERROR "Unknown module type : ${TYPE}")
endif()
endmacro()
@@ -166,18 +178,24 @@
foreach(arg ${defines})
set(rc_result_defs "${rc_result_defs} -D${arg}")
- endforeach(arg ${defines})
+ endforeach()
foreach(arg ${includes})
set(rc_result_incs "-I${arg} ${rc_result_incs}")
- endforeach(arg ${includes})
+ endforeach()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_result_defs}
${rc_result_incs} -i <SOURCE> -O coff -o <OBJECT>")
endmacro()
#idl files support
set(IDL_COMPILER native-widl)
-set(IDL_FLAGS -m32 --win32)
+
+if(ARCH MATCHES i386)
+ set(IDL_FLAGS -m32 --win32)
+elseif(ARCH MATCHES amd64)
+ set(IDL_FLAGS -m64 --win64)
+endif()
+
set(IDL_HEADER_ARG -h -H) #.h
set(IDL_TYPELIB_ARG -t -T) #.tlb
set(IDL_SERVER_ARG -s -S) #.c for server library
Modified: branches/cmake-bringup/toolchain-mingw32.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/toolchain-mingw32…
==============================================================================
--- branches/cmake-bringup/toolchain-mingw32.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/toolchain-mingw32.cmake [iso-8859-1] Mon Dec 27 20:10:40 2010
@@ -34,7 +34,12 @@
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o
<OBJECT> -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm
<FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
set(CMAKE_IDL_COMPILER native-widl)
+if(ARCH MATCHES i386)
set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS>
<DEFINES> -m32 --win32 -h -H <OBJECT> <SOURCE>")
+elseif(ARCH MATCHES amd64)
+set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS>
<DEFINES> -m64 --win64 -h -H <OBJECT> <SOURCE>")
+endif()
+
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE>
<CMAKE_C_LINK_FLAGS> <DEFINES> -I${REACTOS_SOURCE_DIR}/include/psdk
-I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/
-I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos
-I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt
-I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o <OBJECT> ")
set(CMAKE_C_CREATE_STATIC_LIBRARY "${MINGW_PREFIX}ar crs <TARGET>
<LINK_FLAGS> <OBJECTS>")