mold/0001-Use-system-compatible-...

58 lines
1.7 KiB
Diff
Raw Normal View History

2022-09-29 14:55:45 +00:00
From db11436c0ccbfee0f617ae7498c25fb2f4e76626 Mon Sep 17 00:00:00 2001
Message-Id: <db11436c0ccbfee0f617ae7498c25fb2f4e76626.1664460024.git.github@sicherha.de>
2022-08-18 12:37:59 +00:00
From: Christoph Erhardt <github@sicherha.de>
2022-09-29 14:55:45 +00:00
Date: Tue, 27 Sep 2022 13:32:57 +0200
Subject: [PATCH 1/2] Use system-compatible include path for `xxhash.h`
2022-08-18 12:37:59 +00:00
Distributors that build mold against the system-provided xxHash package
expect its header file `xxhash.h` in the top-level include directory,
not in an `xxhash` subdirectory. Adjust the include path and the
`#include` directive accordingly.
---
2022-09-29 14:55:45 +00:00
CMakeLists.txt | 2 ++
Makefile | 1 +
mold.h | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
2022-08-18 12:37:59 +00:00
2022-09-29 14:55:45 +00:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79c035d5..520c7bdf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,6 +126,8 @@ else()
mold_add_tbb()
endif()
+target_include_directories(mold PRIVATE third-party/xxhash)
+
if(WIN32)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR
2022-08-18 12:37:59 +00:00
diff --git a/Makefile b/Makefile
2022-09-29 14:55:45 +00:00
index 2d14c85f..40fa5aab 100644
2022-08-18 12:37:59 +00:00
--- a/Makefile
+++ b/Makefile
2022-09-29 14:55:45 +00:00
@@ -59,6 +59,7 @@ CXXFLAGS = -O2
2022-08-18 12:37:59 +00:00
MOLD_CXXFLAGS := -std=c++20 -fno-exceptions -fno-unwind-tables \
-fno-asynchronous-unwind-tables \
2022-09-29 14:55:45 +00:00
+ -Ithird-party/xxhash \
-Wno-sign-compare -Wno-unused-function \
2022-08-18 12:37:59 +00:00
-DMOLD_VERSION=\"$(VERSION)\" -DLIBDIR="\"$(LIBDIR)\""
diff --git a/mold.h b/mold.h
2022-09-29 14:55:45 +00:00
index b1b859bd..c8dbfcf2 100644
2022-08-18 12:37:59 +00:00
--- a/mold.h
+++ b/mold.h
@@ -32,7 +32,7 @@
#endif
#define XXH_INLINE_ALL 1
-#include "third-party/xxhash/xxhash.h"
+#include <xxhash.h>
2022-09-04 20:57:16 +00:00
#ifdef NDEBUG
# define unreachable() __builtin_unreachable()
2022-08-18 12:37:59 +00:00
--
2022-09-29 14:55:45 +00:00
2.37.3
2022-08-18 12:37:59 +00:00