From 9f71c57fbf39b088e2e4f0e781aa9837d7d15167 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 25 Jul 2022 13:57:57 +0900 Subject: [PATCH 1/2] use FORCE_COMPILE_HRPSYSUTIL if you want to know whethere hrpsysUtils is build or not --- CMakeLists.txt | 54 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb40757a659..a271106783c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ include(FindPkgConfig) include(CheckIncludeFiles) option(ENABLE_INSTALL_RPATH "Enable RPATH setting for installed binary files" OFF) -option(USE_HRPSYSUTIL "Build hrpsysUtil" ON) +option(FORCE_COMPILE_HRPSYSUTIL "Try to build hrpsysUtil even if dependencies are missing" ON) option(USE_IRRLICHT "Build Irrlicht components" OFF) option(NO_DIGITAL_INPUT "Disable readDigitalInput and lengthDigitalInput" OFF) option(USE_QPOASES "Build qpOASES" OFF) @@ -142,30 +142,52 @@ include(CPack) find_package(LibXml2 REQUIRED) find_package(QuickHull REQUIRED) -if(USE_HRPSYSUTIL) - find_package(SDL REQUIRED) - find_package(OpenGL REQUIRED) - find_package(GLUT REQUIRED) - pkg_check_modules(OpenCV opencv) +set(USE_HRPSYSUTIL ON) +find_package(SDL REQUIRED) +if (NOT SDL_FOUND) + message(WARNING "SDL is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) +endif() +find_package(OpenGL REQUIRED) +if (NOT OpenGL_FOUND) + message(WARNING "OpenGL is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) +endif() +find_package(GLUT REQUIRED) +if (NOT GLUT_FOUND) + message(WARNING "GLUT is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) +endif() +pkg_check_modules(OpenCV opencv) +if (NOT OpenCV_FOUND) + pkg_check_modules(OpenCV opencv-2.3.1) if (NOT OpenCV_FOUND) - pkg_check_modules(OpenCV opencv-2.3.1) + pkg_check_modules(OpenCV opencv4) if (NOT OpenCV_FOUND) pkg_check_modules(OpenCV opencv4) if (NOT OpenCV_FOUND) - message(FATAL_ERROR "OpenCV is required to build hrpsysUtil") + message(WARNING "OpenCV is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) endif() endif() endif() - include_directories(${OpenCV_INCLUDE_DIRS}) - link_directories(${OpenCV_LIBRARY_DIRS}) - pkg_check_modules(GLEW glew) - if (NOT GLEW_FOUND) - message(FATAL_ERROR "GLEW is required to build hrpsysUtil") - endif() endif() +include_directories(${OpenCV_INCLUDE_DIRS}) +link_directories(${OpenCV_LIBRARY_DIRS}) +pkg_check_modules(GLEW glew) +if (NOT GLEW_FOUND) + message(WARNING "GLEW is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) +endif() + find_package(PCL) -if(USE_HRPSYSUTIL AND APPLE AND NOT PCL_FOUND) - message(FATAL_ERROR "PCL is required to build hrpsysUtil on Apple platform") +if(PCL_FOUND) + message(WARNING "PCL is required to build hrpsysUtil") + set(USE_HRPSYSUTIL OFF) +endif() + +if(FORCE_COMPILE_HRPSYSUTIL AND (NOT USE_HRPSYSUTIL)) + message(FATAL_ERROR "dependencies required to build hrpsysUtil is not found : SDL_FOUND: ${SDL_FOUND} / OpenGL_FOUND: ${OpenGL_FOUND} / GLUT_FOUND: ${GLUT_FOUND} / OpenCV_FOUND: ${OpenCV_FOUND} / GLEW_FOUND: ${GLEW_FOUND}") endif() execute_process( From 9eb9613186ffd2a47807decfcc5c5350ddfd407a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 25 Jul 2022 17:29:17 +0900 Subject: [PATCH 2/2] use OPENGL_FOUND instead of OpenGL_FOUND for old CMake Co-authored-by: Naoki Hiraoka <32383525+Naoki-Hiraoka@users.noreply.github.com> --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a271106783c..67ed40667cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,7 @@ if (NOT SDL_FOUND) set(USE_HRPSYSUTIL OFF) endif() find_package(OpenGL REQUIRED) -if (NOT OpenGL_FOUND) +if (NOT OPENGL_FOUND) message(WARNING "OpenGL is required to build hrpsysUtil") set(USE_HRPSYSUTIL OFF) endif() @@ -187,7 +187,7 @@ if(PCL_FOUND) endif() if(FORCE_COMPILE_HRPSYSUTIL AND (NOT USE_HRPSYSUTIL)) - message(FATAL_ERROR "dependencies required to build hrpsysUtil is not found : SDL_FOUND: ${SDL_FOUND} / OpenGL_FOUND: ${OpenGL_FOUND} / GLUT_FOUND: ${GLUT_FOUND} / OpenCV_FOUND: ${OpenCV_FOUND} / GLEW_FOUND: ${GLEW_FOUND}") + message(FATAL_ERROR "dependencies required to build hrpsysUtil is not found : SDL_FOUND: ${SDL_FOUND} / OPENGL_FOUND: ${OPENGL_FOUND} / GLUT_FOUND: ${GLUT_FOUND} / OpenCV_FOUND: ${OpenCV_FOUND} / GLEW_FOUND: ${GLEW_FOUND}") endif() execute_process(