You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/01/09 23:35:02 UTC
[arrow] branch master updated: ARROW-4197: [C++] Better Emscripten
support
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new a80c27e ARROW-4197: [C++] Better Emscripten support
a80c27e is described below
commit a80c27e46814ded00216cc48f83e3fedbfb9cf4f
Author: Tim Paine <t....@gmail.com>
AuthorDate: Wed Jan 9 17:34:53 2019 -0600
ARROW-4197: [C++] Better Emscripten support
A few changes for better compatibility with the Emscripten compiler for WebAssembly
- expose the `-ggdb` flag as an option (unsupported by emscripten)
- the `-undefined dynamic_lookup` flag should be set on apple, but not when using emscripten
- allow for `backtrace` to be turned off even if found (no `execinfo.h` available, from `util/logging.cc`)
Author: Tim Paine <t....@gmail.com>
Closes #3350 from timkpaine/emscripten and squashes the following commits:
e3661ff52 <Tim Paine> restore default ggdb behavior, use better environment variable to detect emscripten and add a comment explaining this
a0e91a77c <Tim Paine> expose backtrace at top level, re-add -g, make backtrace private scope again
b8f0c8068 <Tim Paine> Merge branch 'master' into emscripten
5308f6b49 <Tim Paine> fix for emscripten
---
cpp/CMakeLists.txt | 8 ++++++++
cpp/cmake_modules/BuildUtils.cmake | 5 ++++-
cpp/cmake_modules/SetupCxxFlags.cmake | 16 ++++++++++++----
cpp/src/arrow/CMakeLists.txt | 2 +-
4 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 3d2b698..4232af3 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -170,6 +170,10 @@ static|shared (default shared)")
"If off, 'quiet' flags will be passed to linting tools"
OFF)
+ option(ARROW_GGDB_DEBUG
+ "Pass -ggdb flag to debug builds"
+ ON)
+
#----------------------------------------------------------------------
# Project components to enable / disable building
@@ -249,6 +253,10 @@ Note that this requires linking Boost statically"
"Rely on Protocol Buffers shared libraries where relevant"
OFF)
+ option(ARROW_WITH_BACKTRACE
+ "Build with backtrace support"
+ ON)
+
option(ARROW_USE_GLOG
"Build libraries with glog support for pluggable logging"
ON)
diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
index 77db28e..cf2145b 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -182,11 +182,14 @@ function(ADD_ARROW_LIB LIB_NAME)
${ARG_PRIVATE_INCLUDES})
endif()
- if(APPLE)
+ if(APPLE AND NOT DEFINED $ENV{EMSCRIPTEN})
# On OS X, you can avoid linking at library load time and instead
# expecting that the symbols have been loaded separately. This happens
# with libpython* where there can be conflicts between system Python and
# the Python from a thirdparty distribution
+ #
+ # When running with the Emscripten Compiler, we need not worry about
+ # python, and the Emscripten Compiler does not support this option.
set(ARG_SHARED_LINK_FLAGS
"-undefined dynamic_lookup ${ARG_SHARED_LINK_FLAGS}")
endif()
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index 1160835..796a68d 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -340,11 +340,19 @@ endif()
# Debug symbols are stripped for reduced binary size. Add
# -DARROW_CXXFLAGS="-g" to add them
if (NOT MSVC)
- set(C_FLAGS_DEBUG "-ggdb -O0")
- set(C_FLAGS_FASTDEBUG "-ggdb -O1")
+ if(ARROW_GGDB_DEBUG)
+ set(C_FLAGS_DEBUG "-ggdb -O0")
+ set(C_FLAGS_FASTDEBUG "-ggdb -O1")
+ set(CXX_FLAGS_DEBUG "-ggdb -O0")
+ set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
+ else()
+ set(C_FLAGS_DEBUG "-g -O0")
+ set(C_FLAGS_FASTDEBUG "-g -O1")
+ set(CXX_FLAGS_DEBUG "-g -O0")
+ set(CXX_FLAGS_FASTDEBUG "-g -O1")
+ endif()
+
set(C_FLAGS_RELEASE "-O3 -DNDEBUG")
- set(CXX_FLAGS_DEBUG "-ggdb -O0")
- set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
set(CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index 91bdce2..59f0357 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -257,7 +257,7 @@ find_package(Backtrace)
foreach(LIB_TARGET ${ARROW_LIBRARIES})
target_compile_definitions(${LIB_TARGET}
PRIVATE ARROW_EXPORTING)
- if (Backtrace_FOUND)
+ if (Backtrace_FOUND AND ARROW_WITH_BACKTRACE)
target_compile_definitions(${LIB_TARGET}
PRIVATE ARROW_WITH_BACKTRACE)
endif()