How to use Chrome/Chromium “base” library in private products ?

Chrome/Chromium project has a good “base” library that we can use in our products. It’s a good library to include in our product and use it. Yes we can include it in our product and use it.

Here are the steps to compile chromium “base” library and write a simple program using it.

Compile base.lib , base_static.lib:

1. Copy the following directories from the Chrome/chromium source code:
            base
build
testing
third_parth\icu
third_parth\modp_b64

2. Open the base\base.sln file.

3. Compile the “base” project.

Sample source code:

#include <iostream>
#include <base/process_util.h>

using namespace std;

const wchar_t procname[]= L”calc.exe”;

int wmain ()
{
const auto count = base::GetProcessCount(procname,nullptr);
cout << count;
return 1;
}

How to compile this code:

cl /D “_UNICODE” /D “UNICODE” -I. program.cc /link /LIBPATH:build\Release\lib psapi.lib base.lib Advapi32.lib Dbghelp.lib Shell32.lib User32.lib  base.lib

Advertisements
This entry was posted in C/C++, Chrome, Windows VC++ and tagged , , , , . Bookmark the permalink.

2 Responses to How to use Chrome/Chromium “base” library in private products ?

  1. JC_Yang says:

    I wonder how to generate the base.sln. I’ve tried “gyp base.gyp”, and set many variable as need, yet still can’t generate it successfully. After solve all the variable undefined errors, now I encounter this error: “gyp: The ‘run_as’ in target tcmalloc_unittest from file allocator\allocator.gyp must have an ‘action’ section.”. Any suggestions?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s