Skip to content

Commit 8daf756

Browse files
wesmkou
authored andcommitted
ARROW-9446: [C++] Add compiler id, version, and build flags to BuildInfo
Example output: ``` In [1]: pa.show_versions() pyarrow version info -------------------- Package kind: not indicated Arrow C++ library version: 1.0.0-SNAPSHOT Arrow C++ compiler: GNU 8.4.0 Arrow C++ compiler flags: -fdiagnostics-color=always -O3 -DNDEBUG Arrow C++ git revision: feda987 Arrow C++ git description: apache-arrow-0.17.0-708-gfeda9877f-dirty ``` Closes #7738 from wesm/cxxflags-build-info Authored-by: Wes McKinney <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent feda987 commit 8daf756

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

cpp/src/arrow/config.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ static const BuildInfo kBuildInfo = {
2929
ARROW_VERSION_STRING,
3030
ARROW_SO_VERSION,
3131
ARROW_FULL_SO_VERSION,
32+
ARROW_CXX_COMPILER_ID,
33+
ARROW_CXX_COMPILER_VERSION,
34+
ARROW_CXX_COMPILER_FLAGS,
3235
ARROW_GIT_ID,
3336
ARROW_GIT_DESCRIPTION,
3437
ARROW_PACKAGE_KIND,

cpp/src/arrow/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ struct BuildInfo {
3737
std::string version_string;
3838
std::string so_version;
3939
std::string full_so_version;
40+
std::string compiler_id;
41+
std::string compiler_version;
42+
std::string compiler_flags;
4043
std::string git_id;
4144
std::string git_description;
4245
std::string package_kind;

cpp/src/arrow/util/config.h.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#define ARROW_SO_VERSION "@ARROW_SO_VERSION@"
2626
#define ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@"
2727

28+
#define ARROW_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
29+
#define ARROW_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
30+
#define ARROW_CXX_COMPILER_FLAGS "@CMAKE_CXX_FLAGS@"
31+
2832
#define ARROW_GIT_ID "@ARROW_GIT_ID@"
2933
#define ARROW_GIT_DESCRIPTION "@ARROW_GIT_DESCRIPTION@"
3034

python/pyarrow/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ def show_versions():
7777
print("Package kind: {}".format(cpp_build_info.package_kind
7878
if len(cpp_build_info.package_kind) > 0
7979
else "not indicated"))
80-
print("Arrow C++ library version: {}".format(cpp_build_info.version))
81-
print("Arrow C++ git revision: {}".format(cpp_build_info.git_id))
82-
print("Arrow C++ git description: {}"
80+
print("Arrow C++ library version: {0}".format(cpp_build_info.version))
81+
print("Arrow C++ compiler: {0} {1}"
82+
.format(cpp_build_info.compiler_id, cpp_build_info.compiler_version))
83+
print("Arrow C++ compiler flags: {0}"
84+
.format(cpp_build_info.compiler_flags))
85+
print("Arrow C++ git revision: {0}".format(cpp_build_info.git_id))
86+
print("Arrow C++ git description: {0}"
8387
.format(cpp_build_info.git_description))
8488

8589

python/pyarrow/config.pxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ VersionInfo = namedtuple('VersionInfo', ('major', 'minor', 'patch'))
2525
BuildInfo = namedtuple(
2626
'BuildInfo',
2727
('version', 'version_info', 'so_version', 'full_so_version',
28+
'compiler_id', 'compiler_version', 'compiler_flags',
2829
'git_id', 'git_description', 'package_kind'))
2930

3031
cdef _build_info():
@@ -39,6 +40,9 @@ cdef _build_info():
3940
c_info.version_patch),
4041
so_version=frombytes(c_info.so_version),
4142
full_so_version=frombytes(c_info.full_so_version),
43+
compiler_id=frombytes(c_info.compiler_id),
44+
compiler_version=frombytes(c_info.compiler_version),
45+
compiler_flags=frombytes(c_info.compiler_flags),
4246
git_id=frombytes(c_info.git_id),
4347
git_description=frombytes(c_info.git_description),
4448
package_kind=frombytes(c_info.package_kind))

python/pyarrow/includes/libarrow.pxd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil:
5959
c_string version_string
6060
c_string so_version
6161
c_string full_so_version
62+
c_string compiler_id
63+
c_string compiler_version
64+
c_string compiler_flags
6265
c_string git_id
6366
c_string git_description
6467
c_string package_kind

0 commit comments

Comments
 (0)