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)
set(WITH_QGLVIEWER true)
set(WITH_QT5 true)
set(BUILD_EXAMPLES OFF)
set(WITH_QGLVIEWER true CACHE INTERNAL "")
set(WITH_QT5 true CACHE INTERNAL "")
set(BUILD_EXAMPLES OFF CACHE INTERNAL "")
FetchContent_Declare(
DGtal
URL https://github.com/DGtal-team/DGtal/archive/refs/tags/1.2.tar.gz
URL_HASH MD5=19e443ca4f3927c9b9eff742cdfa138f
DEPENDS libQGLViewer_ep-build)
URL_HASH MD5=19e443ca4f3927c9b9eff742cdfa138f)
FetchContent_MakeAvailable(DGtal)
target_link_libraries(DGtal PRIVATE libQGLViewer)

View File

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