Skip to content

Commit

Permalink
add basic c++ project
Browse files Browse the repository at this point in the history
Signed-off-by: theComputeKid <[email protected]>
  • Loading branch information
theComputeKid committed Sep 3, 2022
1 parent 453a65b commit 72d5f3a
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
66 changes: 66 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"env": {
"myDefaultIncludePath": [
"${workspaceFolder}/test/include"
]
},
"configurations": [
{
"name": "Linux",
"includePath": [
"${myDefaultIncludePath}"
],
"browse": {
"path": [
"${myDefaultIncludePath}"
],
"limitSymbolsToIncludedHeaders": true
},
"compilerPath": "/usr/local/cuda/bin/nvcc",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
},
{
"name": "Win32",
"includePath": [
"${myDefaultIncludePath}"
],
"browse": {
"path": [
"${myDefaultIncludePath}"
],
"limitSymbolsToIncludedHeaders": true
},
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "${CUDA_PATH}/bin/nvcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
},
{
"name": "Mac",
"includePath": [
"${myDefaultIncludePath}",
"${workspaceFolder}/src/metal/include"
],
"browse": {
"path": [
"${myDefaultIncludePath}",
"${workspaceFolder}/src/metal/include"
],
"limitSymbolsToIncludedHeaders": true
},
"macFrameworkPath": [],
"compilerPath": "/usr/bin/clang++",
"cStandard": "c17",
"cppStandard": "c++23",
"intelliSenseMode": "macos-clang-arm64"
}
],
"version": 4
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"ms-vscode.cpptools",
"cschlosser.doxdocgen",
"gruntfuggly.todo-tree",
"eamodio.gitlens"
]
}
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "windows-debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/test/out/ExampleProjectExe/bin/debug/ExampleProjectExe.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"preLaunchTask": "make"
},
{
"name": "windows-release",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/test/out/ExampleProjectExe/bin/release/ExampleProjectExe.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"preLaunchTask": "make"
}
]
}
156 changes: 156 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"git.enableCommitSigning": true,
"git.autoRepositoryDetection": "openEditors",
"git.alwaysSignOff": true,
"git.fetchOnPull": true,
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"doxdocgen.generic.dateFormat": "YYYY-MM-DD",
"doxdocgen.file.fileOrder": [
"file",
"empty",
"brief",
"empty",
"version",
"date",
],
"doxdocgen.generic.includeTypeAtReturn": true,
"files.associations": {
"iostream": "cpp",
"variant": "cpp",
"ostream": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ranges": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp",
"coroutine": "cpp",
"resumable": "cpp",
"future": "cpp",
"any": "cpp",
"barrier": "cpp",
"bitset": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cuchar": "cpp",
"execution": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_set": "cpp",
"filesystem": "cpp",
"format": "cpp",
"fstream": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"latch": "cpp",
"locale": "cpp",
"mutex": "cpp",
"numbers": "cpp",
"queue": "cpp",
"ratio": "cpp",
"regex": "cpp",
"scoped_allocator": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stop_token": "cpp",
"strstream": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"valarray": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__std_stream": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"propagate_const": "cpp",
"__functional_base": "cpp",
"simd": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"*.def": "cpp"
},
}
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"windows": {
"command": "nmake"
},
"linux": {
"command": "make"
},
"osx": {
"command": "make"
},
"args": [
"build"
]
}
]
}
14 changes: 14 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#* Makefile to build premake-core for tests on windows
PREMAKE_OUT = vendor\premake-core\bin\release\premake5.exe

#* Runs the tests.
all: build
@echo Testing debug config
@cd test\out\ExampleProjectExe\bin\debug && .\ExampleProjectExe.exe
@echo Testing release config
@cd test\out\ExampleProjectExe\bin\release && .\ExampleProjectExe.exe

build: premake
@cd test\out && msbuild -p:Configuration=debug -m -v:Normal
@cd test\out && msbuild -p:Configuration=release -m -v:Normal

premake: $(PREMAKE_OUT)
@cd test && ..\$(PREMAKE_OUT) vs2022

$(PREMAKE_OUT):
@cd vendor\premake-core && $(MAKE) -nologo -f Bootstrap.mak windows PLATFORM=x64
15 changes: 15 additions & 0 deletions test/exe/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @file main.cpp
*
* @brief Main entry point to CUDA executable project.
*
* @version 0.1
* @date 2022-09-03
*/
#include <iostream>

int main()
{
std::cout << "Hello from the C++ file of the executable" << std::endl;
return 0;
}
54 changes: 54 additions & 0 deletions test/premake5.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
workspace "ExampleProject"

language "C++"

cppdialect "C++17"

location "out"

configurations {
"debug",
"release"
}

architecture "x64"

warnings "Extra"

flags {
"FatalWarnings",
"RelativeLinks",
"MultiProcessorCompile"
}

filter "configurations:release"
symbols "Off"
optimize "Full"
runtime "Release"

filter "configurations:debug"
defines {"DEBUG"}
symbols "On"
optimize "Off"
runtime "Debug"
filter {}

includedirs { "include" }

--* test excetuable project
project "ExampleProjectExe"

kind "ConsoleApp"

location "out/%{prj.name}"

files {
"exe/**.cpp",
"exe/**.hpp",
}

vpaths {
["Import/*"] = "include/**.hpp",
["Sources/*"] = "exe/**.cpp",
["Sources/*"] = "exe/**.cpp",
}

0 comments on commit 72d5f3a

Please sign in to comment.