third-party: build all deps with debugging symbols (#8042)

When building with CMAKE_BUILD_TYPE=Debug, the dependencies are built like this:

| Dep        | Defaults  | Debug                                       |
|------------|-----------|---------------------------------------------|
| unibilium  | `-O2`     | `make CFLAGS=-O0 DEBUG=1`                   |
| msgpack    | `-g -O3`  | `cmake . -DCMAKE_C_FLAGS_DEBUG="-O0 -ggdb"` |
| libuv      | `-g -O2`  | `./configure CFLAGS="-O0 -ggdb"`            |
| luv        | `-g -O2`  | `cmake . -DCMAKE_C_FLAGS_DEBUG="-O0 -ggdb"` |
| libvterm   | not set   | `make CFLAGS=-O0 DEBUG=1`                   |
| libtermkey | not set   | `make CFLAGS=-O0 DEBUG=1`                   |
| jemalloc   | `-g3 -O3` | `./configure CFLAGS="-O0 -ggdb"`            |
| gperf      | `-g -O2`  | `./configure CXXFLAGS="-O0 -ggdb"`          |
| luajit     | `-g -O2`  | haven't checked yet                         |

This means that only unibilium, libtermkey, and libvterm don't build with
debugging symbols by default.

Build them with debugging symbols and optimisations that don't hinder
debugging: -Og -g
This commit is contained in:
Marco Hinz
2018-03-01 10:23:21 +01:00
committed by GitHub
parent ba87a2cde7
commit 3d2f4154b1
4 changed files with 16 additions and 3 deletions

View File

@@ -2,6 +2,9 @@
cmake_minimum_required (VERSION 2.8.7)
project(NVIM_DEPS)
# Needed for: check_c_compiler_flag()
include(CheckCCompilerFlag)
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@@ -11,6 +14,13 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-g)
check_c_compiler_flag(-Og HAS_OG_FLAG)
if(HAS_OG_FLAG)
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif()
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.")
set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.")

View File

@@ -43,6 +43,7 @@ ExternalProject_Add(libtermkey
PREFIX=${DEPS_INSTALL_DIR}
PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig
CFLAGS=-fPIC
${DEFAULT_MAKE_CFLAGS}
install)
endif()

View File

@@ -47,9 +47,10 @@ if(WIN32)
set(LIBVTERM_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
else()
set(LIBVTERM_INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS=-fPIC
install)
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS=-fPIC
${DEFAULT_MAKE_CFLAGS}
install)
endif()
BuildLibvterm(CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}

View File

@@ -20,6 +20,7 @@ ExternalProject_Add(unibilium
BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS=-fPIC
${DEFAULT_MAKE_CFLAGS}
INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install)
list(APPEND THIRD_PARTY_DEPS unibilium)