mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
Fixes for path mangling feature
This commit is contained in:
parent
334cb1dcd1
commit
96d29621b7
100
CMakeLists.txt
100
CMakeLists.txt
@ -8,11 +8,9 @@
|
|||||||
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
|
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
cmake_minimum_required(VERSION 2.4)
|
|
||||||
project(OpenCV)
|
|
||||||
|
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||||
set(OPENCV_INCLUDE_PREFIX include)
|
|
||||||
# Add these standard paths to the search paths for FIND_LIBRARY
|
# Add these standard paths to the search paths for FIND_LIBRARY
|
||||||
# to find libraries from these locations first
|
# to find libraries from these locations first
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@ -55,40 +53,8 @@ if(MSVC)
|
|||||||
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
|
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# SUBDIRECTORIES:
|
cmake_minimum_required(VERSION 2.4)
|
||||||
# Save libs and executables in the same place
|
project(OpenCV)
|
||||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
|
|
||||||
|
|
||||||
if(ANDROID)
|
|
||||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
|
||||||
elseif(WIN32)
|
|
||||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
|
||||||
else()
|
|
||||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ANDROID)
|
|
||||||
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME})
|
|
||||||
else()
|
|
||||||
set(OPENCV_LIB_INSTALL_PATH lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
|
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
||||||
|
|
||||||
# in case of cross compilation this macro will search packages
|
|
||||||
# for host system instead of packages for target system
|
|
||||||
if(NOT COMMAND find_host_package)
|
|
||||||
macro(find_host_package)
|
|
||||||
find_package(${ARGN})
|
|
||||||
endmacro()
|
|
||||||
endif()
|
|
||||||
if(NOT COMMAND find_host_program)
|
|
||||||
macro(find_host_program)
|
|
||||||
find_program(${ARGN})
|
|
||||||
endmacro()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Indicate CMake 2.7 and above that we don't want to mix relative
|
# Indicate CMake 2.7 and above that we don't want to mix relative
|
||||||
@ -99,6 +65,12 @@ if(COMMAND cmake_policy)
|
|||||||
cmake_policy(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Build static or dynamic libs?
|
||||||
|
# Default: dynamic libraries
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Current version number:
|
# Current version number:
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
@ -124,19 +96,52 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
#name mangling
|
#name mangling
|
||||||
if(UNIX)
|
set(OPENCV_INCLUDE_PREFIX include)
|
||||||
|
if(UNIX AND NOT ANDROID AND BUILD_SHARED_LIBS)
|
||||||
option(OPENCV_MANGLED_INSTALL_PATHS "Enables mangled install paths, that help with side by side installs" False)
|
option(OPENCV_MANGLED_INSTALL_PATHS "Enables mangled install paths, that help with side by side installs" False)
|
||||||
if(OPENCV_MANGLED_INSTALL_PATHS)
|
if(OPENCV_MANGLED_INSTALL_PATHS)
|
||||||
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION})
|
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION})
|
||||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV-${OPENCV_VERSION}/doc)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# SUBDIRECTORIES:
|
||||||
# Build static or dynamic libs?
|
# Save libs and executables in the same place
|
||||||
# Default: dynamic libraries
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
|
||||||
# ----------------------------------------------------------------------------
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
|
||||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
|
|
||||||
|
if(ANDROID)
|
||||||
|
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||||
|
elseif(WIN32)
|
||||||
|
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||||
|
else()
|
||||||
|
if(OPENCV_MANGLED_INSTALL_PATHS)
|
||||||
|
set(OPENCV_DOC_INSTALL_PATH share/OpenCV-${OPENCV_VERSION}/doc)
|
||||||
|
else()
|
||||||
|
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME})
|
||||||
|
else()
|
||||||
|
set(OPENCV_LIB_INSTALL_PATH lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
|
||||||
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
|
# in case of cross compilation this macro will search packages
|
||||||
|
# for host system instead of packages for target system
|
||||||
|
if(NOT COMMAND find_host_package)
|
||||||
|
macro(find_host_package)
|
||||||
|
find_package(${ARGN})
|
||||||
|
endmacro()
|
||||||
|
endif()
|
||||||
|
if(NOT COMMAND find_host_program)
|
||||||
|
macro(find_host_program)
|
||||||
|
find_program(${ARGN})
|
||||||
|
endmacro()
|
||||||
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Use statically or dynamically linked CRT?
|
# Use statically or dynamically linked CRT?
|
||||||
@ -1191,7 +1196,6 @@ if(UNIX)
|
|||||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION share/OpenCV/)
|
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION share/OpenCV/)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION share/OpenCV/)
|
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION share/OpenCV/)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
@ -1266,7 +1270,7 @@ endif(ANDROID)
|
|||||||
# The package name specified on the pkg-config command line is defined to
|
# The package name specified on the pkg-config command line is defined to
|
||||||
# be the name of the metadata file, minus the .pc extension. If a library
|
# be the name of the metadata file, minus the .pc extension. If a library
|
||||||
# can install multiple versions simultaneously, it must give each version
|
# can install multiple versions simultaneously, it must give each version
|
||||||
# its own name (for example, GTK 1.2 might have the package name "gtk+"
|
# its own name (for example, GTK 1.2 might have the package name "gtk+"
|
||||||
# while GTK 2.0 has "gtk+-2.0").
|
# while GTK 2.0 has "gtk+-2.0").
|
||||||
# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
|
# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
|
||||||
# prefix=/usr
|
# prefix=/usr
|
||||||
@ -1277,8 +1281,8 @@ endif(ANDROID)
|
|||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
set(exec_prefix "\${prefix}")
|
set(exec_prefix "\${prefix}")
|
||||||
set(libdir "\${exec_prefix}/lib")
|
set(libdir "\${exec_prefix}/lib")
|
||||||
set(includedir "\${prefix}/${OPENCV_INCLUDE_PREFIX}")
|
set(includedir "\${prefix}/${OPENCV_INCLUDE_PREFIX}")
|
||||||
set(VERSION ${OPENCV_VERSION})
|
set(VERSION ${OPENCV_VERSION})
|
||||||
|
|
||||||
set(OPENCV_PC_FILE_NAME "opencv.pc")
|
set(OPENCV_PC_FILE_NAME "opencv.pc")
|
||||||
#need to be explicit with naming the pc file and version number for side by side installs to work.
|
#need to be explicit with naming the pc file and version number for side by side installs to work.
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
# with this path is NOT needed.
|
# with this path is NOT needed.
|
||||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
||||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
|
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
|
||||||
# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.3.0"
|
# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@"
|
||||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2"
|
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MAJOR@"
|
||||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "3"
|
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@"
|
||||||
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
|
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@"
|
||||||
#
|
#
|
||||||
# Advanced variables:
|
# Advanced variables:
|
||||||
# - OpenCV_SHARED
|
# - OpenCV_SHARED
|
||||||
@ -26,6 +26,7 @@
|
|||||||
# - OpenCV_INSTALL_PATH
|
# - OpenCV_INSTALL_PATH
|
||||||
# - OpenCV_LIB_COMPONENTS
|
# - OpenCV_LIB_COMPONENTS
|
||||||
# - OpenCV_EXTRA_COMPONENTS
|
# - OpenCV_EXTRA_COMPONENTS
|
||||||
|
# - OpenCV_USE_MANGLED_PATHS
|
||||||
#
|
#
|
||||||
# =================================================================================================
|
# =================================================================================================
|
||||||
|
|
||||||
@ -38,6 +39,9 @@ SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)
|
|||||||
# Some additional settings are required if OpenCV is built as static libs
|
# Some additional settings are required if OpenCV is built as static libs
|
||||||
set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
|
set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
|
||||||
|
|
||||||
|
# Enables mangled install paths, that help with side by side installs
|
||||||
|
set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@)
|
||||||
|
|
||||||
# Extract the directory where *this* file has been installed (determined at cmake run-time)
|
# Extract the directory where *this* file has been installed (determined at cmake run-time)
|
||||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
@ -71,7 +75,7 @@ ELSEIF(NOT OpenCV_SHARED)
|
|||||||
LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera)
|
LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(@OPENCV_MANGLED_INSTALL_PATHS@)
|
if(OpenCV_USE_MANGLED_PATHS)
|
||||||
#be explicit about the library names.
|
#be explicit about the library names.
|
||||||
set(OpenCV_LIB_COMPONENTS_ )
|
set(OpenCV_LIB_COMPONENTS_ )
|
||||||
foreach( CVLib ${OpenCV_LIB_COMPONENTS})
|
foreach( CVLib ${OpenCV_LIB_COMPONENTS})
|
||||||
@ -118,7 +122,7 @@ IF (NOT OpenCV_SHARED)
|
|||||||
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})
|
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})
|
||||||
set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@)
|
set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@)
|
||||||
|
|
||||||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
|
if (WIN32 AND ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
|
||||||
# Modern CMake:
|
# Modern CMake:
|
||||||
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS})
|
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS})
|
||||||
set(OpenCV_LIBS ${OpenCV_LIBS}
|
set(OpenCV_LIBS ${OpenCV_LIBS}
|
||||||
|
Loading…
Reference in New Issue
Block a user