Skip to content

Commit

Permalink
Fix gflags support for command-line interface
Browse files Browse the repository at this point in the history
This removes our custom gflags find module and uses gflags 2.1's package
configuration. This also updates Travis to install gflags from source
(since the default ubuntu package is out of date).

Fixes #1.
  • Loading branch information
gadomski committed Jan 30, 2015
1 parent 68c6b20 commit a8e6b04
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 37 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install:
- sudo apt-get install liblapack-dev libarpack2-dev libsuperlu3-dev gfortran
- scripts/install_armadillo.sh
- scripts/install_figtree.sh
- scripts/install_gflags.sh
- sudo pip install cpp-coveralls

before_script:
Expand Down
21 changes: 19 additions & 2 deletions cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
find_package(gflags REQUIRED)
find_package(gflags 2.1.1 REQUIRED)

option(USE_GFLAGS_SHARED "Build against shared gflags library instead of static" OFF)
option(USE_GFLAGS_THREADED "Build against threaded gflags library instead of non-threaded" ON)

if (USE_GFLAGS_SHARED)
if (USE_GFLAGS_THREADED)
set(GFLAGS_TARGET gflags-shared)
else(USE_GFLAGS_THREADED)
set(GFLAGS_TARGET gflags_nothreads-shared)
endif(USE_GFLAGS_THREADED)
else(USE_GFLAGS_SHARED)
if (USE_GFLAGS_THREADED)
set(GFLAGS_TARGET gflags-static)
else(USE_GFLAGS_THREADED)
set(GFLAGS_TARGET gflags_nothreads-static)
endif(USE_GFLAGS_THREADED)
endif(USE_GFLAGS_SHARED)

include_directories(
${CPD_INCLUDE_DIR}
Expand All @@ -13,7 +30,7 @@ add_executable(${CPD_CLI_TARGET} ${SRC})
set_property(TARGET ${CPD_CLI_TARGET} PROPERTY OUTPUT_NAME cpd)
target_link_libraries(${CPD_CLI_TARGET}
${CPD_LIB_TARGET}
${GFLAGS_LIBRARIES}
${GFLAGS_TARGET}
)
install(TARGETS ${CPD_CLI_TARGET}
DESTINATION bin
Expand Down
35 changes: 0 additions & 35 deletions cmake/Findgflags.cmake

This file was deleted.

1 change: 1 addition & 0 deletions scripts/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mkdir build && cd build
cmake .. \
-DBUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLI=ON \
-DBUILD_64BIT=$BUILD_64BIT \
-DBUILD_COVERAGE=$CPD_BUILD_COVERAGE \
-DUSE_ARMA_WRAPPER=$USE_ARMA_WRAPPER && \
Expand Down
8 changes: 8 additions & 0 deletions scripts/install_gflags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
wget https://github.com/schuhschuh/gflags/archive/v2.1.1.tar.gz
tar xzvf v2.1.1.tar.gz
cd gflags-2.1.1
mkdir build
cd build
cmake ..
make
sudo make install

0 comments on commit a8e6b04

Please sign in to comment.