Importing external libraries
Table of contents
1. Importing large libraries
1.1 Introduction
1.2. Directives
1. Importing large libraries
1.1 Introduction
Sometimes it is useful to transform 3rd party code into U++ package. There are several methods to do that, however if 3rd party code is huge codebase of hundreds or thousands files, traditional approaches (e.g. put all these files into package) are tedious or outright impossible.
To solve this issue, concept of import description file was introduced. This describes which files of external library are to be compiled and helps with setting up include path.
Import description file is file in package with name "import.ext"
Here is an example of import.ext content:
files *.cpp *.c;
exclude
port/vsipreload.cpp
ogr/generate_encoding_table.c
*/geojson/*
*/sqlite/*
*/sqlite3/*
*/pg/*
*/sde/*
*/sosi/*
*/tiger/*
*/vfk/*
*/shape/*
*/libkml/*
*/dgn/*
*/arcobjects/*
*/dods/*
*/dwg/*
*/filegdb/*
*/fme/*
*/gpkg/*
*/grass/*
*/idb/*
*/ingres/*
*/ili/*
*/mdb/*
*/mysql/*
*/kml/*
*/nas/*
*/idrisi/*
*/xlsx/*
*/xls/*
*/oci/*
*/ogdi/*
*/ods/*
*/gpkg/*
*/osm/*
port/cpl_win32ce_api.cpp
frmts/*
;
exclude(WIN32) linux*.cpp;
includes *.h *.hpp;
In this case, line with "files" basically says that all .cpp and .h files found in package folder are to be added into the project. "exclude" specifies exceptions to this. "includes" adds folders of all matching files into include path.
1.2. Directives
Below is the set of directives that can be used in "import.ext" file:
files
|
Adds all files that match the pattern the set of files to be added to package. Pattern can use '*' wildcard.
|
exclude
|
Removes files that match the pattern from the set.
|
include_path
|
Adds folders that match the pattern to the include path.
|
exclude_path
|
Removes directories from the include path (only folders added by import.ext can be removed)
|
includes
|
Adds folders of all matching files into include path.
|
|
Note that all file paths are relative to the root of package directory.
Directives are processed in the order they appear in the file, gradually adding and removing files in question.
Directives can have condition on configuration flags, placed in parenthesis. Conditions follow the same rules as package conditions.
|