2
0
mirror of https://github.com/boostorg/yap.git synced 2026-01-26 19:12:16 +00:00
Files
yap/cmake/dependencies.cmake
greole bf9e8a121d Dependent compilation of tests, examples ... etc (#100)
* add a project name

* opt out of test, example, perf and doc build

* compiler definitions for clang

* fix build order by setting target depencies

* fix streampos namespace

* bump benchmark version

* remove file since it is part of google benchmark

* deactivate tests for google benchmark

* add missing ;

* add constexpr and variadic templates to compile features

* FIX set compile on interface since yap is an interface lib

* set cxx 14 as compile feature to compile boost

* add missing $

* replace cxx_std_14 by concrete features

* add all features to interface_compile_properties

* fix interface_compile_properties
2020-04-08 18:30:26 -05:00

78 lines
3.0 KiB
CMake

# 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 ()
set_target_properties(boost
PROPERTIES
INTERFACE_COMPILE_FEATURES cxx_decltype_auto
)
###############################################################################
# Google Benchmark
###############################################################################
if(YAP_BUILD_PERF)
execute_process(
COMMAND git clone https://github.com/google/benchmark.git
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
COMMAND git checkout v1.5.0
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/benchmark
)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark)
endif()
###############################################################################
# Autodiff (see https://github.com/fqiang/autodiff_library)
###############################################################################
if(YAP_BUILD_EXAMPLE)
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)
endif()