Skip to content

Commit da4a0aa

Browse files
Added ability to parse script yaml
1 parent 602a9e2 commit da4a0aa

35 files changed

+2817
-58
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "Embed2C"]
1717
path = External/Embed2C
1818
url = https://github.com/Neko-Box-Coder/Embed2C.git
19+
[submodule "yaml-cpp"]
20+
path = External/yaml-cpp
21+
url = https://github.com/jbeder/yaml-cpp.git

CMakeLists.txt

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,75 @@
1+
cmake_minimum_required(VERSION 3.10)
12

3+
# For Clang to do parsing
4+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
25

3-
cmake_minimum_required(VERSION 3.10)
46
project(runcpp2)
57

68
set(CMAKE_CXX_STANDARD 11)
79

8-
add_executable(runcpp2 "${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/main.cpp")
10+
option(RUNCPP2_UPDATE_DEFAULT_YAMLS "Update default yaml files" OFF)
11+
12+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/CLI11")
13+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/ssLogger")
14+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/yaml-cpp")
15+
16+
# =========================================================================
17+
# mkdirp
18+
# =========================================================================
19+
add_library(path_normalize "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps/path-normalize/path-normalize.c")
20+
target_include_directories(path_normalize PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps")
21+
22+
add_library(strdup "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps/strdup/strdup.c")
23+
target_include_directories(strdup PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps")
24+
25+
add_library(mkdirp "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/src/mkdirp.c")
26+
target_include_directories(mkdirp PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/src")
27+
28+
target_link_libraries(mkdirp PRIVATE path_normalize strdup)
29+
30+
31+
# =========================================================================
32+
# Generate yaml files as c
33+
# =========================================================================
34+
if(RUNCPP2_UPDATE_DEFAULT_YAMLS)
35+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/Embed2C")
36+
include("${CMAKE_CURRENT_LIST_DIR}/External/Embed2C/embedFile.cmake")
37+
38+
set(EMBED_EXEC_PATH "")
39+
GET_EXEC_PATH(EMBED_EXEC_PATH)
40+
41+
set(FILES_TO_EMBED "${CMAKE_CURRENT_LIST_DIR}/DefaultYAMLs/DefaultCompilerProfiles.yaml"
42+
"DefaultCompilerProfiles"
43+
"${CMAKE_CURRENT_LIST_DIR}/DefaultYAMLs/DefaultScriptInfo.yaml"
44+
"DefaultScriptInfo"
45+
)
46+
47+
EMBED_FILES("${EMBED_EXEC_PATH}"
48+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/DefaultYAMLs.c"
49+
"${FILES_TO_EMBED}")
50+
endif()
51+
52+
# =========================================================================
53+
# runcpp2
54+
# =========================================================================
55+
56+
add_executable(runcpp2 "${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/CompilerInfo.cpp"
57+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/CompilerProfile.cpp"
58+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/DefaultYAMLs.c"
59+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/DependencyInfo.cpp"
60+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/DependencySource.cpp"
61+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/FlagsOverrideInfo.cpp"
62+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/LinkerInfo.cpp"
63+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/main.cpp"
64+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/ParseUtil.cpp"
65+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/PlatformUtil.cpp"
66+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/runcpp2.cpp"
67+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/ScriptInfo.cpp"
68+
"${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/StringUtil.cpp"
69+
)
70+
71+
target_include_directories(runcpp2 PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Include"
72+
"${CMAKE_CURRENT_LIST_DIR}/External/tinydir"
73+
"${CMAKE_CURRENT_LIST_DIR}/External/cfgpath")
974

75+
target_link_libraries(runcpp2 PRIVATE CLI11::CLI11 ssLogger mkdirp yaml-cpp)
Lines changed: 279 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"title": "Test title",
4-
"description": "Test description",
3+
"title": "Compiler profiles",
4+
"description": "Compiler profiles configuraion",
55
"type": "object",
66
"properties":
77
{
8-
"Dependencies":
8+
"CompilerProfiles":
99
{
1010
"type": "array",
1111
"description": "",
@@ -14,11 +14,284 @@
1414
"type": "object",
1515
"properties":
1616
{
17-
"Name": {"type": "string"}
17+
"Name":
18+
{
19+
"type": "string",
20+
"description": "Name of the compiler profile"
21+
},
22+
"FileExtensions" :
23+
{
24+
"type": "array",
25+
"items":
26+
{
27+
"type":"string"
28+
},
29+
"uniqueItems": true,
30+
"description": "The file extensions for the compiler"
31+
},
32+
"Languages":
33+
{
34+
"type": "array",
35+
"items":
36+
{
37+
"type":"string"
38+
},
39+
"uniqueItems": true,
40+
"description": "The languages supported by the compiler"
41+
},
42+
"SetupSteps" :
43+
{
44+
"type": "array",
45+
"items":
46+
{
47+
"type":"string"
48+
},
49+
"description": "(Optional) Steps in commandline to setup the environment"
50+
},
51+
"ObjectFileExtensions":
52+
{
53+
"type": "object",
54+
"properties":
55+
{
56+
"Windows": {"type": "string"},
57+
"Linux": {"type": "string"},
58+
"Unix": {"type": "string"},
59+
"MacOS": {"type": "string"}
60+
},
61+
"description": "The file extensions for the object files",
62+
"uniqueItems": true
63+
},
64+
"SharedLibraryExtensions":
65+
{
66+
"type": "object",
67+
"properties":
68+
{
69+
"Windows":
70+
{
71+
"type": "array",
72+
"items":
73+
{
74+
"type":"string"
75+
}
76+
},
77+
"Linux":
78+
{
79+
"type": "array",
80+
"items":
81+
{
82+
"type":"string"
83+
}
84+
},
85+
"Unix":
86+
{
87+
"type": "array",
88+
"items":
89+
{
90+
"type":"string"
91+
}
92+
},
93+
"MacOS":
94+
{
95+
"type": "array",
96+
"items":
97+
{
98+
"type":"string"
99+
}
100+
}
101+
},
102+
"uniqueItems": true,
103+
"description": "The file extensions for the shared libraries"
104+
},
105+
"StaticLibraryExtensions":
106+
{
107+
"type": "object",
108+
"properties":
109+
{
110+
"Windows":
111+
{
112+
"type": "array",
113+
"items":
114+
{
115+
"type":"string"
116+
}
117+
},
118+
"Linux":
119+
{
120+
"type": "array",
121+
"items":
122+
{
123+
"type":"string"
124+
}
125+
},
126+
"Unix":
127+
{
128+
"type": "array",
129+
"items":
130+
{
131+
"type":"string"
132+
}
133+
},
134+
"MacOS":
135+
{
136+
"type": "array",
137+
"items":
138+
{
139+
"type":"string"
140+
}
141+
}
142+
},
143+
"uniqueItems": true,
144+
"description": "The file extensions for the static libraries"
145+
},
146+
"DebugSymbolFileExtensions":
147+
{
148+
"type": "object",
149+
"properties":
150+
{
151+
"Windows":
152+
{
153+
"type": "array",
154+
"items":
155+
{
156+
"type":"string"
157+
}
158+
},
159+
"Linux":
160+
{
161+
"type": "array",
162+
"items":
163+
{
164+
"type":"string"
165+
}
166+
},
167+
"Unix":
168+
{
169+
"type": "array",
170+
"items":
171+
{
172+
"type":"string"
173+
}
174+
},
175+
"MacOS":
176+
{
177+
"type": "array",
178+
"items":
179+
{
180+
"type":"string"
181+
}
182+
}
183+
},
184+
"uniqueItems": true,
185+
"description": "(Optional) The file extensions for debug symbols to be copied alongside the binary"
186+
},
187+
"Compiler":
188+
{
189+
"type": "object",
190+
"properties":
191+
{
192+
"SetupSteps" :
193+
{
194+
"type": "array",
195+
"items":
196+
{
197+
"type":"string"
198+
},
199+
"description": "(Optional) Steps in commandline to setup the compiler"
200+
},
201+
"Executable":
202+
{
203+
"type": "string",
204+
"description": "Executable to be called"
205+
},
206+
"DefaultCompileFlags":
207+
{
208+
"type": "string",
209+
"description": "Default arguments to provide for compilation which can be overriden by the script"
210+
},
211+
"CompileArgs":
212+
{
213+
"type": "string",
214+
"description": "The syntax to compile the given file"
215+
}
216+
},
217+
"required":
218+
[
219+
"Executable",
220+
"DefaultCompileFlags",
221+
"CompileArgs"
222+
],
223+
"description": "Specify the compiler settings, so the final flow will be:\n[Setup steps if any] --> {Executable} {CompileArgs}"
224+
},
225+
"Linker":
226+
{
227+
"type": "object",
228+
"properties":
229+
{
230+
"SetupSteps" :
231+
{
232+
"type": "array",
233+
"items":
234+
{
235+
"type":"string"
236+
},
237+
"description": "(Optional) Steps in commandline to setup the linker"
238+
},
239+
"Executable":
240+
{
241+
"type": "string",
242+
"description": "Executable to be called"
243+
},
244+
"DefaultLinkFlags":
245+
{
246+
"type": "string",
247+
"description": "Default arguments to provide for linking dependencies to the binary, which can be overriden by the script"
248+
},
249+
"LinkerArgs":
250+
{
251+
"type": "object",
252+
"properties":
253+
{
254+
"OutputPart":
255+
{
256+
"type": "string",
257+
"description": "Syntax for outputting to the binary"
258+
},
259+
"DependenciesPart":
260+
{
261+
"type": "string",
262+
"description": "Syntax for linking each dependency"
263+
}
264+
},
265+
"required":
266+
[
267+
"OutputPart",
268+
"DependenciesPart"
269+
],
270+
"description": "The syntax to link the given file"
271+
}
272+
},
273+
"required":
274+
[
275+
"Executable",
276+
"DefaultLinkFlags",
277+
"LinkerArgs"
278+
],
279+
"description": "Specify the linker settings, so the final flow will be:\n[Setup steps if any] --> {Executable} {OutputPart} {DependenciesPart}...(for each dependency)"
280+
}
18281
},
19-
"required": ["Name"],
282+
"required":
283+
[
284+
"Name",
285+
"FileExtensions",
286+
"ObjectFileExtensions",
287+
"SharedLibraryExtensions",
288+
"StaticLibraryExtensions",
289+
"Compiler",
290+
"Linker"
291+
],
20292
"uniqueItems": true
21293
}
22294
}
23-
}
295+
},
296+
"required": ["CompilerProfiles"]
24297
}

0 commit comments

Comments
 (0)