Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openbabel/openbabel
Browse files Browse the repository at this point in the history
  • Loading branch information
ghutchis committed Mar 30, 2016
2 parents f96de61 + bdcf6a0 commit 5e6c4f0
Show file tree
Hide file tree
Showing 33 changed files with 11,543 additions and 10,134 deletions.
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
language: cpp

compiler:
- gcc
- clang
matrix:
include:
- compiler: gcc
env: RUN_CTEST='false' FLAGS="-DBUILD_SHARED=OFF -DWITH_INCHI=ON -DWITH_STATIC_INCHI=ON"
- compiler: gcc
env: RUN_CTEST='true' FLAGS="-DPYTHON_BINDINGS=ON -DRUN_SWIG=ON"
- compiler: clang
env: RUN_CTEST='true' FLAGS="-DPYTHON_BINDINGS=ON -DRUN_SWIG=ON"

before_install:
- sudo apt-get update -qq
Expand All @@ -13,8 +18,8 @@ install:
before_script:
- mkdir build
- cd build
- cmake -DCMAKE_CXX_FLAGS="-march=native -mno-avx" -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON ..
- cmake ${FLAGS} ..

script:
- make -j2
- ctest -j 2
- if [ ${RUN_CTEST} = 'true' ]; then ctest -j 2; fi
77 changes: 44 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ else() # Windows - bin dir = lib dir to load libraries
endif(ENABLE_VERSIONED_FORMATS)
endif()
endif()
set(OB_INCLUDE_DIRS "include/openbabel-2.0")
if(NOT DEFINED OB_INCLUDE_DIRS)
set(OB_INCLUDE_DIRS "include/openbabel-2.0")
endif()
set(OB_EXPORTS_FILE "${openbabel_BINARY_DIR}/OpenBabel2_EXPORTS.cmake")
# Ensure a fresh file is made each time CMake is run
file(REMOVE "${OB_EXPORTS_FILE}")
Expand Down Expand Up @@ -150,7 +152,7 @@ if(OPENBABEL_USE_SYSTEM_INCHI)
endif()
else()
message(STATUS "Using included inchi library.")
# set(INCHI_LIBRARY inchi) ... set INCHI_LIBRARY amd INCH_INCLUDE_DIR by commandline
set(INCHI_LIBRARY inchi)
endif()

if(WIN32)
Expand Down Expand Up @@ -308,26 +310,45 @@ if(MINGW)
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-auto-import ${CMAKE_EXE_LINKER_FLAGS}")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
if(NOT GCC_IS_NEWER_THAN_4_0) # GCC 3.x
find_package(Boost)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
add_definitions(-DUSE_BOOST -DHAVE_SHARED_POINTER)
set(SHARED_POINTER true)
else()
message(FATAL_ERROR "Boost is required to compile OpenBabel with GCC 3.x")
endif()
else()
add_definitions(-DHAVE_SHARED_POINTER)
message(STATUS "Checking available shared pointer...")
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <memory>
int main(){ std::shared_ptr<int> p; return 0; }"
HAVE_STD_SHARED_PTR)
check_cxx_source_compiles("#include <memory>
int main(){ std::tr1::shared_ptr<int> p; return 0; }"
HAVE_STD_TR1_SHARED_PTR)
check_cxx_source_compiles("#include <tr1/memory>
int main(){ std::tr1::shared_ptr<int> p; return 0; }"
HAVE_STD_TR1_SHARED_PTR_IN_TR1_HEADER)
if(HAVE_STD_SHARED_PTR)
set(OB_SHARED_PTR_IMPLEMENTATION "std::shared_ptr")
set(OB_SHARED_PTR_HEADER "memory")
set(SHARED_POINTER true)
add_definitions(-DHAVE_SHARED_POINTER)
elseif(HAVE_STD_TR1_SHARED_PTR)
set(OB_SHARED_PTR_IMPLEMENTATION "std::tr1::shared_ptr")
set(OB_SHARED_PTR_HEADER "memory")
set(SHARED_POINTER true)
add_definitions(-DHAVE_SHARED_POINTER)
elseif(HAVE_STD_TR1_SHARED_PTR_IN_TR1_HEADER)
set(OB_SHARED_PTR_IMPLEMENTATION "std::tr1::shared_ptr")
set(OB_SHARED_PTR_HEADER "tr1/memory")
set(SHARED_POINTER true)
add_definitions(-DHAVE_SHARED_POINTER)
else()
find_package(Boost)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
add_definitions(-DUSE_BOOST -DHAVE_SHARED_POINTER)
set(SHARED_POINTER true)
else()
message(FATAL_ERROR "Boost is required to compile OpenBabel with GCC 3.x")
endif()
set(OB_SHARED_PTR_IMPLEMENTATION "boost::shared_ptr")
set(OB_SHARED_PTR_HEADER "boost/memory")
endif()
if (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
set(SHARED_POINTER true)
add_definitions(-DHAVE_SHARED_POINTER)
endif()
message(STATUS "Use ${OB_SHARED_PTR_IMPLEMENTATION} in ${OB_SHARED_PTR_HEADER}")
# Intel C++ Compiler
# Note: Windows version uses different options!
Expand Down Expand Up @@ -381,16 +402,6 @@ if(ENABLE_OPENMP)
endif()
endif()
if(MSVC)
message(STATUS "MSVC_VERSION =" ${MSVC_VERSION})
if (${MSVC_VERSION} EQUAL 1600)
# To be added: AND SP1 OR gcc>4.0
add_definitions(-DHAVE_SHARED_POINTER)
set(SHARED_POINTER true)
message("SHARED_POINTER set")
endif()
endif()
# Some rpath handling for Linux and Mac
if(UNIX AND BUILD_SHARED)
if(APPLE)
Expand Down Expand Up @@ -424,7 +435,7 @@ file(GLOB_RECURSE headers include/openbabel/*.h)
configure_file(${openbabel_SOURCE_DIR}/src/config.h.cmake
${openbabel_BINARY_DIR}/include/openbabel/babelconfig.h)
install(FILES ${openbabel_BINARY_DIR}/include/openbabel/babelconfig.h
DESTINATION include/openbabel-2.0/openbabel)
DESTINATION ${OB_INCLUDE_DIRS}/openbabel)
if(NOT MSVC)
configure_file(${openbabel_SOURCE_DIR}/openbabel-2.0.pc.cmake
${openbabel_BINARY_DIR}/openbabel-2.0.pc @ONLY)
Expand Down Expand Up @@ -458,13 +469,13 @@ else(CAIRO_FOUND)
message(STATUS "Could NOT find Cairo. PNG output will NOT be supported.")
endif(CAIRO_FOUND)
# Should we enable optimizations for the native architecture?
# Should we enable optimizations for the native CPU architecture?
# (this will speed up similarity calculations and maybe those involving Eigen)
if(NOT MSVC)
option(OPTIMIZE_NATIVE "Optimize for native architecture. Turn off if cross-compiling." ON)
option(OPTIMIZE_NATIVE "Optimize for native CPU architecture. Turn off if compiling for distribution/reuse on other machines." OFF)
if(OPTIMIZE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
message(STATUS "Optimizing code for this machine's architecture. Use -DOPTIMIZE_NATIVE=OFF if cross-compiling.")
message(STATUS "Optimizing code for this machine's CPU architecture. Use -DOPTIMIZE_NATIVE=OFF if compiling for distribution/reuse on other machines.")
endif()
endif()
Expand Down
Loading

0 comments on commit 5e6c4f0

Please sign in to comment.