From: asozinov Date: Mon, 27 Mar 2023 11:03:45 +0000 (+0100) Subject: DXF plugin X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4aa8d04044438d641dd943a3982469a33c980b23;p=modules%2Fshaper.git DXF plugin Import as Shape/Sketcj License check --- diff --git a/CMakeCommon/FindDXF.cmake b/CMakeCommon/FindDXF.cmake new file mode 100644 index 000000000..71c7c9708 --- /dev/null +++ b/CMakeCommon/FindDXF.cmake @@ -0,0 +1,29 @@ +# Copyright (c) 2021-present OPEN CASCADE SAS +# +# This file is part of commercial software by OPEN CASCADE SAS. +# +# This software is furnished in accordance with the terms and conditions +# of the contract and with the inclusion of this copyright notice. +# This software or any other copy thereof may not be provided or otherwise +# be made available to any third party. +# No ownership title to the software is transferred hereby. +# +# OPEN CASCADE SAS makes no representation or warranties with respect to the +# performance of this software, and specifically disclaims any responsibility +# for any damages, special or consequential, connected with its use. +# + +#path to DXF component dir +set(DXF_DIR "D:/C/SALOME-master/W64/DXF") + +if(EXISTS ${DXF_DIR}) + set(CMAKE_PREFIX_PATH ${DXF_DIR}/cmake ${CMAKE_PREFIX_PATH}) + include(FindTBB) + #find_package(PRODUCTS) + set(HAVE_DXF True) + set(PRODUCTS_DXF_FOUND True) + #if(PRODUCTS_DXF_LIBRARIES) + # set(HAVE_DXF True) + # set(PRODUCTS_DXF_FOUND True) + #endif() +endif() diff --git a/CMakeCommon/FindTBB.cmake b/CMakeCommon/FindTBB.cmake new file mode 100644 index 000000000..8745fe35a --- /dev/null +++ b/CMakeCommon/FindTBB.cmake @@ -0,0 +1,103 @@ +# - Find TBB +# Sets the following variables: +# TBB_INCLUDE_DIRS - path to the TBB include directory +# TBB_LIBRARIES - path to the TBB libraries to be linked against +# + +######################################################################### +# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ + +MESSAGE(STATUS "Check for TBB ...") + +# ------ + +SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR}) + +IF(TBB_ROOT_DIR) + LIST(APPEND CMAKE_PREFIX_PATH "${TBB_ROOT_DIR}") +ENDIF(TBB_ROOT_DIR) + +FIND_PATH(TBB_INCLUDE_DIRS tbb/tbb.h PATH_SUFFIXES include) + +IF(MACHINE_IS_64) + SET(PLT_SUFFIX intel64) +ELSE(MACHINE_IS_64) + SET(PLT_SUFFIX ia32) +ENDIF(MACHINE_IS_64) + +include(CheckCXXSourceCompiles) + +SET(_PATH_SUFFIXES) +IF(TBB_ROOT_DIR) + FOREACH(_PATH cc4.1.0_libc2.4_kernel2.6.16.21 gcc4.4 gcc4.1) + LIST(APPEND _PATH_SUFFIXES ${PLT_SUFFIX}/${_PATH}) + ENDFOREACH() +ENDIF() + +FIND_LIBRARY(_tbb_library_tbb + NAMES tbb + PATH_SUFFIXES ${_PATH_SUFFIXES}) +FIND_LIBRARY(_tbb_library_tbb_debug + NAMES tbb_debug + PATH_SUFFIXES ${_PATH_SUFFIXES}) +FIND_LIBRARY(_tbb_library_tbbmalloc + NAMES tbbmalloc + PATH_SUFFIXES ${_PATH_SUFFIXES}) + +SET(_tbb_libraries ${_tbb_library_tbb} ${_tbb_library_tbbmalloc} ${_tbb_library_tbb_debug}) + +IF(_tbb_libraries) + + SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${TBB_INCLUDE_DIRS}") + SET(CMAKE_REQUIRED_LIBRARIES "${_tbb_libraries}") + + UNSET(_tbb_link_ok CACHE) + CHECK_CXX_SOURCE_COMPILES(" + #include + using namespace tbb; + size_t testme(size_t n) + { + return n*n; + } + int main(int argc, char* argv[]) + { + parallel_for( 1, 10, 1, testme ); + } + " + _tbb_link_ok + ) + + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + + IF(_tbb_link_ok) + SET(TBB_LIBRARY_tbb ${_tbb_library_tbb} CACHE FILEPATH "Path to a library") + SET(TBB_LIBRARY_tbbmalloc ${_tbb_library_tbbmalloc} CACHE FILEPATH "Path to a library") + SET(TBB_LIBRARIES ${TBB_LIBRARY_tbb} ${TBB_LIBRARY_tbbmalloc}) + ENDIF() + +ENDIF(_tbb_libraries) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARY_tbb TBB_LIBRARY_tbbmalloc) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0804d5a4e..bc881adc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ INCLUDE(FindEclipse) INCLUDE(Common) INCLUDE(FindTInspector) INCLUDE(FindSalomeQt5) +INCLUDE(FindDXF) +INCLUDE(FindTBB) IF(HAVE_SALOME) INCLUDE(SalomeSetupPlatform) # From CONFIGURATION @@ -190,6 +192,9 @@ ADD_SUBDIRECTORY (src/SketchPlugin) ADD_SUBDIRECTORY (src/SketchSolver) ADD_SUBDIRECTORY (src/ModuleBase) ADD_SUBDIRECTORY (src/PartSet) +IF(${HAVE_DXF}) + ADD_SUBDIRECTORY (src/DXFPlugin) +ENDIF(${HAVE_DXF}) ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/ExchangePlugin) @@ -213,6 +218,10 @@ ADD_SUBDIRECTORY (src/SketchAPI) ADD_SUBDIRECTORY (src/GDMLAPI) ADD_SUBDIRECTORY (src/ConnectorAPI) ADD_SUBDIRECTORY (src/FiltersAPI) +IF(${HAVE_DXF}) + ADD_SUBDIRECTORY (src/DXFAPI) +ENDIF(${HAVE_DXF}) + # Tests ADD_SUBDIRECTORY (test.API/SHAPER) diff --git a/src/CTestTestfileInstall.cmake b/src/CTestTestfileInstall.cmake index c559f1a55..746b8af7c 100644 --- a/src/CTestTestfileInstall.cmake +++ b/src/CTestTestfileInstall.cmake @@ -44,6 +44,7 @@ SUBDIRS(ConnectorAPI Config ExchangeAPI ModelGeomAlgo + DXFPlugin Locale test_API ) diff --git a/src/Config/plugins.xml.in b/src/Config/plugins.xml.in index 7c23b377e..ff72aaea5 100644 --- a/src/Config/plugins.xml.in +++ b/src/Config/plugins.xml.in @@ -15,6 +15,7 @@ + @DEFAULT_SOLVER@