Commit graph

226 commits

Author SHA1 Message Date
Nico Weber a9fb317a63 Build: Clang should get -Werror too
I accidentally removed it in a619943001 and #3002 only restored
it for gcc.
2020-08-05 17:29:15 +02:00
Brian Gianforcaro 5a984b811c Build: Re-enable -Werror when building with GCC
It looks like PR #2986 mistakenly removed this from both the
Clang and GCC CXX_FLAGS, when the intention seems to have been
to only disable it for Clang.
2020-08-05 12:07:20 +02:00
Nico Weber a619943001 Build: Make things build with clang without needing local changes
Useful for sanitizer fuzzer builds.

clang doesn't have a -fconcepts switch (I'm guessing it just enables
concepts automatically with -std=c++2a, but I haven't checked),
and at least the version on my system doesn't understand
-Wno-deprecated-move, so pass these two flags only to gcc.
In return, disable -Woverloaded-virtual which fires in many places.

The preceding commits fixed the handful of -Wunused-private-field
warnings that clang emitted.
2020-08-04 17:42:08 +02:00
Nico Weber d8b6314018 Build: Support make's and ninja's restat optimization
After running a build command, make by default stat()s the command's
output, and if it wasn't touched, then it cancels all build steps
that were scheduled only because this command was expected to change
the output.

Ninja has the same feature, but it's opt-in behind the per-command
"restat = 1" setting. However, CMake enables it by default for all
custom commands.

Use Meta/write-only-on-difference.sh to write the output to a temporary
file, and then copy the temporary file only to the final location if the
contents of the output have changed since last time.
write-only-on-difference.sh automatically creates the output's parent
directory, so stop doing that in CMake.

Reduces the number of build steps that run after touching a file
in LibCore from 522 to 312.

Since we now no longer trigger the CMake special case "If COMMAND
specifies an executable target name (created by the add_executable()
command), it will automatically be replaced by the location of the
executable created at build time", we now need to use qualified paths to
the generators.

Somewhat related to #2877.
2020-08-04 15:58:08 +02:00
Emanuele Torre 75a4b1a27e Build: Use -fconcepts flag to enable C++20 concepts. 2020-08-01 10:44:42 +02:00
Andreas Kling dc4327c54b Build: Remove two unnecessary CXXFLAGS
Seems like we can build without these two flags now:

    -Wno-sized-deallocation
    -fno-sized-deallocation

I don't remember why they were needed in the first place.
2020-07-24 02:57:11 +02:00
Andreas Kling 91f25c8f91 Build: Build with minimal debug info (-g1)
This allows us to look up source file/line information from addresses
without bloating the build too much. It could probably be made smaller
with some tricks.
2020-07-21 19:08:01 +02:00
Stefano Cristiano a1e1aa96fb Toolchain: Allow building using CMake on macOS 2020-07-13 08:46:44 +02:00
Linus Groh 4684e9a80f Build: Support GENERATED_SOURCES in serenity_{bin,libc}() as well 2020-06-21 20:24:28 +02:00
Emanuele Torre 22aa4cbf92 Build: rename image target => qemu-image
Also add a new `image` target which is just an alias to `qemu-image`.

This makes the CMakeLists.txt file more readable in my opinion.
2020-06-21 10:13:04 +02:00
Emanuele Torre 4a784d4d1b Meta: get rid of sync.sh using the technique used in the previous commit 2020-06-21 10:13:04 +02:00
Nico Weber 35c4a4971a CMake: Make the install step more zen
The "Installing $foo..." messages are just noise, so turn them off.
2020-06-19 20:34:25 +02:00
Nico Weber e162b59a5e cmake: Make setting CMAKE_BUILD_TYPE an error.
I tried setting it to Release, then noticed that it didn't build
due to gcc's optimizer-level dependent warnings and -Werror, then
started fixing the warnings for a bit (all false positives),
then looked at the global CMakeLists.txt and realized that the
default build is aleady using compiler optimizations. It looks like
people aren't supposed to change this, so make that explicit to
be friendly to people familiar with cmake but new to serenity.
2020-06-06 10:04:29 +02:00
Paul Redmond 4d4e578edf Ports: Fix CMake-based ports
The SDL port failed to build because the CMake toolchain filed pointed
to the old root. Now the toolchain file assumes that the Root is in
Build/Root.

Additionally, the AK/ and Kernel/ headers need to be installed in the
root too.
2020-05-29 20:21:10 +02:00
Emanuele Torre 83c11434e4 CMake: Add convenience targets to run lint-shell-scripts and check-style 2020-05-29 07:59:45 +02:00
etaIneLp 330aecb5d8
Build: Use a separate byproduct name for the GRUB disk image (#2424)
The grub-image target no longer conflicts with normal image target.
This unbreaks using CMake with Ninja.

Fixes #2423.
2020-05-28 10:08:38 +02:00
etaIneLp 775d44efb5 Build: Add grub-image target to CMake 2020-05-28 00:50:55 +02:00
Andreas Kling 250c3b363d Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem"
This reverts commit c1eb744ff0.
2020-05-20 16:24:26 +02:00
Andrew Kaster c1eb744ff0 Build: Include headers from LibC, LibM, and LibPthread with -isystem
Make sure that userspace is always referencing "system" headers in a way
that would build on target :). This means removing the explicit
include_directories of Libraries/LibC in favor of having it export its
headers as SYSTEM. Also remove a redundant include_directories of
Libraries in the 'serenity build' part of the build script. It's already
set at the top.

This causes issues for the Kernel, and for crt0.o. These special cases
are handled individually.
2020-05-20 08:37:50 +02:00
Dominik Madarasz b7357d1a3a Build: Use -Wno-expansion-to-defined 2020-05-16 22:41:09 +02:00
Andreas Kling c12cfdea87 Build: Remove -Wno-volatile flag
I've fixed all the warnings about invalid use of the "volatile" keyword
so it should be fine to enable this now.
2020-05-16 11:35:16 +02:00
Andreas Kling 76bcd284f9 AK: Remove experimental clang -Wconsumed stuff
This stopped working quite some time ago due to Clang losing track of
typestates for some reason and everything becoming "unknown".

Since we're primarily using GCC anyway, it doesn't seem worth it to try
and maintain this non-working experiment for a secondary compiler.

Also it doesn't look like the Clang team is actively maintaining this
flag anyway. So good-bye, -Wconsumed. :/
2020-05-16 10:55:54 +02:00
Shannon Booth 3d153e5ed3 Build: Disable deprecated volatile warning
We will probably need to fix this at some stage, but for now let's just
disable the warning.
2020-05-16 09:51:31 +02:00
Sergey Bugaev 32f8e57834 Build: Ask GCC to always emit colorful diagnostics 2020-05-15 10:01:35 +02:00
Sergey Bugaev 486540fa90 Build: Allow using CMake 3.16
Because apparently that's what a lot of people have,
and they report it works fine.
2020-05-15 10:01:35 +02:00
Sergey Bugaev 450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00