Commit graph

58 commits

Author SHA1 Message Date
Victor Perevertkin 8e1fa03456
[CMAKE] Replace custom scripts in compilerflags with standard ones
- add_target_link_flags changed to target_link_options
- add_target_property changed to set_property(... APPEND ...)
2021-09-14 17:56:22 +03:00
Jérôme Gardou 54ecf703f2 [CMAKE:GCC] Produce RosSym data even when building with separate debug symbols 2021-06-29 11:49:20 +02:00
Jérôme Gardou d1f5c31820 [SDK] Add GCC overrides for SAL annotations
GCC has some functions, variables & type attributes which can be used as aliases
for some of the SAL annotations. Although it's not as rich & precise, it's still useful
since we actually enable -Werror on GCC builds whereas we don't use such an option
on MSVC builds.

For now, _Must_inspect_result_ is aliased to warn_result_unused attribute.
2021-06-28 10:20:57 +02:00
Dmitry Borisov 6e33c8ffd3
[PEFIXUP] Fixup of resource sections in GCC builds. (#3594)
Make resource sections discardable for kernel-mode drivers and DLLs.
2021-05-10 00:36:38 +02:00
Jérôme Gardou ec68a3311f [CMAKE] Use SEH exceptions for c++ in clang amd64 build 2021-05-03 22:00:57 +02:00
Jérôme Gardou b52ab2493b Revert "[CMAKE] Disable SSE instruction on GCC amd64 builds"
The right fix is to ensure that the stack is properly 16-bit aligned
This reverts commit 63944988a2.
2021-05-03 22:00:57 +02:00
Jérôme Gardou 63944988a2 [CMAKE] Disable SSE instruction on GCC amd64 builds
Except for user-mode modules
2021-04-28 13:10:23 +02:00
Jérôme Gardou 9ef5a7eb7a [CMAKE] Fix compilation with newer windres versions
Also use clang as preprocessor when using it
Also, use *our* headers instead of the platform ones
2021-04-27 11:54:12 +02:00
Victor Perevertkin 72ad37c1cd
[CMAKE] Unify configs for architectures
config*.cmake files are constantly getting out of sync between
each other. Besides that, the parameters are not really dependent
on a target architecture, but rather on a compiler (except *ARCH)

This approach seems to be more future-prone, and allows to see
all the options in one file (there are really not that many of them)
2021-04-15 06:44:52 +03:00
Jérôme Gardou 83e1afe12a [CMAKE] Do not call clang with unsupported arguments 2021-04-09 10:09:55 +02:00
Victor Perevertkin c7d1ff4a9d [SDK][NDK] Fix clang 12 compilation 2021-04-09 03:51:32 +03:00
Jérôme Gardou 9c4ae0d05e [CMAKE] Honor CMAKE_EXE_LINKER_FLAGS_INIT in GCC build 2021-04-06 19:26:33 +02:00
Jérôme Gardou f5bace8536 [CMAKE] Move toolchain specific handling to set_module_type_toolchain
+ style fixes
2021-03-23 11:18:43 +01:00
Jérôme Gardou e55123a6a2 [CMAKE] Add the kernel module type
Take this as an occasion to use target_link_options more
2021-03-23 11:18:43 +01:00
Jérôme Gardou 812c9e5a11 [CMAKE] Fixup of driver sections in GCC builds
Also introduce a helper variable to list KMode modules
2021-03-23 11:18:43 +01:00
Jérôme Gardou 5489efcb1a [SDK:TOOLS] Add --driver option to pefixup
For now, this adds IMAGE_SCN_MEM_DISCARDABLE to the INIT section, and IMAGE_SCN_MEM_NOT_PAGED to sections which are not named PAGE or .reloc
2021-03-23 11:18:43 +01:00
Jérôme Gardou 56b1baa3dd [CMAKE] Restore using LD linker script with GCC 2021-03-23 11:18:43 +01:00
Hervé Poussineau 39545c3385 [CMAKE] Use -Wno-error when compiling with GCC x64 2021-01-05 14:19:45 +01:00
Jérôme Gardou c8d07514c8 [CMAKE] Fix GCC -fstack-protector usage 2021-01-05 13:38:57 +01:00
Jérôme Gardou b96e88894a [CMAKE] Turn import libs into regular C static libs
Embed msvcrtex into libmsvcrt

Idea taken from Thomas Faber
2020-12-28 12:13:30 +01:00
Victor Perevertkin 16e5ce8fb1
[CMAKE] Use C_STANDARD property instead of command line option
Addendum to 64211aa696 and 19779b3f96
2020-12-05 15:35:06 +03:00
Hervé Poussineau 4469ab3620 [CMAKE] Disable compression of debug sections in GCC <= 7.0
We use MSVC, Clang or GCC > 7.0 these days.
2020-12-01 18:44:53 +01:00
Jérôme Gardou edc1f3ca56 [CMAKE] Fix use of CLang
- Updated toolchain file
 - set GCC variable when using CLang in "GCC mode"
 - Properly retrieve GCC support libraries
 - Various flags needed to get this going
2020-11-16 16:58:10 +01:00
Jérôme Gardou bf04126e02 |CMAKE] Use RULE_LAUNCH_COMPILE property to handle ccache 2020-11-09 10:47:19 +01:00
Jérôme Gardou bbe47e61b1 |CMAKE] Use ExternalProject for host-tools build 2020-10-22 09:31:11 +02:00
Jérôme Gardou 00ed72d7e8 [CMAKE] Get rid of add_compile_flags
Use add_compile_options and the like instead
2020-10-20 21:44:54 +02:00
Jérôme Gardou 683489ccf1 [CMAKE] Use -ffile-prefix-map for GCC builds
And also simplify the __RELFILE__ macro definition for the other cases
2020-10-20 21:44:54 +02:00
Jérôme Gardou ed61512236 [CMAKE] Get rid of add_compile_flags_language macro
in favor of add_compile_options and the like with generator expressions
Also take this as an opportunity to remove the C++11 standard hack, GCC 8 now defaults to C++14
2020-10-20 21:44:54 +02:00
Jérôme Gardou d6ea8659c8 [CMAKE] Get rid of the set_cpp macro
Instead of messing with global variables and the like, we introduce two target properties:
 - WITH_CXX_EXCEPTIONS: if you want to use C++ exceptions
 - WITH_CXX_RTTI: if you need RTTI in your module
You can use the newly introduced set_target_cpp_properties function, with WITH_EXCEPTIONS and WITH_RTTI arguments
We also introduce two libraries :
 - cpprt: for C++ runtime routines
 - cppstl: for the C++ standard template library

NB: On GCC, this requires to create imported libraries with the related built-in libraries:libsupc++, limingwex, libstdc++

Finally, we manage the relevant flags with the ad-hoc generator expressions

So, if you don't need exceptions, nor RTTI, nor use any runtime at all: you simply have nothing else to do than add your C++ file to your module
2020-10-20 21:44:54 +02:00
Serge Gautherie aae5cd8ea2
[CMAKE] Remove obsolete 'GCC_VERSION' checks (#2962)
following upgrade to RosBE 2.2.0 support and GCC 8.4.
2020-07-04 15:33:50 +02:00
Thomas Faber dd6eb40381
[CMAKE] Remove work-arounds for old CMake versions. CORE-17109 2020-06-20 15:25:29 +02:00
Amine Khaldi 139a3d6661
[CMAKE] Implement PCH builds with target_precompile_headers. CORE-16905 2020-06-06 21:58:41 +03:00
Serge Gautherie 11345aedd8
[FORMATTING] [CMAKE] Remove space in 'if (' (#2847) 2020-05-26 20:24:02 +02:00
Victor Perevertkin 95483b42ea
[REACTOS] Raise C standard to gnu99
And remove -Wdeclaration-after-statement
2020-05-04 21:44:55 +03:00
Sylvain Deverre 7f6246e660 [CMAKE] Fix SEPARATE_DBG build on GCC 2020-04-19 13:00:18 +02:00
Mark Jansen 0b948581fc
[SDK][HOST-TOOLS] Add load_config workaround for gcc builds
Since binutils can not add this, we re-introduce pefixup.
It searches for the exported symbol '_load_config_used',
and uses that to fill out the LOAD_CONFIG directory in the PE header
2020-04-17 17:47:24 +02:00
Victor Perevertkin 7e069ccdb2
[CMAKE] Replace custom functions to built-in ones
add_target_compile_definitions -> target_compile_definitions
add_target_compile_flags -> target_compile_options
add_target_include_directories -> target_include_directories
2020-04-16 15:59:38 +03:00
Victor Perevertkin 0d187f7d56
[CMAKE] Add --gc-sections flag to GCC linker.
This returns C++ binaries size to normal (on GCC 8.4).
I don't see any noticable effect of this on GCC 4.7.2

CORE-16670
2020-04-09 04:02:06 +03:00
Serge Gautherie 29c1089983 [CMAKE] gcc.cmake: '-Wno-unused-const-variable' applies to GCC 6.1+
GCC 4.7.2 logs
'cc1: error: unrecognized command line option "-Wno-unused-const-variable" [-Werror]'

Addendum to 8eb7a1a2f4.
2020-03-08 13:30:10 +01:00
Hermès Bélusca-Maïto 93beefacbe
[CMAKE][FREELDR] Take the global defines into account when compiling ASM files.
Now the SARCH_xxx can be used in ASM files too.
Dedicated to Dmitry Borisov ;)
2020-03-06 22:55:12 +01:00
Andrew Cook ce531a28ec
Rework host tools
Now configured at the same time as reactos and only
one list of targets to maintain

Correctly rebuilds when a tool changes (tested widl)
2019-08-17 17:39:31 +02:00
Timo Kreuzer 4b79367647 [CMAKE] Define _GLIBCXX_HAVE_BROKEN_VSWPRINTF to fix build with GLIBCXX and our c++ headers 2019-07-20 13:56:18 +02:00
Timo Kreuzer 58b615f668 [CMAKE] Disable some overly sensitive warnings
-Wno-unused-const-variable
-Wno-unused-local-typedefs
-Wno-deprecated
2019-07-20 13:56:18 +02:00
Thomas Faber 36e9a6f8dd
[CMAKE] Disable INIT section ld scripts for now. CORE-16183 ROSBE-154 2019-07-07 16:06:43 +02:00
Thomas Faber c4d8e2a6e9
[CMAKE] Ensure the INIT section is placed at the end of a module. CORE-14683
For MSVC, marking the section as discardable will do this automatically.
For GCC, we use a linker script that places it after the .reloc section
(which should be the last "real" section, check ld --verbose output for the
default linker script).

This fixes what seems to be a regression from r55835 (!).
2019-07-07 08:18:10 +02:00
Hervé Poussineau 8eb7a1a2f4 [CMAKE] Disable unused-const-variable warning
This prevents some errors like this one:

In file included from ../dll/win32/wldap32/ber.c:27:0:
../sdk/include/reactos/wine/debug.h:378:48: error: '__wine_dbch___default' defined but not used [-Werror=unused-const-variable=]
     static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
                                                ^
../dll/win32/wldap32/ber.c:29:1: note: in expansion of macro 'WINE_DEFAULT_DEBUG_CHANNEL'
 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~
2019-05-27 13:22:40 +02:00
Hervé Poussineau 5fe74532af [CMAKE] Disable --compress-debug-sections on GCC >= 7.0
This leads to 'bad reloc address in section .zdebug_info'
2019-05-27 13:22:40 +02:00
Timo Kreuzer fad4b34db7 [CMAKE] Fix LINK_DEPENDS usage
Up to CMake 3.3 LINK_DEPENDS was ignored in non-Makefile generators. See also http://www.cmake.org/pipermail/cmake/2010-May/037206.html. Since CMake 3.4 it is no longer ignored, but requires CMP0005 policy to be set to NEW and it requires a full path which was already correctly used on GCC, but not on MSVC builds.
2019-04-27 14:29:33 +02:00
Andrew Cook 716613cddc [CMAKE] Use new policies for CMP0005 and CMP0018 (#1481)
* [CMAKE] Fix for CMP0018
The new behaviour lets us explicitly disabling position independent code, avoiding the need to change undocumented variables

* LINK_DEPENDS is semicolon separated

* [CMAKE] Fix for CMP0005
it seems impossible to have cmake correct escape PROXY_CLSID_IS so move it to the header
2019-04-27 11:33:37 +02:00
Jérôme Gardou f489c3fd07 [CMAKE] Clear CMAKE_<LANGUAGE>_IMPLICIT_LINK_LIBRARIES and
_IMPLICIT_LINK_DIRECTORIES

Othrewise, if you link a RC module with a static C library (as done for
fusion DLLs), you get the standard C libraries from GCC. This is not
what we want.

This might have to be done for MSVC builds. Check build.ninja to verify
this.
2019-04-06 17:43:38 +02:00