Player Driver Macros

From The Player Project

(Difference between revisions)
Jump to: navigation, search
(New page: Player contains a large amount of CMake driver macros in order to help resolve driver dependencies, etc. This section discusses all of the macros available for use. See [[Adding a driver...)
 
Line 6: Line 6:
Add a driver to the list of drivers to be built or not built. Only call this once you have determined the final value of cumulativeVar. Pass source files, flags, etc. as extra args preceded by keywords as follows:
Add a driver to the list of drivers to be built or not built. Only call this once you have determined the final value of cumulativeVar. Pass source files, flags, etc. as extra args preceded by keywords as follows:
-
  SOURCES <source file list>
+
  SOURCES &lt;source file list>
  INCLUDEDIRS <include directories list>
  INCLUDEDIRS <include directories list>
  LIBDIRS <library directories list>
  LIBDIRS <library directories list>
Line 22: Line 22:
Add some extra code to compile and link into playerdrivers. Pass source files, flags, etc. as extra args preceded by keywords as follows:
Add some extra code to compile and link into playerdrivers. Pass source files, flags, etc. as extra args preceded by keywords as follows:
-
  SOURCES <source file list>
+
  SOURCES &lt;source file list>
  INCLUDEDIRS <include directories list>
  INCLUDEDIRS <include directories list>
  LIBDIRS <library directories list>
  LIBDIRS <library directories list>

Latest revision as of 02:35, 12 June 2011

Player contains a large amount of CMake driver macros in order to help resolve driver dependencies, etc. This section discusses all of the macros available for use. See Adding a driver to Player for details on when these macros are used.

Contents

PLAYERDRIVER_ADD_DRIVER

PLAYERDRIVER_ADD_DRIVER (_name _cumulativeVar <variable args>)

Add a driver to the list of drivers to be built or not built. Only call this once you have determined the final value of cumulativeVar. Pass source files, flags, etc. as extra args preceded by keywords as follows:

SOURCES <source file list>
INCLUDEDIRS <include directories list>
LIBDIRS <library directories list>
LINKFLAGS <link flags list>
CFLAGS <compile flags list>
name
Driver name.
cumulativeVar
The option used in the called CMakeLists.txt to check if the driver has been enabled.

PLAYERDRIVER_ADD_EXTRA

PLAYERDRIVER_ADD_EXTRA (_name)

Add some extra code to compile and link into playerdrivers. Pass source files, flags, etc. as extra args preceded by keywords as follows:

SOURCES <source file list>
INCLUDEDIRS <include directories list>
LIBDIRS <library directories list>
LINKFLAGS <link flags list>
CFLAGS <compile flags list>

PLAYERDRIVER_OPTION

PLAYERDRIVER_OPTION (_name _cumulativeVar _defaultValue [reason])

Add an option to enable/disable a driver.

NOTE: This macro initialises _cumulativeVar, so it must be called before any other PLAYERDRIVER macros.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
defaultValue
Set to ON or OFF depending on if the driver should be built by default.
reason
Give a reason for disabling to the user. If not provided, a standard reason will be given.

PLAYERDRIVER_REQUIRE_OS

PLAYERDRIVER_REQUIRE_OS (_name _cumulativeVar <variable args>)

Require a certain OS.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
variable args
OS variables to check for (see FindOS.cmake in the cmake/internal/ dir for a list of what variable is set on each OS).

PLAYERDRIVER_REJECT_OS

PLAYERDRIVER_REJECT_OS (_name _cumulativeVar <variable args>)

Prevent building on a certain OS.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
variable args
OS variables to check for (see FindOS.cmake in the cmake/internal/ dir for a list of what variable is set on each OS).

PLAYERDRIVER_REQUIRE_PKG

PLAYERDRIVER_REQUIRE_PKG (_name _cumulativeVar _package _includeDirs _libDirs _linkLibs _linkFlags _cFlags [_version])

Check if a required package is available using pkg-config. If a minimum version is required, supply it as an optional argument with no spaces. For example, ">=0.9.6".

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
package
Name (and possibly version) of the package to look for.
includeDirs
Name of the variable to receive the include directories.
libDirs
Name of the variable to receive the library directories.
linkLibs
Name of the variable to receive the libraries to link to.
linkFlags
Name of the variable to receive the link flags.
cFlags
Name of the variable to receive the compile flags.

PLAYERDRIVER_REQUIRE_HEADER

PLAYERDRIVER_REQUIRE_HEADER (_name _cumulativeVar _header)

Check if a required C header file is available. If extra include directories are necessary for the check, set them using CMAKE_REQUIRED_INCLUDES. If extra include files must be included for the check to succeed, specify them as extra arguments.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
header
Name of the header file to look for.

PLAYERDRIVER_REQUIRE_HEADER_CPP

PLAYERDRIVER_REQUIRE_HEADER_CPP (_name _cumulativeVar _header)

Check if a required C++ header file is available. (CMake will try to compile a small program using C++ with a #include<_header> line.) See the CheckIncludeFileCXX.cmake module for extra variables that may modify how this macro runs.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
header
Name of the header file to look for.

PLAYERDRIVER_REQUIRE_FUNCTION

PLAYERDRIVER_REQUIRE_FUNCTION (_name _cumulativeVar _function)

Check if a required function is available on the system.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
function
Name of the function to look for.

PLAYERDRIVER_REQUIRE_LIB

PLAYERDRIVER_REQUIRE_LIB (_name _cumulativeVar _library _function _path)

Check if a required library is available on the system.

name
Driver name.
cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
library
Name of the library to look for.
function
Function to check the library with.
path
Location where the library is expected to be.

PLAYERDRIVER_REQUIRE_ENVVAR

PLAYERDRIVER_REQUIRE_ENVVAR (_name _cumulativeVar _envvar _dest)

Require an environment variable be set, and store its value in the variable stored in _dest.

name
Driver name.
_cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
_envvar
The environment variable to check for.
_dest
The variable to store the value in. Set to NOTFOUND if the environment variable is not set.

PLAYERDRIVER_ADD_DEFINEOPTION

PLAYERDRIVER_ADD_DEFINEOPTION (_cumulativeVar _option _defaultValue _type _desc)

Add an option that can be set to ON or OFF by the user and a #define set accordingly in driver_config.h.

cumulativeVar
The option used in the calling CMakeLists.txt to check if the driver has been enabled.
option
The name of the option. This is what the user will see as well as what should be used in code.
defaultValue
The default value of the option.
type
The option type. This must be one of the CMake option types: BOOL, INT or STRING.
desc
A brief description of the option, for the user's information.
Personal tools