Add ExprTk_BUILD_EXAMPLES to build examples

Also move examples into an examples folder
This commit is contained in:
Spiros Tsalikis 2023-02-25 15:01:05 -05:00
parent 2c35cb4e74
commit 1491ae63ca
21 changed files with 78 additions and 19 deletions

View File

@ -48,3 +48,10 @@ if (ExprTk_BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif ()
# create an ExprTK option for building examples
option(ExprTk_BUILD_EXAMPLES "Build ExprTk examples" ON)
# if ExprTk_BUILD_EXAMPLES is set to ON, then build the examples
if (ExprTk_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()

71
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,71 @@
# **************************************************************
# * C++ Mathematical Expression Toolkit Library *
# * *
# * Author: Arash Partow (1999-2023) *
# * URL: https://www.partow.net/programming/exprtk/index.html *
# * *
# * Copyright notice: *
# * Free use of the Mathematical Expression Toolkit Library is *
# * permitted under the guidelines and in accordance with the *
# * most current version of the MIT License. *
# * http://www.opensource.org/licenses/MIT *
# * *
# **************************************************************
# create executables for each example
add_executable(exprtk_simple_example_01 exprtk_simple_example_01.cpp)
target_link_libraries(exprtk_simple_example_01 ExprTk)
add_executable(exprtk_simple_example_02 exprtk_simple_example_02.cpp)
target_link_libraries(exprtk_simple_example_02 ExprTk)
add_executable(exprtk_simple_example_03 exprtk_simple_example_03.cpp)
target_link_libraries(exprtk_simple_example_03 ExprTk)
add_executable(exprtk_simple_example_04 exprtk_simple_example_04.cpp)
target_link_libraries(exprtk_simple_example_04 ExprTk)
add_executable(exprtk_simple_example_05 exprtk_simple_example_05.cpp)
target_link_libraries(exprtk_simple_example_05 ExprTk)
add_executable(exprtk_simple_example_06 exprtk_simple_example_06.cpp)
target_link_libraries(exprtk_simple_example_06 ExprTk)
add_executable(exprtk_simple_example_07 exprtk_simple_example_07.cpp)
target_link_libraries(exprtk_simple_example_07 ExprTk)
add_executable(exprtk_simple_example_08 exprtk_simple_example_08.cpp)
target_link_libraries(exprtk_simple_example_08 ExprTk)
add_executable(exprtk_simple_example_09 exprtk_simple_example_09.cpp)
target_link_libraries(exprtk_simple_example_09 ExprTk)
add_executable(exprtk_simple_example_10 exprtk_simple_example_10.cpp)
target_link_libraries(exprtk_simple_example_10 ExprTk)
add_executable(exprtk_simple_example_11 exprtk_simple_example_11.cpp)
target_link_libraries(exprtk_simple_example_11 ExprTk)
add_executable(exprtk_simple_example_12 exprtk_simple_example_12.cpp)
target_link_libraries(exprtk_simple_example_12 ExprTk)
add_executable(exprtk_simple_example_13 exprtk_simple_example_13.cpp)
target_link_libraries(exprtk_simple_example_13 ExprTk)
add_executable(exprtk_simple_example_14 exprtk_simple_example_14.cpp)
target_link_libraries(exprtk_simple_example_14 ExprTk)
add_executable(exprtk_simple_example_15 exprtk_simple_example_15.cpp)
target_link_libraries(exprtk_simple_example_15 ExprTk)
add_executable(exprtk_simple_example_16 exprtk_simple_example_16.cpp)
target_link_libraries(exprtk_simple_example_16 ExprTk)
add_executable(exprtk_simple_example_17 exprtk_simple_example_17.cpp)
target_link_libraries(exprtk_simple_example_17 ExprTk)
add_executable(exprtk_simple_example_18 exprtk_simple_example_18.cpp)
target_link_libraries(exprtk_simple_example_18 ExprTk)
add_executable(exprtk_simple_example_19 exprtk_simple_example_19.cpp)
target_link_libraries(exprtk_simple_example_19 ExprTk)

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void trig_function()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void square_wave()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void polynomial()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void fibonacci()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
struct myfunc : public exprtk::ifunction<T>
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void vector_function()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void logic()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void composite()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void primes()
{

View File

@ -22,7 +22,6 @@
#include "exprtk.hpp"
template <typename T>
void newton_sqrt()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void square_wave2()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void bubble_sort()
{

View File

@ -23,7 +23,6 @@
#include "exprtk.hpp"
template <typename T>
void savitzky_golay_filter()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void stddev_example()
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void black_scholes_merton_model()
{

View File

@ -22,7 +22,6 @@
#include "exprtk.hpp"
template <typename T>
void linear_least_squares()
{

View File

@ -23,7 +23,6 @@
#include "exprtk.hpp"
template <typename T>
struct rnd_01 : public exprtk::ifunction<T>
{

View File

@ -21,7 +21,6 @@
#include "exprtk.hpp"
template <typename T>
void file_io()
{

View File

@ -23,7 +23,6 @@
#include "exprtk.hpp"
template <typename T>
class randu : public exprtk::igeneric_function<T>
{