Skip to content
Merged
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
32 changes: 16 additions & 16 deletions DefaultYAMLs/DefaultScriptInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ RequiredProfiles:
# (Optional) Override the default compile flags for each platform.
OverrideCompileFlags:
# Target Platform
Default:
# Profile with the respective flags to override. ("Default" for any profile)
DefaultPlatform:
# Profile with the respective flags to override. ("DefaultProfile" for any profile)
"g++":
# (Optional) Flags to be removed from the default compile flags, separated by space
Remove: ""
Expand All @@ -39,8 +39,8 @@ OverrideCompileFlags:
# (Optional) Override the default link flags for each platform.
OverrideLinkFlags:
# Target Platform
Default:
# Profile with the respective flags to override ("Default" for any profile)
DefaultPlatform:
# Profile with the respective flags to override ("DefaultProfile" for any profile)
"g++":
# (Optional) Flags to be removed from the default link flags, separated by space
Remove: ""
Expand All @@ -52,18 +52,18 @@ OverrideLinkFlags:
# (Optional) Other source files (relative to script file path) to be compiled.
OtherFilesToBeCompiled:
# Target Platform
Default:
DefaultPlatform:
# Target Profile
Default:
DefaultProfile:
- "./AnotherSourceFile.cpp"

# (Optional) Define cross-compiler defines for each platform and profile.
# Defines can be specified as just a name or as a name-value pair.
Defines:
# Target Platform (Default, Windows, Linux, MacOS, or Unix)
Default:
# Profile name (e.g., "g++", "clang++", "msvc", or "Default" for any profile)
"Default":
# Target Platform (DefaultPlatform, Windows, Linux, MacOS, or Unix)
DefaultPlatform:
# Profile name (e.g., "g++", "clang++", "msvc", or "DefaultProfile" for any profile)
"DefaultProfile":
- "EXAMPLE_DEFINE" # Define without a value
- "VERSION_MAJOR=1" # Define with a value

Expand Down Expand Up @@ -117,7 +117,7 @@ Dependencies:
Default:
# Setup shell commands for the specified profile.
# Default commands are run in the dependency folder
# You can also use "Default" if all the compilers run the same setup commands
# You can also use "DefaultProfile" if all the compilers run the same setup commands
"g++":
- "mkdir build"

Expand All @@ -126,7 +126,7 @@ Dependencies:
Build:
# Target Platform
Default:
# Target Profile ("Default" for any profile)
# Target Profile ("DefaultProfile" for any profile)
"g++":
- "cd build && cmake .."
- "cd build && cmake --build ."
Expand All @@ -140,10 +140,10 @@ Dependencies:

# (Optional) Files to be copied to next to output binary for each platform and profile
FilesToCopy:
# Target Platform (Default, Windows, Linux, MacOS, or Unix)
Default:
# Profile name (e.g., "g++", "clang++", "msvc", or "Default" for any profile)
"Default":
# Target Platform (DefaultPlatform, Windows, Linux, MacOS, or Unix)
DefaultPlatform:
# Profile name (e.g., "g++", "clang++", "msvc", or "DefaultProfile" for any profile)
DefaultProfile:
# List of files to copy (relative to the dependency folder)
- "assets/textures/sprite.png"
Windows:
Expand Down
24 changes: 12 additions & 12 deletions DefaultYAMLs/DefaultUserConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ Templates:

# TODO: Add support for custom platform
# Each of the platform dependent settings can be listed under
# - Default
# - DefaultPlatform
# - Windows
# - Linux
# - MacOS
# - Unix
FilesTypes: &CommonFilesTypes
ObjectLinkFile:
Prefix:
Default: ""
DefaultPlatform: ""
Extension:
Windows: ".obj"
Unix: ".o"
Expand Down Expand Up @@ -123,12 +123,12 @@ Profiles:
# (Optional) The commands to run in **shell** before calling the compiler/linker for each platform.
# This is run inside the .runcpp2 directory where the build happens.
# Setup:
# Default: []
# DefaultPlatform: []

# (Optional) The commands to run in **shell** after calling the compiler/linker for each platform.
# This is run inside the .runcpp2 directory where the build happens.
# Cleanup:
# Default: []
# DefaultPlatform: []

# The file properties for the object files for each platform.
FilesTypes: *CommonFilesTypes
Expand All @@ -137,11 +137,11 @@ Profiles:
Compiler:
# (Optional) The command to be prepend for each compile command in **shell** for each platform
# PreRun:
# Default: ""
# DefaultPlatform: ""

# Shell command to use for checking if the executable exists or not
CheckExistence:
Default: "g++ -v"
DefaultPlatform: "g++ -v"

# Here are a list of substitution strings for RunParts, Setup and Cleanup
# {Executable}: Compiler executable
Expand All @@ -162,7 +162,7 @@ Profiles:
# {OutputFilePath}: (Similar to previous)
CompileTypes:
Executable:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g"
Executable: "g++"
RunParts: *g++_CompileRunParts
Expand All @@ -173,14 +173,14 @@ Profiles:
# This is run inside the .runcpp2 directory where the build happens.
# Cleanup: []
Static:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g"
Executable: "g++"
RunParts: *g++_CompileRunParts
# Setup: []
# Cleanup: []
Shared:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g -fpic"
Executable: "g++"
RunParts: *g++_CompileRunParts
Expand All @@ -191,11 +191,11 @@ Profiles:
Linker:
# (Optional) The command to be prepend for each link command in **shell** for each platform
# PreRun:
# Default: ""
# DefaultPlatform: ""

# Shell command to use for checking if the executable exists or not
CheckExistence:
Default: "g++ -v"
DefaultPlatform: "g++ -v"

# Here are a list of substitution strings for RunParts, Setup and Cleanup
# {Executable}: Linker executable
Expand Down Expand Up @@ -240,7 +240,7 @@ Profiles:
# Setup: []
# Cleanup: []
Static:
Default:
DefaultPlatform:
Flags: ""
Executable: "g++"
RunParts: *g++_LinkRunParts
Expand Down
28 changes: 14 additions & 14 deletions Examples/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ PassScriptPath: true

OtherFilesToBeCompiled:
# Target Platform
Default:
DefaultPlatform:
# Target Profile
"g++":
- "./OtherSources/AnotherSourceFileGcc.cpp"
"msvc":
- "./OtherSources/AnotherSourceFileMSVC.cpp"

Defines:
Default:
DefaultPlatform:
# Turns into `TEST_DEF=\"Test Define Working\"` in shell
Default: ["TEST_DEF=\\\"Test Define Working\\\""]
DefaultProfile: ["TEST_DEF=\\\"Test Define Working\\\""]

Dependencies:
- Name: ssLogger
Expand All @@ -31,36 +31,36 @@ PassScriptPath: true
LibraryType: Shared
IncludePaths: ["Include"]
LinkProperties:
Default:
Default:
DefaultPlatform:
DefaultProfile:
SearchLibraryNames: ["ssLogger"]
ExcludeLibraryNames: ["ssLogger_SRC"]
SearchDirectories: ["./build", "./build/Debug", "./build/Release"]
Setup:
Default:
Default:
DefaultPlatform:
DefaultProfile:
- "mkdir build"
Build:
Default:
Default:
DefaultPlatform:
DefaultProfile:
- "cd build && cmake .. -DssLOG_BUILD_TYPE=SHARED"
- "cd build && cmake --build . --config Release -j 16"
FilesToCopy:
# Target Platform (Default, Windows, Linux, MacOS, or Unix)
Default:
Default:
DefaultPlatform:
DefaultProfile:
- "./Include/ssLogger/ssLog.hpp"

- Name: System2.cpp
Platforms: [Default]
Platforms: [DefaultPlatform]
Source:
Type: Git
Value: "https://github.com/Neko-Box-Coder/System2.cpp.git"
LibraryType: Header
IncludePaths: [".", "./External/System2"]
Setup:
Default:
Default:
DefaultPlatform:
DefaultProfile:
- "git submodule update --init --recursive"
*/

Expand Down
38 changes: 19 additions & 19 deletions Src/Tests/Data/ProfileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ int main(int argc, char** argv)
FileExtensions: [.cpp, .cc, .cxx]
Languages: ["c++"]
Setup:
Default: ["setup command 1", "setup command 2"]
DefaultPlatform: ["setup command 1", "setup command 2"]
Cleanup:
Default: []
DefaultPlatform: []
FilesTypes:
ObjectLinkFile:
Prefix:
Default: ""
DefaultPlatform: ""
Extension:
Windows: ".obj"
Unix: ".o"
Expand Down Expand Up @@ -54,12 +54,12 @@ int main(int argc, char** argv)
Unix: ".a"
Compiler:
PreRun:
Default: ""
DefaultPlatform: ""
CheckExistence:
Default: "g++ -v"
DefaultPlatform: "g++ -v"
CompileTypes:
Executable:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g"
Executable: "g++"
RunParts:
Expand All @@ -70,24 +70,24 @@ int main(int argc, char** argv)
- Type: Once
CommandPart: " \"{InputFilePath}\" -o \"{OutputFilePath}\""
Static:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g"
Executable: "g++"
RunParts:
- Type: Once
CommandPart: "{Executable} -c {CompileFlags}"
Shared:
Default:
DefaultPlatform:
Flags: "-std=c++17 -Wall -g -fpic"
Executable: "g++"
RunParts:
- Type: Once
CommandPart: "{Executable} -c {CompileFlags}"
Linker:
PreRun:
Default: ""
DefaultPlatform: ""
CheckExistence:
Default: "g++ -v"
DefaultPlatform: "g++ -v"
LinkTypes:
Executable:
Unix:
Expand All @@ -103,7 +103,7 @@ int main(int argc, char** argv)
- Type: Once
CommandPart: "{Executable} {LinkFlags} -o \"{OutputFilePath}\""
Static:
Default:
DefaultPlatform:
Flags: ""
Executable: "g++"
RunParts:
Expand Down Expand Up @@ -154,12 +154,12 @@ int main(int argc, char** argv)
ssTEST_OUTPUT_ASSERT("Languages contains c++", profile.Languages.count("c++") == 1);

//Verify Setup
ssTEST_OUTPUT_ASSERT("Setup has Default platform", profile.Setup.count("Default") == 1);
ssTEST_OUTPUT_ASSERT("Setup has Default platform", profile.Setup.count("DefaultPlatform") == 1);
ssTEST_OUTPUT_SETUP
(
const std::vector<std::string>& setupCommands = profile.Setup.at("Default");
const std::vector<std::string>& setupCommands = profile.Setup.at("DefaultPlatform");
);
ssTEST_OUTPUT_ASSERT("Setup Default has 2 commands", setupCommands.size() == 2);
ssTEST_OUTPUT_ASSERT("Setup DefaultPlatform has 2 commands", setupCommands.size() == 2);
ssTEST_OUTPUT_ASSERT("Setup command 1", setupCommands.at(0) == "setup command 1");
ssTEST_OUTPUT_ASSERT("Setup command 2", setupCommands.at(1) == "setup command 2");

Expand All @@ -183,11 +183,11 @@ int main(int argc, char** argv)
sharedLinkFile.Extension.at("Linux") == ".so");

//Verify Compiler
ssTEST_OUTPUT_ASSERT( "Compiler CheckExistence Default",
profile.Compiler.CheckExistence.at("Default") == "g++ -v");
ssTEST_OUTPUT_ASSERT( "Compiler CheckExistence DefaultPlatform",
profile.Compiler.CheckExistence.at("DefaultPlatform") == "g++ -v");
ssTEST_OUTPUT_SETUP
(
const auto& executableCompile = profile.Compiler.OutputTypes.Executable.at("Default");
const auto& executableCompile = profile.Compiler.OutputTypes.Executable.at("DefaultPlatform");
);
ssTEST_OUTPUT_ASSERT( "Compiler Executable flags",
executableCompile.Flags == "-std=c++17 -Wall -g");
Expand All @@ -197,8 +197,8 @@ int main(int argc, char** argv)
executableCompile.RunParts.size() == 3);

//Verify Linker
ssTEST_OUTPUT_ASSERT( "Linker CheckExistence Default",
profile.Linker.CheckExistence.at("Default") == "g++ -v");
ssTEST_OUTPUT_ASSERT( "Linker CheckExistence DefaultPlatform",
profile.Linker.CheckExistence.at("DefaultPlatform") == "g++ -v");
ssTEST_OUTPUT_SETUP
(
const auto& executableLink = profile.Linker.OutputTypes.Executable.at("Unix");
Expand Down
2 changes: 1 addition & 1 deletion Src/runcpp2/Data/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void runcpp2::Data::Profile::GetNames(std::vector<std::string>& outNames) const
outNames.push_back(alias);

//Special name all that applies to all profile
outNames.push_back("Default");
outNames.push_back("DefaultProfile");
}

bool runcpp2::Data::Profile::ParseYAML_Node(ryml::ConstNodeRef& profileNode)
Expand Down
10 changes: 5 additions & 5 deletions Src/runcpp2/PlatformUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ std::string runcpp2::ProcessPath(const std::string& path)
std::vector<std::string> runcpp2::GetPlatformNames()
{
#ifdef _WIN32
return {"Windows", "Default"};
return {"Windows", "DefaultPlatform"};
#elif __linux__
return {"Linux", "Unix", "Default"};
return {"Linux", "Unix", "DefaultPlatform"};
#elif __APPLE__
return {"MacOS", "Unix", "Default"};
return {"MacOS", "Unix", "DefaultPlatform"};
#elif __unix__
return {"Unix", "Default"};
return {"Unix", "DefaultPlatform"};
#else
return {"Unknown", "Default"};
return {"Unknown", "DefaultPlatform"};
#endif
}

Expand Down
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ TODO:
- Separate git and local source options
- Add branch/tag option for git
- Add initialize submodule option for git
- Change "Default" to "DefaultProfile" and "DefaultPlatform"
- Migrate to libyaml
- Add wildcard support for filenames and extensions
- Add tests and examples (On Windows as well)
Expand Down