summaryrefslogtreecommitdiffstats
path: root/Tests/Tutorial/Step3
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Tutorial/Step3')
-rw-r--r--Tests/Tutorial/Step3/CMakeLists.txt37
-rw-r--r--Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt1
-rw-r--r--Tests/Tutorial/Step3/MathFunctions/MathFunctions.h1
-rw-r--r--Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx23
-rw-r--r--Tests/Tutorial/Step3/TutorialConfig.h.in4
-rw-r--r--Tests/Tutorial/Step3/directions.txt26
-rw-r--r--Tests/Tutorial/Step3/tutorial.cxx32
7 files changed, 0 insertions, 124 deletions
diff --git a/Tests/Tutorial/Step3/CMakeLists.txt b/Tests/Tutorial/Step3/CMakeLists.txt
deleted file mode 100644
index baa0a44..0000000
--- a/Tests/Tutorial/Step3/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-cmake_minimum_required(VERSION 3.3)
-project(Tutorial)
-
-set(CMAKE_CXX_STANDARD 14)
-
-# should we use our own math functions
-option(USE_MYMATH "Use tutorial provided math implementation" ON)
-
-# the version number.
-set(Tutorial_VERSION_MAJOR 1)
-set(Tutorial_VERSION_MINOR 0)
-
-# configure a header file to pass some of the CMake settings
-# to the source code
-configure_file(
- "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
- "${PROJECT_BINARY_DIR}/TutorialConfig.h"
- )
-
-# add the MathFunctions library?
-if(USE_MYMATH)
- add_subdirectory(MathFunctions)
- list(APPEND EXTRA_LIBS MathFunctions)
- list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
-endif(USE_MYMATH)
-
-# add the executable
-add_executable(Tutorial tutorial.cxx)
-
-target_link_libraries(Tutorial ${EXTRA_LIBS})
-
-# add the binary tree to the search path for include files
-# so that we will find TutorialConfig.h
-target_include_directories(Tutorial PUBLIC
- "${PROJECT_BINARY_DIR}"
- ${EXTRA_INCLUDES}
- )
diff --git a/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt
deleted file mode 100644
index 8b443a6..0000000
--- a/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_library(MathFunctions mysqrt.cxx)
diff --git a/Tests/Tutorial/Step3/MathFunctions/MathFunctions.h b/Tests/Tutorial/Step3/MathFunctions/MathFunctions.h
deleted file mode 100644
index cd36bcc..0000000
--- a/Tests/Tutorial/Step3/MathFunctions/MathFunctions.h
+++ /dev/null
@@ -1 +0,0 @@
-double mysqrt(double x);
diff --git a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx
deleted file mode 100644
index 7d9379e..0000000
--- a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "MathFunctions.h"
-#include <iostream>
-
-// a hack square root calculation using simple operations
-double mysqrt(double x)
-{
- if (x <= 0) {
- return 0;
- }
-
- double result = x;
-
- // do ten iterations
- for (int i = 0; i < 10; ++i) {
- if (result <= 0) {
- result = 0.1;
- }
- double delta = x - (result * result);
- result = result + 0.5 * delta / result;
- std::cout << "Computing sqrt of " << x << " to be " << result << std::endl;
- }
- return result;
-}
diff --git a/Tests/Tutorial/Step3/TutorialConfig.h.in b/Tests/Tutorial/Step3/TutorialConfig.h.in
deleted file mode 100644
index e23f521..0000000
--- a/Tests/Tutorial/Step3/TutorialConfig.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-// the configured options and settings for Tutorial
-#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
-#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
-#cmakedefine USE_MYMATH
diff --git a/Tests/Tutorial/Step3/directions.txt b/Tests/Tutorial/Step3/directions.txt
deleted file mode 100644
index 54d0318..0000000
--- a/Tests/Tutorial/Step3/directions.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Adding Usage Requirements for Library #
-
-Usage requirements allow for far better control over a library / executable's
-link and include line. While also giving more control over the transitive
-property of targets inside CMake. The primary commands that leverage usage
-requirements are:
-
- - target_compile_definitions
- - target_compile_options
- - target_include_directories
- - target_link_libraries
-
-First up is MathFunctions. We first state that anybody linking to MathFunctions
-needs to include the current source directory, while MathFunctions itself
-doesn't. So this can become an INTERFACE usage requirement.
-
-Remember INTERFACE means things that consumers require but the producer doesn't.
-
- target_include_directories(MathFunctions
- INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
-
-Now that we've specified usage requirements for MathFunctions we can safely remove
-our uses of the EXTRA_INCLUDES variable.
-
-Run cmake or cmake-gui to configure the project and then build it with your
-chosen build tool.
diff --git a/Tests/Tutorial/Step3/tutorial.cxx b/Tests/Tutorial/Step3/tutorial.cxx
deleted file mode 100644
index c2b89df..0000000
--- a/Tests/Tutorial/Step3/tutorial.cxx
+++ /dev/null
@@ -1,32 +0,0 @@
-// A simple program that computes the square root of a number
-#include <cmath>
-#include <iostream>
-#include <string>
-
-#include "TutorialConfig.h"
-
-#ifdef USE_MYMATH
-# include "MathFunctions.h"
-#endif
-
-int main(int argc, char* argv[])
-{
- if (argc < 2) {
- std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
- << Tutorial_VERSION_MINOR << std::endl;
- std::cout << "Usage: " << argv[0] << " number" << std::endl;
- return 1;
- }
-
- double inputValue = std::stod(argv[1]);
-
-#ifdef USE_MYMATH
- double outputValue = mysqrt(inputValue);
-#else
- double outputValue = sqrt(inputValue);
-#endif
-
- std::cout << "The square root of " << inputValue << " is " << outputValue
- << std::endl;
- return 0;
-}