summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/yap/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/yap/cmake')
-rw-r--r--src/boost/libs/yap/cmake/Disassemble.cmake71
-rw-r--r--src/boost/libs/yap/cmake/constexpr_if.cpp13
-rw-r--r--src/boost/libs/yap/cmake/dependencies.cmake68
3 files changed, 152 insertions, 0 deletions
diff --git a/src/boost/libs/yap/cmake/Disassemble.cmake b/src/boost/libs/yap/cmake/Disassemble.cmake
new file mode 100644
index 000000000..93f6e9a5b
--- /dev/null
+++ b/src/boost/libs/yap/cmake/Disassemble.cmake
@@ -0,0 +1,71 @@
+# 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)
+#
+#
+# This CMake module provides a way to get the disassembly of a function within
+# an executable created with `add_executable`. The module provides a `disassemble`
+# function that creates a target which, when built, outputs the disassembly of
+# the given function within an executable to standard output.
+#
+# Parameters
+# ----------
+# target:
+# The name of the target to create. Building this target will generate the
+# requested disassembly.
+#
+# EXECUTABLE executable:
+# The name of an executable to disassemble. This must be the name of a valid
+# executable that was created with `add_executable`. The disassembly target
+# thus created will be made dependent on the executable, so that it is built
+# automatically when the disassembly is requested.
+#
+# FUNCTION function-name:
+# The name of the function to disassemble in the executable.
+#
+# [ALL]:
+# If provided, the generated target is included in the 'all' target.
+#
+function(disassemble target)
+ cmake_parse_arguments(ARGS "ALL" # options
+ "EXECUTABLE;FUNCTION" # 1 value args
+ "" # multivalued args
+ ${ARGN})
+
+ if (NOT ARGS_EXECUTABLE)
+ message(FATAL_ERROR "The `EXECUTABLE` argument must be provided.")
+ endif()
+ if (NOT TARGET ${ARGS_EXECUTABLE})
+ message(FATAL_ERROR "The `EXECUTABLE` argument must be the name of a valid "
+ "executable created with `add_executable`.")
+ endif()
+
+ if (NOT ARGS_FUNCTION)
+ message(FATAL_ERROR "The `FUNCTION` argument must be provided.")
+ endif()
+
+ if (ARGS_ALL)
+ set(ARGS_ALL "ALL")
+ else()
+ set(ARGS_ALL "")
+ endif()
+
+ if (DISASSEMBLE_lldb)
+ add_custom_target(${target} ${ARGS_ALL}
+ COMMAND ${DISASSEMBLE_lldb} -f $<TARGET_FILE:${ARGS_EXECUTABLE}>
+ -o "disassemble --name ${ARGS_FUNCTION}"
+ -o quit
+ DEPENDS ${ARGS_EXECUTABLE}
+ )
+ elseif(DISASSEMBLE_gdb)
+ add_custom_target(${target} ${ARGS_ALL}
+ COMMAND ${DISASSEMBLE_gdb} -batch -se $<TARGET_FILE:${ARGS_EXECUTABLE}>
+ -ex "disassemble ${ARGS_FUNCTION}"
+ DEPENDS ${ARGS_EXECUTABLE}
+ )
+ endif()
+endfunction()
+
+find_program(DISASSEMBLE_gdb gdb)
+find_program(DISASSEMBLE_lldb lldb)
diff --git a/src/boost/libs/yap/cmake/constexpr_if.cpp b/src/boost/libs/yap/cmake/constexpr_if.cpp
new file mode 100644
index 000000000..be6ca37f7
--- /dev/null
+++ b/src/boost/libs/yap/cmake/constexpr_if.cpp
@@ -0,0 +1,13 @@
+// Copyright (C) 2016-2018 T. Zachary Laine
+//
+// 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)
+int main ()
+{
+#if CHECK_CONSTEXPR_IF
+ if constexpr (true) {
+ return 0;
+ }
+#endif
+}
diff --git a/src/boost/libs/yap/cmake/dependencies.cmake b/src/boost/libs/yap/cmake/dependencies.cmake
new file mode 100644
index 000000000..b246e8877
--- /dev/null
+++ b/src/boost/libs/yap/cmake/dependencies.cmake
@@ -0,0 +1,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)