try to integrate coveralls and improve configure script

This commit is contained in:
Thomas Fussell 2015-11-20 21:30:32 -05:00
parent acfb5c642b
commit 6fd3fef717
4 changed files with 96 additions and 46 deletions

View File

@ -1,21 +1,51 @@
# from: https://github.com/nlohmann/json/blob/master/.travis.yml
language: cpp
script:
- python configure --shared --build-tests --autotest && make -C build
compiler:
- clang
- gcc
install:
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- clang
notifications:
email: false
sudo: false
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'valgrind', 'python-pip', 'python-yaml']
before_script:
- pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
env: COMPILER=g++-4.9
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'valgrind']
env: COMPILER=g++-5
- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: ['clang-3.6', 'valgrind']
env: COMPILER=clang++-3.6
script:
- ./configure --enable-shared --enable-tests
- make -C build CXX=$COMPILER CXXFLAGS="-lstdc++"
- ./bin/xlnt.test
- valgrind --error-exitcode=1 --leak-check=full ./xlnt.test
after_success:
- if [ "$COMPILER" = "g++-4.9" ]; then make -C build clean ; fi
- if [ "$COMPILER" = "g++-4.9" ]; then touch include/xlnt/xlnt_config.hpp ; fi
- if [ "$COMPILER" = "g++-4.9" ]; then make -C build xlnt.test CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER ; fi
- if [ "$COMPILER" = "g++-4.9" ]; then ./bin/xlnt.test ; fi
- if [ "$COMPILER" = "g++-4.9" ]; then coveralls --include source/worksheet/test_worksheet.hpp --gcov-options '\-lp' --gcov 'gcov-4.9' ; fi
notifications:
email: false

View File

@ -67,23 +67,40 @@ SET(MINIZ ../third-party/miniz/miniz.c ../third-party/miniz/miniz.h)
SET(PUGIXML ../third-party/pugixml/src/pugixml.hpp ../third-party/pugixml/src/pugixml.cpp ../third-party/pugixml/src/pugiconfig.hpp)
if(SHARED)
add_library(xlnt SHARED ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
add_library(xlnt.shared SHARED ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
add_definitions(-DXLNT_SHARED)
if(MSVC)
target_compile_definitions(xlnt PRIVATE XLNT_EXPORT=1)
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
target_compile_definitions(xlnt.shared PRIVATE XLNT_EXPORT=1)
set_target_properties(xlnt.shared PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
endif()
else()
add_library(xlnt STATIC ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
endif()
SET_TARGET_PROPERTIES(
xlnt
install(TARGETS xlnt.shared
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR}
)
SET_TARGET_PROPERTIES(
xlnt.shared
PROPERTIES
OUTPUT_NAME xlnt
VERSION ${PROJECT_VERSION_FULL}
SOVERSION ${PROJECT_VERSION}
INSTALL_NAME_DIR "${LIB_DEST_DIR}"
)
)
endif()
if(STATIC)
add_library(xlnt.static STATIC ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
install(TARGETS xlnt.static
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR}
)
SET_TARGET_PROPERTIES(
xlnt.static
PROPERTIES
OUTPUT_NAME xlnt
)
endif()
source_group(xlnt FILES ${ROOT_HEADERS})
source_group(detail FILES ${DETAIL_HEADERS} ${DETAIL_SOURCES})
@ -118,18 +135,11 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../include/xlnt
DESTINATION include
PATTERN ".DS_Store" EXCLUDE
)
install(TARGETS xlnt
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR}
)
install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${LIB_DEST_DIR}/pkgconfig
)

View File

@ -43,7 +43,11 @@ source_group(tests\\workbook FILES ${WORKBOOK_TESTS})
source_group(tests\\worksheet FILES ${WORKSHEET_TESTS})
source_group(runner FILES ${RUNNER})
target_link_libraries(xlnt.test xlnt)
if(SHARED)
target_link_libraries(xlnt.test xlnt.shared)
else()
target_link_libraries(xlnt.test xlnt.static)
endif()
if(MSVC)
set_target_properties(xlnt.test PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")

24
configure vendored
View File

@ -58,7 +58,7 @@ def find_cmake():
return cmake
def parse_args(args):
options = {}
options = {'SHARED' : 1}
generator = default_generator(sys.platform)
if len(args) == 0:
@ -73,18 +73,24 @@ def parse_args(args):
if not option.startswith('--'):
raise Exception('bad option: {}'.format(option))
if option == '--shared':
if option == '--enable-shared':
options['SHARED'] = 1
elif option == '--static':
elif option == '--enable-static':
options['STATIC'] = 1
elif option == '--disable-shared':
options['SHARED'] = 0
elif option == '--build-tests':
elif option == '--disable-static':
options['STATIC'] = 0
elif option == '--enable-tests':
options['BUILD_TESTS'] = 1
elif option == '--autotest':
options['AUTORUN_TESTS'] = 1
elif option == '--coverage':
options['COVERAGE'] = 1
elif option == '--build-examples':
elif option == '--enable-coverage':
options['CALC_COVERAGE'] = 1
elif option == '--enable-examples':
options['BUILD_EXAMPLES'] = 1
elif option == '--enable-benchmarks':
options['BUILD_BENCHMARKS'] = 1
elif option == '--enable-benchmarks':
options['BUILD_BENCHMARKS'] = 1
elif option.startswith('--prefix='):
options['CMAKE_INSTALL_PREFIX'] = option.split('=')[1]
else: