Commit 2e8b8eb8 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'help-guide-tutorial'

8ab85635 Help: Add tutorial guide table of contents
0a6c9c41 Help: Update tutorial to include text from CMake book
eef3e020 Help: Populate tutorial guide text
862cfc0e Help/guide/tutorial: Adopt tutorial code
d2fde948 Help: Add infrastructure for guide-level documentation
f067af8e Tests/Tutorial: Remove trailing blank lines
d5a81ef7

 Tests/Tutorial: Remove unused file
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3439
parents edf232db 8ab85635
Pipeline #139911 passed with stage
in 0 seconds
...@@ -817,7 +817,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) ...@@ -817,7 +817,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE WORLD_READ WORLD_EXECUTE
REGEX "Help/dev($|/)" EXCLUDE REGEX "Help/(dev|guide|index.rst)($|/)" EXCLUDE
) )
# Install auxiliary files integrating with other tools. # Install auxiliary files integrating with other tools.
......
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
project(Tutorial) project(Tutorial)
set(CMAKE_CXX_STANDARD 14)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
# control where the static and shared libraries are built so that on windows # control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable # we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_CXX_STANDARD 14)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
# the version number.
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
if(APPLE) if(APPLE)
set(CMAKE_INSTALL_RPATH "@executable_path/../lib") set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
elseif(UNIX) elseif(UNIX)
......
# add the library that runs # add the library that runs
add_library(MathFunctions MathFunctions.cxx) add_library(MathFunctions MathFunctions.cxx)
...@@ -62,6 +61,7 @@ target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") ...@@ -62,6 +61,7 @@ target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH")
set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0") set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0")
set_property(TARGET MathFunctions PROPERTY SOVERSION "1") set_property(TARGET MathFunctions PROPERTY SOVERSION "1")
# install rules
install(TARGETS MathFunctions install(TARGETS MathFunctions
DESTINATION lib DESTINATION lib
EXPORT MathFunctionsTargets) EXPORT MathFunctionsTargets)
......
// the configured options and settings for Tutorial // the configured options and settings for Tutorial
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
project(Tutorial) project(Tutorial)
set(CMAKE_CXX_STANDARD 14)
# Set the version number
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
# control where the static and shared libraries are built so that on windows # control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable # we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_CXX_STANDARD 14)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
# the version number.
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
# configure a header file to pass the version number only # configure a header file to pass the version number only
configure_file( configure_file(
"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
......
# add the library that runs # add the library that runs
add_library(MathFunctions MathFunctions.cxx) add_library(MathFunctions MathFunctions.cxx)
...@@ -57,5 +56,6 @@ endif() ...@@ -57,5 +56,6 @@ endif()
# building on windows # building on windows
target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH")
# install rules
install(TARGETS MathFunctions DESTINATION lib) install(TARGETS MathFunctions DESTINATION lib)
install(FILES MathFunctions.h DESTINATION include) install(FILES MathFunctions.h DESTINATION include)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
......
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
project(Tutorial) project(Tutorial)
set(CMAKE_CXX_STANDARD 14)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
# control where the static and shared libraries are built so that on windows # control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable # we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_CXX_STANDARD 14)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
# the version number.
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
# configure a header file to pass the version number only # configure a header file to pass the version number only
configure_file( configure_file(
"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
......
# add the library that runs # add the library that runs
add_library(MathFunctions MathFunctions.cxx) add_library(MathFunctions MathFunctions.cxx)
...@@ -56,5 +55,6 @@ target_compile_definitions(MathFunctions PRIVATE "$<$<BOOL:${USE_MYMATH}>:USE_MY ...@@ -56,5 +55,6 @@ target_compile_definitions(MathFunctions PRIVATE "$<$<BOOL:${USE_MYMATH}>:USE_MY
#building on windows #building on windows
target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH")
# install rules
install(TARGETS MathFunctions DESTINATION lib) install(TARGETS MathFunctions DESTINATION lib)
install(FILES MathFunctions.h DESTINATION include) install(FILES MathFunctions.h DESTINATION include)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
......
...@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.3) ...@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.3)
project(Tutorial) project(Tutorial)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
# the version number.
# set the version number
set(Tutorial_VERSION_MAJOR 1) set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0) set(Tutorial_VERSION_MINOR 0)
......
// the configured options and settings for Tutorial // the configured options and settings for Tutorial
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
......
...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14) ...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14)
# should we use our own math functions # should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON) option(USE_MYMATH "Use tutorial provided math implementation" ON)
# the version number. # set the version number
set(Tutorial_VERSION_MAJOR 1) set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0) set(Tutorial_VERSION_MINOR 0)
......
...@@ -2,4 +2,3 @@ ...@@ -2,4 +2,3 @@
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
#cmakedefine USE_MYMATH #cmakedefine USE_MYMATH
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "TutorialConfig.h" #include "TutorialConfig.h"
// should we include the MathFunctions header?
#ifdef USE_MYMATH #ifdef USE_MYMATH
# include "MathFunctions.h" # include "MathFunctions.h"
#endif #endif
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
...@@ -20,6 +22,7 @@ int main(int argc, char* argv[]) ...@@ -20,6 +22,7 @@ int main(int argc, char* argv[])
double inputValue = std::stod(argv[1]); double inputValue = std::stod(argv[1]);
// which square root function should we use?
#ifdef USE_MYMATH #ifdef USE_MYMATH
double outputValue = mysqrt(inputValue); double outputValue = mysqrt(inputValue);
#else #else
......
...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14) ...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14)
# should we use our own math functions # should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON) option(USE_MYMATH "Use tutorial provided math implementation" ON)
# the version number. # set the version number
set(Tutorial_VERSION_MAJOR 1) set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0) set(Tutorial_VERSION_MINOR 0)
......
...@@ -2,4 +2,3 @@ ...@@ -2,4 +2,3 @@
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
#cmakedefine USE_MYMATH #cmakedefine USE_MYMATH
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "TutorialConfig.h" #include "TutorialConfig.h"
// should we include the MathFunctions header?
#ifdef USE_MYMATH #ifdef USE_MYMATH
# include "MathFunctions.h" # include "MathFunctions.h"
#endif #endif
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
...@@ -20,6 +22,7 @@ int main(int argc, char* argv[]) ...@@ -20,6 +22,7 @@ int main(int argc, char* argv[])
double inputValue = std::stod(argv[1]); double inputValue = std::stod(argv[1]);
// which square root function should we use?
#ifdef USE_MYMATH #ifdef USE_MYMATH
double outputValue = mysqrt(inputValue); double outputValue = mysqrt(inputValue);
#else #else
......
...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14) ...@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14)
# should we use our own math functions # should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON) option(USE_MYMATH "Use tutorial provided math implementation" ON)
# the version number. # set the version number
set(Tutorial_VERSION_MAJOR 1) set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0) set(Tutorial_VERSION_MINOR 0)
......
...@@ -6,5 +6,6 @@ target_include_directories(MathFunctions ...@@ -6,5 +6,6 @@ target_include_directories(MathFunctions
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
) )
# install rules
install(TARGETS MathFunctions DESTINATION lib) install(TARGETS MathFunctions DESTINATION lib)
install(FILES MathFunctions.h DESTINATION include) install(FILES MathFunctions.h DESTINATION include)
...@@ -2,4 +2,3 @@ ...@@ -2,4 +2,3 @@
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
#cmakedefine USE_MYMATH #cmakedefine USE_MYMATH
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "TutorialConfig.h" #include "TutorialConfig.h"
// should we include the MathFunctions header?
#ifdef USE_MYMATH #ifdef USE_MYMATH
# include "MathFunctions.h" # include "MathFunctions.h"
#endif #endif
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc < 2) { if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl; << Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl;
...@@ -20,6 +22,7 @@ int main(int argc, char* argv[]) ...@@ -20,6 +22,7 @@ int main(int argc, char* argv[])
double inputValue = std::stod(argv[1]); double inputValue = std::stod(argv[1]);
// which square root function should we use?
#ifdef USE_MYMATH #ifdef USE_MYMATH
double outputValue = mysqrt(inputValue); double outputValue = mysqrt(inputValue);
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment