-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3666529
commit f89fd2e
Showing
8 changed files
with
65 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "Run.hpp" | ||
|
||
#include "../BuildConfig.hpp" | ||
#include "../Logger.hpp" | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
int run(Vec<String> args) { | ||
const String outDir = emitMakefile(args); | ||
const int exitCode = std::system(("make -C " + outDir).c_str()); | ||
if (exitCode != EXIT_SUCCESS) { | ||
Logger::error("Build failed with exit code ", exitCode); | ||
return exitCode; | ||
} | ||
|
||
const String projectName = "poac"; // TODO: get from poac.toml | ||
return std::system((outDir + "/" + projectName).c_str()); | ||
} | ||
|
||
void runHelp() { | ||
std::cout << runDesc << '\n'; | ||
std::cout << '\n'; | ||
std::cout << "Usage: poac run [OPTIONS] [args]..." << '\n'; | ||
std::cout << '\n'; | ||
std::cout << "Arguments:" << '\n'; | ||
std::cout << " [args]...\t\tArguments passed to the program" << '\n'; | ||
std::cout << '\n'; | ||
std::cout << "Options:" << '\n'; | ||
std::cout << " -d, --debug\t\tBuild with debug information (default)" | ||
<< '\n'; | ||
std::cout << " -r, --release\tBuild with optimizations" << '\n'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
#include "../Rustify.hpp" | ||
|
||
static inline constexpr StringRef runDesc = "Build and execute src/main.cc"; | ||
|
||
int run(Vec<String> args); | ||
void runHelp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters