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 2017/04/16 13:29:23 UTC

arrow git commit: ARROW-832: [C++] Update to gtest 1.8.0, remove now unneeded test_main.cc

Repository: arrow
Updated Branches:
  refs/heads/master ee5cb2ad1 -> dad1a8ee3


ARROW-832: [C++] Update to gtest 1.8.0, remove now unneeded test_main.cc

I haven't tried this out on MSVC yet.

Also includes .gitignore fix for ARROW-821

Author: Wes McKinney <we...@twosigma.com>

Closes #549 from wesm/ARROW-832 and squashes the following commits:

2f246a0 [Wes McKinney] Remove unused CMake variable
7a62cf4 [Wes McKinney] Small fix when ARROW_BUILD_BENCHMARKS=off
8eaa318 [Wes McKinney] Add dependency on gtest for benchmarks
5f692db [Wes McKinney] Update to gtest 1.8.0, remove now unneeded test_main.cc


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/dad1a8ee
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/dad1a8ee
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/dad1a8ee

Branch: refs/heads/master
Commit: dad1a8ee3810d1584b96a5324f0d84215cd48216
Parents: ee5cb2a
Author: Wes McKinney <we...@twosigma.com>
Authored: Sun Apr 16 09:29:15 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sun Apr 16 09:29:15 2017 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt                | 42 ++++++++++++++++++++--------------
 cpp/src/arrow/util/CMakeLists.txt | 25 +++-----------------
 cpp/src/arrow/util/test_main.cc   | 26 ---------------------
 python/.gitignore                 |  2 +-
 4 files changed, 29 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/dad1a8ee/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 83610d3..08120e9 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -43,7 +43,7 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
 set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
 
 set(GFLAGS_VERSION "2.1.2")
-set(GTEST_VERSION "1.7.0")
+set(GTEST_VERSION "1.8.0")
 set(GBENCHMARK_VERSION "1.1.0")
 set(FLATBUFFERS_VERSION "1.6.0")
 set(JEMALLOC_VERSION "4.4.0")
@@ -458,7 +458,7 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIR})
 # ----------------------------------------------------------------------
 # Enable / disable tests and benchmarks
 
-if(ARROW_BUILD_TESTS)
+if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
   add_custom_target(unittest ctest -L unittest)
 
   if("$ENV{GTEST_HOME}" STREQUAL "")
@@ -472,9 +472,13 @@ if(ARROW_BUILD_TESTS)
 
     set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix/src/googletest_ep")
     set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")
-    set(GTEST_STATIC_LIB "${GTEST_PREFIX}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(GTEST_STATIC_LIB
+      "${GTEST_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(GTEST_MAIN_STATIC_LIB
+      "${GTEST_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}")
     set(GTEST_VENDORED 1)
     set(GTEST_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+                         -DCMAKE_INSTALL_PREFIX=${GTEST_PREFIX}
                          -Dgtest_force_shared_crt=ON
                          -DCMAKE_CXX_FLAGS=${GTEST_CMAKE_CXX_FLAGS})
 
@@ -482,22 +486,11 @@ if(ARROW_BUILD_TESTS)
       # BUILD_BYPRODUCTS is a 3.2+ feature
       ExternalProject_Add(googletest_ep
         URL "https://github.com/google/googletest/archive/release-${GTEST_VERSION}.tar.gz"
-        CMAKE_ARGS ${GTEST_CMAKE_ARGS}
-        # googletest doesn't define install rules, so just build in the
-        # source dir and don't try to install.  See its README for
-        # details.
-        BUILD_IN_SOURCE 1
-        BUILD_BYPRODUCTS "${GTEST_STATIC_LIB}"
-        INSTALL_COMMAND "")
+        CMAKE_ARGS ${GTEST_CMAKE_ARGS})
     else()
       ExternalProject_Add(googletest_ep
         URL "https://github.com/google/googletest/archive/release-${GTEST_VERSION}.tar.gz"
-        CMAKE_ARGS ${GTEST_CMAKE_ARGS}
-        # googletest doesn't define install rules, so just build in the
-        # source dir and don't try to install.  See its README for
-        # details.
-        BUILD_IN_SOURCE 1
-        INSTALL_COMMAND "")
+        CMAKE_ARGS ${GTEST_CMAKE_ARGS})
     endif()
   else()
     find_package(GTest REQUIRED)
@@ -509,9 +502,12 @@ if(ARROW_BUILD_TESTS)
   include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
   ADD_THIRDPARTY_LIB(gtest
     STATIC_LIB ${GTEST_STATIC_LIB})
+  ADD_THIRDPARTY_LIB(gtest_main
+    STATIC_LIB ${GTEST_MAIN_STATIC_LIB})
 
   if(GTEST_VENDORED)
     add_dependencies(gtest googletest_ep)
+    add_dependencies(gtest_main googletest_ep)
   endif()
 
   # gflags (formerly Googleflags) command line parsing
@@ -753,10 +749,22 @@ include_directories(SYSTEM "${HADOOP_HOME}/include")
 ############################################################
 set(ARROW_MIN_TEST_LIBS
   arrow_static
-  arrow_test_main
+  gtest
+  gtest_main
   ${ARROW_BASE_LIBS}
   ${BOOST_REGEX_LIBRARY})
 
+if (APPLE)
+  set(ARROW_MIN_TEST_LIBS
+    ${ARROW_MIN_TEST_LIBS}
+    ${CMAKE_DL_LIBS})
+elseif(NOT MSVC)
+  set(ARROW_MIN_TEST_LIBS
+    ${ARROW_MIN_TEST_LIBS}
+    pthread
+    ${CMAKE_DL_LIBS})
+endif()
+
 set(ARROW_TEST_LINK_LIBS ${ARROW_MIN_TEST_LIBS})
 
 set(ARROW_BENCHMARK_LINK_LIBS

http://git-wip-us.apache.org/repos/asf/arrow/blob/dad1a8ee/cpp/src/arrow/util/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/CMakeLists.txt b/cpp/src/arrow/util/CMakeLists.txt
index 9aa8bae..b22c8ac 100644
--- a/cpp/src/arrow/util/CMakeLists.txt
+++ b/cpp/src/arrow/util/CMakeLists.txt
@@ -32,28 +32,6 @@ install(FILES
 # arrow_test_main
 #######################################
 
-if (ARROW_BUILD_TESTS)
-  add_library(arrow_test_main
-	test_main.cc)
-
-  if (APPLE)
-	  target_link_libraries(arrow_test_main
-        gtest
-        dl)
-	  set_target_properties(arrow_test_main
-        PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
-  elseif(MSVC)
-	  target_link_libraries(arrow_test_main
-        gtest)
-  else()
-	  target_link_libraries(arrow_test_main
-        gtest
-        pthread
-        dl
-	    )
-  endif()
-endif()
-
 if (ARROW_BUILD_BENCHMARKS)
   add_library(arrow_benchmark_main benchmark_main.cc)
   if (APPLE)
@@ -66,6 +44,9 @@ if (ARROW_BUILD_BENCHMARKS)
       pthread
 	  )
   endif()
+
+  # TODO(wesm): Some benchmarks include gtest.h
+  add_dependencies(arrow_benchmark_main gtest)
 endif()
 
 ADD_ARROW_TEST(bit-util-test)

http://git-wip-us.apache.org/repos/asf/arrow/blob/dad1a8ee/cpp/src/arrow/util/test_main.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/test_main.cc b/cpp/src/arrow/util/test_main.cc
deleted file mode 100644
index f928047..0000000
--- a/cpp/src/arrow/util/test_main.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "gtest/gtest.h"
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-
-  int ret = RUN_ALL_TESTS();
-
-  return ret;
-}

http://git-wip-us.apache.org/repos/asf/arrow/blob/dad1a8ee/python/.gitignore
----------------------------------------------------------------------
diff --git a/python/.gitignore b/python/.gitignore
index 4ab8020..ba40c3e 100644
--- a/python/.gitignore
+++ b/python/.gitignore
@@ -16,7 +16,7 @@ Testing/
 *.c
 *.cpp
 pyarrow/version.py
-pyarrow/table_api.h
+pyarrow/*_api.h
 # Python files
 
 # setup.py working directory