]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | # Copyright Louis Dionne 2016 |
2 | # Copyright Zach Laine 2016 | |
3 | # Distributed under the Boost Software License, Version 1.0. | |
4 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | ############################################################################### | |
7 | # Boost | |
8 | ############################################################################### | |
9 | find_package(Boost COMPONENTS) | |
10 | if (Boost_INCLUDE_DIRS) | |
11 | add_library(boost INTERFACE) | |
12 | target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIRS}) | |
13 | else () | |
14 | message("-- Boost was not found; attempting to download it if we haven't already...") | |
15 | include(ExternalProject) | |
16 | ExternalProject_Add(install-Boost | |
17 | PREFIX ${CMAKE_BINARY_DIR}/dependencies/boost_1_68_0 | |
18 | URL https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2 | |
19 | CONFIGURE_COMMAND "" | |
20 | BUILD_COMMAND "" | |
21 | INSTALL_COMMAND "" | |
22 | LOG_DOWNLOAD ON | |
23 | ) | |
24 | ||
25 | ExternalProject_Get_Property(install-Boost SOURCE_DIR) | |
26 | add_library(boost INTERFACE) | |
27 | target_include_directories(boost INTERFACE ${SOURCE_DIR}) | |
28 | add_dependencies(boost install-Boost) | |
29 | unset(SOURCE_DIR) | |
30 | endif () | |
31 | ||
20effc67 TL |
32 | set_target_properties(boost |
33 | PROPERTIES | |
34 | INTERFACE_COMPILE_FEATURES cxx_decltype_auto | |
35 | ) | |
92f5a8d4 TL |
36 | |
37 | ############################################################################### | |
38 | # Google Benchmark | |
39 | ############################################################################### | |
92f5a8d4 | 40 | |
20effc67 TL |
41 | if(YAP_BUILD_PERF) |
42 | execute_process( | |
43 | COMMAND git clone https://github.com/google/benchmark.git | |
44 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
45 | ) | |
46 | execute_process( | |
47 | COMMAND git checkout v1.5.0 | |
48 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/benchmark | |
49 | ) | |
50 | set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) | |
51 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark) | |
52 | endif() | |
92f5a8d4 TL |
53 | |
54 | ||
55 | ############################################################################### | |
56 | # Autodiff (see https://github.com/fqiang/autodiff_library) | |
57 | ############################################################################### | |
20effc67 TL |
58 | |
59 | if(YAP_BUILD_EXAMPLE) | |
92f5a8d4 TL |
60 | add_library(autodiff_library |
61 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/ActNode.cpp | |
62 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/BinaryOPNode.cpp | |
63 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Edge.cpp | |
64 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/EdgeSet.cpp | |
65 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Node.cpp | |
66 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/OPNode.cpp | |
67 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/PNode.cpp | |
68 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Stack.cpp | |
69 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/Tape.cpp | |
70 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/UaryOPNode.cpp | |
71 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/VNode.cpp | |
72 | ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library/autodiff.cpp | |
73 | ) | |
74 | target_include_directories(autodiff_library PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/example/autodiff_library) | |
75 | target_compile_definitions(autodiff_library PUBLIC BOOST_ALL_NO_LIB=1) | |
76 | target_link_libraries(autodiff_library boost) | |
20effc67 | 77 | endif() |