summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/yap/cmake/dependencies.cmake
blob: b246e887774362428761492c59f6e57c0784c1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright Louis Dionne 2016
# Copyright Zach Laine 2016
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

###############################################################################
# Boost
###############################################################################
find_package(Boost COMPONENTS)
if (Boost_INCLUDE_DIRS)
  add_library(boost INTERFACE)
  target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIRS})
else ()
  message("-- Boost was not found; attempting to download it if we haven't already...")
  include(ExternalProject)
  ExternalProject_Add(install-Boost
    PREFIX ${CMAKE_BINARY_DIR}/dependencies/boost_1_68_0
    URL https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
    LOG_DOWNLOAD ON
  )

  ExternalProject_Get_Property(install-Boost SOURCE_DIR)
  add_library(boost INTERFACE)
  target_include_directories(boost INTERFACE ${SOURCE_DIR})
  add_dependencies(boost install-Boost)
  unset(SOURCE_DIR)
endif ()


###############################################################################
# Google Benchmark
###############################################################################
execute_process(
    COMMAND git clone https://github.com/google/benchmark.git
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
    COMMAND git checkout v1.2.0
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/benchmark
)

option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." OFF)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark)


###############################################################################
# Autodiff (see https://github.com/fqiang/autodiff_library)
###############################################################################
add_library(autodiff_library
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/ActNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/BinaryOPNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Edge.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/EdgeSet.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Node.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/OPNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/PNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Stack.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Tape.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/UaryOPNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/VNode.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/autodiff.cpp
)
target_include_directories(autodiff_library PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library)
target_compile_definitions(autodiff_library PUBLIC BOOST_ALL_NO_LIB=1)
target_link_libraries(autodiff_library boost)