libspnav doesn't announce its version in CMake "Summary report"

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
User avatar
Kunda1
Veteran
Posts: 12742
Joined: Thu Jan 05, 2017 9:03 pm

libspnav doesn't announce its version in CMake "Summary report"

Post by Kunda1 »

Code: Select all

-- SPNAV:               [/usr/lib/libspnav.so] [/usr/include]

Code: Select all

==============
Summary report
==============

-- Build type:          None
-- Compiler:            /usr/bin/c++ (11.2.0)
-- Flags:               -Wall -Wextra -Wno-write-strings -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -fPIC -w
-- Standard:            Requires C++17
-- Python:              3.10.2 [/usr/bin/python] [.cpython-310-x86_64-linux-gnu]
-- PCL:                 not enabled
-- pybind11:            not enabled
-- Boost:               1.78.0 (1.78.0)
-- XercesC:             3.2.3 [/usr/lib/libxerces-c.so] [/usr/include]
-- ZLIB:                1.2.12
-- PyCXX:               6.2.8 [/var/tmp/pamac-build-beast/freecad-git/src/FreeCAD/src]
-- OCC:                 7.5.3 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib] [/usr/include/opencascade]
-- SMESH:               build internal
--  MEDFile:            4.1.0 [/usr/lib/libmedC.so;/usr/lib/libmed.so] [/usr/include]
--  HDF5:               1.12.1
--  VTK:                9.1.0
-- NETGEN:              not enabled
-- SWIG:                4.0.2
-- Eigen3               3.4.0
-- Qt5Core:             5.15.3
-- Qt5Network:          5.15.3
-- Qt5Xml:              5.15.3
-- Qt5XmlPatterns:      5.15.3
-- Qt5Widgets:          5.15.3
-- Qt5PrintSupport:     5.15.3
-- Qt5OpenGL:           5.15.3
-- Qt5Svg:              5.15.3
-- Qt5UiTools:          5.15.3
-- Qt5Concurrent:       5.15.3
-- Qt5WebEngineWidgets: 5.15.8
-- Designer plugin:     not built per user request (BUILD_DESIGNER_PLUGIN)
-- Shiboken2:           5.15.3 [/usr/lib64/cmake/Shiboken2-5.15.3] [/usr/include/shiboken2;/usr/include/python3.10]
-- PySide2:             5.15.3 [/usr/include/PySide2]
-- PySide2Tools:        [/usr/bin/uic] [/usr/bin/rcc]
-- Freetype:            2.11.1
-- OpenGL:              /usr/lib/libGL.so
-- OpenGLU:             [/usr/lib/libGLU.so][/usr/include]
-- Coin3D:              4.0.1 [Coin] []
-- Pivy:                0.6.6
-- SPNAV:               [/usr/lib/libspnav.so] [/usr/include]
-- Matplotlib:          3.5.1
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             1.9.3
--  Language:           English
--  Coin3D_DOC:         not found
FreeCAD revision: freecad-git 0.20.0.28679.g35913fc695-1 (Wed 13 Apr 2022 08:29:34 PM EDT)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
chennes
Veteran
Posts: 2246
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by chennes »

As far as I can tell it should be available to cMake as "Spnav_VERSION" in the PrintFinalReport.cmake (on Linux), but I can't test it, I don't have libspnav installed.
Chris Hennes
Pioneer Library System
User avatar
Kunda1
Veteran
Posts: 12742
Joined: Thu Jan 05, 2017 9:03 pm

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by Kunda1 »

Here's the current block

Code: Select all

    if (WIN32)
    #message(STATUS "SPNAV:               not available yet for your OS") # FREECAD_USE_3DCONNEXION instead...
    else(WIN32)
        if(DEFINED SPNAV_FOUND)
            message(STATUS "SPNAV:               [${SPNAV_LIBRARY}] [${SPNAV_INCLUDE_DIR}]")
        else(DEFINED SPNAV_FOUND)
            message(STATUS "SPNAV:               not found")
        endif(DEFINED SPNAV_FOUND)
    endif(WIN32)
https://github.com/FreeCAD/FreeCAD/blob ... #L166-L174
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
chennes
Veteran
Posts: 2246
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by chennes »

Try something like:

Code: Select all

        if(DEFINED SPNAV_FOUND)
            message(STATUS "SPNAV:               [${SPNAV_LIBRARY} ${Spnav_VERSION}] [${SPNAV_INCLUDE_DIR}]")
Chris Hennes
Pioneer Library System
User avatar
Kunda1
Veteran
Posts: 12742
Joined: Thu Jan 05, 2017 9:03 pm

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by Kunda1 »

chennes wrote: Thu Apr 14, 2022 12:35 pm Try something like:

Code: Select all

        if(DEFINED SPNAV_FOUND)
            message(STATUS "SPNAV:               [${SPNAV_LIBRARY} ${Spnav_VERSION}] [${SPNAV_INCLUDE_DIR}]")
Didn't work for me, Here's the output

Code: Select all

-- Found Spnav: /usr/lib/libspnav.so  
.
.
.
-- SPNAV:               [/usr/lib/libspnav.so ] [/usr/include]
Edit:
Wait! i had a typo. Trying again!

Edit2:
No. didn't work. Here's the diff

Code: Select all

diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
index 926deff843..83151dd93c 100644
--- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
+++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
@@ -167,7 +167,7 @@ macro(PrintFinalReport)
     #message(STATUS "SPNAV:               not available yet for your OS") # FREECAD_USE_3DCONNEXION instead...
     else(WIN32)
         if(DEFINED SPNAV_FOUND)
-            message(STATUS "SPNAV:               [${SPNAV_LIBRARY}] [${SPNAV_INCLUDE_DIR}]")
+           message(STATUS "SPNAV:               [${SPNAV_LIBRARY} ${Spnav_VERSION}] [${SPNAV_INCLUDE_DIR}]")
         else(DEFINED SPNAV_FOUND)
             message(STATUS "SPNAV:               not found")
         endif(DEFINED SPNAV_FOUND)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wmayer
Founder
Posts: 18819
Joined: Thu Feb 19, 2009 10:32 am

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by wmayer »

Neither Spnav_VERSION nor SPNAV_VERSION nor any other variable that stores the version number is defined. CMake support for the spnav library is done with FreeCAD's own FindSpnav.cmake file which only searches for the spnav.h header file.

The SDK of spnav nowhere defines a version number so it's not even possible to extend the CMake support to provide a version number. The only version number comes from the Linux packaging system which on my system e.g. is 0.2.3. And the version number of the package is probably not related to the development state of spnav because here is a PDF from 2012 where it says the version number is 0.9: https://buildmedia.readthedocs.org/medi ... /spnav.pdf
User avatar
chennes
Veteran
Posts: 2246
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by chennes »

They put a version number in their pkg-config file, I think. Can we get cMake to use pkgconfig to locate spnav?
Chris Hennes
Pioneer Library System
User avatar
Kunda1
Veteran
Posts: 12742
Joined: Thu Jan 05, 2017 9:03 pm

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by Kunda1 »

I personally have an interest in seeing more up to date libspnav's because of this confusing output that users will probably redundantly report:
https://forum.freecadweb.org/viewtopic.php?f=8&t=65632 (issue #4711)
It's fixed in 0.3 but shortly afterwards upstream released a v1.0

Image
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wmayer
Founder
Posts: 18819
Joined: Thu Feb 19, 2009 10:32 am

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by wmayer »

chennes wrote: Thu Apr 14, 2022 3:06 pm They put a version number in their pkg-config file, I think. Can we get cMake to use pkgconfig to locate spnav?
I think there is a mechanism to load pkgconfig files with CMake but at least inside the two packages on Ubuntu there is no such file provided. However, in the code repository there is a spnav.pc.in

EDIT:
According to the history this file was added just a month ago. So, then of course none of the existing packages will offer such a file.
User avatar
waebbl
Posts: 165
Joined: Thu Aug 16, 2018 3:12 pm

Re: libspnav doesn't announce its version in CMake "Summary report"

Post by waebbl »

On Gentoo, having libspnav-1.0 installed, the pkg-config file lists Version: 1.0.

In CMake there's the FindPkgConfig module, which can handle pkg-config files with the pkg_check_modules() function[1],

[1] https://cmake.org/cmake/help/latest/mod ... onfig.html
Post Reply