Giter VIP home page Giter VIP logo

cnsuhao / yxbase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youxiao/yxbase

0.0 1.0 0.0 137.89 MB

Extract base library from Chromium 60.0.3112.90

Python 9.27% C++ 70.90% Objective-C++ 0.23% C 0.28% Java 0.75% nesC 0.02% Objective-C 0.16% Assembly 0.01% Roff 0.01% Shell 0.24% HTML 1.49% JavaScript 16.52% Makefile 0.02% sed 0.01% CMake 0.01% AppleScript 0.01% Emacs Lisp 0.03% Batchfile 0.02% PHP 0.02% CSS 0.03%

yxbase's Introduction

yxbase库介绍

  • Chromium Base库是一套十分强大的且跨平台的开发库,提供了(内存/消息循环/线程/文件/字符串/文字编码/json/时间/定时器……)等开发中经常会使用到的功能实现,由Google完成开发,性能及稳定性值得信任。
  • yxbase基于Chromium 60.0.3112.90版本抽离base库
  • yxbase使用Chromium的GN + Ninja方式进行构建和编译(目前支持Win/Mac平台,暂未生成其他系统的GN工具到buildtools文件夹)

yxbase库编译

  • 安装depot_tools(包含GN和Ninja工具),放在yxbase根目录,compile.bat脚本可自动识别。提供了一份Windows可直接用的depot_tools(https://pan.baidu.com/s/1qYr4T68 提取码:btad)
  • 运行compile.bat
  • 使用args.gn文件内的编译配置
  • 默认输出在out目录
  • vs命令行运行create_yxbase_run_in_vs_cmd.bat脚本合并最终的yxbase.lib
  • 在Win10 + VS2015 Update3编译/验证/测试通过

yxbase库使用

1. 在GN工程使用

 executable("example") {
 output_name = "example"

 deps = [
  "//base:base",
 ]
 
 sources = [
  "example/example.cc",
 ]
}
 

2. 在VS工程使用

  • 包含目录:yxbase path
  • 链接库文件:
yxbase.lib
advapi32.lib
comdlg32.lib
dbghelp.lib
delayimp.lib
dnsapi.lib
gdi32.lib
kernel32.lib
msimg32.lib
odbc32.lib
odbccp32.lib
ole32.lib
oleaut32.lib
psapi.lib
shell32.lib
shlwapi.lib
user32.lib
usp10.lib
uuid.lib
version.lib
wininet.lib
winmm.lib
winspool.lib
ws2_32.lib

一个调用例子

#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/files/file_util.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include <iostream>

int main() {
  base::FilePath dir;
  PathService::Get(base::DIR_EXE, &dir);

  std::cout << "compute " << base::UTF16ToUTF8(dir.value()) << " size..." << std::endl;
    int64_t dir_size = base::ComputeDirectorySize(dir);

  std::cout << base::IntToString(dir_size) << std::endl;
  
  system("pause");
}

yxbase's People

Contributors

youxiao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.