Skip to content

Commit 8310f8e

Browse files
WIP
1 parent c413ff6 commit 8310f8e

File tree

15 files changed

+100
-1052
lines changed

15 files changed

+100
-1052
lines changed

.clangd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CompileFlags: # Tweak the parse settings
2+
Add: -ferror-limit=0
3+
#Add: [-xc++, -Wall] # treat all files as C++, enable more warnings
4+
#Add: [-Wall, -Wno-return-local-addr, -Wno-sign-compare, -Wno-unused-variable, -Wno-unused-parameter, -Wextra, -pedantic, -Werror] # treat all files as C++, enable more warnings
5+
#Remove: -W* # strip all other warning-related flags
6+
#Compiler: clang++ # Change argv[0] of compile flags to `clang++`
7+
8+
Diagnostics:
9+
Suppress:
10+
[
11+
-Wsign-compare,
12+
-Wunused-variable,
13+
-Wunused-parameter,
14+
-Wswitch,
15+
-Wgnu-zero-variadic-macro-arguments,
16+
-Wdefaulted-function-deleted
17+
]
18+
19+
#Suppress: [-Wreturn-local-addr, -Wsign-compare, -Wunused-variable, -Wunused-parameter, -Wreturn-stack-address, -Wdefaulted-function-deleted, -Wgnu-zero-variadic-macro-arguments]
20+
21+

.gitmodules

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
[submodule "ssLogger"]
55
path = External/ssLogger
66
url = https://github.com/Neko-Box-Coder/ssLogger.git
7-
[submodule "tinydir"]
8-
path = External/tinydir
9-
url = https://github.com/cxong/tinydir.git
107
[submodule "cfgpath"]
118
path = External/cfgpath
129
url = https://github.com/Malvineous/cfgpath.git
13-
[submodule "mkdirp.c"]
14-
path = External/mkdirp
15-
url = https://github.com/stephenmathieson/mkdirp.c.git
1610
[submodule "Embed2C"]
1711
path = External/Embed2C
1812
url = https://github.com/Neko-Box-Coder/Embed2C.git
@@ -22,3 +16,6 @@
2216
[submodule "filesystem"]
2317
path = External/filesystem
2418
url = https://github.com/gulrak/filesystem.git
19+
[submodule "System2"]
20+
path = External/System2
21+
url = https://github.com/Neko-Box-Coder/System2.git

CMakeLists.txt

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/CLI11")
1313
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/ssLogger")
1414
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/yaml-cpp")
1515

16-
# =========================================================================
17-
# mkdirp
18-
# =========================================================================
19-
20-
21-
add_library(path_normalize "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps/path-normalize/path-normalize.c")
22-
target_include_directories(path_normalize PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps")
23-
24-
add_library(strdup "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps/strdup/strdup.c")
25-
target_include_directories(strdup PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/deps")
26-
27-
add_library(mkdirp "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/src/mkdirp.c")
28-
target_include_directories(mkdirp PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/mkdirp/src")
29-
30-
target_link_libraries(mkdirp PRIVATE path_normalize strdup)
31-
3216
# =========================================================================
3317
# filesystem
3418
# =========================================================================
@@ -55,6 +39,13 @@ if(RUNCPP2_UPDATE_DEFAULT_YAMLS)
5539
"${FILES_TO_EMBED}")
5640
endif()
5741

42+
43+
# =========================================================================
44+
# System2
45+
# =========================================================================
46+
47+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/System2")
48+
5849
# =========================================================================
5950
# runcpp2
6051
# =========================================================================
@@ -77,22 +68,24 @@ add_executable(runcpp2 "${CMAKE_CURRENT_LIST_DIR}/Src/runcpp2/Data/CompilerInfo
7768
)
7869

7970
target_include_directories(runcpp2 PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Include"
80-
"${CMAKE_CURRENT_LIST_DIR}/External/tinydir"
8171
"${CMAKE_CURRENT_LIST_DIR}/External/cfgpath")
8272

83-
target_link_libraries(runcpp2 PRIVATE CLI11::CLI11 ssLogger yaml-cpp ghc_filesystem)
73+
target_link_libraries(runcpp2 PRIVATE CLI11::CLI11 ssLogger yaml-cpp ghc_filesystem System2)
8474

8575
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
8676
set(STANDARD_COMPILE_FLAGS "/utf-8;/W1")
8777
else()
8878
set(STANDARD_COMPILE_FLAGS "-Wall"
8979
"-Wno-return-local-addr"
9080
"-Wno-sign-compare"
91-
"-Wno-unused-variable"
81+
#"-Wno-unused-variable"
82+
#"-Wno-unused-but-set-variable"
9283
"-Wno-unused-parameter"
9384
"-Wno-switch"
9485
"-Wno-gnu-zero-variadic-macro-arguments"
9586
"-Wextra"
9687
"-pedantic"
9788
"-Werror")
98-
endif()
89+
endif()
90+
91+
target_compile_options(runcpp2 PRIVATE ${STANDARD_COMPILE_FLAGS})

DefaultYAMLs/DefaultCompilerProfiles.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CompilerProfiles:
4747
# Executable to be called
4848
Executable: "g++"
4949

50-
# Default arguments to provide for compilation which can be overriden by the script
50+
# Default arguments to provide for compilation which can be overridden by the script
5151
DefaultCompileFlags: "-std=c++17 -Wall -Werror"
5252

5353
# The syntax to compile the given file.
@@ -64,7 +64,7 @@ CompilerProfiles:
6464
Executable: "g++"
6565

6666
# Default arguments to provide for linking dependencies to the binary,
67-
# which can be overriden by the script
67+
# which can be overridden by the script
6868
DefaultLinkFlags: ""
6969

7070
# The syntax to link the given file

DefaultYAMLs/DefaultScriptInfo.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Dependencies:
5454
SearchLibraryName: lib1
5555

5656
# The path to be searched for the dependency.
57-
# {BuildType} will be replaced accordingly
5857
# TODO: Make this a list
5958
SearchPath: ./build
6059

@@ -63,8 +62,7 @@ Dependencies:
6362
# Setup commands for the specified platform
6463
All:
6564
# Setup commands for the specified profile.
66-
# {BuildType} will be replaced accordingly
6765
"g++":
6866
- "mkdir build"
69-
- "cd build && cmake .. -DCMAKE_BUILD_TYPE={BuildType}"
67+
- "cd build && cmake .."
7068
- "cd build && cmake --build ."

External/System2

Submodule System2 added at 92550e9

External/mkdirp

Lines changed: 0 additions & 1 deletion
This file was deleted.

External/tinydir

Lines changed: 0 additions & 1 deletion
This file was deleted.

Include/runcpp2/ParseUtil.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace runcpp2
77
{
88

9+
//TODO: Use rapidyaml instead
10+
911
namespace Internal
1012
{
1113
struct NodeRequirement

Include/runcpp2/PlatformUtil.hpp

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,73 +10,15 @@ namespace runcpp2
1010

1111
namespace Internal
1212
{
13-
//char GetAltFileSystemSeparator();
13+
char GetAltFileSystemSeparator();
1414

15-
//char GetFileSystemSeparator();
15+
char GetFileSystemSeparator();
1616

17-
//std::string ProcessPath(const std::string& path);
17+
std::string ProcessPath(const std::string& path);
1818

19-
//bool FileOrDirectoryExists(const std::string& path, bool& outIsDir);
20-
21-
//std::string GetFileDirectory(const std::string& filePath);
22-
23-
//std::string GetFileNameWithExtension(const std::string& filePath);
24-
25-
//std::string GetFileNameWithoutExtension(const std::string& filePath);
26-
27-
//std::string GetFileExtension(const std::string& filePath);
28-
2919
std::vector<std::string> GetPlatformNames();
3020
}
3121

3222
}
3323

34-
#ifdef __unix__
35-
struct System2CommandInfo
36-
{
37-
int ParentToChildPipes[2];
38-
int ChildToParentPipes[2];
39-
pid_t ChildProcessID;
40-
};
41-
42-
enum SYSTEM2_PIPE_FILE_DESCRIPTORS
43-
{
44-
SYSTEM2_FD_READ = 0,
45-
SYSTEM2_FD_WRITE = 1
46-
};
47-
48-
enum SYSTEM2_RESULT
49-
{
50-
SYSTEM2_RESULT_COMMAND_TERMINATED = 3,
51-
SYSTEM2_RESULT_COMMAND_NOT_FINISHED = 2,
52-
SYSTEM2_RESULT_READ_NOT_FINISHED = 1,
53-
SYSTEM2_RESULT_SUCCESS = 0,
54-
SYSTEM2_RESULT_PIPE_CREATE_FAILED = -1,
55-
SYSTEM2_RESULT_PIPE_FD_CLOSE_FAILED = -2,
56-
SYSTEM2_RESULT_FORK_FAILED = -3,
57-
SYSTEM2_RESULT_READ_FAILED = -4,
58-
SYSTEM2_RESULT_WRITE_FAILED = -5,
59-
SYSTEM2_RESULT_COMMAND_WAIT_FAILED = -6,
60-
};
61-
#endif
62-
63-
SYSTEM2_RESULT System2Run(const char* command, System2CommandInfo* outCommandInfo);
64-
SYSTEM2_RESULT System2ReadFromOutput( System2CommandInfo* info,
65-
char* outputBuffer,
66-
uint32_t outputBufferSize,
67-
uint32_t* outBytesRead);
68-
69-
SYSTEM2_RESULT System2WriteToInput( System2CommandInfo* info,
70-
const char* inputBuffer,
71-
const uint32_t inputBufferSize);
72-
73-
SYSTEM2_RESULT System2GetCommandReturnValueAsync( System2CommandInfo* info,
74-
int* outReturnCode);
75-
76-
SYSTEM2_RESULT System2GetCommandReturnValueSync(System2CommandInfo* info,
77-
int* outReturnCode);
78-
79-
80-
81-
8224
#endif

0 commit comments

Comments
 (0)