Fix CGNS support on Windows

This commit is contained in:
Matthias Hochsteger 2020-03-11 14:53:08 +00:00
parent db5ad09b79
commit 603141cf1a
7 changed files with 29 additions and 7 deletions

View File

@ -55,6 +55,7 @@ build_win:
cmake %SRC_DIR%
-G Ninja
-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%
-DUSE_CGNS=ON
-DUSE_OCC=ON
-DOCC_LIBRARY=C:/install_opencascade_7.4.0_static/win64/vc14/lib/TKernel.lib
-DOCC_INCLUDE_DIR=C:/install_opencascade_7.4.0_static/inc

View File

@ -391,7 +391,7 @@ endif(ENABLE_CPP_CORE_GUIDELINES_CHECK)
add_library(netgen_cgns INTERFACE)
if(USE_CGNS)
find_library( CGNS_LIBRARY cgns )
find_library( CGNS_LIBRARY NAMES cgns cgnsdll )
find_path( CGNS_INCLUDE_DIR cgnslib.h )
target_compile_definitions(netgen_cgns INTERFACE NG_CGNS)
target_include_directories(netgen_cgns INTERFACE ${CGNS_INCLUDE_DIR})

View File

@ -51,6 +51,7 @@ set(NETGEN_USE_MPI @USE_MPI@)
set(NETGEN_USE_OCC @USE_OCC@)
set(NETGEN_USE_JPEG @USE_JPEG@)
set(NETGEN_USE_MPEG @USE_MPEG@)
set(NETGEN_USE_CGNS @USE_CGNS@)
set(NETGEN_INTEL_MIC @INTEL_MIC@)
set(NETGEN_INSTALL_PROFILES @INSTALL_PROFILES@)
set(NETGEN_USE_CCACHE @USE_CCACHE@)

View File

@ -20,6 +20,7 @@ if(WIN32)
set (OCC_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/occ_win64.zip" CACHE STRING INTERNAL)
set (TCLTK_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/tcltk_win64.zip" CACHE STRING INTERNAL)
set (ZLIB_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/zlib_win64.zip" CACHE STRING INTERNAL)
set (CGNS_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/cgns_win64.zip" CACHE STRING INTERNAL)
endif(WIN32)
if(UNIX)
@ -86,6 +87,10 @@ if(USE_GUI)
include(cmake/external_projects/tcltk.cmake)
endif(USE_GUI)
if(USE_CGNS)
include(cmake/external_projects/cgns.cmake)
endif(USE_CGNS)
#######################################################################
if(USE_MPI)
if(UNIX)

View File

@ -0,0 +1,15 @@
if(WIN32)
ExternalProject_Add(project_win_cgns
URL ${CGNS_DOWNLOAD_URL_WIN}
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX}
LOG_DOWNLOAD 1
)
list(APPEND NETGEN_DEPENDENCIES project_win_cgns)
endif(WIN32)

View File

@ -30,7 +30,7 @@ namespace netgen::cg
case PENTA_15:
return 3;
default:
throw Exception("Read CGNS: unknown element type " + string(ElementTypeName[type]));
throw Exception("Read CGNS: unknown element type " + string(cg_ElementTypeName(type)));
}
}
@ -68,7 +68,7 @@ namespace netgen::cg
map = map_quad8;
break;
default:
throw Exception("Read CGNS: unknown element type " + string(ElementTypeName[type]));
throw Exception("Read CGNS: unknown element type " + string(cg_ElementTypeName(type)));
}
int np;
@ -106,7 +106,7 @@ namespace netgen::cg
case HEXA_20:
case PENTA_15:
default:
throw Exception("Read CGNS: unknown element type " + string(ElementTypeName[type]));
throw Exception("Read CGNS: unknown element type " + string(cg_ElementTypeName(type)));
}
Element el(np);
@ -130,7 +130,7 @@ namespace netgen::cg
case EdgeCenter:
return 1;
default:
throw Exception("Read CGNS: unknown grid location " + string(GridLocationName[location]));
throw Exception("Read CGNS: unknown grid location " + string(cg_GridLocationName(location)));
}
}
@ -222,7 +222,7 @@ namespace netgen::cg
case KFaceCenter:
case EdgeCenter:
default:
throw Exception("Read CGNS: unknown grid location " + string(GridLocationName[sol.location]));
throw Exception("Read CGNS: unknown grid location " + string(cg_GridLocationName(sol.location)));
}
}

View File

@ -31,7 +31,7 @@ endif(NOT WIN32)
# target_link_libraries(nglib PRIVATE gen la gprim PUBLIC ngcore)
target_link_libraries(nglib PUBLIC ngcore)
target_link_libraries( nglib PRIVATE ${OCC_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${OCC_LIBRARIES} )
target_link_libraries( nglib PRIVATE ${OCC_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${OCC_LIBRARIES} netgen_cgns )
if(USE_OCC AND NOT WIN32)
target_link_libraries(nglib PUBLIC occ)