[MacPorts] #48288: CMake generating broken Xcode projects when using OpenCV
MacPorts
noreply at macports.org
Thu Jul 9 15:42:23 PDT 2015
#48288: CMake generating broken Xcode projects when using OpenCV
-----------------------------------+--------------------------------
Reporter: christian.richardt@… | Owner: macports-tickets@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.3.3
Resolution: | Keywords:
Port: opencv cmake |
-----------------------------------+--------------------------------
Comment (by christian.richardt@…):
The problem in `FRAMEWORK_SEARCH_PATHS = (//System/Library/Frameworks, );`
indeed appears to be the double slash. Deleting one of the slashes
manually (in all instances) fixes the Xcode project. Seems like Xcode is a
little fragile in that respect, and maybe it's a a regression in Xcode.
I narrowed it down to the `qt4` variant that adds the double slash in
OpenCV:
{{{
$ diff -c OpenCVModules-release\@3.0.0_0.cmake OpenCVModules-
release\@3.0.0_0+qt4.cmake
*** OpenCVModules-release at 3.0.0_0.cmake 2015-06-22 21:27:25.000000000
+0200
--- OpenCVModules-release at 3.0.0_0+qt4.cmake 2015-07-09
23:47:38.000000000 +0200
***************
*** 9,14 ****
--- 9,15 ----
set_property(TARGET opencv_hal APPEND PROPERTY IMPORTED_CONFIGURATIONS
RELEASE)
set_target_properties(opencv_hal PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE
"//System/Library/Frameworks/AGL.framework;//System/Library/Frameworks/OpenGL.framework"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_hal.a"
)
***************
*** 154,160 ****
set_property(TARGET opencv_ts APPEND PROPERTY IMPORTED_CONFIGURATIONS
RELEASE)
set_target_properties(opencv_ts PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
! IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE
"opencv_hal;opencv_core;opencv_imgproc;opencv_imgcodecs;opencv_videoio;opencv_highgui"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_ts.a"
)
--- 155,161 ----
set_property(TARGET opencv_ts APPEND PROPERTY IMPORTED_CONFIGURATIONS
RELEASE)
set_target_properties(opencv_ts PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
! IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE
"opencv_hal;opencv_core;opencv_imgproc;opencv_imgcodecs;opencv_videoio;opencv_highgui;//System/Library/Frameworks/AGL.framework;//System/Library/Frameworks/OpenGL.framework"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_ts.a"
)
}}}
{{{
$ diff opencv\@3.0.0_0.pc opencv\@3.0.0_0+qt4.pc
13c13
< Libs.private: -l-framework Cocoa -L/opt/local/lib -lpng -ltiff -ljasper
-ljpeg -lImath -lIlmImf -lIex -lHalf -lIlmThread -lavcodec -lavformat
-lavutil -lswscale -lavresample -lz -lbz2 -l-framework
VideoDecodeAcceleration -l-framework QTKit -l-framework QuartzCore
-l-framework AppKit
---
> Libs.private: -L/opt/local/lib -lQtOpenGL -lQtGui -lQtTest -lQtCore
-lpng -ltiff -ljasper -ljpeg -lImath -lIlmImf -lIex -lHalf -lIlmThread
-lavcodec -lavformat -lavutil -lswscale -lavresample -lz -lbz2
-l-framework VideoDecodeAcceleration -l-framework QTKit -l-framework
QuartzCore -l-framework AppKit -L//System/Library/Frameworks -lAGL
-lOpenGL
}}}
I tracked down the source to the following: if OpenCV is configured
`WITH_QT`, and Qt is found,
[https://github.com/Itseez/opencv/blob/b46719b0931b256ab68d5f833b8fadd83737ddd1/cmake/OpenCVFindLibsGUI.cmake#L73
OpenCVFindLibsGUI.cmake] also adds `${OPENGL_LIBRARIES}` (AGL and OpenGL)
to `OPENCV_LINKER_LIBS`. This appears to be the step that produces the
broken paths. For some reason, the SDK path component is missing, which I
do get if I do
{{{
find_package(OpenGL REQUIRED)
message(STATUS ${OPENGL_LIBRARIES})
}}}
in a test project:
{{{
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework
}}}
I don't understand why `find_package(OpenGL REQUIRED)` produces different
paths when MacPort configures OpenCV than when I use it in my own project?
--
Ticket URL: <https://trac.macports.org/ticket/48288#comment:4>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list