Building Libs for Windows Debug Version with VS2017/Qt5.12

Having trouble installing or compiling FreeCAD? Get help here.
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Mon Mar 25, 2019 10:13 am

apeltauer wrote:
Mon Mar 25, 2019 9:57 am
wmayer wrote:
Sat Mar 23, 2019 5:59 pm
Then I found another oddity: the debug version area_d.pyd links against the release version of boost-python instead of the debug version.
solved this by adding this

Code: Select all

  set (BOOST_COMPONENTS ${BOOST_COMPONENTS} python37)
But maybe there is a smarter solution...
We have to be careful with adding hard-coded version numbers in library names. We have to determine the used Python version and based on this determine the name of the component.
User avatar
looo
Posts: 3301
Joined: Mon Nov 11, 2013 5:29 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby looo » Mon Mar 25, 2019 11:31 am

regarding this problem:
set (BOOST_COMPONENTS ${BOOST_COMPONENTS} python37)
Does it really make sense to continue using boost python. In my opinion using pybind11 will simplify the builds a lot because it can be used header only. (This way boost doesn't have a matching python version, which will simplefy the version matrix a lot) Also it has tools to connect numpy to eigen which is (in my opinion) quite important for low-level stuff.
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Mon Mar 25, 2019 12:40 pm

wmayer wrote:
Sun Mar 24, 2019 11:40 am
wmayer wrote:
Sun Mar 24, 2019 10:29 am
At the moment my local build lacks of shiboken/PySide support but this is what I look next.
Your libpack lacks of the PySide2 and shiboken2 config cmake files. Can you attach them to this thread, please?
Actually I don't need these files because it's very easy to create them manually. Inside the Libpack under cmake create the file Shiboken2Config.cmake with this content

Code: Select all

SET(SHIBOKEN_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/shiboken2)
SET(SHIBOKEN_LIBRARY     optimized ${FREECAD_LIBPACK_DIR}/lib/shiboken2.cp37-win_amd64.lib debug ${FREECAD_LIBPACK_DIR}/lib/shiboken2_d_d.cp37-win_amd64.lib)
and the file PySide2Config.cmake with this content:

Code: Select all

SET(PYSIDE_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/PySide2)
SET(PYSIDE_LIBRARY     optimized ${FREECAD_LIBPACK_DIR}/lib/pyside2.cp37-win_amd64.lib debug ${FREECAD_LIBPACK_DIR}/lib/pyside2_d.cp37-win_amd64_d.lib)
SET(PYSIDE_PYTHONPATH  ${FREECAD_LIBPACK_DIR}/pyside/Lib/site-packages)
SET(PYSIDE_TYPESYSTEMS ${FREECAD_LIBPACK_DIR}/pyside/share/PySide/typesystems)
Added the cmake files for shiboken2 and pyside2. Now cmake finds this two components with no other adoption
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Mon Mar 25, 2019 12:50 pm

wmayer wrote:
Sun Mar 24, 2019 11:40 am
Currently the clbunder has some special handling for the PCL stuff which could be simplified too. Therefore create the file PCLConfig.cmake with (rename that one pcl has generated because it's not easy to use anyway because it messes up our boost handling):

Code: Select all

link_directories(${FREECAD_LIBPACK_DIR}/lib)
set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.9)
set(PCL_LIBRARY_DIRS ${FREECAD_LIBPACK_DIR}/lib)

set(PCL_COMMON_LIBRARIES optimized pcl_common_release debug pcl_common_debug)
set(PCL_FEATURES_LIBRARIES optimized pcl_features_release debug pcl_features_debug)
set(PCL_FILTERS_LIBRARIES optimized pcl_filters_release debug pcl_filters_debug)
set(PCL_IO_LIBRARIES optimized pcl_io_release debug pcl_io_debug)
set(PCL_IO_PLY_LIBRARIES optimized pcl_io_ply_release debug pcl_io_ply_debug)
set(PCL_KDTREE_LIBRARIES optimized pcl_kdtree_release debug pcl_kdtree_debug)
set(PCL_KEYPOINTS_LIBRARIES optimized pcl_keypoints_release debug pcl_keypoints_debug)
set(PCL_ML_LIBRARIES optimized pcl_ml_release debug pcl_ml_debug)
set(PCL_OCTREE_LIBRARIES optimized pcl_octree_release debug pcl_octree_debug)
set(PCL_RECOGNITION_LIBRARIES optimized pcl_recognition_release debug pcl_recognition_debug)
set(PCL_REGISTRATION_LIBRARIES optimized pcl_registration_release debug pcl_registration_debug)
set(PCL_SAMPLE_CONSENSUS_LIBRARIES optimized pcl_sample_consensus_release debug pcl_sample_consensus_debug)
set(PCL_SEARCH_LIBRARIES optimized pcl_search_release debug pcl_search_debug)
set(PCL_SEGMENTATION_LIBRARIES optimized pcl_segmentation_release debug pcl_segmentation_debug)
set(PCL_STEREO_LIBRARIES optimized pcl_stereo_release debug pcl_stereo_debug)
set(PCL_SURFACE_LIBRARIES optimized pcl_surface_release debug pcl_surface_debug)
set(PCL_TRACKING_LIBRARIES optimized pcl_tracking_release debug pcl_tracking_debug)

set(PCL_LIBRARIES
    ${PCL_COMMON_LIBRARIES}
    ${PCL_FEATURES_LIBRARIES}
    ${PCL_FILTERS_LIBRARIES}
    ${PCL_IO_LIBRARIES}
    ${PCL_IO_PLY_LIBRARIES}
    ${PCL_KDTREE_LIBRARIES}
    ${PCL_KEYPOINTS_LIBRARIES}
    ${PCL_ML_LIBRARIES}
    ${PCL_OCTREE_LIBRARIES}
    ${PCL_RECOGNITION_LIBRARIES}
    ${PCL_REGISTRATION_LIBRARIES}
    ${PCL_SAMPLE_CONSENSUS_LIBRARIES}
    ${PCL_SEARCH_LIBRARIES}
    ${PCL_SEGMENTATION_LIBRARIES}
    ${PCL_STEREO_LIBRARIES}
    ${PCL_SURFACE_LIBRARIES}
    ${PCL_TRACKING_LIBRARIES}
)
set(PCL_FOUND TRUE)
set(PCL_COMMON_FOUND TRUE)
set(PCL_FEATURES_FOUND TRUE)
set(PCL_FILTERS_FOUND TRUE)
set(PCL_IO_FOUND TRUE)
set(PCL_IO_PLY_FOUND TRUE)
set(PCL_KDTREE_FOUND TRUE)
set(PCL_KEYPOINTS_FOUND TRUE)
set(PCL_ML_FOUND TRUE)
set(PCL_OCTREE_FOUND TRUE)
set(PCL_RECOGNITION_FOUND TRUE)
set(PCL_REGISTRATION_FOUND TRUE)
set(PCL_SAMPLE_CONSENSUS_FOUND TRUE)
set(PCL_SEARCH_FOUND TRUE)
set(PCL_SEGMENTATION_FOUND TRUE)
set(PCL_STEREO_FOUND TRUE)
set(PCL_SURFACE_FOUND TRUE)
set(PCL_TRACKING_FOUND TRUE)
Then in the UseLibPackCLbundler.cmake we can write

Code: Select all

find_package(PCL)
I have create a new PCL-config.cmake to find the new version 1.9.
In the UseLibPackCLbundler.cmake i have added this line, so the old libpack should also work (with a warning)

Code: Select all

find_package(PCL)
if(NOT EXISTS ${PCL_INCLUDE_DIRS})
  set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.7)
  set(PCL_LIBRARY_DIRS ${FREECAD_LIBPACK_DIR}/lib)
  .....
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Mon Mar 25, 2019 1:25 pm

looo wrote:
Mon Mar 25, 2019 11:31 am
regarding this problem:
set (BOOST_COMPONENTS ${BOOST_COMPONENTS} python37)
Does it really make sense to continue using boost python. In my opinion using pybind11 will simplify the builds a lot because it can be used header only. (This way boost doesn't have a matching python version, which will simplefy the version matrix a lot) Also it has tools to connect numpy to eigen which is (in my opinion) quite important for low-level stuff.
The question is how long VS2013 should be supported because the minimum version for pybind11 is VS2015. But for the libpack for VS2017 I also vote to use pybind11 instead of boost.python.
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Mon Mar 25, 2019 1:31 pm

wmayer wrote:
Mon Mar 25, 2019 1:25 pm
looo wrote:
Mon Mar 25, 2019 11:31 am
regarding this problem:
set (BOOST_COMPONENTS ${BOOST_COMPONENTS} python37)
Does it really make sense to continue using boost python. In my opinion using pybind11 will simplify the builds a lot because it can be used header only. (This way boost doesn't have a matching python version, which will simplefy the version matrix a lot) Also it has tools to connect numpy to eigen which is (in my opinion) quite important for low-level stuff.
The question is how long VS2013 should be supported because the minimum version for pybind11 is VS2015. But for the libpack for VS2017 I also vote to use pybind11 instead of boost.python.
ok, i already have added pybind11 to the new libpack, will try to use it...
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Mon Mar 25, 2019 1:40 pm

Can you please attach the pybind11 cmake config file to this thread?
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Mon Mar 25, 2019 2:01 pm

wmayer wrote:
Mon Mar 25, 2019 1:40 pm
Can you please attach the pybind11 cmake config file to this thread?
you can find the file in

Code: Select all

share\cmake\pybind11\
Attachments
pybind11_install.7z
(108.57 KiB) Downloaded 14 times
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Mon Mar 25, 2019 3:58 pm

To use pybind11 in the libarea project if have to adopt the cmake file with this:

Code: Select all

.....
else()
  include_directories(${pybind11_INCLUDE_DIR})
endif(NOT FREECAD_USE_PYBIND11)
Then pybind is included correctly....
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Mon Mar 25, 2019 6:53 pm

apeltauer wrote:
Mon Mar 25, 2019 3:58 pm
To use pybind11 in the libarea project if have to adopt the cmake file with this:

Code: Select all

.....
else()
  include_directories(${pybind11_INCLUDE_DIR})
endif(NOT FREECAD_USE_PYBIND11)
Then pybind is included correctly....
So, did setting FREECAD_USE_PYBIND11 pass the cmake configure check? For me it always failed with an error that it cannot find the Python libraries. pybind11Tools.cmake uses

Code: Select all

find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
to determine the Python version which loads the module FindPythonLibsNew.cmake. Now there it cannot locate PYTHON_LIBRARY and then stops with:

Code: Select all

    # raise an error if the python libs are still not found.
    if(NOT EXISTS "${PYTHON_LIBRARY}")
        message(FATAL_ERROR "Python libraries not found")
    endif()