Skip to content
Snippets Groups Projects
CMakeLists.txt 1.36 KiB
Newer Older
Nicolas Mansard's avatar
Nicolas Mansard committed
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE "DEBUG")
ENDIF()

IF(NOT BOOST_NUMPY_DIR)
  SET(BOOST_NUMPY_DIR ".")
ENDIF()

FIND_PACKAGE(Boost 1.45.0)
Nicolas Mansard's avatar
Nicolas Mansard committed

Nicolas Mansard's avatar
Nicolas Mansard committed
IF(Boost_FOUND)
Nicolas Mansard's avatar
Nicolas Mansard committed

Nicolas Mansard's avatar
Nicolas Mansard committed
  INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" "/usr/include/python2.7" "/usr/include/eigen3" "Boost.NumPy")
  LINK_DIRECTORIES(${BOOST_NUMPY_DIR})

  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(simple SHARED src/simple.cpp)
  TARGET_LINK_LIBRARIES(simple ${Boost_LIBRARIES})

  ADD_LIBRARY(mystring SHARED src/mystring.cpp)
  TARGET_LINK_LIBRARIES(mystring ${Boost_LIBRARIES})

  ADD_LIBRARY(bnpy SHARED src/bnpy.cpp)
  TARGET_LINK_LIBRARIES(bnpy ${Boost_LIBRARIES})

  ADD_LIBRARY(eigen SHARED src/eigen.cpp)
  TARGET_LINK_LIBRARIES(eigen ${Boost_LIBRARIES} libboost_numpy.so)

Nicolas Mansard's avatar
Nicolas Mansard committed
  ADD_LIBRARY(eigenc SHARED src/eigenc.cpp)
  TARGET_LINK_LIBRARIES(eigenc ${Boost_LIBRARIES})

  ADD_LIBRARY(eigentemplate SHARED src/eigentemplate.cpp)
  TARGET_LINK_LIBRARIES(eigentemplate ${Boost_LIBRARIES})

Nicolas Mansard's avatar
Nicolas Mansard committed
ELSEIF(NOT Boost_FOUND)
  MESSAGE(FATAL_ERROR "Unable to find correct Boost version. Did you set BOOST_ROOT?")
ENDIF()


IF(CMAKE_COMPILER_IS_GNUCXX)
  ADD_DEFINITIONS("-Wall")
ELSE()
  MESSAGE(FATAL_ERROR "CMakeLists.txt has not been tested/written for your compiler.")
ENDIF()