CMake fixes for absl
Update to build with C++17, as absl is built in C++17 mode, and its symbols include things like std::string_view. Tweak CMake to force libbloaty as a static library and enable position indepent code to resolve linking errors.
This commit is contained in:
parent
a3bcb8db5e
commit
6f9e0d9780
@ -1,7 +1,17 @@
|
||||
diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
--- ./CMakeLists.txt.1 2020-05-24 00:36:23.000000000 -0400
|
||||
+++ ./CMakeLists.txt 2020-05-26 21:06:16.035802108 -0400
|
||||
@@ -36,6 +36,8 @@ else(${PKG_CONFIG_FOUND})
|
||||
+++ ./CMakeLists.txt 2020-12-19 12:32:29.021943521 -0500
|
||||
@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.5)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
project (Bloaty VERSION 1.0)
|
||||
project (Bloaty VERSION 1.1)
|
||||
-set(CMAKE_CXX_STANDARD 11)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Options we define for users.
|
||||
option(BLOATY_ENABLE_ASAN "Enable address sanitizer." OFF)
|
||||
@@ -36,6 +37,8 @@ else(${PKG_CONFIG_FOUND})
|
||||
endif(${PKG_CONFIG_FOUND})
|
||||
endif(UNIX)
|
||||
|
||||
@ -10,7 +20,7 @@ diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
# Set default build type.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
|
||||
@@ -89,7 +91,6 @@ endif(UNIX)
|
||||
@@ -89,11 +92,10 @@ endif(UNIX)
|
||||
|
||||
include_directories(.)
|
||||
include_directories(src)
|
||||
@ -18,7 +28,21 @@ diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")
|
||||
|
||||
# Baseline build flags.
|
||||
@@ -159,6 +160,13 @@ add_library(libbloaty
|
||||
-set(CMAKE_CXX_FLAGS "-std=c++11 -W -Wall -Wno-sign-compare")
|
||||
+set(CMAKE_CXX_FLAGS "-W -Wall -Wno-sign-compare")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g1")
|
||||
@@ -149,7 +151,7 @@ endif(${PROTOC_FOUND})
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/bloaty_package.bloaty
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
-add_library(libbloaty
|
||||
+add_library(libbloaty STATIC
|
||||
src/bloaty.cc
|
||||
src/demangle.cc
|
||||
src/disassemble.cc
|
||||
@@ -159,6 +161,13 @@ add_library(libbloaty
|
||||
src/macho.cc
|
||||
src/range_map.cc
|
||||
src/webassembly.cc
|
||||
@ -32,7 +56,7 @@ diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
# Until Abseil has a proper CMake build system
|
||||
third_party/abseil-cpp/absl/base/internal/raw_logging.cc # Grrrr...
|
||||
third_party/abseil-cpp/absl/base/internal/throw_delegate.cc
|
||||
@@ -179,7 +187,8 @@ add_library(libbloaty
|
||||
@@ -179,7 +188,8 @@ add_library(libbloaty
|
||||
third_party/abseil-cpp/absl/types/bad_optional_access.cc
|
||||
# One source file, no special build system needed.
|
||||
third_party/demumble/third_party/libcxxabi/cxa_demangle.cpp
|
||||
@ -42,7 +66,7 @@ diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
|
||||
if(UNIX)
|
||||
set(LIBBLOATY_LIBS libbloaty)
|
||||
@@ -249,9 +258,8 @@ else()
|
||||
@@ -249,9 +259,8 @@ else()
|
||||
enable_testing()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
@ -54,7 +78,7 @@ diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
|
||||
|
||||
set(TEST_TARGETS
|
||||
bloaty_test
|
||||
@@ -261,7 +269,7 @@ else()
|
||||
@@ -261,7 +270,7 @@ else()
|
||||
|
||||
foreach(target ${TEST_TARGETS})
|
||||
add_executable(${target} tests/${target}.cc)
|
||||
|
@ -38,7 +38,6 @@ support for WebAssembly.
|
||||
%build
|
||||
%cmake \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBLOATY_ENABLE_CMAKETARGETS=OFF \
|
||||
-DBUILD_TESTING=ON
|
||||
%cmake_build
|
||||
|
Loading…
Reference in New Issue
Block a user