fix compilation

i am absolutely filled with anger at how much time this took. stop
using build systems other than cmake. stop using cmake as if it was
2004. stop making languages without a proper, standardized and
enforced way to package projects.
This commit is contained in:
ccolin 2022-01-09 16:51:59 +01:00
parent 53a50c61af
commit efec18499f
3 changed files with 46 additions and 65 deletions

View File

@ -1,30 +0,0 @@
<!DOCTYPE QGLVIEWER>
<QGLViewer version="2.6.3">
<State stereo="false">
<foregroundColor blue="25" red="217" green="22"/>
<backgroundColor blue="255" red="217" green="228"/>
</State>
<Display FPSIsDisplayed="false" gridIsDrawn="false" axisIsDrawn="false" cameraIsEdited="false"/>
<Geometry width="800" fullScreen="false" posX="100" posY="127" height="600"/>
<Camera>
<Parameters zClippingCoefficient="1.73205" Type="PERSPECTIVE" fieldOfView="0.785398" sceneRadius="22.4054" zNearCoefficient="0.005" orthoCoef="0.670991">
<SceneCenter y="1" x="1" z="1"/>
</Parameters>
<Stereo physScreenWidth="0.5" focusDistance="54.0913" IODist="0.062"/>
<ManipulatedCameraFrame>
<position y="-36.9988" x="45.4908" z="-1.12818"/>
<orientation q2="0.174868" q1="0.411944" q0="0.590319" q3="0.671749"/>
<ManipulatedParameters zoomSens="1" rotSens="1" transSens="1" spinSens="0.3" wheelSens="1"/>
<ManipulatedCameraParameters rotatesAroundUpVector="false" flySpeed="0.224054" zoomsOnPivotPoint="false">
<sceneUpVector y="1" x="0" z="0"/>
</ManipulatedCameraParameters>
</ManipulatedCameraFrame>
</Camera>
<ManipulatedFrame>
<position y="0" x="0" z="0"/>
<orientation q2="0" q1="0" q0="0" q3="1"/>
<ManipulatedParameters zoomSens="1" rotSens="1" transSens="1" spinSens="0.3" wheelSens="1"/>
</ManipulatedFrame>
<Light pos_light_y="-84.9391" pos_light_x="10.6884" pos_light_z="127.287"/>
<Rendering mode="0"/>
</QGLViewer>

View File

@ -2,14 +2,15 @@ cmake_minimum_required(VERSION 3.15)
include(FetchContent) include(FetchContent)
set(WITH_QGLVIEWER true) set(WITH_QGLVIEWER true CACHE INTERNAL "")
set(WITH_QT5 true) set(WITH_QT5 true CACHE INTERNAL "")
set(BUILD_EXAMPLES OFF) set(BUILD_EXAMPLES OFF CACHE INTERNAL "")
FetchContent_Declare( FetchContent_Declare(
DGtal DGtal
URL https://github.com/DGtal-team/DGtal/archive/refs/tags/1.2.tar.gz URL https://github.com/DGtal-team/DGtal/archive/refs/tags/1.2.tar.gz
URL_HASH MD5=19e443ca4f3927c9b9eff742cdfa138f URL_HASH MD5=19e443ca4f3927c9b9eff742cdfa138f)
DEPENDS libQGLViewer_ep-build)
FetchContent_MakeAvailable(DGtal) FetchContent_MakeAvailable(DGtal)
target_link_libraries(DGtal PRIVATE libQGLViewer)

View File

@ -3,39 +3,49 @@ cmake_minimum_required(VERSION 3.15)
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
libQGLViewer libQGLViewer_sources
URL http://www.libqglviewer.com/src/libQGLViewer-2.7.2.tar.gz URL http://www.libqglviewer.com/src/libQGLViewer-2.7.2.tar.gz
URL_HASH MD5=a9d965d1ce41f7db6b34f440bb74f061 URL_HASH MD5=a9d965d1ce41f7db6b34f440bb74f061)
CONFIGURE_COMMAND "qmake ${CMAKE_CURRENT_SOURCE_DIR}/QGLViewer/QGLViewer.pro"
STEP_TARGETS build
# BUILD_BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/QGLViewer/libQGLViewer-qt5.so
LOG_DOWNLOAD true
LOG_CONFIGURE true
LOG_BUILD true
LOG_INSTALL true)
ExternalProject_Get_property(libQGLViewer_ep SOURCE_DIR) FetchContent_MakeAvailable(libQGLViewer_sources)
message("libqglviewer_ep src dir: ${SOURCE_DIR}") FetchContent_GetProperties(
ExternalProject_Get_property(libQGLViewer_ep CONFIGURE_COMMAND) libQGLViewer_sources
message("libqglviewer_ep configure command: ${CONFIGURE_COMMAND}") SOURCE_DIR libQGLViewer_SOURCE_DIR
# ExternalProject_Get_property(libQGLViewer_ep BUILD_BYPRODUCTS) BINARY_DIR libQGLViewer_BINARY_DIR)
# message("libqglviewer_ep build byproducts: ${BUILD_BYPRODUCTS}")
set(QGLVIEWER_INCLUDE_DIR find_program(QMAKE qmake)
$<BUILD_INTERFACE:${SOURCE_DIR}> execute_process(
$<INSTALL_INTERFACE:include> WORKING_DIRECTORY ${libQGLViewer_BINARY_DIR}
CACHE PATH "") COMMAND "${QMAKE}" "${libQGLViewer_SOURCE_DIR}/QGLViewer/QGLViewer.pro"
# # Can't use find_library as the library isn't there at config time COMMAND_ECHO STDERR
# find_library(QGLVIEWER_LIBRARIES OUTPUT_VARIABLE QGLVIEWER_CFG_OUT
# NAMES qglviewer-qt4 qglviewer QGLViewer QGLViewer2 QGLViewer-qt5 ERROR_VARIABLE QGLVIEWER_CFG_OUT
# PATHS ${SOURCE_DIR} ECHO_OUTPUT_VARIABLE
# PATH_SUFFIXES QGLViewer QGLViewer/release) ECHO_ERROR_VARIABLE
set(QGLVIEWER_LIBRARIES RESULT_VARIABLE QGLVIEWER_CFG_RES)
$<BUILD_INTERFACE:${SOURCE_DIR}/QGLViewer/libQGLViewer-qt5.so> message("QGLViewer configuration result: ${QGLVIEWER_CFG_RES}")
$<INSTALL_INTERFACE:lib/libQGLViewer-qt5.so>
CACHE FILEPATH "") find_program(MAKE make)
include(ProcessorCount)
ProcessorCount(NCORES)
execute_process(
WORKING_DIRECTORY ${libQGLViewer_BINARY_DIR}
COMMAND "${MAKE}" "-j${NCORES}"
COMMAND_ECHO STDERR
OUTPUT_VARIABLE QGLVIEWER_BUILD_OUT
ERROR_VARIABLE QGLVIEWER_BUILD_OUT
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
RESULT_VARIABLE QGLVIEWER_BUILD_RES)
message("QGLViewer build result: ${QGLVIEWER_BUILD_RES}")
add_library(libQGLViewer INTERFACE) add_library(libQGLViewer INTERFACE)
target_include_directories(libQGLViewer INTERFACE ${libQGLViewer_SOURCE_DIR})
# QGLViewer moves its build output back to its source dir
find_library(QGLVIEWER_LIBRARIES
NAMES qglviewer-qt4 qglviewer QGLViewer QGLViewer2 QGLViewer-qt5
PATHS ${libQGLViewer_SOURCE_DIR}
PATH_SUFFIXES QGLViewer QGLViewer/release)
target_link_libraries(libQGLViewer INTERFACE ${QGLVIEWER_LIBRARIES}) target_link_libraries(libQGLViewer INTERFACE ${QGLVIEWER_LIBRARIES})
add_dependencies(libQGLViewer libQGLViewer_ep-build)
target_include_directories(libQGLViewer INTERFACE ${QGLVIEWER_INCLUDE_DIR})