13 Star 69 Fork 22

johnsonyl/cpps

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.cpp 3.01 KB
一键复制 编辑 原始数据 按行查看 历史
johnsonyl 提交于 2021-02-18 14:08 +08:00 . 2021-02-18 更新
#import "json"
#import "compress"
#import "http"
#include <lib/setuptools/logging.cpp>
#include <lib/setuptools/dist.cpp>
#include <lib/setuptools/upload.cpp>
#include <lib/setuptools/ccompiler.cpp>
#include <lib/setuptools/compiler.cpp>
#include <lib/setuptools/msccompiler.cpp>
#include <lib/setuptools/unixcompiler.cpp>
#include <lib/setuptools/macoscompiler.cpp>
namespace setuptools{
var setup(var option){
var args = getargs();
//dist(option);
var type = "";
if(args.size() == 3){
type = args[2];
if(args[1] == "-install" || args[1] == "-update"){
type = "build";
}
}
if(type == ""){
log.error("you need input param [dist,install]");
return false;
}else if(type == "dist"){
dist(option);
}
else if(type == "upload"){
var apikey = upload_check();
if(apikey == ""){
//账号密码错误
return false;
}
var ret = dist(option);
if(ret) upload(option,apikey);
}
else if (type == "build")
{
var work_path = io.getcwd(); //工作目录
var real_install_path = "{work_path}/dist/"; //编译目录
var real_build_type = sys.debug;
var link_type = 1; // 1. dynamic Share library 2.Stand library 3.executable 2 or 3 only be used when nocpps is compiled!
var is_nocpps_build = false;
if(isvalid(install_path)) {
real_install_path = install_path;
work_path = install_path;
}
if(isvalid(build_type))
real_build_type = build_type;
if( option["link_type"] != null)
link_type = option["link_type"];
if( option["nocpps"] != null)
is_nocpps_build = option["nocpps"];
if(is_nocpps_build){ //仅非cpps编译才会关注是否独立debug release模式.
if(isbool(option["debug"])){
real_build_type = option["debug"];
}
}
if(option["ext_modules"] != null){
var curos = "";
if(sys.platform == "win64" || sys.platform == "win32")
curos = "windows";
else if(sys.platform == "linux32" || sys.platform == "linux64")
curos = "linux";
else if(sys.platform == "macos32" || sys.platform == "macos64")
curos = "macos";
var taros = option["platfrom"];
if(taros != null && curos != taros && taros != "all")
{
log.error("The Module Don't Support {curos} Platfrom. Stop Compiler.");
return false;
}
foreach(var mod: option["ext_modules"]){
var output_name = option["name"];
if(mod["output_name"]){
output_name = mod["output_name"];
}
var taros = mod["platfrom"];
if(taros == null || curos == taros || taros == "all"){
var code = compiler(output_name,work_path,mod,real_install_path,real_build_type,is_nocpps_build,link_type);
if(code == false){
return false;
}
}
}
}
if(isvalid(compiler_result)) compiler_result = true; //返回通知编译结果.
}
}
var find_packages(){
var ret = [];
var list = io.walk(".");
foreach(var filename:list){
ret.push_back(filename);
}
return ret;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/cppscript/cpps.git
git@gitee.com:cppscript/cpps.git
cppscript
cpps
cpps
master

搜索帮助