Add cmake project files for cpp/ directory and all relevant subdirecctories
+ Add Makefiles generated by CMake JIC make is preferred + Update cmake version, header comments, and project descriptions
This commit is contained in:
parent
d4f6fb9d41
commit
8817a594be
|
@ -1,6 +1,11 @@
|
|||
build/
|
||||
**/build/
|
||||
**/.vscode
|
||||
**/.idea/**
|
||||
**/driver
|
||||
**/*.o
|
||||
**/cmake-build-debug/**
|
||||
**/CMakeCache.txt
|
||||
**/cmake_install.cmake
|
||||
**/CMakeFiles/**
|
||||
**/Makefile
|
||||
**/*.cbp
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 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(
|
||||
#[[NAME]] Klips
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A root project for several small cpp practice projects"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_subdirectory(cmake)
|
||||
add_subdirectory(datastructs)
|
||||
add_subdirectory(sdl-cmake)
|
|
@ -10,6 +10,9 @@ shaunrd0/klips/cpp/
|
|||
└── sdl-cmake # Barebones sdl application written in C++ built with cmake
|
||||
```
|
||||
|
||||
This directory contains a `CMakeLists.txt`, which can be selected to open as a
|
||||
project within your preferred IDE. From there, all nested examples can be built,
|
||||
debugged, and ran.
|
||||
|
||||
In general, if a `CMakeLists.txt` is included in the project's root directory,
|
||||
we can build the example with the following commands
|
||||
|
@ -19,7 +22,7 @@ mkdir build && cd build
|
|||
cmake .. && cmake --build .
|
||||
```
|
||||
|
||||
|
||||
If cmake is not being used in a project, it can be built with `g++` manually using
|
||||
the commands outlined in `*/.vscode/tasks.json`, or by using VSCode to open the example
|
||||
and running the build task.
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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 2.8)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the your project name
|
||||
project(cmake-template)
|
||||
|
@ -17,4 +19,3 @@ include_directories(./include)
|
|||
# Point CMake to look for more CMakeLists within the following directories
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(apps)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 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 (
|
||||
#[[NAME]] DataStructures
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing various data structures in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_subdirectory(binarysearchtree)
|
||||
add_subdirectory(circledoublelist)
|
||||
add_subdirectory(circlesinglelist)
|
||||
add_subdirectory(doublelist)
|
||||
add_subdirectory(maxheap)
|
||||
add_subdirectory(queuelist)
|
||||
add_subdirectory(singlelist)
|
||||
add_subdirectory(stacklist)
|
||||
add_subdirectory(vector)
|
||||
|
||||
# Add subdirectory for examples of templated data stuctures
|
||||
add_subdirectory(templates)
|
|
@ -1,14 +1,13 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: A basic CMakeLists configuration to test BST implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
# Define the project name
|
||||
project(BinarySearchTree)
|
||||
# Define source files
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(CircleDouble)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp circledoublelist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp circledoublelist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# CircleDoubleList
|
||||
###############################################################################
|
||||
|
||||
circledoublelist.o: circledoublelist.cpp circledoublelist.h
|
||||
${CXX} ${CXXFLAGS} -c circledoublelist.cpp -o circledoublelist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(CircleSingle)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp circlesinglelist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp circlesinglelist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# CircleSingleList
|
||||
###############################################################################
|
||||
|
||||
circlesinglelist.o: circlesinglelist.cpp circlesinglelist.h
|
||||
${CXX} ${CXXFLAGS} -c circlesinglelist.cpp -o circlesinglelist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a doubly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(DoubleList)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp doublelist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp doublelist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# DoubleList
|
||||
###############################################################################
|
||||
|
||||
doublelist.o: doublelist.cpp doublelist.h
|
||||
${CXX} ${CXXFLAGS} -c doublelist.cpp -o doublelist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a max heap implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(MaxHeap)
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a queue implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Queue)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp queuelist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp queuelist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# QueueList
|
||||
###############################################################################
|
||||
|
||||
queuelist.o: queuelist.cpp queuelist.h
|
||||
${CXX} ${CXXFLAGS} -c queuelist.cpp -o queuelist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,12 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a singly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(SingleList)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp singlelist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp singlelist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# SingleList
|
||||
###############################################################################
|
||||
|
||||
singlelist.o: singlelist.cpp singlelist.h
|
||||
${CXX} ${CXXFLAGS} -c singlelist.cpp -o singlelist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,13 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Stack)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp stacklist.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp stacklist.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# StackList
|
||||
###############################################################################
|
||||
|
||||
stacklist.o: stacklist.cpp stacklist.h
|
||||
${CXX} ${CXXFLAGS} -c stacklist.cpp -o stacklist.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -0,0 +1,21 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 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 (
|
||||
#[[NAME]] TemplatedStructures
|
||||
VERSION 1.0
|
||||
DESCRIPTION "A project for practicing templated data structures in C++"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
add_subdirectory(doublelist)
|
||||
add_subdirectory(queuelist)
|
||||
add_subdirectory(stacklist)
|
||||
add_subdirectory(vector)
|
|
@ -1,18 +1,16 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a doubly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(DoubleList)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(DoubleListDriver ${SRC})
|
||||
add_executable(TemplatedDoubleListDriver ${SRC})
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp
|
||||
${CXX} ${CXXFLAGS} driver.cpp -o driver
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,18 +1,16 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a queue implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Queue)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(QueueDriver ${SRC})
|
||||
add_executable(TemplatedQueueDriver ${SRC})
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp
|
||||
${CXX} ${CXXFLAGS} driver.cpp -o driver
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,18 +1,16 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(Stack)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(StackDriver ${SRC})
|
||||
add_executable(TemplatedStackDriver ${SRC})
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp
|
||||
${CXX} ${CXXFLAGS} driver.cpp -o driver
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,18 +1,17 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(VectorDriver)
|
||||
# Define source files
|
||||
set(SRC driver.cpp)
|
||||
# Build an executable
|
||||
add_executable(VectorDriver ${SRC})
|
||||
add_executable(TemplatedVectorDriver ${SRC})
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp
|
||||
${CXX} ${CXXFLAGS} driver.cpp -o driver
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -1,14 +1,13 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2021 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.2)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Define the project name
|
||||
project(VectorDriver)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-g -Wall
|
||||
|
||||
###############################################################################
|
||||
# Driver
|
||||
###############################################################################
|
||||
|
||||
driver: driver.cpp vector.o
|
||||
${CXX} ${CXXFLAGS} driver.cpp vector.o -o driver
|
||||
|
||||
###############################################################################
|
||||
# Vector
|
||||
###############################################################################
|
||||
|
||||
vector.o: vector.cpp vector.h
|
||||
${CXX} ${CXXFLAGS} -c vector.cpp -o vector.o
|
||||
|
||||
###############################################################################
|
||||
# Clean
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
rm -f *.o driver
|
|
@ -0,0 +1,58 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
|
||||
# Define CMake version
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project( # Define project
|
||||
invaders # Project name
|
||||
DESCRIPTION "Space invaders remake using OpenGL and CPP"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
# Pass this to program to control debug output
|
||||
option (EXE_BUILD "Should we build the executable?" ON)
|
||||
|
||||
add_library( # Add Library
|
||||
lib-invaders # Library Name
|
||||
"src/lib-invaders.cpp" # Sources..
|
||||
"src/lib-invaders.h"
|
||||
)
|
||||
|
||||
target_include_directories( # When calling library, include a directory
|
||||
lib-invaders # Library name
|
||||
PUBLIC #
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}" # Source directory of exe including our library
|
||||
)
|
||||
|
||||
if (EXE_BUILD)
|
||||
set(BUILD_STATUS "Building default executable")
|
||||
include(FindOpenGL)
|
||||
include(FindGLUT)
|
||||
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
|
||||
|
||||
add_executable( # Creating executable
|
||||
invaders # Exe name
|
||||
"app/invaders.cpp" # Exe Source(s)
|
||||
)
|
||||
|
||||
# Link the executable with OpenGL libraries
|
||||
target_link_libraries( # Linking the exe to library
|
||||
invaders # Executable to link
|
||||
PUBLIC #
|
||||
lib-invaders # Library to link
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
|
||||
# Link the executable with OpenGL Utility Toolkit
|
||||
target_link_libraries( # Linking the exe to library
|
||||
invaders # Executable to link
|
||||
PUBLIC #
|
||||
lib-invaders # Library to link
|
||||
${GLUT_LIBRARIES}
|
||||
)
|
||||
endif()
|
|
@ -21,13 +21,13 @@ option (DB_BUILD "Should we run the build in debug mode?" OFF)
|
|||
option (EXE_BUILD "Should we build the executable?" ON)
|
||||
|
||||
add_library( # Add Library
|
||||
lib-inherit # Library Name
|
||||
"src/lib-inherit.cpp" # Sources..
|
||||
"src/lib-inherit.h"
|
||||
lib-sdl-test # Library Name
|
||||
"src/lib-sdl-test.cpp" # Sources..
|
||||
"src/lib-sdl-test.h"
|
||||
)
|
||||
|
||||
target_include_directories( # When calling library, include a directory
|
||||
lib-inherit # Library name
|
||||
lib-sdl-test # Library name
|
||||
PUBLIC #
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}" # Source directory of exe including our library
|
||||
)
|
||||
|
@ -39,13 +39,13 @@ if (EXE_BUILD)
|
|||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
add_executable( # Creating executable
|
||||
inherited # Exe name
|
||||
"apps/inherited.cpp" # Exe Source(s)
|
||||
sdl-test # Exe name
|
||||
"apps/sdl-test.cpp" # Exe Source(s)
|
||||
)
|
||||
target_link_libraries( # Linking the exe to library
|
||||
inherited # Executable to link
|
||||
sdl-test # Executable to link
|
||||
PRIVATE #
|
||||
lib-inherit # Library to link
|
||||
lib-sdl-test # Library to link
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
elseif(DB_BUILD)
|
||||
|
@ -61,7 +61,7 @@ elseif(DB_CONF)
|
|||
# Configure header file with CMake variables defined in src/lib-inherit.h.in
|
||||
# @ONLY is specified, only variables of the form @VAR@ will be replaced and ${VAR} will be ignored.
|
||||
# configure_file(src/lib-inherit.h src/lib-inherit.h @ONLY)
|
||||
configure_file(apps/inherited.cpp apps/inherited.cpp @ONLY)
|
||||
configure_file(apps/sdl-test.cpp apps/sdl-test.cpp @ONLY)
|
||||
|
||||
# Create compile_commands.json for linter
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
## apps/inherited.cpp
|
||||
*/
|
||||
|
||||
#include <src/lib-inherit.h>
|
||||
#include <src/lib-sdl-test.h>
|
||||
#include <iostream>
|
||||
//#include <string>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
## src/lib-inherit.cpp
|
||||
*/
|
||||
|
||||
#include <src/lib-inherit.h>
|
||||
#include <src/lib-sdl-test.h>
|
||||
|
||||
// Shape class definitions
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
# Root CMakeLists.txt of cpp practice 4-inheritance
|
||||
|
||||
# Define CMake version
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project( # Define project
|
||||
inheritance # Project name
|
||||
DESCRIPTION "Example project for class inheritance"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
# Pass this to program to control debug output
|
||||
option (DB_CONF "Should we debug and configure files with cmake values?" ON)
|
||||
option (DB_BUILD "Should we run the build in debug mode?" OFF)
|
||||
option (EXE_BUILD "Should we build the executable?" ON)
|
||||
|
||||
add_library( # Add Library
|
||||
lib-inherit # Library Name
|
||||
"src/lib-inherit.cpp" # Sources..
|
||||
"src/lib-inherit.h"
|
||||
)
|
||||
|
||||
target_include_directories( # When calling library, include a directory
|
||||
lib-inherit # Library name
|
||||
PUBLIC #
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}" # Source directory of exe including our library
|
||||
)
|
||||
|
||||
if (EXE_BUILD)
|
||||
set(BUILD_STATUS "Building default executable")
|
||||
include(FindPkgConfig)
|
||||
pkg_search_module(SDL2 REQUIRED sdl2)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
add_executable( # Creating executable
|
||||
inherited # Exe name
|
||||
"apps/inherited.cpp" # Exe Source(s)
|
||||
)
|
||||
target_link_libraries( # Linking the exe to library
|
||||
inherited # Executable to link
|
||||
PRIVATE #
|
||||
lib-inherit # Library to link
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
elseif(DB_BUILD)
|
||||
set(BUILD_STATUS "Building in debug mode")
|
||||
|
||||
# Create compile_commands.json for linter
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
target_compile_definitions(inherited PRIVATE BUILD_STATUS=${BUILD_STATUS})
|
||||
elseif(DB_CONF)
|
||||
set(BUILD_STATUS "Building in debug mode, configuring files")
|
||||
|
||||
# Configure header file with CMake variables defined in src/lib-inherit.h.in
|
||||
# @ONLY is specified, only variables of the form @VAR@ will be replaced and ${VAR} will be ignored.
|
||||
# configure_file(src/lib-inherit.h src/lib-inherit.h @ONLY)
|
||||
configure_file(apps/inherited.cpp apps/inherited.cpp @ONLY)
|
||||
|
||||
# Create compile_commands.json for linter
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
endif()
|
||||
#target_compile_definitions(inherited PRIVATE BUILD_STATUS=${BUILD_STATUS})
|
||||
|
Loading…
Reference in New Issue