Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DefaultYAMLs/Default/clang++.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Compiler:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "clang++"
RunParts: &g++_CompileRunParts
RunParts: &clang++_CompileRunParts
- Type: Once
CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}"
- Type: Repeats
Expand All @@ -49,13 +49,13 @@ Compiler:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "clang++"
RunParts: *g++_CompileRunParts
RunParts: *clang++_CompileRunParts
ExpectedOutputFiles: *g++_CompileExpectedOutputFiles
Shared:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags} -fpic"
Executable: "clang++"
RunParts: *g++_CompileRunParts
RunParts: *clang++_CompileRunParts
ExpectedOutputFiles: *g++_CompileExpectedOutputFiles
Linker:
CheckExistence:
Expand Down
112 changes: 112 additions & 0 deletions DefaultYAMLs/Default/clang.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# DO NOT modify this file. Changes will be overwritten when there's a reset or update

Name: "clang"
FileExtensions: [.c]
Languages: ["c"]
Import: "./CommonFileTypes.yaml"
Parameters:
Profile.CompileMode:
Default: "Debug"
Constraint:
- "Debug:-std=c99 -Wall -g -Og"
- "Release:-std=c++17 -Wall -O2 -DNDEBUG=1"
Profile.OutputPreprocess:
Default: "false"
Constraint:
- "true: -E"
- "1: -E"
- "false:"
- "0:"
Variables:
Profile.Intern_CompileFlags: "{Profile.CompileMode}{Profile.OutputPreprocess}"
Compiler:
CheckExistence:
DefaultPlatform: "clang -v"
CompileTypes:
Executable:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "clang"
RunParts: &gcc_CompileRunParts
- Type: Once
CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}"
- Type: Repeats
CommandPart: " -D{Stage.DefineNameOnly}="
- Type: Repeats
CommandPart: " \"-D{Stage.DefineName}={Stage.DefineValue}\""
- Type: Repeats
CommandPart: " -isystem \"{Stage.IncludeDirectory.Dep.Path}\""
- Type: Repeats
CommandPart: " -I\"{Stage.IncludeDirectory.Source.Path}\""
- Type: Once
CommandPart: " \"{Stage.Input.Path}\" -o \"{Stage.Output.Directory}{/}\
{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\
{Stage.ObjectLinkFile.Extension}\""
ExpectedOutputFiles: &gcc_CompileExpectedOutputFiles
- "{Stage.Output.Directory}{/}{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\
{Stage.ObjectLinkFile.Extension}"
Static:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "clang"
RunParts: *gcc_CompileRunParts
ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles
Shared:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags} -fpic"
Executable: "clang"
RunParts: *gcc_CompileRunParts
ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles
Linker:
CheckExistence:
DefaultPlatform: "clang -v"
LinkTypes:
Executable:
Unix:
Flags: "-Wl,-rpath,\\$ORIGIN"
Executable: "clang"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.Output.Name}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles: ["{Stage.Output.Directory}{/}{Stage.Output.Name}"]
Windows:
Flags: "-Wl,-rpath,\\$ORIGIN"
Executable: "clang"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}"
Static:
DefaultPlatform:
Flags: ""
Executable: "clang"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}{Stage.StaticLinkFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}\
{Stage.StaticLinkFile.Extension}"
Shared:
DefaultPlatform:
Flags: "-shared -Wl,-rpath,\\$ORIGIN"
Executable: "clang"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\
{Stage.SharedLibraryFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\
{Stage.SharedLibraryFile.Extension}"
112 changes: 112 additions & 0 deletions DefaultYAMLs/Default/gcc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# DO NOT modify this file. Changes will be overwritten when there's a reset or update

Name: "gcc"
FileExtensions: [.c]
Languages: ["c"]
Import: "./CommonFileTypes.yaml"
Parameters:
Profile.CompileMode:
Default: "Debug"
Constraint:
- "Debug:-std=c99 -Wall -g -Og"
- "Release:-std=c++17 -Wall -O2 -DNDEBUG=1"
Profile.OutputPreprocess:
Default: "false"
Constraint:
- "true: -E"
- "1: -E"
- "false:"
- "0:"
Variables:
Profile.Intern_CompileFlags: "{Profile.CompileMode}{Profile.OutputPreprocess}"
Compiler:
CheckExistence:
DefaultPlatform: "gcc -v"
CompileTypes:
Executable:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "gcc"
RunParts: &gcc_CompileRunParts
- Type: Once
CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}"
- Type: Repeats
CommandPart: " -D{Stage.DefineNameOnly}="
- Type: Repeats
CommandPart: " \"-D{Stage.DefineName}={Stage.DefineValue}\""
- Type: Repeats
CommandPart: " -isystem \"{Stage.IncludeDirectory.Dep.Path}\""
- Type: Repeats
CommandPart: " -I\"{Stage.IncludeDirectory.Source.Path}\""
- Type: Once
CommandPart: " \"{Stage.Input.Path}\" -o \"{Stage.Output.Directory}{/}\
{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\
{Stage.ObjectLinkFile.Extension}\""
ExpectedOutputFiles: &gcc_CompileExpectedOutputFiles
- "{Stage.Output.Directory}{/}{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\
{Stage.ObjectLinkFile.Extension}"
Static:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags}"
Executable: "gcc"
RunParts: *gcc_CompileRunParts
ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles
Shared:
DefaultPlatform:
Flags: "{Profile.Intern_CompileFlags} -fpic"
Executable: "gcc"
RunParts: *gcc_CompileRunParts
ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles
Linker:
CheckExistence:
DefaultPlatform: "gcc -v"
LinkTypes:
Executable:
Unix:
Flags: "-Wl,-rpath,\\$ORIGIN"
Executable: "gcc"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.Output.Name}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles: ["{Stage.Output.Directory}{/}{Stage.Output.Name}"]
Windows:
Flags: "-Wl,-rpath,\\$ORIGIN"
Executable: "gcc"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}"
Static:
DefaultPlatform:
Flags: ""
Executable: "gcc"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}{Stage.StaticLinkFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}\
{Stage.StaticLinkFile.Extension}"
Shared:
DefaultPlatform:
Flags: "-shared -Wl,-rpath,\\$ORIGIN"
Executable: "gcc"
RunParts:
- Type: Once
CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\
{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\
{Stage.SharedLibraryFile.Extension}\""
- Type: Repeats
CommandPart: " \"{Stage.Input.Path}\""
ExpectedOutputFiles:
- "{Stage.Output.Directory}{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\
{Stage.SharedLibraryFile.Extension}"
4 changes: 3 additions & 1 deletion DefaultYAMLs/DefaultUserConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

# A profile to be used if not specified while running the build script
PreferredProfile:
DefaultPlatform: "g++"
DefaultPlatform: "gcc"
Windows: "msvc"

# List of compiler/linker profiles that instruct how to compile/link
# See "./Default/g++.yaml" for the documentation of each field in a profile entry
Profiles:
- Import: "./Default/gcc.yaml"
- Import: "./Default/clang.yaml"
- Import: "./Default/g++.yaml"
- Import: "./Default/clang++.yaml"
- Import: "./Default/vs2022_v17+.yaml"
2 changes: 1 addition & 1 deletion External/System2
Submodule System2 updated 1 files
+1 −0 System2.h
6 changes: 5 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pipeline

Trigger:
$GITHUB_PUSH_REF , $GITHUB_PR_REF , $GITHUB_PR_ACTION
^refs/heads/master , , $|^ , .[a-zA-Z0-9/]* , (opened|synchronize)$
^refs/heads/master , , $|^ , .[a-zA-Z0-9/\-_]* , (opened|synchronize)$

Param:
TARGET_REF
Expand Down Expand Up @@ -336,6 +336,7 @@ pipeline
bash 'cp ./BootstrapBuild/runcpp2 ./Build'
bash "./Build/runcpp2 run -l -c ./DefaultYAMLs/DefaultUserConfig.yaml " +
"./Build.cpp --runcpp2-path ./Build/runcpp2"
sleep 5
stash 'linux_debug_build'
}
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
Expand All @@ -354,6 +355,7 @@ pipeline
bat ".\\Build\\runcpp2.exe run -l -c " +
".\\DefaultYAMLs\\DefaultUserConfig.yaml .\\Build.cpp --runcpp2-path " +
".\\Build\\runcpp2.exe"
sleep 5
stash 'windows_debug_build'
}
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
Expand All @@ -371,6 +373,7 @@ pipeline
bash 'cp ./BootstrapBuild/runcpp2 ./Build'
bash "./Build/runcpp2 run -l -c ./DefaultYAMLs/DefaultUserConfig.yaml " +
"./Build.cpp --runcpp2-path ./Build/runcpp2 --release"
sleep 5
stash 'linux_release_build'
}
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
Expand All @@ -389,6 +392,7 @@ pipeline
bat ".\\Build\\runcpp2.exe run -l -c " +
".\\DefaultYAMLs\\DefaultUserConfig.yaml .\\Build.cpp --runcpp2-path " +
".\\Build\\runcpp2.exe --release"
sleep 5
stash 'windows_release_build'
}
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
Expand Down
64 changes: 64 additions & 0 deletions Tests/C_ProfileTest/System2Test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* runcpp2
Dependencies:
- Name: System2
Platforms: [DefaultPlatform]
Source:
Local:
Path: "../../External/System2"
LibraryType: Header
IncludePaths: ["."]
*/

#include "System2.h"
#include <stdio.h>

int main(int argc, char** argv)
{
(void)argc;
(void)argv;

//NOTE: This will fail for C++, this tests to use C Profile only
System2CommandInfo commandInfo = {
.RedirectInput = true,
.RedirectOutput = true
};

//Run the command in shell (subprocess is also available, see main.c)
{
#if defined(__unix__) || defined(__APPLE__)
System2Run("read testVar && echo testVar is \\\"$testVar\\\"", &commandInfo);
#elif defined(_WIN32)
System2Run("set /p testVar= && echo testVar is \"!testVar!\"", &commandInfo);
#else
#error "Unexpected platform?"
#endif
}

//Send input to the command
{
char input[] = "test content\n";
System2WriteToInput(&commandInfo, input, sizeof(input));
}

//Wait for command to finish and get return code
int returnCode = -1;
System2GetCommandReturnValue(&commandInfo, -1, &returnCode);

//Capture output and print it
{
char outputBuffer[1024];
uint32_t bytesRead = 0;

System2ReadFromOutput(&commandInfo, outputBuffer, 1023, &bytesRead);
outputBuffer[bytesRead] = 0;

printf("%s\n", outputBuffer);
printf("%s: %d\n", "Command has executed with return value", returnCode);
}

System2CleanupCommand(&commandInfo);
return 0;

//Output: testVar is "test content"
//Output: Command has executed with return value: 0
}
Loading