Hello.
May I ask why you removed the -nodefaultlibs flag?
Regards.
Jérôme.
Le 18/09/2011 02:57, dgorbachev(a)svn.reactos.org a écrit :
Author: dgorbachev
Date: Sun Sep 18 00:57:17 2011
New Revision: 53730
URL:
http://svn.reactos.org/svn/reactos?rev=53730&view=rev
Log:
[CMAKE]
Allow to specify prefix/suffix for GCC and Binutils.
Modified:
trunk/reactos/cmake/gcc.cmake
trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt
trunk/reactos/lib/sdk/crt/oldnames.cmake
trunk/reactos/toolchain-gcc.cmake
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=53730&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Sun Sep 18 00:57:17 2011
@@ -86,7 +86,7 @@
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER>
<CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o<TARGET>
<LINK_LIBRARIES>")
-set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base
-Wl,--disable-auto-import -Wl,--disable-stdcall-fixup")
+set(CMAKE_EXE_LINKER_FLAGS "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import,--disable-stdcall-fixup")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}
-Wl,--disable-stdcall-fixup")
@@ -134,7 +134,7 @@
endif()
if(${TYPE} STREQUAL kernelmodedriver)
- add_target_link_flags(${MODULE} "-Wl,--exclude-all-symbols
-Wl,-file-alignment=0x1000 -Wl,-section-alignment=0x1000")
+ add_target_link_flags(${MODULE}
"-Wl,--exclude-all-symbols,-file-alignment=0x1000,-section-alignment=0x1000")
endif()
endfunction()
@@ -190,25 +190,25 @@
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
COMMAND native-spec2def -n=${_name}${_suffix} -a=${ARCH2}
-d=${CMAKE_CURRENT_BINARY_DIR}/${_name}_implib.def
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_BINARY_DIR}/${_name}_implib.def --kill-at
--output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+ COMMAND ${CMAKE_DLLTOOL} --def
${CMAKE_CURRENT_BINARY_DIR}/${_name}_implib.def --kill-at
--output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} native-spec2def)
# Delayed importlib creation
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
COMMAND native-spec2def -n=${_name}${_suffix} -a=${ARCH2}
-d=${CMAKE_CURRENT_BINARY_DIR}/${_name}_delayed_implib.def
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_BINARY_DIR}/${_name}_delayed_implib.def --kill-at --output-delaylib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
+ COMMAND ${CMAKE_DLLTOOL} --def
${CMAKE_CURRENT_BINARY_DIR}/${_name}_delayed_implib.def --kill-at --output-delaylib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} native-spec2def)
elseif(${_extension} STREQUAL ".def")
message("Use of def files for import libs is deprecated:
${_exports_file}")
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at
--output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+ COMMAND ${CMAKE_DLLTOOL} --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
--kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at --output-delaylib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
+ COMMAND ${CMAKE_DLLTOOL} --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
--kill-at --output-delaylib ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
else()
message(FATAL_ERROR "Unsupported exports file extension:
${_extension}")
@@ -243,7 +243,7 @@
endfunction()
macro(macro_mc FILE)
- set(COMMAND_MC ${MINGW_PREFIX}windmc -A -b ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc -r
${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos)
+ set(COMMAND_MC ${CMAKE_MC_COMPILER} -A -b ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc -r
${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos)
endmacro()
#pseh lib, needed with mingw
Modified: trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/CMakeLi…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] Sun Sep 18 00:57:17
2011
@@ -65,8 +65,7 @@
if(NOT MSVC)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib
${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
- COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
+ COMMAND ${CMAKE_DLLTOOL} --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def
--kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES
GENERATED TRUE)
Modified: trunk/reactos/lib/sdk/crt/oldnames.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/oldnames.cmake…
==============================================================================
--- trunk/reactos/lib/sdk/crt/oldnames.cmake [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/oldnames.cmake [iso-8859-1] Sun Sep 18 00:57:17 2011
@@ -1,8 +1,7 @@
if(NOT MSVC)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
- COMMAND ${MINGW_PREFIX}dlltool --def
${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib
${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
- COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
+ COMMAND ${CMAKE_DLLTOOL} --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def
--kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES
GENERATED TRUE)
Modified: trunk/reactos/toolchain-gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/toolchain-gcc.cmake?rev=53…
==============================================================================
--- trunk/reactos/toolchain-gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/toolchain-gcc.cmake [iso-8859-1] Sun Sep 18 00:57:17 2011
@@ -3,19 +3,25 @@
set(ARCH i386)
endif()
-# Choose the right MinGW prefix
-if(ARCH MATCHES i386)
+# Choose the right MinGW toolchain prefix
+if (NOT DEFINED MINGW_TOOLCHAIN_PREFIX)
+ if(ARCH MATCHES i386)
- if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
- set(MINGW_PREFIX "" CACHE STRING "MinGW Prefix")
- else()
- set(MINGW_PREFIX "mingw32-" CACHE STRING "MinGW Prefix")
- endif(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+ set(MINGW_TOOLCHAIN_PREFIX "" CACHE STRING "MinGW Toolchain
Prefix")
+ else()
+ set(MINGW_TOOLCHAIN_PREFIX "mingw32-" CACHE STRING "MinGW
Toolchain Prefix")
+ endif(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
-elseif(ARCH MATCHES amd64)
- set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW
Prefix")
-elseif(ARCH MATCHES arm)
- set(MINGW_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Prefix")
+ elseif(ARCH MATCHES amd64)
+ set(MINGW_TOOLCHAIN_PREFIX "x86_64-w64-mingw32-" CACHE STRING
"MinGW Toolchain Prefix")
+ elseif(ARCH MATCHES arm)
+ set(MINGW_TOOLCHAIN_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW
Toolchain Prefix")
+ endif()
+endif()
+
+if (NOT DEFINED MINGW_TOOLCHAIN_SUFFIX)
+ set(MINGW_TOOLCHAIN_SUFFIX "" CACHE STRING "MinGW Toolchain
Suffix")
endif()
if(ENABLE_CCACHE)
@@ -28,11 +34,13 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
-# Which compilers to use for C and C++
-set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_PREFIX}gcc)
-set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++)
-set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
-set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
+# Which tools to use
+set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
+set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX})
+set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
+set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
+set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
+set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crs<TARGET>
<LINK_FLAGS> <OBJECTS>")
@@ -46,4 +54,4 @@
#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "Standard C++
Libraries")
-set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib
-Wl,--enable-auto-image-base -Wl,--disable-auto-import")
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")