Update build
This commit is contained in:
parent
b87dd4203b
commit
a29393bc18
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -6,7 +6,7 @@
|
||||
"type": "shell",
|
||||
"command": "./build",
|
||||
"args": [
|
||||
""
|
||||
"run"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
15
Readme.md
15
Readme.md
@ -1,16 +1,11 @@
|
||||
# how to build
|
||||
```
|
||||
g++ build.cpp -o build
|
||||
```
|
||||
|
||||
after first emsdk clone run this
|
||||
|
||||
```
|
||||
cd emsdk
|
||||
./emsdk install latest
|
||||
./emsdk activate latest
|
||||
source ./emsdk_env.sh
|
||||
cd ..
|
||||
./build
|
||||
or
|
||||
./build run
|
||||
or
|
||||
./build cla build web // first clear all then build for web
|
||||
```
|
||||
|
||||
# Code style
|
||||
|
@ -214,13 +214,16 @@ int main(int argc, char const *argv[])
|
||||
command = {"git", "clone", "https://github.com/emscripten-core/emsdk.git"};
|
||||
nob_cmd_run_sync(command);
|
||||
std::filesystem::remove_all("emsdk/.git");
|
||||
return 0;
|
||||
command = {"./emsdk/emsdk", "install", "latest"};
|
||||
nob_cmd_run_sync(command);
|
||||
command = {"./emsdk/emsdk", "activate", "latest"};
|
||||
nob_cmd_run_sync(command);
|
||||
}
|
||||
|
||||
if (web_build)
|
||||
{
|
||||
cpp_compiler = "em++";
|
||||
c_compiler = "emcc";
|
||||
cpp_compiler = "./emsdk/upstream/emscripten/em++";
|
||||
c_compiler = "./emsdk/upstream/emscripten/emcc";
|
||||
opt_flags = "-Os";
|
||||
RAYINCLUDE.push_back("-DPLATFORM_WEB");
|
||||
BUILD_FILE = BUILD_FILE.replace_extension(".html");
|
||||
|
51
build.hpp
51
build.hpp
@ -11,12 +11,63 @@
|
||||
#include <list>
|
||||
#include <filesystem>
|
||||
|
||||
enum class Color
|
||||
{
|
||||
black,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
blue,
|
||||
purple,
|
||||
cyan,
|
||||
white,
|
||||
reset,
|
||||
};
|
||||
|
||||
void pick_color(Color color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case Color::black:
|
||||
printf("\033[0;30m");
|
||||
break;
|
||||
case Color::red:
|
||||
printf("\033[0;31m");
|
||||
break;
|
||||
case Color::green:
|
||||
printf("\033[0;32m");
|
||||
break;
|
||||
case Color::yellow:
|
||||
printf("\033[0;33m");
|
||||
break;
|
||||
case Color::blue:
|
||||
printf("\033[0;34m");
|
||||
break;
|
||||
case Color::purple:
|
||||
printf("\033[0;35m");
|
||||
break;
|
||||
case Color::cyan:
|
||||
printf("\033[0;36m");
|
||||
break;
|
||||
case Color::white:
|
||||
printf("\033[0;37m");
|
||||
break;
|
||||
case Color::reset:
|
||||
printf("\033[0m");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void print_command(std::vector<std::string> &arguments)
|
||||
{
|
||||
pick_color(Color::cyan);
|
||||
for (auto &&i : arguments)
|
||||
{
|
||||
printf("%s ", i.c_str());
|
||||
}
|
||||
pick_color(Color::white);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user