Skip to content

Commit 973f8f8

Browse files
Merge pull request #2 from Neko-Box-Coder/PlatformsIndependentConfig
Platforms independent config
2 parents 2b065bc + d9ee743 commit 973f8f8

22 files changed

+866
-376
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ if(RUNCPP2_UPDATE_DEFAULT_YAMLS OR EMBEDDED_FILE_SIZE LESS 1024)
3838
message(WARNING "Please build Embed2C first")
3939
return()
4040
else()
41-
set(FILES_TO_EMBED "${CMAKE_CURRENT_LIST_DIR}/DefaultYAMLs/DefaultCompilerProfiles.yaml"
42-
"DefaultCompilerProfiles"
41+
set(FILES_TO_EMBED "${CMAKE_CURRENT_LIST_DIR}/DefaultYAMLs/DefaultUserConfig.yaml"
42+
"DefaultUserConfig"
4343
"${CMAKE_CURRENT_LIST_DIR}/DefaultYAMLs/DefaultScriptInfo.yaml"
4444
"DefaultScriptInfo"
4545
)
@@ -78,6 +78,7 @@ add_executable(runcpp2 "${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/CompilerInfo
7878
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/DependencySetup.cpp"
7979
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/DependencySource.cpp"
8080
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/FlagsOverrideInfo.cpp"
81+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/ProfilesFlagsOverride.cpp"
8182
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/LinkerInfo.cpp"
8283
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/ScriptInfo.cpp"
8384
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/CompilerProfileHelper.cpp"

DefaultYAMLs/DefaultScriptInfo.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@ RequiredProfiles:
1212

1313
# (Optional) Override the default compile flags
1414
OverrideCompileFlags:
15-
# Profile with the respective flags to override
16-
"g++":
17-
# Flags to be removed from the default compile flags, separated by space
18-
Remove: ""
19-
20-
# Additional flags to be appended to the default compile flags
21-
Append: ""
15+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
16+
All:
17+
# Profile with the respective flags to override
18+
"g++":
19+
# Flags to be removed from the default compile flags, separated by space
20+
Remove: ""
21+
22+
# Additional flags to be appended to the default compile flags, separated by space
23+
Append: ""
24+
2225

2326
# (Optional) Override the default link flags
2427
OverrideLinkFlags:
25-
# Profile with the respective flags to override
26-
"g++":
27-
# Flags to be removed from the default compile flags, separated by space
28-
Remove: ""
29-
30-
# Additional flags to be appended to the default compile flags
31-
Append: ""
28+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
29+
All:
30+
# Profile with the respective flags to override
31+
"g++":
32+
# Flags to be removed from the default link flags, separated by space
33+
Remove: ""
34+
35+
# Additional flags to be appended to the default link flags, separated by space
36+
Append: ""
3237

3338
# (Optional) The list of dependencies needed by the script
3439
Dependencies:
@@ -65,12 +70,13 @@ Dependencies:
6570

6671
# (Optional) Additional link options for this dependency
6772
AdditionalLinkOptions:
73+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
6874
All: []
6975

7076

7177
# (Optional) List of setup commands for the supported platforms
7278
Setup:
73-
# Setup commands for the specified platform
79+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
7480
All:
7581
# Setup commands for the specified profile.
7682
# All commands are run in the dependency folder

DefaultYAMLs/DefaultUserConfig.yaml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ CompilerProfiles:
1414
# The languages supported by the profile
1515
Languages: ["c++"]
1616

17-
# (Optional) Steps in commandline to setup the environment
18-
SetupSteps: []
17+
# (Optional) Steps to run before calling the compiler/linker.
18+
# This is run inside the .runcpp2 directory where the build happens.
19+
SetupSteps:
20+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
21+
All: []
1922

2023
# The file extension for the object files for each platform
2124
ObjectFileExtensions:
@@ -41,14 +44,33 @@ CompilerProfiles:
4144
# Specify the compiler settings, so the final flow will be:
4245
# [Setup steps if any] --> {Executable} {CompileArgs}
4346
Compiler:
44-
# (Optional) Steps in commandline to setup the compiler
45-
SetupSteps: []
47+
# (Optional) The command to run together before running each compile command
48+
EnvironmentSetup:
49+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
50+
All: ""
4651

4752
# Executable to be called
4853
Executable: "g++"
4954

5055
# Default arguments to provide for compilation which can be overridden by the script
51-
DefaultCompileFlags: "-std=c++17 -Wall -Werror"
56+
DefaultCompileFlags:
57+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
58+
All: "-std=c++17 -Wall -Werror"
59+
60+
# Flags for compiling to an executable
61+
ExecutableCompileFlags:
62+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
63+
All: ""
64+
65+
# Flags for compiling to a static library
66+
StaticLibCompileFlags:
67+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
68+
All: ""
69+
70+
# Flags for compiling to a shared library
71+
SharedLibCompileFlags:
72+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
73+
All: ""
5274

5375
# The syntax to compile the given file.
5476
# [Setup steps if any] -->
@@ -63,15 +85,34 @@ CompilerProfiles:
6385
# Specify the linker settings, so the final flow will be:
6486
# [Setup steps if any] --> {Executable} {OutputPart} {DependenciesPart}...(for each dependency)
6587
Linker:
66-
# (Optional) Steps in commandline to setup the linker
67-
SetupSteps: []
88+
# (Optional) The command to run together before running each link command
89+
EnvironmentSetup:
90+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
91+
All: ""
6892

6993
# Executable to be called
7094
Executable: "g++"
7195

7296
# Default arguments to provide for linking dependencies to the binary,
7397
# which can be overridden by the script
74-
DefaultLinkFlags: ""
98+
DefaultLinkFlags:
99+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
100+
All: ""
101+
102+
# Flags for linking as an executable
103+
ExecutableLinkFlags:
104+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
105+
All: ""
106+
107+
# Flags for linking as a static library
108+
StaticLibLinkFlags:
109+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
110+
All: ""
111+
112+
# Flags for linking as a shared library
113+
SharedLibLinkFlags:
114+
# Applies to all platforms (Can be changed to Linux, MacOS, Windows, Unix, etc.)
115+
All: ""
75116

76117
# The syntax to link the given file
77118
LinkerArgs:

DefaultYAMLs/ScriptInfoSchema.json

Lines changed: 42 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"title": "Script dependencies",
4-
"description": "Script dependencies setup",
54
"type": "object",
65
"properties":
76
{
8-
"Language":
9-
{
10-
"type": "string",
11-
"description": "(Optional) Language of the script"
12-
},
7+
"Language": { "type": "string" },
138
"RequiredProfiles":
149
{
1510
"type": "object",
@@ -18,13 +13,9 @@
1813
"^.*$":
1914
{
2015
"type": "array",
21-
"items":
22-
{
23-
"type":"string"
24-
}
16+
"items": { "type":"string" }
2517
}
2618
},
27-
"description": "(Optional) Preferred compiler/linker profiles for the script",
2819
"additionalProperties": false
2920
},
3021
"OverrideCompileFlags":
@@ -35,26 +26,24 @@
3526
"^.*$":
3627
{
3728
"type": "object",
38-
"properties":
29+
"patternProperties":
3930
{
40-
"Remove":
31+
"^.*$":
4132
{
42-
"type": "string",
43-
"description": "Flags to be removed from the default compile flags, separated by space"
44-
},
45-
"Append":
46-
{
47-
"type": "string",
48-
"description": "Additional flags to be appended to the default compile flags"
33+
"type": "object",
34+
"properties":
35+
{
36+
"Remove": { "type": "string" },
37+
"Append": { "type": "string" }
38+
},
39+
"additionalProperties": false,
40+
"required": ["Remove", "Append"]
4941
}
5042
},
51-
"additionalProperties": false,
52-
"description": "Profile with the respective flags to override",
53-
"required": ["Remove", "Append"]
43+
"additionalProperties": false
5444
}
5545
},
56-
"additionalProperties": false,
57-
"description": "(Optional) Override the default compile flags"
46+
"additionalProperties": false
5847
},
5948
"OverrideLinkFlags":
6049
{
@@ -64,46 +53,38 @@
6453
"^.*$":
6554
{
6655
"type": "object",
67-
"properties":
56+
"patternProperties":
6857
{
69-
"Remove":
70-
{
71-
"type": "string",
72-
"description": "Flags to be removed from the default compile flags, separated by space"
73-
},
74-
"Append":
58+
"^.*$":
7559
{
76-
"type": "string",
77-
"description": "Additional flags to be appended to the default compile flags"
60+
"type": "object",
61+
"properties":
62+
{
63+
"Remove": { "type": "string" },
64+
"Append": { "type": "string" }
65+
},
66+
"additionalProperties": false,
67+
"required": ["Remove", "Append"]
7868
}
79-
},
80-
"additionalProperties": false,
81-
"description": "Profile with the respective flags to override",
82-
"required": ["Remove", "Append"]
83-
}
69+
}
70+
},
71+
"additionalProperties": false
8472
},
85-
"additionalProperties": false,
86-
"description": "(Optional) Override the default link flags"
73+
"additionalProperties": false
8774
},
8875
"Dependencies":
8976
{
9077
"type": "array",
91-
"description": "(Optional) The list of dependencies needed by the script",
9278
"items":
9379
{
9480
"type": "object",
9581
"properties":
9682
{
97-
"Name":
98-
{
99-
"type": "string",
100-
"description": "Dependency name"
101-
},
83+
"Name": { "type": "string" },
10284
"Platforms":
10385
{
10486
"type": "array",
105-
"items": { "type":"string" },
106-
"description": "Supported platforms of the dependency"
87+
"items": { "type":"string" }
10788
},
10889
"Source":
10990
{
@@ -113,29 +94,21 @@
11394
"Type":
11495
{
11596
"type": "string",
116-
"enum": ["Git", "Local"],
117-
"description": "The type of the dependency (Git/Local)"
97+
"enum": ["Git", "Local"]
11898
},
119-
"Value":
120-
{
121-
"type": "string",
122-
"description": "The location of the dependency (git repository location, local directory)"
123-
}
99+
"Value": { "type": "string" }
124100
},
125-
"required": ["Type", "Value"],
126-
"description": "The source of getting the dependency"
101+
"required": ["Type", "Value"]
127102
},
128103
"LibraryType":
129104
{
130105
"type": "string",
131-
"enum": ["Static", "Object", "Shared", "Header"],
132-
"description": "Library Type (Static, Object, Shared, Header)"
106+
"enum": ["Static", "Object", "Shared", "Header"]
133107
},
134108
"IncludePaths":
135109
{
136110
"type": "array",
137-
"items": { "type":"string" },
138-
"description": "Paths to be added to include paths"
111+
"items": { "type":"string" }
139112
},
140113
"LinkProperties":
141114
{
@@ -150,8 +123,7 @@
150123
"SearchLibraryNames":
151124
{
152125
"type": "array",
153-
"items": { "type":"string" },
154-
"description": "The library name to be searched for when linking against the script"
126+
"items": { "type":"string" }
155127
},
156128
"ExcludeLibraryNames":
157129
{
@@ -161,8 +133,7 @@
161133
"SearchDirectories":
162134
{
163135
"type": "array",
164-
"items": { "type":"string" },
165-
"description": "The path to be searched for the dependency. {BuildType} will be replaced accordingly"
136+
"items": { "type":"string" }
166137
},
167138
"AdditionalLinkOptions":
168139
{
@@ -178,12 +149,10 @@
178149
}
179150
},
180151
"required": ["SearchLibraryNames", "SearchDirectories"],
181-
"additionalProperties": false,
182-
"description": "Properties for searching the library binary for the profile"
152+
"additionalProperties": false
183153
}
184154
},
185-
"additionalProperties": false,
186-
"description": "Searchable properties of the dependency"
155+
"additionalProperties": false
187156
},
188157
"Setup":
189158
{
@@ -198,16 +167,13 @@
198167
"^.*$":
199168
{
200169
"type": "array",
201-
"items": { "type":"string" },
202-
"description": "Setup commands for the specified profile. {BuildType} will be replaced accordingly"
170+
"items": { "type":"string" }
203171
}
204172
},
205-
"additionalProperties": false,
206-
"description": "Setup commands for the specified platform"
173+
"additionalProperties": false
207174
}
208175
},
209-
"additionalProperties": false,
210-
"description": "(Optional) List of setup commands for the supported platforms"
176+
"additionalProperties": false
211177
}
212178
},
213179
"additionalProperties": false,

0 commit comments

Comments
 (0)