Coder Social home page Coder Social logo

download-include-files's Introduction

download-include-files.py

This script downloads header files with special notation in C/C++ code automatically.

For example, the following code downloads xxhash.h from GitHub and save it at third_party/include/xxhash.h.

#include "xxhash.h" //--download-from--:https://github.com/Cyan4973/xxHash/blob/v0.8.0/xxhash.h

Special comment in C/C++ code

download-include-files.py recognizes the following #include and special comment pair.

#include "(FILENAME)" // --download-from--:(URL)

or

#include "(FILENAME)" /* --download-from--:(URL) */

These comments indicate to download (URL) as (FILENAME).

The following example downloads xxhash.h from github.

#include "xxhash.h" // --download-from--:https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h

And the local filepath of it is

third_party/include/xxhash.h

You can change the prefix third_party/include by the --include command line option (see below).

Special form #include "github.com/..." in C/C++ code

download-include-files.py recognizes the following special form of #include.

#include "github.com/(FILENAME)"

This #include line indicates to download (FILENAME) from GitHub.

For example, the following #include downloads stb_image.h from github.

#include "github.com/nothings/stb/blob/master/stb_image.h"

And the local file name of it is

third_party/include/github.com/nothings/stb/blob/master/stb_image.h

You can change third_party/include by --include (see below).

--include (or -I)

The root directory of (FILENAME) can be specified by the following command line option

--include (DIR)

when you specify --include, actual downloaded file path becomes

(DIR)/(FILENAME)

Default (DIR) is "third_party/include".

The following example downloads files under external/include/

download-include-files.py *.c *.h *.cpp *.hpp --include external/include

And above examples are downloaded as

external/include/xxhash.h
external/include/github.com/nothings/stb/blob/master/stb_image.h

Download only form

When you just want to download a file but avoid to be compiled, you can put them within comment line.

// #include "github.com/..."

See examples/rapidjson/rapidjson-example.cpp for details.

Glob

Since this program uses standard Python glob module, you can use usual glob notations. (Even on Windows Command Prompt)

download-include-files's People

Contributors

t-mat avatar

Watchers

 avatar  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.