From 57df145536ccadad1234e9553781143643592244 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 24 Oct 2013 13:46:04 +0000 Subject: [PATCH] Win32 compilation. --- CMakeLists.txt | 1 + adm_local/cmake_files/FindNetgen.cmake | 36 +++++++++++++++++++++- doc/salome/gui/NETGENPLUGIN/CMakeLists.txt | 6 ++-- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 7 +++++ 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ae9557..de6b16e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,6 +145,7 @@ ENDIF(EXISTS ${SMESH_ROOT_DIR}) ## FIND_PACKAGE(SalomeNetgen REQUIRED) +ADD_DEFINITIONS(${NETGEN_DEFINITIONS}) # Detection summary: SALOME_PACKAGE_REPORT_AND_CHECK() diff --git a/adm_local/cmake_files/FindNetgen.cmake b/adm_local/cmake_files/FindNetgen.cmake index 7fe64e9..f4ea2ec 100644 --- a/adm_local/cmake_files/FindNetgen.cmake +++ b/adm_local/cmake_files/FindNetgen.cmake @@ -47,7 +47,34 @@ FIND_PATH(_netgen_add_inc_dir occgeom.hpp HINTS ${_netgen_base_inc_dir} PATH_SUF LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir}) LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS) -FIND_LIBRARY(NETGEN_LIBRARIES NAMES nglib) +FIND_LIBRARY(NETGEN_nglib NAMES nglib) +IF(WIN32) + FIND_LIBRARY(NETGEN_csg NAMES csg) + FIND_LIBRARY(NETGEN_gen NAMES gen) + FIND_LIBRARY(NETGEN_geom2d NAMES geom2d) + FIND_LIBRARY(NETGEN_gprim NAMES gprim) + FIND_LIBRARY(NETGEN_interface NAMES interface) + FIND_LIBRARY(NETGEN_la NAMES la) + FIND_LIBRARY(NETGEN_mesh NAMES mesh) + FIND_LIBRARY(NETGEN_occ NAMES occ) + FIND_LIBRARY(NETGEN_stl NAMES stl) +ENDIF(WIN32) + +SET(NETGEN_LIBRARIES ${NETGEN_nglib}) + +IF(WIN32) + SET(NETGEN_LIBRARIES ${NETGEN_LIBRARIES} + ${NETGEN_csg} + ${NETGEN_gen} + ${NETGEN_geom2d} + ${NETGEN_gprim} + ${NETGEN_interface} + ${NETGEN_la} + ${NETGEN_mesh} + ${NETGEN_occ} + ${NETGEN_stl} + ) +ENDIF(WIN32) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETGEN REQUIRED_VARS NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES) @@ -56,4 +83,11 @@ IF(NETGEN_FOUND) IF(NOT Netgen_FIND_QUIETLY) MESSAGE(STATUS "Netgen library: ${NETGEN_LIBRARIES}") ENDIF() + SET(NETGEN_DEFINITIONS "-DOCCGEOMETRY") + + #RNV: currently on windows use netgen without thread support. + #TODO: check support of the multithreading on windows + IF(WIN32) + SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNO_PARALLEL_THREADS") + ENDIF(WIN32) ENDIF() diff --git a/doc/salome/gui/NETGENPLUGIN/CMakeLists.txt b/doc/salome/gui/NETGENPLUGIN/CMakeLists.txt index fe0e0e0..6fa8eab 100755 --- a/doc/salome/gui/NETGENPLUGIN/CMakeLists.txt +++ b/doc/salome/gui/NETGENPLUGIN/CMakeLists.txt @@ -27,7 +27,7 @@ SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/stati SET(DOC_SMESH_MeshersList NETGENPlugin) SET(f1 "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py") SET(f "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") -IF(WINDOWS) +IF(WIN32) STRING(REPLACE "/" "\\" f ${f}) STRING(REPLACE "/" "\\" f1 ${f1}) STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PYTHONPATH% @@ -46,7 +46,7 @@ IF(WINDOWS) ") SET(EXT "bat") SET(CALL_STR "call") -ELSE(WINDOWS) +ELSE(WIN32) SET(DOC_PYTHONPATH ${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${SMESH_ROOT_DIR}/bin/salome:${SMESH_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages) SET(DOC_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/lib/salome:${SMESH_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome") SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:\${PYTHONPATH} @@ -55,7 +55,7 @@ ELSE(WINDOWS) ") SET(EXT "sh") SET(CALL_STR ".") -ENDIF(WINDOWS) +ENDIF(WIN32) FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}") diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 8c95376..a0a380e 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -88,6 +88,9 @@ namespace netgen { #include #include +#ifdef WIN32 +#include +#endif using namespace nglib; using namespace std; @@ -3652,7 +3655,11 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName() TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str(); aGenericName += "NETGEN_"; +#ifndef WIN32 aGenericName += getpid(); +#else + aGenericName += _getpid(); +#endif aGenericName += "_"; aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString()); aGenericName += ".out"; -- 2.39.2