parent
ff6e01acd0
commit
71a6bde442
6 changed files with 179 additions and 77 deletions
@ -1,2 +1,47 @@ |
||||
def add(name: str) -> None: |
||||
import os |
||||
import json |
||||
|
||||
def add(author, package: str) -> None: |
||||
f_conf = open("./config.json", "r") |
||||
conf = json.loads(f_conf.read()) |
||||
f_conf.close() |
||||
if package in conf["packages"]: raise Exception("Package already added") |
||||
f_conf = open("./config.json", "w") |
||||
conf["packages"].append({ "author": author, "pkg": package}) |
||||
f_conf.write(json.dumps(conf, indent=4)) |
||||
f_conf.close() |
||||
|
||||
install(author, package) |
||||
|
||||
def install_root() -> None: |
||||
f_conf = open("./config.json", "r") |
||||
conf = json.loads(f_conf.read()) |
||||
f_conf.close() |
||||
for package in conf["packages"]: |
||||
install(package) |
||||
|
||||
def install(author, package) -> None: |
||||
if os.path.exists(f"./vendor/{package}"): |
||||
return |
||||
|
||||
os.system(f"git clone https://github.com/{author}/{package} ./vendor/{package}") |
||||
|
||||
if os.path.exists(f"./vendor/{package}/config.json"): |
||||
conf = open(f"./vendor/{package}/config.json", "r").read() |
||||
conf = json.loads(conf) |
||||
if len(conf["packages"]) > 0: |
||||
for pkg in conf["packages"]: |
||||
install(pkg["author"], pkg["pkg"]) |
||||
|
||||
if os.path.exists(f"./vendor/{package}/dependencies.lua"): |
||||
dep = open(f"./vendor/{package}/dependencies.lua", "r") |
||||
pkg_deps = dep.read() |
||||
dep.close() |
||||
dep = open(f"./deps.lua", "a") |
||||
dep.write("\n" + pkg_deps) |
||||
dep.close() |
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,54 +1,50 @@ |
||||
def get() -> str: |
||||
return '''project "App" |
||||
kind "ConsoleApp" |
||||
language "C++" |
||||
cppdialect "C++20" |
||||
systemversion "latest" |
||||
|
||||
targetdir("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") |
||||
objdir("%{wks.location}/bin-int/" .. outputdir .. "/%{prj.name}") |
||||
|
||||
files |
||||
{ |
||||
"src/**.h", |
||||
"src/**.cpp" |
||||
} |
||||
|
||||
filter "configurations:Debug" |
||||
defines |
||||
{ |
||||
"BK_DEBUG", |
||||
"DEBUG" |
||||
} |
||||
runtime "Debug" |
||||
symbols "on" |
||||
|
||||
|
||||
filter "configurations:Release" |
||||
defines |
||||
{ |
||||
"BK_RELEASE", |
||||
"NDEBUG" |
||||
} |
||||
runtime "Release" |
||||
optimize "on" |
||||
|
||||
filter "system:windows" |
||||
staticruntime "on" |
||||
defines |
||||
{ |
||||
"BK_PLATFORM_WINDOWS" |
||||
} |
||||
|
||||
filter "system:linux" |
||||
staticruntime "on" |
||||
defines |
||||
{ |
||||
"BK_PLATFORM_LINUX" |
||||
} |
||||
filter "" |
||||
includedirs |
||||
|
||||
links |
||||
|
||||
kind "ConsoleApp" |
||||
language "C++" |
||||
cppdialect "C++20" |
||||
systemversion "latest" |
||||
|
||||
targetdir("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") |
||||
objdir("%{wks.location}/bin-int/" .. outputdir .. "/%{prj.name}") |
||||
|
||||
files |
||||
{ |
||||
"src/**.h", |
||||
"src/**.cpp" |
||||
} |
||||
|
||||
filter "configurations:Debug" |
||||
defines |
||||
{ |
||||
"BK_DEBUG", |
||||
"DEBUG" |
||||
} |
||||
runtime "Debug" |
||||
symbols "on" |
||||
|
||||
|
||||
filter "configurations:Release" |
||||
defines |
||||
{ |
||||
"BK_RELEASE", |
||||
"NDEBUG" |
||||
} |
||||
runtime "Release" |
||||
optimize "on" |
||||
|
||||
filter "system:windows" |
||||
staticruntime "on" |
||||
defines |
||||
{ |
||||
"BK_PLATFORM_WINDOWS" |
||||
} |
||||
|
||||
filter "system:linux" |
||||
staticruntime "on" |
||||
defines |
||||
{ |
||||
"BK_PLATFORM_LINUX" |
||||
} |
||||
filter "" |
||||
''' |
@ -1,20 +1,20 @@ |
||||
def get(name) -> str: |
||||
return '''workspace "''' + name + '''" |
||||
architecture "x64" |
||||
configurations { "Debug", "Release" } |
||||
startproject "App" |
||||
architecture "x64" |
||||
configurations { "Debug", "Release" } |
||||
startproject "App" |
||||
|
||||
flags |
||||
{ |
||||
"MultiProcessorCompile" |
||||
} |
||||
flags |
||||
{ |
||||
"MultiProcessorCompile" |
||||
} |
||||
|
||||
linkgroups "On" |
||||
outputdir = "%{cfg.system}-%{cfg.architecture}-%{cfg.buildcfg}" |
||||
|
||||
include "Depedencies.lua" |
||||
linkgroups "On" |
||||
outputdir = "%{cfg.system}-%{cfg.architecture}-%{cfg.buildcfg}" |
||||
|
||||
group "App" |
||||
include "app" |
||||
group "" |
||||
include "dependencies.lua" |
||||
|
||||
group "App" |
||||
include "app" |
||||
group "" |
||||
''' |
@ -1,16 +1,23 @@ |
||||
import os |
||||
import sys |
||||
import Package |
||||
from Buildtools import verifie_tools |
||||
from Project import Project |
||||
|
||||
def setup() -> None: |
||||
def bakasable() -> None: |
||||
if len(sys.argv) >= 2: |
||||
if not os.path.exists(sys.argv[1]): os.mkdir(sys.argv[1]) |
||||
os.chdir(sys.argv[1]) |
||||
verifie_tools() |
||||
project: Project = Project("Test") |
||||
project = Project("Test") |
||||
project.create() |
||||
Package.add("anulax1225", "bakatools") |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
setup() |
||||
print(""" ____ _ _ __ _ ____ _ ____ _ _____ |
||||
| __ ) / \\ | |/ / / \\ / ___| / \\ | __ )| | | ____| |
||||
| _ \\ / _ \\ | ' / / _ \\ \\___ \\ / _ \\ | _ \\| | | _| |
||||
| |_) / ___ \\| . \\ / ___ \\ ___) / ___ \\| |_) | |___| |___ |
||||
|____/_/ \\_\\_|\\_\\/_/ \\_\\____/_/ \\_\\____/|_____|_____| |
||||
""") |
||||
bakasable() |
Loading…
Reference in New Issue