Clean up CMakeLists in all C++ examples
+ Rename output executables to match directory structure + Remove libraries for small examples + Supress -Wreturn-type warnings for singleton that is intentionally not copyable
This commit is contained in:
parent
573fc4e1e8
commit
a97dfbe34b
|
@ -1,13 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing C++ ##
|
||||
## This project can be built to debug and run all nested projects ##
|
||||
## Or, any subdirectory with a project() statement can be selected ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing algorithms in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing graph algorithms in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing graph algorithms in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
|
@ -16,7 +15,7 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-graph-object "lib-graph.cpp")
|
||||
|
||||
add_executable(graph-test-object "graph.cpp")
|
||||
target_link_libraries(graph-test-object lib-graph-object)
|
||||
add_executable(
|
||||
algo-graphs-object graph.cpp
|
||||
lib-graph.cpp lib-graph.hpp
|
||||
)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A CMakeLists configuration to test a simple graph implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
|
@ -16,7 +15,7 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-graph-simple "lib-graph.cpp")
|
||||
|
||||
add_executable(graph-test-simple "graph.cpp")
|
||||
target_link_libraries(graph-test-simple lib-graph-simple)
|
||||
add_executable(
|
||||
algo-graphs-simple graph.cpp
|
||||
lib-graph.cpp lib-graph.hpp
|
||||
)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists to test templated graph implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
|
@ -16,7 +15,4 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
#add_library(lib-graph-templated "lib-graph.cpp")
|
||||
|
||||
add_executable(graph-test-templated "graph.cpp")
|
||||
#target_link_libraries(graph-test-templated lib-graph-templated)
|
||||
add_executable(algo-graphs-templated graph.cpp)
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: Driver program to test object graph implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
*/
|
||||
|
||||
#include "lib-graph.hpp"
|
||||
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test RBT implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
|
@ -16,7 +15,7 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-graph-weighted "lib-graph.cpp")
|
||||
|
||||
add_executable(graph-test-weighted "graph.cpp")
|
||||
target_link_libraries(graph-test-weighted lib-graph-weighted)
|
||||
add_executable(
|
||||
algo-graphs-weighted graph.cpp
|
||||
lib-graph.cpp lib-graph.hpp
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing sorting algorithms in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice bubble sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -9,7 +9,7 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(BubbleSort LANGUAGES CXX)
|
||||
|
||||
add_executable(bubble-sort "bubble-sort.cpp")
|
||||
|
||||
add_library(lib-bubble "lib-bubble.cpp")
|
||||
target_link_libraries(bubble-sort lib-bubble)
|
||||
add_executable(
|
||||
algo-sort-bubble bubble-sort.cpp
|
||||
lib-bubble.cpp lib-bubble.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bubble sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bubble sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bubble sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice bucket sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -9,7 +9,7 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(BucketSort LANGUAGES CXX)
|
||||
|
||||
add_executable(bucket-sort "bucket-sort.cpp")
|
||||
|
||||
add_library(lib-bucket "lib-bucket.cpp")
|
||||
target_link_libraries(bucket-sort lib-bucket)
|
||||
add_executable(
|
||||
algo-sort-bucket bucket-sort.cpp
|
||||
lib-bucket.cpp lib-bucket.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bucket sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bucket sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bucket sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice counting sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -9,7 +9,7 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(CountingSort LANGUAGES CXX)
|
||||
|
||||
add_executable(counting-sort "counting-sort.cpp")
|
||||
|
||||
add_library(lib-counting "lib-counting.cpp")
|
||||
target_link_libraries(counting-sort lib-counting)
|
||||
add_executable(
|
||||
algo-sort-counting counting-sort.cpp
|
||||
lib-counting.cpp lib-counting.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of counting sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of counting sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -35,13 +35,17 @@ void CountingSort(std::vector<int> &array)
|
|||
// + Since each element stores its own count, just add the count at index i-1
|
||||
for (size_t i = 1; i <= maxValue; i++) {
|
||||
tempArray[i] += tempArray[i - 1];
|
||||
// tempArray[i] - 1 now represents the sorted 0-index pos for each value i
|
||||
}
|
||||
|
||||
// Step through the array from right-to-left and place each value in their pos
|
||||
// + As we run into values lookup their position with tempArray[value]
|
||||
for (ssize_t arrayIndex = array.size() - 1; arrayIndex >= 0; arrayIndex--) {
|
||||
// Store as references; Changes reflect on actual values within each array
|
||||
const int &arrayValue = array[arrayIndex];
|
||||
// Store as reference; Changes to valueCount reflect within tempArray
|
||||
int &valueCount = tempArray[arrayValue];
|
||||
sortedArray[valueCount - 1] = arrayValue;
|
||||
// Subtract from tempArray[arrayValue] to update position of next occurrence
|
||||
valueCount = valueCount - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of counting sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(HeapSort LANGUAGES CXX)
|
||||
|
||||
add_executable(heap-sort "heap-sort.cpp")
|
||||
add_executable(
|
||||
algo-sort-heap heap-sort.cpp
|
||||
lib-heap.cpp lib-heap.hpp
|
||||
)
|
||||
|
||||
add_library(lib-heap "lib-heap.cpp")
|
||||
target_link_libraries(heap-sort lib-heap)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of heap sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of heap sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of heap sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice insertion sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(InsertionSort LANGUAGES CXX)
|
||||
|
||||
add_executable(insertion-sort "insertion-sort.cpp")
|
||||
project (
|
||||
#[[NAME]] InsertionSort
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing insertion sort in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-insertion "lib-insertion.cpp")
|
||||
target_link_libraries(insertion-sort lib-insertion)
|
||||
add_executable(
|
||||
algo-sort-insertion insertion-sort.cpp
|
||||
lib-insertion.cpp lib-insertion.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of insertion sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of insertion sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "lib-insertion.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
void InsertionSort(std::vector<int> &array)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of insertion sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice merge sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
project(MergeSort LANGUAGES CXX)
|
||||
|
||||
add_executable(merge-sort "merge-sort.cpp")
|
||||
project (
|
||||
#[[NAME]] MergeSort
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing merge sort in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
add_executable(
|
||||
algo-sort-merge merge-sort.cpp
|
||||
lib-merge.cpp lib-merge.h
|
||||
)
|
||||
|
||||
add_library(lib-merge "lib-merge.cpp")
|
||||
target_link_libraries(merge-sort lib-merge)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of merge sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of merge sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of merge sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice quick sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(QuickSort LANGUAGES CXX)
|
||||
|
||||
add_executable(quick-sort "quick-sort.cpp")
|
||||
project (
|
||||
#[[NAME]] QuickSort
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing quick sort in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-quick "lib-quick.cpp")
|
||||
target_link_libraries(quick-sort lib-quick)
|
||||
add_executable(
|
||||
algo-sort-quick quick-sort.cpp
|
||||
lib-quick.cpp lib-quick.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of quick sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of quick sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of quick sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice radix sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(RadixSort LANGUAGES CXX)
|
||||
|
||||
add_executable(radix-sort "radix-sort.cpp")
|
||||
project (
|
||||
#[[NAME]] RadixSort
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing radix sort in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-radix-counting "lib-counting.cpp")
|
||||
add_library(lib-radix "lib-radix.cpp")
|
||||
|
||||
target_link_libraries(radix-sort lib-radix lib-radix-counting)
|
||||
add_executable(
|
||||
algo-sort-radix radix-sort.cpp
|
||||
lib-counting.cpp lib-counting.hpp
|
||||
lib-radix.cpp lib-radix.hpp
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of counting sort using a custom library ##
|
||||
## + In support of a radix sort implementation ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of counting sort using a custom library ##
|
||||
## + In support of a radix sort implementation ##
|
||||
## ##
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of radix sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
*/
|
||||
|
||||
#include "lib-radix.hpp"
|
||||
#include "lib-counting.hpp"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of radix sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of radix sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to practice selection sort ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(SelectionSort LANGUAGES CXX)
|
||||
|
||||
add_executable(select-sort "select-sort.cpp")
|
||||
project (
|
||||
#[[NAME]] SelectionSort
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing selection sort in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-select "lib-select.cpp")
|
||||
target_link_libraries(select-sort lib-select)
|
||||
add_executable(
|
||||
algo-sort-select select-sort.cpp
|
||||
lib-select.cpp lib-select.h
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of selection sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of selection sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of selection sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing algorithms in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test BST implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
@ -15,7 +15,7 @@ project (
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-bst-algo "bst.cpp")
|
||||
|
||||
add_executable(test-bst-algo "driver.cpp")
|
||||
target_link_libraries(test-bst-algo lib-bst-algo)
|
||||
add_executable(
|
||||
algo-trees-bst driver.cpp
|
||||
bst.cpp bst.h
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a binary search tree implementation ##
|
||||
## The algorithms in this example are seen in MIT Intro to Algorithms ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a binary search tree implementation ##
|
||||
## The algorithms in this example are seen in MIT Intro to Algorithms ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Driver program to test BST algorithms from MIT intro to algorithms ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test RBT implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
@ -15,7 +15,7 @@ project (
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-redblack "redblack.cpp")
|
||||
|
||||
add_executable(test-redblack "driver.cpp")
|
||||
target_link_libraries(test-redblack lib-redblack)
|
||||
add_executable(
|
||||
algo-trees-redblack driver.cpp
|
||||
redblack.cpp redblack.h
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Driver program to test RBT algorithms from MIT intro to algorithms ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a red-black tree implementation ##
|
||||
## The algorithms in this example are seen in MIT Intro to Algorithms ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a red black tree implementation ##
|
||||
## The algorithms in this example are seen in MIT Intro to Algorithms ##
|
||||
## ##
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A template project for getting started working with CMake ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Define the version of CMake
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# CMake options
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# Compiler options
|
||||
add_compile_options("-Wall")
|
||||
|
||||
# Define the your project name
|
||||
project(cmake-template)
|
||||
project (
|
||||
#[[NAME]] CMakeTemplate
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A basic CMake template for C++ projects"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
# Include any directories the compiler may need
|
||||
include_directories(./include)
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
################################################################################
|
||||
## This directory is for storing / compiling our executable code
|
||||
|
||||
# Create a reference / variable to refer to our source code
|
||||
set(APP_SRC say-hello.cpp)
|
||||
|
||||
# Add our executable, naming it and linking it to our source code
|
||||
add_executable(say-hello ${APP_SRC})
|
||||
add_executable(cmake-example-template ${APP_SRC})
|
||||
|
||||
# Link to our custom library, defined in c-cmake/src/
|
||||
target_link_libraries(say-hello lib-klips)
|
||||
|
||||
target_link_libraries(cmake-example-template cmake-example-lib)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
################################################################################
|
||||
*/
|
||||
|
||||
#include <lib-klips.hpp>
|
||||
#include <lib-example.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main () {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
################################################################################
|
||||
## This directory is for storing source code
|
||||
|
||||
# Create any links we might need
|
||||
set(LIB_SRC lib-klips.cpp)
|
||||
set(LIB_SRC lib-example.cpp)
|
||||
|
||||
# Define our library within CMake and link to the source code
|
||||
add_library(lib-klips ${LIB_SRC})
|
||||
|
||||
add_library(cmake-example-lib ${LIB_SRC})
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
################################################################################
|
||||
*/
|
||||
|
||||
#include <lib-klips.hpp>
|
||||
#include <lib-example.hpp>
|
||||
#include <iostream>
|
||||
|
||||
void PrintHello(int n) {
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing cryptography in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
|
@ -16,7 +15,7 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-cipher "lib-cipher.cpp")
|
||||
|
||||
add_executable(columnar-transposition-test "driver.cpp")
|
||||
target_link_libraries(columnar-transposition-test lib-cipher)
|
||||
add_executable(
|
||||
crypto-columnar-transposition driver.cpp
|
||||
lib-cipher.cpp lib-cipher.hpp
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing C++ data structure implementations ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test BST implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
@ -15,7 +15,7 @@ project (
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-bst "bst.cpp")
|
||||
|
||||
add_executable(test-bst "driver.cpp")
|
||||
target_link_libraries(test-bst lib-bst)
|
||||
add_executable(
|
||||
data-bst driver.cpp
|
||||
bst.cpp bst.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a circular doubly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(CircleDouble)
|
||||
# Define source files
|
||||
set(SRC driver.cpp circledoublelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(CircleDoubleDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] CircleDoubleList
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Project for testing circular doubly linked list implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-circular-doubly-linked-list driver.cpp
|
||||
circledoublelist.cpp circledoublelist.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a circular singly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(CircleSingle)
|
||||
# Define source files
|
||||
set(SRC driver.cpp circlesinglelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(CircleSingleDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] CircleSingleList
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Project for testing circular singly linked list implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-circular-singly-linked-list driver.cpp
|
||||
circlesinglelist.cpp circlesinglelist.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a doubly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(DoubleList)
|
||||
# Define source files
|
||||
set(SRC driver.cpp doublelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(DoubleListDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] DoubleList
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for testing a doubly linked list implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-doubly-linked-list driver.cpp
|
||||
doublelist.cpp doublelist.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a max heap implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(MaxHeap)
|
||||
# Define source files
|
||||
set(SRC driver.cpp maxheap.cpp)
|
||||
# Build an executable
|
||||
add_executable(HeapDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] MaxHeap
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for testing a max heap implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-max-heap driver.cpp
|
||||
maxheap.cpp maxheap.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a queue implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Queue)
|
||||
# Define source files
|
||||
set(SRC driver.cpp queuelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(QueueDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] Queue
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Project for testing queue implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-queue driver.cpp
|
||||
queuelist.cpp queuelist.h
|
||||
)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a singly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(SingleList)
|
||||
# Define source files
|
||||
set(SRC driver.cpp singlelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(SingleListDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] SingleList
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for testing a singly linked list implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-singly-linked-list driver.cpp
|
||||
singlelist.cpp singlelist.h
|
||||
)
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a stack implementation using linked lists ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Stack)
|
||||
# Define source files
|
||||
set(SRC driver.cpp stacklist.cpp)
|
||||
# Build an executable
|
||||
add_executable(StackDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] Stack
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for testing a Stack implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-stack driver.cpp
|
||||
stacklist.cpp stacklist.h
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing templated data structures in C++ ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a doubly linked list implementation ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a templated doubly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(DoubleList)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(TemplatedDoubleListDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] TemplatedDoubleList
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing templated doubly linked list implementations"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(data-templates-doubly-linked-list driver.cpp)
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a queue implementation ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a templated queue implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Queue)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(TemplatedQueueDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] TemplatedQueue
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing templated queue implementations"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(data-templates-queue driver.cpp)
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a stack implementation using linked lists ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a templated stack implementation using linked lists ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Stack)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(TemplatedStackDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] TemplatedStack
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing templated Stack implementations"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(data-templates-stack driver.cpp)
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test Vector implementation ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a templated vector implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## vector.cpp
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(VectorDriver)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(TemplatedVectorDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] TemplatedVector
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing templated Vector implementations"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(data-templates-vectors driver.cpp)
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test Vector implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## vector.cpp
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(VectorDriver)
|
||||
# Define source files
|
||||
set(SRC driver.cpp vector.cpp)
|
||||
# Build an executable
|
||||
add_executable(VectorDriver ${SRC})
|
||||
project (
|
||||
#[[NAME]] VectorDriver
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for testing a basic Vector implementation"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_executable(
|
||||
data-vectors driver.cpp
|
||||
vector.cpp vector.h
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: A root project for practicing C++ ##
|
||||
|
@ -6,8 +6,8 @@
|
|||
## Or, any subdirectory with a project() statement can be selected ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Define CMake version
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
@ -15,15 +14,15 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(lib-opengl-test "src/lib-opengl-test.cpp")
|
||||
target_include_directories(lib-opengl-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
add_library(graphics-lib-opengl src/lib-opengl-test.cpp)
|
||||
target_include_directories(graphics-lib-opengl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
# Find OpenGL package
|
||||
find_package(OpenGL REQUIRED)
|
||||
if (OPENGL_FOUND)
|
||||
# Link opengl-test executable to OpenGL
|
||||
target_include_directories(lib-opengl-test PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(lib-opengl-test PUBLIC ${OPENGL_LIBRARIES})
|
||||
target_include_directories(graphics-lib-opengl PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(graphics-lib-opengl PUBLIC ${OPENGL_LIBRARIES})
|
||||
else()
|
||||
message(
|
||||
"Error: CMake was unable to find the OpenGL package\n"
|
||||
|
@ -35,8 +34,8 @@ endif()
|
|||
find_package(GLUT REQUIRED)
|
||||
if (GLUT_FOUND)
|
||||
# Link lib-opengl-test executable to GLUT
|
||||
target_include_directories(lib-opengl-test PUBLIC ${GLUT_INCLUDE_DIR})
|
||||
target_link_libraries(lib-opengl-test PUBLIC ${GLUT_LIBRARIES})
|
||||
target_include_directories(graphics-lib-opengl PUBLIC ${GLUT_INCLUDE_DIR})
|
||||
target_link_libraries(graphics-lib-opengl PUBLIC ${GLUT_LIBRARIES})
|
||||
else()
|
||||
message(
|
||||
"Error: CMake was unable to find the GLUT package\n"
|
||||
|
@ -45,6 +44,6 @@ else()
|
|||
endif()
|
||||
|
||||
# Add test executable
|
||||
add_executable(opengl-test "apps/test-gl.cpp")
|
||||
target_link_libraries(opengl-test PRIVATE lib-opengl-test)
|
||||
target_include_directories(opengl-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
add_executable(graphics-cmake-opengl apps/test-gl.cpp)
|
||||
target_link_libraries(graphics-cmake-opengl PRIVATE graphics-lib-opengl)
|
||||
target_include_directories(graphics-cmake-opengl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Define CMake version
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
@ -17,16 +16,15 @@ project(
|
|||
|
||||
# Add Library
|
||||
add_library(
|
||||
lib-sdl-test # Library Name
|
||||
"src/lib-sdl-test.cpp" # Sources..
|
||||
"src/lib-sdl-test.h"
|
||||
graphics-lib-sdl # Library Name
|
||||
src/lib-sdl-test.cpp src/lib-sdl-test.h # Sources..
|
||||
)
|
||||
|
||||
target_include_directories( # When calling library, include a directory
|
||||
lib-sdl-test # Library name
|
||||
graphics-lib-sdl # Library name
|
||||
PUBLIC # Visibility
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src" # Source directory for library
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src # Source directory for library
|
||||
)
|
||||
|
||||
# Search for SDL2 package
|
||||
find_package(SDL2 REQUIRED sdl2)
|
||||
|
@ -35,20 +33,20 @@ find_package(SDL2 REQUIRED sdl2)
|
|||
if (SDL2_FOUND)
|
||||
# Any target that links with this library will also link to SDL2
|
||||
# + Because we choose PUBLIC visibility
|
||||
target_include_directories(lib-sdl-test PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(lib-sdl-test PUBLIC "${SDL2_LIBRARIES}")
|
||||
target_include_directories(graphics-lib-sdl PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(graphics-lib-sdl PUBLIC "${SDL2_LIBRARIES}")
|
||||
|
||||
# Creating executable
|
||||
add_executable(
|
||||
sdl-test # Exe name
|
||||
"apps/sdl-test.cpp" # Exe Source(s)
|
||||
graphics-cmake-sdl # Exe name
|
||||
apps/sdl-test.cpp # Exe Source(s)
|
||||
)
|
||||
|
||||
# Linking the exe to library
|
||||
target_link_libraries(
|
||||
sdl-test # Executable to link
|
||||
graphics-cmake-sdl # Executable to link
|
||||
PRIVATE # Visibility
|
||||
lib-sdl-test # Library to link
|
||||
graphics-lib-sdl # Library to link
|
||||
)
|
||||
|
||||
else()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing C++ design patterns ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
|
|
|
@ -15,7 +15,8 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(abstract-parts "parts.cpp")
|
||||
add_library(abstract-factory "factory.cpp")
|
||||
add_executable(abstract-factory-test "main.cpp")
|
||||
target_link_libraries(abstract-factory-test abstract-factory abstract-parts)
|
||||
add_executable(
|
||||
patterns-abstract-factory main.cpp
|
||||
parts.cpp parts.hpp
|
||||
abstract-factory.cpp abstract-factory.hpp
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the adapter C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Adapter
|
||||
VERSION 1.0
|
||||
|
@ -15,6 +16,7 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(adapter "adapter.cpp")
|
||||
add_executable(adapter-test "main.cpp")
|
||||
target_link_libraries(adapter-test adapter)
|
||||
add_executable(
|
||||
patterns-adapter main.cpp
|
||||
adapter.cpp adapter.hpp
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the bridge C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Bridge
|
||||
VERSION 1.0
|
||||
|
@ -15,7 +16,8 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(abstraction "abstraction.cpp")
|
||||
add_library(implementation "implementation.cpp")
|
||||
add_executable(bridge-test "main.cpp")
|
||||
target_link_libraries(bridge-test abstraction implementation)
|
||||
add_executable(
|
||||
patterns-bridge main.cpp
|
||||
abstraction.cpp abstraction.hpp
|
||||
implementation.cpp implementation.hpp
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the factory C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Factory
|
||||
VERSION 1.0
|
||||
|
@ -15,7 +16,8 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(parts "parts.cpp")
|
||||
add_library(factory "factory.cpp")
|
||||
add_executable(factory-test "main.cpp")
|
||||
target_link_libraries(factory-test factory parts)
|
||||
add_executable(
|
||||
patterns-factory main.cpp
|
||||
parts.cpp parts.hpp
|
||||
factory.cpp abstract-factory.hpp
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "factory.hpp"
|
||||
#include "abstract-factory.hpp"
|
||||
|
||||
Part* GearFactory::requestPart() {
|
||||
// Create a new part
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "factory.hpp"
|
||||
#include "abstract-factory.hpp"
|
||||
|
||||
int main(const int argc, const char * argv[]) {
|
||||
// Testing GearFactory
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the observer C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Observer
|
||||
VERSION 1.0
|
||||
|
@ -15,6 +16,7 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(observer "observer.cpp")
|
||||
add_executable(observer-test "main.cpp")
|
||||
target_link_libraries(observer-test observer)
|
||||
add_executable(
|
||||
patterns-observer main.cpp
|
||||
observer.cpp observer.hpp
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the prototype C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Prototype
|
||||
VERSION 1.0
|
||||
|
@ -15,6 +16,7 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(prototype "prototype.cpp")
|
||||
add_executable(prototype-test "main.cpp")
|
||||
target_link_libraries(prototype-test prototype)
|
||||
add_executable(
|
||||
patterns-prototype main.cpp
|
||||
prototype.cpp prototype.hpp
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the singleton C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
|
@ -15,7 +15,8 @@ project(
|
|||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_library(singleton "singleton.cpp")
|
||||
add_library(singleton-pointer "singleton-pointer.cpp")
|
||||
add_executable(singleton-test "main.cpp")
|
||||
target_link_libraries(singleton-test singleton singleton-pointer)
|
||||
add_executable(
|
||||
patterns-singleton main.cpp
|
||||
singleton-pointer.cpp singleton-pointer.hpp
|
||||
singleton.cpp singleton.hpp
|
||||
)
|
||||
|
|
|
@ -19,7 +19,13 @@ private:
|
|||
ClassicSingleton(){ message = "New ClassicSingleton\n";}
|
||||
// Do not allow copying of this object
|
||||
ClassicSingleton(const ClassicSingleton&){}
|
||||
// Ignore -Wreturn-type warnings; It's intentional for this pattern
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wreturn-type"
|
||||
ClassicSingleton& operator=(const ClassicSingleton&){}
|
||||
// Unmatched pop reverts GCC to commandline options
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Static pointer to instance of this singleton
|
||||
static ClassicSingleton* instance;
|
||||
|
|
|
@ -17,9 +17,15 @@ private:
|
|||
std::string message;
|
||||
|
||||
// Don't allow copying of this class
|
||||
// Ignore -Wreturn-type warnings; It's intentional for this pattern
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wreturn-type"
|
||||
Singleton() { message = "New singleton\n";}
|
||||
Singleton(const Singleton &) {}
|
||||
Singleton &operator=(const Singleton &) {}
|
||||
// Unmatched pop reverts GCC to commandline options
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
};
|
||||
|
||||
#endif // SINGLETON_H
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the state C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] State
|
||||
VERSION 1.0
|
||||
|
@ -15,6 +16,7 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(state "state.cpp")
|
||||
add_executable(state-test "main.cpp")
|
||||
target_link_libraries(state-test state)
|
||||
add_executable(
|
||||
patterns-state main.cpp
|
||||
state.cpp state.hpp
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
###############################################################################
|
||||
################################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: A project for practicing the visitor C++ design pattern ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(
|
||||
#[[NAME]] Visitor
|
||||
VERSION 1.0
|
||||
|
@ -15,6 +16,7 @@ project(
|
|||
)
|
||||
add_compile_options("-Wall")
|
||||
|
||||
add_library(visitor "visitor.cpp")
|
||||
add_executable(visitor-test "main.cpp")
|
||||
target_link_libraries(visitor-test visitor)
|
||||
add_executable(
|
||||
patterns-visitor main.cpp
|
||||
visitor.cpp visitor.hpp
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue