Restructure to SCons with empty Vector lib
This commit is contained in:
parent
c10e35d940
commit
d0a7f73512
4
.gitignore
vendored
4
.gitignore
vendored
@ -32,3 +32,7 @@
|
|||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
# SConstruct
|
||||||
|
**/.sconsign.dblite
|
||||||
|
compile_commands.json
|
||||||
|
.cache/
|
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Debug",
|
||||||
|
"type": "gdb",
|
||||||
|
"request": "launch",
|
||||||
|
"target": "./vector.out",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"valuesFormatting": "parseText",
|
||||||
|
"preLaunchTask": "build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
.vscode/tasks.json
vendored
Normal file
11
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "scons",
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
Makefile
11
Makefile
@ -1,11 +0,0 @@
|
|||||||
CXX = g++
|
|
||||||
CXXFLAGS = -Wall -O3
|
|
||||||
|
|
||||||
program: main.o
|
|
||||||
$(CXX) $(CXXFLAGS) -o program.out main.o
|
|
||||||
|
|
||||||
main.o: main.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -c main.cpp
|
|
||||||
|
|
||||||
clean :
|
|
||||||
-rm *.o *.out
|
|
12
README.md
12
README.md
@ -1,7 +1,9 @@
|
|||||||
# cpp-template
|
# Vector Library
|
||||||
|
|
||||||
## Instructions
|
## Building
|
||||||
|
Run `scons` in the root directory.
|
||||||
|
|
||||||
- Formatting: `./format.sh`
|
## Developing
|
||||||
- Building: `make`
|
The `scons` command also generates a `compile_commands.json` which can be used by the VSCodium extension `clangd` for autocompletion, debugging, etc.
|
||||||
- Running: `./program.out`
|
|
||||||
|
Build and run scripts for VSCodium are provided as well.
|
8
SConstruct
Normal file
8
SConstruct
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!python
|
||||||
|
|
||||||
|
# Create the environment and create a Compilation Database for use in VSCodium
|
||||||
|
env = DefaultEnvironment(tools=['default', 'compilation_db'])
|
||||||
|
env.CompilationDatabase()
|
||||||
|
|
||||||
|
# Build the output program
|
||||||
|
Program('vector.out', Glob('*.cpp'))
|
6
Vector.cpp
Normal file
6
Vector.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "Vector.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
Vector::Vector() {
|
||||||
|
std::cout << "Vector created" << std::endl;
|
||||||
|
}
|
5
main.cpp
5
main.cpp
@ -1,7 +1,6 @@
|
|||||||
|
#include "Vector.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "Hello World!" << std::endl;
|
Vector vector;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
clang_format_command="clang-format"
|
|
||||||
clang_tidy_command="run-clang-tidy"
|
|
||||||
fi
|
|
||||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
|
||||||
clang_format_command="clang-format-11"
|
|
||||||
clang_tidy_command="run-clang-tidy-11"
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval "$clang_format_command -i *.h *.cpp -style=file"
|
|
||||||
eval "$clang_tidy_command -fix"
|
|
Loading…
x
Reference in New Issue
Block a user