-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
121 lines (98 loc) · 4.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#============================================================================
#
# Copyright 2016 by:
#
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
#
# This file is licensed by CSIRO under the copy of the CSIRO Open Source
# Software License Agreement (variation of the BSD / MIT License) included
# with the file.
#
# As a condition of this license, you agree that where you make any
# adaptations, modifications, further developments, or additional features
# available to CSIRO or the public in connection with your access to the
# Software, you do so on the terms of the BSD 3-Clause License template,
# a copy available at: http://opensource.org/licenses/BSD-3-Clause
#
# For further information, contact the CSIRO Workspace Team:
# workspace@csiro.au
#
# This copyright notice must be included with all copies of the source code.
#
#============================================================================
cmake_minimum_required(VERSION 3.0)
project(OPENCV)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_path(WORKSPACE_CMAKE_ROOT Workspace_CMake_Root.txt
HINTS ${CMAKE_SOURCE_DIR} ENV WORKSPACE_CMAKE_ROOT
DOC "Directory containing the Workspace_CMake_Root.txt file")
if (NOT WORKSPACE_CMAKE_ROOT)
message(FATAL_ERROR "Please set WORKSPACE_CMAKE_ROOT to the directory containing the file Workspace_CMake_Root.txt")
endif()
include( ${WORKSPACE_CMAKE_ROOT}/CMakeLists.txt NO_POLICY_SCOPE )
endif()
include_directories(${OPENCV_SOURCE_DIR})
if (NOT ${OPENCV_SOURCE_DIR} STREQUAL ${OPENCV_BINARY_DIR})
include_directories(${OPENCV_BINARY_DIR})
endif()
set(OPENCV_PLUGIN_VERSION 0.1.0)
string(REGEX MATCH "^[0-9]+" OPENCV_PLUGIN_SOVERSION ${OPENCV_PLUGIN_VERSION})
set(CMAKE_AUTOMOC ON)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# Stop OpenCV RelWithDebInfo build trying to use the debug libs (kaboom!)
if(WIN32)
set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)
endif()
find_package(Qt5Core)
find_package(Qt5Widgets)
set(QT_LIBRARIES Qt5::Core;Qt5::Widgets)
set(HEADERS
${OPENCV_SOURCE_DIR}/cvtypes.h
${OPENCV_SOURCE_DIR}/opencvplugin_api.h
${OPENCV_SOURCE_DIR}/opencvplugin.h
)
set(INSTALL_HEADERS
${OPENCV_SOURCE_DIR}/cvtypes.h
${OPENCV_SOURCE_DIR}/opencvplugin_api.h
${OPENCV_SOURCE_DIR}/opencvplugin.h
)
set(MOC_HEADERS
)
set(SOURCES
${OPENCV_SOURCE_DIR}/cvtypes.cpp
${OPENCV_SOURCE_DIR}/opencvplugin.cpp
)
set(UI_SOURCES
)
include(${OPENCV_SOURCE_DIR}/Datatypes/CMakeLists.txt)
include(${OPENCV_SOURCE_DIR}/Operations/CMakeLists.txt)
include(${OPENCV_SOURCE_DIR}/Widgets/CMakeLists.txt)
add_definitions(-DOPENCV_PLUGIN_VERSION=${OPENCV_PLUGIN_VERSION})
# The next line is used by the simple application generator wizard
# add_subdirectory(${OPENCV_SOURCE_DIR}/Application)
# qtx macros are defined in the ${WORKSPACE_CMAKE_ROOT}/CMakeLists.txt included at the top of this file
# to support both Qt4 and Qt5 builds.
qtx_wrap_cpp(MOC_SOURCES ${MOC_HEADERS})
qtx_wrap_ui(UIC_SOURCES ${UI_SOURCES})
qtx_add_resources(RES_SOURCES ${RESOURCES})
add_library(opencvplugin ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${UIC_SOURCES} ${RES_SOURCES})
target_link_libraries(opencvplugin dataanalysisplugin meshplugin renderingplugin workspace ${OpenCV_LIBS} ${QT_LIBRARIES})
set_target_properties(opencvplugin PROPERTIES
DEFINE_SYMBOL CSIRO_OPENCV_EXPORT
VERSION ${OPENCV_PLUGIN_VERSION}
SOVERSION ${OPENCV_PLUGIN_SOVERSION}
)
setTargetOutputDirectory(opencvplugin ${CSIRO_INSTALL_AREA}/lib/Plugins)
configure_file(pkg-opencvplugin.cmake ${CSIRO_INSTALL_AREA}/cmake/Exports/pkg-opencvplugin.cmake @ONLY)
foreach(iPath ${OpenCV_LIB_DIR})
list(APPEND EXTRA_INSTALL_AREAS "\n${iPath}/..")
endforeach()
set_install_area_file(opencvplugin "${CSIRO_INSTALL_AREA}" ${EXTRA_INSTALL_AREAS})
# Copy our install headers into the install directory so that others can build against our plugin.
foreach(inFile ${INSTALL_HEADERS})
string(REGEX REPLACE "(${OPENCV_SOURCE_DIR}/)(.*)" "${CSIRO_INSTALL_AREA}/include/OpenCV/\\2" outFile "${inFile}")
configure_file(${inFile} ${outFile} COPYONLY)
endforeach(inFile)
add_subdirectory(Designer)
add_subdirectory(Tests)