mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 05:01:03 +00:00
[CMAKE]
- add gcc dependencies to executables, not to mingw_(w)main [STLPORT] - move features definitions where it belongs. [SDK] - errno _must_ be defined in errno.h, nowhere else, or stlport headers choke. svn path=/branches/cmake-bringup/; revision=49049
This commit is contained in:
parent
1958e125aa
commit
27267a3cab
4 changed files with 14 additions and 30 deletions
26
gcc.cmake
26
gcc.cmake
|
@ -17,9 +17,6 @@ set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-bas
|
|||
# Compiler Core
|
||||
add_definitions(-pipe -fms-extensions)
|
||||
|
||||
# stlport special
|
||||
add_definitions(-D_STLP_GCC_USES_GNU_LD)
|
||||
|
||||
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>")
|
||||
|
||||
set(CMAKE_RC_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
|
@ -36,6 +33,14 @@ add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-e
|
|||
# Optimizations
|
||||
add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
|
||||
|
||||
#linkage hell...
|
||||
add_library(gcc STATIC IMPORTED)
|
||||
set_target_properties(gcc PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libgcc.a
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "mingw_common -lkernel32")
|
||||
add_library(supc++ STATIC IMPORTED)
|
||||
set_target_properties(supc++ PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libsupc++.a
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "gcc -lmsvcrt")
|
||||
|
||||
# Macros
|
||||
macro(set_entrypoint MODULE ENTRYPOINT)
|
||||
if(${ENTRYPOINT} STREQUAL "0")
|
||||
|
@ -81,7 +86,7 @@ macro(set_module_type MODULE TYPE)
|
|||
else()
|
||||
target_link_libraries(${MODULE} mingw_wmain)
|
||||
endif(NOT IS_UNICODE)
|
||||
target_link_libraries(${MODULE} mingw_common)
|
||||
target_link_libraries(${MODULE} mingw_common gcc)
|
||||
endif()
|
||||
if(${TYPE} MATCHES win32cui)
|
||||
set_subsystem(${MODULE} console)
|
||||
|
@ -91,7 +96,7 @@ macro(set_module_type MODULE TYPE)
|
|||
else()
|
||||
target_link_libraries(${MODULE} mingw_wmain)
|
||||
endif(NOT IS_UNICODE)
|
||||
target_link_libraries(${MODULE} mingw_common)
|
||||
target_link_libraries(${MODULE} mingw_common gcc)
|
||||
endif()
|
||||
if(${TYPE} MATCHES win32dll)
|
||||
set_entrypoint(${MODULE} DllMain@12)
|
||||
|
@ -137,14 +142,3 @@ macro(ADD_TYPELIB TARGET)
|
|||
endforeach()
|
||||
add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
|
||||
endmacro()
|
||||
|
||||
#linkage hell...
|
||||
add_library(msvcrt_imp SHARED IMPORTED)
|
||||
set_target_properties(msvcrt_imp PROPERTIES IMPORTED_IMPLIB ${REACTOS_SOURCE_DIR}/importlibs/libmsvcrt.a)
|
||||
add_library(gcc STATIC IMPORTED)
|
||||
set_target_properties(gcc PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libgcc.a
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "mingw_common -lkernel32")
|
||||
add_library(supc++ STATIC IMPORTED)
|
||||
set_target_properties(supc++ PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libsupc++.a
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "gcc -lmsvcrt")
|
||||
|
||||
|
|
|
@ -134,13 +134,7 @@ extern "C" {
|
|||
_invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
|
||||
_invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
|
||||
|
||||
#ifndef _CRT_ERRNO_DEFINED
|
||||
#define _CRT_ERRNO_DEFINED
|
||||
_CRTIMP extern int *__cdecl _errno(void);
|
||||
#define errno (*_errno())
|
||||
errno_t __cdecl _set_errno(int _Value);
|
||||
errno_t __cdecl _get_errno(int *_Value);
|
||||
#endif
|
||||
#include <errno.h>
|
||||
_CRTIMP unsigned long *__cdecl __doserrno(void);
|
||||
#define _doserrno (*__doserrno())
|
||||
errno_t __cdecl _set_doserrno(unsigned long _Value);
|
||||
|
|
4
lib/3rdparty/mingw/CMakeLists.txt
vendored
4
lib/3rdparty/mingw/CMakeLists.txt
vendored
|
@ -57,10 +57,6 @@ add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
|
|||
set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
|
||||
add_dependencies(mingw_wmain psdk)
|
||||
|
||||
#hack : this way, every executable will be linked to libgcc
|
||||
target_link_libraries(mingw_main gcc)
|
||||
target_link_libraries(mingw_wmain gcc)
|
||||
|
||||
add_library(mingw_dllmain crtdll.c dllargv.c)
|
||||
add_dependencies(mingw_dllmain psdk)
|
||||
|
||||
|
|
|
@ -157,9 +157,9 @@
|
|||
* It is being put in this file as there is no way to check if we are using GNU ld automatically,
|
||||
* so it becomes user's responsibility.
|
||||
*/
|
||||
/*
|
||||
#define _STLP_GCC_USES_GNU_LD
|
||||
*/
|
||||
#ifdef __MINGW32__
|
||||
# define _STLP_GCC_USES_GNU_LD
|
||||
#endif
|
||||
|
||||
/*==========================================================
|
||||
* Compatibility section
|
||||
|
|
Loading…
Reference in a new issue