CMakeLists.txt 3.38 KB
Newer Older
1
2
3
4
5
6
7
8
# ----------------------------------------------------------------------------
#   Copyright (c) 2018 Armin Sobhani <arminms@gmail.com>
# 
#   Distributed under the Boost Software License Version 1.0.
#   (See accompanying file LICENSE_1_0.txt or copy at
#   http:www.boost.org/LICENSE_1_0.txt)
# 
# ----------------------------------------------------------------------------
Armin Sobhani's avatar
Armin Sobhani committed
9
10
11
12
13

cmake_minimum_required(VERSION 2.8)

project(BoostBioseq)

14
15
16
17
# find OpenCL
find_package(OpenCL REQUIRED)
include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})

Armin Sobhani's avatar
Armin Sobhani committed
18
# find Boost
19
find_package(Boost 1.53 REQUIRED)
Armin Sobhani's avatar
Armin Sobhani committed
20
21
22
23
24
25
26
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

# check for c++11
if(NOT MSVC)
    include(CheckCXXCompilerFlag)
    CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
    if(NOT COMPILER_SUPPORTS_CXX11) 
27
      CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
Armin Sobhani's avatar
Armin Sobhani committed
28
29
30
31
32
33
34
    endif()
    if(COMPILER_SUPPORTS_CXX11)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    elseif(COMPILER_SUPPORTS_CXX0X)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
    else()
        message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
35
    endif()
Armin Sobhani's avatar
Armin Sobhani committed
36
37
38
39
40
41
42
43
44
endif()

# optional third-party libraries
# option(BOOST_BIOSEQ_HAVE_TBB "Have TBB" OFF)

include_directories(include)

if(WIN32)
  # optional support for boost dynamic libraries
Armin Sobhani's avatar
Armin Sobhani committed
45
  option(BOOST_BIOSEQ_BOOST_ALL_DYN_LINK "Use boost dynamic link libraries" ON)
Armin Sobhani's avatar
Armin Sobhani committed
46
47
48
  if(${BOOST_BIOSEQ_BOOST_ALL_DYN_LINK})
    add_definitions(-DBOOST_ALL_DYN_LINK)
  else()
49
    # for default use static libs
Armin Sobhani's avatar
Armin Sobhani committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    set(Boost_USE_STATIC_LIBS ON)
  endif()
  link_directories(${Boost_LIBRARY_DIRS})
endif()

# Visual Studio C++
if(MSVC)
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  add_definitions(-D_SCL_SECURE_NO_WARNINGS)
  add_definitions(-D_HAS_ITERATOR_DEBUGGING=0)
  add_definitions(-DNOMINMAX)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4003") # Not enough actual parameters for a BOOST_PP macro
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") # Warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4305") # Warning C4305: 'initializing': truncation from 'double' to 'float'
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") # Warning C4800: 'uint32_t' : forcing value to bool 'true' or 'false' (performance warning)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4838") # Warning C4838: conversion from 'double' to 'float' requires a narrowing conversion
endif()

option(BOOST_BIOSEQ_BUILD_TESTS "Build the Boost.Bioseq tests" ON)
if(${BOOST_BIOSEQ_BUILD_TESTS})
  enable_testing()
  add_subdirectory(test)
endif()

76
77
78
79
option(BOOST_BIOSEQ_BUILD_BENCHMARKS "Build the Boost.Bioseq benchmarks" ON)
if(${BOOST_BIOSEQ_BUILD_BENCHMARKS})
  add_subdirectory(perf)
endif()
Armin Sobhani's avatar
Armin Sobhani committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

# option(BOOST_BIOSEQ_BUILD_EXAMPLES "Build the Boost.Bioseq examples" OFF)
# if(${BOOST_BIOSEQ_BUILD_EXAMPLES})
#   add_subdirectory(example)
# endif()

# configure cmake config file
configure_file(
  cmake/BoostBioseqConfig.cmake.in
  ${BoostBioseq_BINARY_DIR}/BoostBioseqConfig.cmake
  @ONLY
)

# install cmake config file
install(
  FILES ${BoostBioseq_BINARY_DIR}/BoostBioseqConfig.cmake
  DESTINATION lib/cmake/BoostBioseq
)

# install header files
install(DIRECTORY include/boost DESTINATION include/bioseq)