-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathFindPylon.cmake
165 lines (143 loc) · 5.3 KB
/
FindPylon.cmake
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# This file was reused from the following GitHub repository: https://github.com/lagadic/visp/blob/master/cmake/FindPylon.cmake
#############################################################################
#
# ViSP, open source Visual Servoing Platform software.
# Copyright (C) 2005 - 2019 by Inria. All rights reserved.
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See the file LICENSE.txt at the root directory of this source
# distribution for additional information about the GNU GPL.
#
# For using ViSP with software that can not be combined with the GNU
# GPL, please contact Inria about acquiring a ViSP Professional
# Edition License.
#
# See http://visp.inria.fr for more information.
#
# This software was developed at:
# Inria Rennes - Bretagne Atlantique
# Campus Universitaire de Beaulieu
# 35042 Rennes Cedex
# France
#
# If you have questions regarding the use of this file, please contact
# Inria at visp@inria.fr
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Description:
# Try to find Basler Pylon library API
#
# PYLON_FOUND
# PYLON_INCLUDE_DIRS
# PYLON_LIBRARIES
# PYLON_VERSION
#
# Authors:
# Wenfeng CAI
# Fabien Spindler : compat with OSX and Windows
#
#############################################################################
if(APPLE)
find_path(PYLON_INCLUDE_DIR pylon/PylonIncludes.h)
find_path(PYLON_BASE_INCLUDE_DIR
NAMES Base/GCTypes.h
HINTS ${PYLON_INCLUDE_DIR}/Headers
PATH_SUFFIXES GenICam)
find_library(PYLON_LIBRARIES pylon)
find_program(PYLON_CONFIG pylon-config
HINTS ${PYLON_INCLUDE_DIR}
PATH_SUFFIXES Versions/A/Resources/Tools)
if(PYLON_INCLUDE_DIR)
list(APPEND PYLON_INCLUDE_DIRS ${PYLON_INCLUDE_DIR})
endif()
if(PYLON_BASE_INCLUDE_DIR)
list(APPEND PYLON_INCLUDE_DIRS ${PYLON_BASE_INCLUDE_DIR})
endif()
if(PYLON_CONFIG)
execute_process(COMMAND ${PYLON_CONFIG} "--version"
OUTPUT_VARIABLE PYLON_VERSION_TMP
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "-n" "" PYLON_VERSION ${PYLON_VERSION_TMP})
endif()
if(PYLON_INCLUDE_DIRS AND PYLON_LIBRARIES)
set(PYLON_FOUND TRUE)
endif()
mark_as_advanced(PYLON_BASE_INCLUDE_DIR)
elseif(MSVC)
find_path(PYLON_INCLUDE_DIR pylon/PylonIncludes.h
PATHS "${PYLON_HOME}/include")
set(PYLON_LIB_SEARCH_PATH "${PYLON_HOME}/lib/x64")
find_library(PYLON_BASE_LIBRARY
NAMES PylonBase_v6_0.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
find_library(PYLON_GCBASE_LIBRARY
NAMES GCBase_MD_VC141_v3_1_Basler_pylon.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
find_library(PYLON_GENAPI_LIBRARY
NAMES GenApi_MD_VC141_v3_1_Basler_pylon.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
find_library(PYLON_UTILITY_LIBRARY
NAMES PylonUtility_v6_0.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
find_library(PYLON_GUI_LIBRARY
NAMES PylonGUI_v6_0.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
find_library(PYLON_C_LIBRARY
NAMES PylonC.lib
PATHS ${PYLON_LIB_SEARCH_PATH})
if(PYLON_INCLUDE_DIR)
list(APPEND PYLON_INCLUDE_DIRS ${PYLON_INCLUDE_DIR})
endif()
if(PYLON_BASE_LIBRARY AND PYLON_GCBASE_LIBRARY)
list(APPEND PYLON_LIBRARIES ${PYLON_BASE_LIBRARY})
list(APPEND PYLON_LIBRARIES ${PYLON_GCBASE_LIBRARY})
list(APPEND PYLON_LIBRARIES ${PYLON_GENAPI_LIBRARY})
list(APPEND PYLON_LIBRARIES ${PYLON_UTILITY_LIBRARY})
list(APPEND PYLON_LIBRARIES ${PYLON_GUI_LIBRARY})
list(APPEND PYLON_LIBRARIES ${PYLON_C_LIBRARY})
endif()
if(PYLON_INCLUDE_DIRS AND PYLON_LIBRARIES)
set(PYLON_FOUND TRUE)
endif()
mark_as_advanced(
PYLON_BASE_LIBRARY
PYLON_GCBASE_LIBRARY
PYLON_GENAPI_LIBRARY
PYLON_UTILITY_LIBRARY
PYLON_GUI_LIBRARY
PYLON_C_LIBRARY
)
elseif(UNIX)
set(PYLON_ROOT_SEARCH_PATH /opt/pylon5)
# For more possible versions, just add more paths below.
# list(APPEND PYLON_ROOT_SEARCH_PATH "/somepath/include")
find_program(PYLON_CONFIG pylon-config
PATHS ${PYLON_ROOT}
PATHS ${PYLON_ROOT}
PATHS ${PYLON_ROOT_SEARCH_PATH}
PATH_SUFFIXES bin)
if(PYLON_CONFIG)
execute_process(COMMAND ${PYLON_CONFIG} "--version"
OUTPUT_VARIABLE PYLON_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${PYLON_CONFIG} "--libs" "--libs-rpath"
OUTPUT_VARIABLE PYLON_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${PYLON_CONFIG} "--cflags-only-I"
OUTPUT_VARIABLE PYLON_INC_TMP
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "-I" "" PYLON_INCLUDE_DIRS ${PYLON_INC_TMP})
set(PYLON_FOUND TRUE)
endif()
endif()
mark_as_advanced(
PYLON_INCLUDE_DIR
PYLON_INCLUDE_DIRS
PYLON_LIBRARIES
PYLON_CONFIG
)