Skip to content

Commit

Permalink
Don't link in python if we build without python
Browse files Browse the repository at this point in the history
  • Loading branch information
pranjalv123 committed Jun 12, 2019
1 parent 6bc2f56 commit 90763d0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 2.6)
project (phylokit)

OPTION(BUILD_STATIC "build static library (otherwise build shared [ default ])" ON)
OPTION(BUILD_PYTHON "build static library (otherwise build shared [ default ])" OFF)

file(GLOB SOURCES *.cpp util/*.cpp)
file(GLOB HEADERS *.hpp)
Expand All @@ -14,23 +15,28 @@ add_definitions(-std=c++14 -g -O3 -Wall)
endif()
find_package(Boost)
if(Boost_FOUND)
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" /usr/include/python2.7)
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" )
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost 1.45.0 COMPONENTS python)

ADD_LIBRARY(phylokit_python SHARED pyext/bindings.cxx ${SOURCES} )
SET_TARGET_PROPERTIES(phylokit_python PROPERTIES OUTPUT_NAME pyphylokit)
TARGET_LINK_LIBRARIES(phylokit_python ${Boost_LIBRARIES} )

if (BUILD_PYTHON)
FIND_PACKAGE(Boost 1.45.0 COMPONENTS python)
INCLUDE_DIRECTORIES(/usr/include/python2.7)
ADD_LIBRARY(phylokit_python SHARED pyext/bindings.cxx ${SOURCES} )
SET_TARGET_PROPERTIES(phylokit_python PROPERTIES OUTPUT_NAME pyphylokit)
TARGET_LINK_LIBRARIES(phylokit_python ${Boost_LIBRARIES} )
endif()


elseif(NOT Boost_FOUND)
IF (WIN32)
INCLUDE_DIRECTORIES("boost/")
else()
INCLUDE_DIRECTORIES("boost/" /usr/include/python2.7)
INCLUDE_DIRECTORIES("boost/" )
IF (BUILD_PYTHON)
INCLUDE_DIRECTORIES(/usr/include/python2.7)
ENDIF()
ENDIF()
endif()

Expand Down

0 comments on commit 90763d0

Please sign in to comment.