Skip to content

Commit

Permalink
up for 8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
franneck94 committed Aug 8, 2023
1 parent e21bc66 commit 8cb997e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ package-lock.json
*.vsix
*.cpuprofile
*.log
*.pdb
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# C/C++ Runner Change Log

## Version 8.1.0: Aug 08, 2023

- **Info**: Added LTO for Cuda Code
- **Info**: Added Compile Time Info for Cuda Code

## Version 8.0.0: Aug 08, 2023

- **Info**: Added the ability to compile Cuda (.cu) code with the Cuda NVCC compiler
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# VSCode C/C++ Runner

🚀 Compile, run and debug [**single**](#compile-a-single-file) or [**multiple**](#compile-all-files-in-one-folder) C/C++ files with ease. 🚀
🚀 Compile, run and debug [**single**](#compile-a-single-file) or [**multiple**](#compile-all-files-in-one-folder) C/C++/Cuda files with ease. 🚀
You do not need to know about any compiler commands. 😎

## Example
Expand All @@ -9,10 +9,11 @@ You do not need to know about any compiler commands. 😎

## Software Requirements

- 🔧 Any GCC, Clang, or MSVC compiler
- 🔧 Any GCC, Clang, MSVC or Cuda NVCC compiler

Make sure that your GCC/Clang compiler is either in your [PATH](https://superuser.com/a/284351) or you have to manually set the **C/C++ Compiler** setting of this extension.
For Windows Users that want to use the [Visual Studio compiler](https://visualstudio.microsoft.com/) (called **MSVC**) see instructions [here](#using-the-msvc-compiler).
For Windows Users that want to use the [Visual Studio compiler](https://visualstudio.microsoft.com/) (called **MSVC**) see instructions [here](#using-the-msvc-compiler).
For Cuda code the **NVCC** Compiler will be automatically called.

## The Extension automatically activates when

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "c-cpp-runner",
"displayName": "C/C++ Runner",
"description": "🚀 Compile, run and debug single or multiple C/C++ files with ease. 🚀",
"version": "8.0.0",
"version": "8.1.0",
"publisher": "franneck94",
"license": "MIT",
"icon": "icon.png",
Expand All @@ -11,7 +11,7 @@
"theme": "dark"
},
"engines": {
"vscode": "^1.79.0"
"vscode": "^1.81.0"
},
"categories": [
"Programming Languages",
Expand Down
23 changes: 16 additions & 7 deletions src/executor/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function executeBuildTask(
singleFileBuild,
);
} else {
commandLine = executeBuildCudaTaskUnixBased(
commandLine = executeCudaBuildTask(
settingsProvider,
activeFolder,
buildMode,
Expand Down Expand Up @@ -301,7 +301,7 @@ function executeBuildTaskUnixBased(
return commandLine;
}

function executeBuildCudaTaskUnixBased(
function executeCudaBuildTask(
settingsProvider: SettingsProvider,
activeFolder: string,
buildMode: Builds,
Expand All @@ -322,13 +322,18 @@ function executeBuildCudaTaskUnixBased(
let fullCompilerArgs = '';
let fullLinkerArgs = '';

const showCompilationTime = settingsProvider.showCompilationTime;
if (showCompilationTime) {
fullCompilerArgs += ' --time -';
}

if (standard) {
fullCompilerArgs += ` --std=${standard}`;
}
if (buildMode === Builds.debug) {
fullCompilerArgs += ' -O0';
fullCompilerArgs += ' -g -O0';
} else {
fullCompilerArgs += ' -Xptxas -O3';
fullCompilerArgs += ' -O3';
}
if (compilerArgs && compilerArgs.length > 0 && !settingsProvider.useMsvc) {
fullCompilerArgs += ' ' + compilerArgs.join(' ');
Expand All @@ -345,7 +350,11 @@ function executeBuildCudaTaskUnixBased(
const objectFiles: string[] = [];
const fullFileArgs: string[] = [];

const useLto =
settingsProvider.useLinkTimeOptimization && buildMode === Builds.release;
const ltoFlag = useLto ? '--lto' : '';
const operatingSystem = settingsProvider.operatingSystem;

for (const file of files) {
const fileExtension = path.parse(file).ext;

Expand All @@ -367,9 +376,9 @@ function executeBuildCudaTaskUnixBased(

let fullFileArg;
if (hasSpace) {
fullFileArg = ` -c '${file}' -o '${objectFilePath}'`;
fullFileArg = `${ltoFlag} -c '${file}' -o '${objectFilePath}'`;
} else {
fullFileArg = ` -c ${file} -o ${objectFilePath}`;
fullFileArg = `${ltoFlag} -c ${file} -o ${objectFilePath}`;
}

objectFiles.push(objectFilePath);
Expand Down Expand Up @@ -415,7 +424,7 @@ function executeBuildCudaTaskUnixBased(
}

if (objectFiles.length < LOWER_LIMIT_WILDARD_COMPILE) {
const fullObjectFileArgs = ` ${objectFilesStr} -o ${executablePath}`;
const fullObjectFileArgs = `${ltoFlag} ${objectFilesStr} -o ${executablePath}`;
commandLine += ` ${appendSymbol} ${compiler} ${fullCompilerArgs} ${fullObjectFileArgs}`;
}

Expand Down

0 comments on commit 8cb997e

Please sign in to comment.