build: allow overriding installation directories

More sensible defaults and allow for overriding. Also make PDB installation
optional on Windows if RelWithDebInfo isn't the build type being used.

CMAKE_INSTALL_PREFIX defaults to GStreamer install location on Windows and
/usr/lib on other platforms.

PLUGIN_INSTALL_DIR defaults to CMAKE_INSTALL_PREFIX/gstreamer-1.0

LIBRARY_INSTALL_DIR defaults to CMAKE_INSTALL_PREFIX/

PDB_INSTALL_DIR defaults to CMAKE_INSTALL_PREFIX/
This commit is contained in:
Joshua M. Doe
2020-04-15 09:11:40 -04:00
parent 2a8fc2f84d
commit 26e05b7058
25 changed files with 80 additions and 108 deletions

View File

@@ -121,14 +121,27 @@ include_directories(
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (WIN32)
file(TO_CMAKE_PATH "${GSTREAMER_INCLUDE_DIR}/../.." _PREFIX)
get_filename_component(_PREFIX "${GSTREAMER_PLUGIN_DIR}/../" REALPATH)
else ()
set(_PREFIX "/usr")
set(_PREFIX "/usr/lib")
endif ()
set(CMAKE_INSTALL_PREFIX "${_PREFIX}"
CACHE PATH "Common prefix for all installed files (e.g., plugins will be installed under CMAKE_INSTALL_PREFIX/lib/gstreamer-1.0)" FORCE)
CACHE PATH "Common prefix for all installed files (e.g., plugins will be installed under CMAKE_INSTALL_PREFIX/gstreamer-1.0)" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (NOT LIBRARY_INSTALL_DIR)
set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/"
CACHE PATH "Location to install libraries (e.g., libgstklv-1.0-0.so/dll)")
endif ()
if (NOT PLUGIN_INSTALL_DIR)
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/gstreamer-1.0/"
CACHE PATH "Location to install plugins (e.g., libgstpylon.so/dll)")
endif()
if (WIN32 AND NOT PDB_INSTALL_DIR)
set(PDB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/gstreamer-1.0/"
CACHE PATH "Location to install PDB debug files (e.g., libgstpylon.pdb)")
endif()
add_subdirectory(gst-libs)
# Build the plugins