From 08ca8a9d855bd06716e3fceeb9cff59d30436cc4 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 15 Dec 2015 17:15:46 +0300 Subject: [PATCH] Second phase of SketchSolver refactoring 1. Environment for PlaneGCS solver --- CMakeCommon/FindPlaneGCS.cmake | 49 +++++++++++++++++++++++++++++++++ env_Salome.bat | 13 +++++++++ env_linux.sh | 13 +++++++++ msvc10_env.bat | 13 +++++++++ src/SketchSolver/CMakeLists.txt | 6 ++-- 5 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 CMakeCommon/FindPlaneGCS.cmake diff --git a/CMakeCommon/FindPlaneGCS.cmake b/CMakeCommon/FindPlaneGCS.cmake new file mode 100644 index 000000000..7e51104dd --- /dev/null +++ b/CMakeCommon/FindPlaneGCS.cmake @@ -0,0 +1,49 @@ +# - Try to find PlaneGCS (sketcher part of FreeCAD) +# Once done this will define +# +# PLANEGCS_FOUND - system has PlaneGCS +# PLANEGCS_INCLUDE_DIRS - the Plaine include directory +# PLANEGCS_LIBRARIES - Link these to use PlaneGCS + +#============================================================================= +## Copyright (C) 2014-20xx CEA/DEN, EDF R&D +#============================================================================= + +IF(NOT PLANEGCS_FIND_QUIETLY) + MESSAGE(STATUS "Try to find PlainGCS at $ENV{PLANEGCS_ROOT_DIR}...") +ENDIF() + +FIND_PATH(PLANEGCS_INCLUDE_DIR NAMES GCS.h + HINTS ENV PLANEGCS_ROOT_DIR + PATH_SUFFIXES include +) + +FIND_PATH(PLANEGCS_CMAKE_DIR NAMES FindEigen3.cmake + HINTS ENV PLANEGCS_ROOT_DIR + PATH_SUFFIXES cmake +) + +FIND_LIBRARY(PLANEGCS_LIBRARY NAMES PlaneGCS + HINTS ENV PLANEGCS_ROOT_DIR + PATH_SUFFIXES lib +) + +# verify Eigen and Boost libraries are found +FILE(TO_CMAKE_PATH "$ENV{EIGEN_ROOT_DIR}/include/eigen3" EIGEN3_INCLUDE_DIR) +FILE(TO_CMAKE_PATH "$ENV{BOOST_ROOT_DIR}" BOOST_ROOT) +SET(CMAKE_MODULE_PATH "${PLANEGCS_CMAKE_DIR}" ${CMAKE_MODULE_PATH}) +FIND_PACKAGE(Eigen3 3.2.5 REQUIRED) +FIND_PACKAGE(Boost COMPONENTS graph REQUIRED) + +IF(Boost_FOUND AND EIGEN3_FOUND) + SET(PLANEGCS_INCLUDE_DIRS ${PLANEGCS_INCLUDE_DIR}) + SET(PLANEGCS_LIBRARIES ${PLANEGCS_LIBRARY}) +ENDIF() + +# handle the QUIETLY and REQUIRED arguments and set PLANEGCS_FOUND to TRUE +# if all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PlaneGCS + REQUIRED_VARS PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR) + +MARK_AS_ADVANCED(PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR) \ No newline at end of file diff --git a/env_Salome.bat b/env_Salome.bat index 7b147b26d..c20699bd4 100644 --- a/env_Salome.bat +++ b/env_Salome.bat @@ -23,6 +23,19 @@ if "%SOLVESPACE_ROOT_DIR%" == "" ( ) SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH% +if "%PLANEGCS_ROOT_DIR%" == "" ( + SET PLANEGCS_ROOT_DIR=%ROOT_DIR%\products\planegcs-0.16 +) +SET PATH=%PLANEGCS_ROOT_DIR%\lib;%PATH% + +if "%EIGEN_ROOT_DIR%" == "" ( + SET EIGEN_ROOT_DIR=%ROOT_DIR%\products\eigen-3.2.7 +) + +if "%BOOST_ROOT_DIR%" == "" ( + SET BOOST_ROOT_DIR=%ROOT_DIR%\products\boost-1.52.0 +) + cd %SALOME_ROOT_DIR%\WORK call set_env.bat %1 call "%PDIR%\env_compile.bat" diff --git a/env_linux.sh b/env_linux.sh index ef10d0d7d..2aaa7dbbd 100644 --- a/env_linux.sh +++ b/env_linux.sh @@ -24,6 +24,19 @@ export SOLVESPACE_ROOT_DIR=${NEWGEOM_PDIR}/solvespace-2.1 export LD_LIBRARY_PATH=${SOLVESPACE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} ## +#------ PlaneGCS ------ +export PLANEGCS_ROOT_DIR=${NEWGEOM_PDIR}/planegcs-0.16 +export LD_LIBRARY_PATH=${PLANEGCS_ROOT_DIR}/lib:${LD_LIBRARY_PATH} +## + +#------ Eigen ------ +export EIGEN_ROOT_DIR=${NEWGEOM_PDIR}/eigen-3.2.7 +## + +#------ Boost ------ +export BOOST_ROOT_DIR=${NEWGEOM_PDIR}/boost-1.52.0 +## + #------ lcov ------ export LCOV_ROOT_DIR=${NEWGEOM_PDIR}/lcov-1.11 export PATH=${LCOV_ROOT_DIR}/bin:${PATH} diff --git a/msvc10_env.bat b/msvc10_env.bat index 246307098..0d63c8b4f 100644 --- a/msvc10_env.bat +++ b/msvc10_env.bat @@ -123,6 +123,19 @@ set PATH=%CMAKEDIR%\bin;%PATH% @SET _NO_DEBUG_HEAP=1 @REM ------------------------- +@REM ------------------------- +@SET PLANEGCS_ROOT_DIR=%PDIR%\planegcs-0.16 +@SET PATH=%PLANEGCS_ROOT_DIR%\lib;%PATH% +@REM ------------------------- + +@REM ------------------------- +@SET EIGEN_ROOT_DIR=%PDIR%\eigen-3.2.7 +@REM ------------------------- + +@REM ------------------------- +@SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0 +@REM ------------------------- + @REM ------------------------- @REM PTHREAD @SET PATH=%PDIR%\pthreads-2.9.1\lib;%PATH% diff --git a/src/SketchSolver/CMakeLists.txt b/src/SketchSolver/CMakeLists.txt index c75eb93ba..25c5a8c26 100644 --- a/src/SketchSolver/CMakeLists.txt +++ b/src/SketchSolver/CMakeLists.txt @@ -79,7 +79,7 @@ INSTALL(TARGETS SketchSolver DESTINATION plugins) # Include specific solvers FIND_FILE(SSPath "SolveSpaceSolver/CMakeLists.txt" PATHS "${CMAKE_CURRENT_SOURCE_DIR}") STRING(COMPARE NOTEQUAL ${SSPath} "SSPath-NOTFOUND" SSPath_FOUND) -FIND_FILE(GCSPath "PlainGCSSolver/CMakeLists.txt" PATHS "${CMAKE_CURRENT_SOURCE_DIR}") +FIND_FILE(GCSPath "PlaneGCSSolver/CMakeLists.txt" PATHS "${CMAKE_CURRENT_SOURCE_DIR}") STRING(COMPARE NOTEQUAL ${GCSPath} "GCSPath-NOTFOUND" GCSPath_FOUND) IF(${SSPath_FOUND} OR ${GCSPath_FOUND}) @@ -88,8 +88,8 @@ IF(${SSPath_FOUND} OR ${GCSPath_FOUND}) ADD_SUBDIRECTORY(SolveSpaceSolver) ENDIF() IF(${GCSPath_FOUND}) - MESSAGE(STATUS "PlainGCSSolver plugin found in ${GCSPath}") - ADD_SUBDIRECTORY(PlainGCSSolver) + MESSAGE(STATUS "PlaneGCSSolver plugin found in ${GCSPath}") + ADD_SUBDIRECTORY(PlaneGCSSolver) ENDIF() ELSE() MESSAGE(WARNING "No sketch solver plugin is found") -- 2.39.2