Merge branch 'merge_request_cmake_cleanup' into 'master'

Cleanup CMake build system

See merge request !48
This commit is contained in:
Joachim Schöberl 2017-05-30 07:48:38 +02:00
commit fa2a9320b0
36 changed files with 253 additions and 162 deletions

View File

@ -16,19 +16,51 @@ option( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF )
option( INTEL_MIC "cross compile for intel xeon phi")
option( INSTALL_PROFILES "install environment variable settings to /etc/profile.d" OFF )
option( USE_CCACHE "use ccache")
option( USE_INTERNAL_TCL "Compile tcl files into the code and don't install them" ON)
option( USE_SUPERBUILD "use ccache" ON)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules")
if(APPLE)
set(INSTALL_DIR_DEFAULT /Applications/Netgen.app)
else(APPLE)
if(WIN32)
set(INSTALL_DIR_DEFAULT "C:/netgen")
else(WIN32)
set(INSTALL_DIR_DEFAULT /opt/netgen)
endif(WIN32)
endif(APPLE)
if(INSTALL_DIR)
message(WARNING "INSTALL_DIR is deprecated, use CMAKE_INSTALL_PREFIX instead")
set(INSTALL_DIR_DEFAULT ${INSTALL_DIR})
endif(INSTALL_DIR)
if(UNIX)
message("Checking for write permissions in install directory...")
execute_process(COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX})
execute_process(COMMAND test -w ${CMAKE_INSTALL_PREFIX} RESULT_VARIABLE res)
if(res)
message(WARNING "No write access at install directory, please set correct permissions")
endif()
endif(UNIX)
if (USE_SUPERBUILD)
project (SUPERBUILD)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR_DEFAULT}" CACHE PATH "Install directory" FORCE)
endif()
# execute the superbuild (this script will be invoked again without the
# USE_SUPERBUILD option this time)
include (cmake/SuperBuild.cmake)
return() # stop processing this file further
else()
project(Netgen)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR_DEFAULT}" CACHE PATH "Install directory" FORCE)
endif()
endif()
set(NETGEN_VERSION_MAJOR 6)
@ -68,43 +100,68 @@ if (ADDITIONAL_PATHS)
set(CMAKE_PREFIX_PATH ${ADDITIONAL_PATHS})
endif (ADDITIONAL_PATHS)
if(APPLE)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/Contents/Resources" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
else(APPLE)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
endif(APPLE)
#######################################################################
# use rpath
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
#######################################################################
# build options
add_definitions(-DUSE_TIMEOFDAY)
include_directories ("${PROJECT_SOURCE_DIR}/include")
include_directories ("${PROJECT_SOURCE_DIR}/libsrc/include")
include_directories ("${PROJECT_BINARY_DIR}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(INCDIR include CACHE PATH "install directory for header files")
if(APPLE)
set(ng_install_dir_bin ../MacOS)
set(ng_install_dir_lib ../MacOS)
set(NG_INSTALL_DIR_BIN_DEFAULT Contents/MacOS)
set(NG_INSTALL_DIR_LIB_DEFAULT Contents/MacOS)
set(NG_INSTALL_DIR_CMAKE_DEFAULT Contents/Resources/share/cmake)
set(NG_INSTALL_DIR_PYTHON_DEFAULT Contents/Resources/${PYTHON_PACKAGES_INSTALL_DIR})
set(NG_INSTALL_DIR_RES_DEFAULT Contents/Resources/share)
set(NG_INSTALL_DIR_INCLUDE_DEFAULT Contents/Resources/include)
set(NG_RPATH_TOKEN "@loader_path")
else(APPLE)
set(ng_install_dir_bin bin)
set(ng_install_dir_lib lib)
set(NG_INSTALL_DIR_BIN_DEFAULT bin)
set(NG_INSTALL_DIR_LIB_DEFAULT lib)
set(NG_INSTALL_DIR_CMAKE_DEFAULT lib/cmake)
set(NG_INSTALL_DIR_PYTHON_DEFAULT ${PYTHON_PACKAGES_INSTALL_DIR})
set(NG_INSTALL_DIR_RES_DEFAULT share)
set(NG_INSTALL_DIR_INCLUDE_DEFAULT include)
set(NG_RPATH_TOKEN "\$ORIGIN")
endif(APPLE)
set(ng_install_dir EXPORT netgen-targets RUNTIME DESTINATION ${ng_install_dir_bin} COMPONENT netgen LIBRARY DESTINATION ${ng_install_dir_lib} COMPONENT netgen_devel ARCHIVE DESTINATION ${ng_install_dir_lib} COMPONENT netgen_devel)
install(EXPORT netgen-targets DESTINATION share/cmake)
set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)")
set(NG_INSTALL_DIR_PYTHON ${NG_INSTALL_DIR_PYTHON_DEFAULT} CACHE STRING "Install directory for Python files")
set(NG_INSTALL_DIR_BIN ${NG_INSTALL_DIR_BIN_DEFAULT} CACHE STRING "Install directory for executables")
set(NG_INSTALL_DIR_LIB ${NG_INSTALL_DIR_LIB_DEFAULT} CACHE STRING "Install directory for libraries")
set(NG_INSTALL_DIR_INCLUDE ${NG_INSTALL_DIR_INCLUDE_DEFAULT} CACHE STRING "Install directory for header files")
set(NG_INSTALL_DIR_CMAKE ${NG_INSTALL_DIR_CMAKE_DEFAULT} CACHE STRING "Install directory for CMake files")
set(NG_INSTALL_DIR_RES ${NG_INSTALL_DIR_RES_DEFAULT} CACHE STRING "Install directory for resources")
get_filename_component(NETGEN_CMAKE_DIR_ABSOLUTE ${NG_INSTALL_DIR_CMAKE} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(NETGEN_BINARY_DIR_ABSOLUTE ${NG_INSTALL_DIR_BIN} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(NETGEN_LIBRARY_DIR_ABSOLUTE ${NG_INSTALL_DIR_LIB} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(NETGEN_INCLUDE_DIR_ABSOLUTE ${NG_INSTALL_DIR_INCLUDE} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(NETGEN_PYTHON_DIR_ABSOLUTE ${NG_INSTALL_DIR_PYTHON} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(NETGEN_RESOURCE_DIR_ABSOLUTE ${NG_INSTALL_DIR_RES} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
file(RELATIVE_PATH NETGEN_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${CMAKE_INSTALL_PREFIX})
file(RELATIVE_PATH NETGEN_BINARY_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${NETGEN_BINARY_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_LIBRARY_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${NETGEN_LIBRARY_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_INCLUDE_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${NETGEN_INCLUDE_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_PYTHON_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${NETGEN_PYTHON_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_RESOURCE_DIR ${NETGEN_CMAKE_DIR_ABSOLUTE} ${NETGEN_RESOURCE_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_RPATH ${NETGEN_BINARY_DIR_ABSOLUTE} ${NETGEN_LIBRARY_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_PYTHON_RPATH_BIN ${NETGEN_PYTHON_DIR_ABSOLUTE} ${NETGEN_BINARY_DIR_ABSOLUTE})
file(RELATIVE_PATH NETGEN_PYTHON_RPATH ${NETGEN_PYTHON_DIR_ABSOLUTE} ${NETGEN_LIBRARY_DIR_ABSOLUTE})
if(WIN32)
set(NETGEN_PYTHON_RPATH ${NETGEN_PYTHON_RPATH_BIN})
endif(WIN32)
set(NG_INSTALL_DIR EXPORT netgen-targets RUNTIME DESTINATION ${NG_INSTALL_DIR_BIN} COMPONENT netgen LIBRARY DESTINATION ${NG_INSTALL_DIR_LIB} COMPONENT netgen_devel ARCHIVE DESTINATION ${NG_INSTALL_DIR_LIB} COMPONENT netgen_devel)
install(EXPORT netgen-targets DESTINATION ${NG_INSTALL_DIR_CMAKE} )
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "${NG_RPATH_TOKEN};${NG_RPATH_TOKEN}/${NETGEN_RPATH}")
include (CheckIncludeFiles)
check_include_files (dlfcn.h HAVE_DLFCN_H)
@ -185,8 +242,8 @@ if (USE_PYTHON)
include_directories(${PYBIND_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIRS})
install(DIRECTORY ${PYBIND_INCLUDE_DIR}/pybind11 DESTINATION ${INCDIR} COMPONENT netgen_devel)
install(FILES ${PYBIND_INCLUDE_DIR}/../LICENSE DESTINATION ${INCDIR}/pybind11 COMPONENT netgen_devel)
install(DIRECTORY ${PYBIND_INCLUDE_DIR}/pybind11 DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
install(FILES ${PYBIND_INCLUDE_DIR}/../LICENSE DESTINATION ${NG_INSTALL_DIR_INCLUDE}/pybind11 COMPONENT netgen_devel)
endif (USE_PYTHON)
#######################################################################
@ -222,10 +279,10 @@ endif (USE_MPEG)
#######################################################################
if(INSTALL_PROFILES)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "#!/bin/sh\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export PATH=${INSTALL_DIR}/bin:$PATH\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export NETGENDIR=${INSTALL_DIR}/bin\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export PYTHONPATH=${INSTALL_DIR}/${PYTHON_PACKAGES_INSTALL_DIR}:.\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:.\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export PATH=${CMAKE_INSTALL_PREFIX}/bin:$PATH\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export NETGENDIR=${CMAKE_INSTALL_PREFIX}/bin\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${PYTHON_PACKAGES_INSTALL_DIR}:.\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:.\n")
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh DESTINATION /etc/profile.d COMPONENT netgen)
string(ASCII 27 Esc)
@ -237,19 +294,19 @@ endif(INSTALL_PROFILES)
#######################################################################
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fixup.cmake "\
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/netgen_fixup.cmake)
set(APP ${INSTALL_DIR})
set(APP ${CMAKE_INSTALL_PREFIX})
message(\${APP})
set(BU_CHMOD_BUNDLE_ITEMS ON)
file(GLOB libs ${CMAKE_INSTALL_PREFIX}/${ng_install_dir_lib}/*.dylib ${CMAKE_INSTALL_PREFIX}/${ng_install_dir_lib}/*.so)
file(GLOB libs ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_LIB}/*.dylib ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_LIB}/*.so)
message(\"\${libs}\")
netgen_fixup_bundle( \${APP}/Contents/MacOS/netgen \"\${libs}\" ${CMAKE_INSTALL_PREFIX}/${ng_install_dir_lib} )
execute_process(COMMAND ln -s /Applications ${INSTALL_DIR}/../Applications)
netgen_fixup_bundle( \${APP}/Contents/MacOS/netgen \"\${libs}\" ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_LIB} )
execute_process(COMMAND ln -s /Applications ${CMAKE_INSTALL_PREFIX}/../Applications)
set (bundle_filename \$ENV{NETGEN_BUNDLE_NAME})
if(NOT bundle_filename)
set(bundle_filename netgen)
endif(NOT bundle_filename)
execute_process(COMMAND hdiutil create -volname Netgen -srcfolder ${INSTALL_DIR} -ov -format UDZO \${bundle_filename}-${PACKAGE_VERSION}.dmg)
execute_process(COMMAND hdiutil create -volname Netgen -srcfolder ${CMAKE_INSTALL_PREFIX} -ov -format UDZO \${bundle_filename}-${PACKAGE_VERSION}.dmg)
")
add_custom_target(bundle COMMAND ${CMAKE_COMMAND} "-P" "${CMAKE_CURRENT_BINARY_DIR}/fixup.cmake")
#######################################################################
@ -323,7 +380,7 @@ export PYTHONPATH=$Netgen_BUNDLE/Contents/Resources/${PYTHON_PACKAGES_INSTALL_DI
cd $Netgen_MACOS
$Netgen_MACOS/netgen
")
install(PROGRAMS ${mac_startup} DESTINATION ${ng_install_dir_bin})
install(PROGRAMS ${mac_startup} DESTINATION ${NG_INSTALL_DIR_BIN})
set(mac_ngsuite ${CMAKE_CURRENT_BINARY_DIR}/ngsuite.sh)
file(WRITE ${mac_ngsuite} "\
@ -332,7 +389,7 @@ Netgen_BUNDLE=\"`echo \"$0\" | sed -e 's/\\/Contents\\/MacOS\\/Netgen1//'`\"
Netgen_MACOS=\"$Netgen_BUNDLE/Contents/MacOS\"
open -a /Applications/Utilities/Terminal.app $Netgen_MACOS/startup.sh
")
install(PROGRAMS ${mac_ngsuite} DESTINATION ../MacOS RENAME Netgen1)
install(PROGRAMS ${mac_ngsuite} DESTINATION ${NG_INSTALL_DIR_BIN} RENAME Netgen1)
set(mac_plist ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
file(WRITE ${mac_plist} "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
@ -350,8 +407,8 @@ open -a /Applications/Utilities/Terminal.app $Netgen_MACOS/startup.sh
</dict>
</plist>
")
install(FILES ${mac_plist} DESTINATION ../)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/netgen.icns DESTINATION . RENAME Netgen.icns)
install(FILES ${mac_plist} DESTINATION ${NG_INSTALL_DIR_BIN}/../)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/netgen.icns DESTINATION ${NG_INSTALL_DIR_RES}/../ RENAME Netgen.icns)
endif(APPLE)
@ -368,10 +425,14 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
#######################################################################
# Generate package config file
get_directory_property(NETGEN_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/NetgenConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION share/cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION ${NG_INSTALL_DIR_CMAKE})
#######################################################################
# Configure message

View File

@ -1,9 +1,20 @@
set(PACKAGE_VERSION "@NETGEN_VERSION@")
set(NETGEN_DIR "@CMAKE_INSTALL_PREFIX@")
set(NETGEN_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@INCDIR@")
get_filename_component(NETGEN_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(NETGEN_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_DIR@")
set(NETGEN_COMPILE_DEFINITIONS "@NETGEN_COMPILE_DEFINITIONS@")
set(NETGEN_INCLUDE_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_INCLUDE_DIR@")
set(NETGEN_BINARY_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_BINARY_DIR@")
set(NETGEN_LIBRARY_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_LIBRARY_DIR@")
set(NETGEN_PYTHON_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_PYTHON_DIR@")
set(NETGEN_RESOURCE_DIR "${NETGEN_CMAKE_DIR}/@NETGEN_RESOURCE_DIR@")
set(NETGEN_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(NETGEN_INCLUDE_DIRS "${NETGEN_CMAKE_DIR}/@NETGEN_INCLUDE_DIR@/include;${NETGEN_CMAKE_DIR}/@NETGEN_INCLUDE_DIR@")
set(NETGEN_CMAKE_THREAD_LIBS_INIT "@CMAKE_THREAD_LIBS_INIT@")
set(NETGEN_FFMPEG_LIBRARIES "@FFMPEG_LIBRARIES@")
set(NETGEN_JPEG_INCLUDE_DIR "@JPEG_INCLUDE_DIR@")
@ -14,17 +25,14 @@ set(NETGEN_METIS_LIBRARY "@METIS_LIBRARY@")
set(NETGEN_MKL_LIBRARIES "@MKL_LIBRARIES@")
set(NETGEN_MPI_CXX_INCLUDE_PATH "@MPI_CXX_INCLUDE_PATH@")
set(NETGEN_MPI_CXX_LIBRARIES "@MPI_CXX_LIBRARIES@")
set(NETGEN_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/@INCDIR@;@CMAKE_INSTALL_PREFIX@/@INCDIR@/include")
set(NETGEN_OCC_INCLUDE_DIR "@OCC_INCLUDE_DIR@")
set(NETGEN_OCC_LIBRARIES_BIN "@OCC_LIBRARIES_BIN@")
set(NETGEN_OCC_LIBRARIES "@OCC_LIBRARIES@")
set(NETGEN_OCC_LIBRARY_DIR "@OCC_LIBRARY_DIR@")
set(NETGEN_OPENGL_LIBRARIES "@OPENGL_LIBRARIES@")
set(NETGEN_PYBIND_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
set(NETGEN_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@")
set(NETGEN_PYTHON_INCLUDE_DIRS "@PYTHON_INCLUDE_DIRS@")
set(NETGEN_PYTHON_LIBRARIES "@PYTHON_LIBRARIES@")
set(NETGEN_PYTHON_PACKAGES_INSTALL_DIR "@PYTHON_PACKAGES_INSTALL_DIR@")
set(NETGEN_TCL_INCLUDE_PATH "@TCL_INCLUDE_PATH@")
set(NETGEN_TCL_LIBRARY "@TCL_LIBRARY@")
set(NETGEN_TK_DND_LIBRARY "@TK_DND_LIBRARY@")
@ -45,5 +53,8 @@ set(NETGEN_INTEL_MIC @INTEL_MIC@)
set(NETGEN_INSTALL_PROFILES @INSTALL_PROFILES@)
set(NETGEN_USE_CCACHE @USE_CCACHE@)
set(NETGEN_PYTHON_RPATH "@NETGEN_PYTHON_RPATH@")
set(NETGEN_RPATH_TOKEN "@NG_RPATH_TOKEN@")
include(${CMAKE_CURRENT_LIST_DIR}/netgen-targets.cmake)
message(STATUS "Found Netgen: ${NETGEN_DIR}")
message(STATUS "Found Netgen: ${CMAKE_CURRENT_LIST_DIR}")

View File

@ -40,19 +40,10 @@ if(WIN32)
endif(${CMAKE_SIZEOF_VOID_P} MATCHES 4)
endif(WIN32)
#######################################################################
# find netgen
if(APPLE)
set(INSTALL_DIR /Applications/Netgen.app CACHE PATH "Install path")
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/Contents/Resources" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
else(APPLE)
set(INSTALL_DIR /opt/netgen CACHE PATH "Install path")
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
endif(APPLE)
if(UNIX)
message("Checking for write permissions in install directory...")
execute_process(COMMAND mkdir -p ${INSTALL_DIR})
execute_process(COMMAND test -w ${INSTALL_DIR} RESULT_VARIABLE res)
execute_process(COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX})
execute_process(COMMAND test -w ${CMAKE_INSTALL_PREFIX} RESULT_VARIABLE res)
if(res)
message(WARNING "No write access at install directory, please set correct permissions")
endif()
@ -94,7 +85,7 @@ if(USE_OCC AND WIN32 AND NOT OCC_INCLUDE_DIR)
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${INSTALL_DIR}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX}
LOG_DOWNLOAD 1
)
list(APPEND NETGEN_DEPENDENCIES win_download_occ)
@ -140,10 +131,11 @@ set_vars( NETGEN_CMAKE_ARGS
USE_NATIVE_ARCH
USE_OCC
USE_MPEG
INSTALL_DIR
USE_INTERNAL_TCL
INSTALL_PROFILES
INTEL_MIC
CMAKE_PREFIX_PATH
CMAKE_INSTALL_PREFIX
)
# propagate all variables set on the command line using cmake -DFOO=BAR
@ -166,7 +158,7 @@ endif()
ExternalProject_Add (netgen
DEPENDS ${NETGEN_DEPENDENCIES}
SOURCE_DIR ${PROJECT_SOURCE_DIR}
CMAKE_ARGS -DUSE_SUPERBUILD=OFF ${NETGEN_CMAKE_ARGS} -DCMAKE_PREFIX_PATH=${INSTALL_DIR}
CMAKE_ARGS -DUSE_SUPERBUILD=OFF ${NETGEN_CMAKE_ARGS}
INSTALL_COMMAND ""
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/netgen
BUILD_COMMAND ${NETGEN_BUILD_COMMAND}
@ -176,21 +168,21 @@ ExternalProject_Add (netgen
# Check if the git submodules (i.e. pybind11) are up to date
# in case, something is wrong, emit a warning but continue
ExternalProject_Add_Step(netgen check_submodules
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
DEPENDERS install # Steps on which this step depends
)
# Due to 'ALWAYS 1', this step is always run which also forces a build of
# the Netgen subproject
ExternalProject_Add_Step(netgen check_submodules1
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
DEPENDEES configure # Steps on which this step depends
DEPENDERS build # Steps that depend on this step
ALWAYS 1 # No stamp file, step always runs
)
install(CODE "execute_process(COMMAND cmake --build . --target install --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/netgen)")
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/netgen)")
add_custom_target(test_netgen
${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/netgen

View File

@ -61,7 +61,7 @@ elseif(WIN32)
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${INSTALL_DIR}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX}
LOG_DOWNLOAD 1
)

View File

@ -1 +1 @@
INSTALL(FILES ng4.pdf DESTINATION doc COMPONENT netgen_doc)
INSTALL(FILES ng4.pdf DESTINATION ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX}/doc COMPONENT netgen_doc)

View File

@ -14,7 +14,7 @@ endif(APPLE)
if(NOT WIN32)
target_link_libraries(csg mesh ${PYTHON_LIBRARIES})
target_link_libraries(csg ${PYTHON_LIBRARIES})
install( TARGETS csg ${ng_install_dir})
install( TARGETS csg ${NG_INSTALL_DIR})
endif(NOT WIN32)
@ -25,7 +25,7 @@ if(USE_GUI)
if(APPLE)
set_target_properties( csgvis PROPERTIES SUFFIX ".so")
endif(APPLE)
install( TARGETS csgvis ${ng_install_dir})
install( TARGETS csgvis ${NG_INSTALL_DIR})
endif(NOT WIN32)
endif(USE_GUI)
@ -36,5 +36,5 @@ install(FILES
polyhedra.hpp revolution.hpp singularref.hpp solid.hpp
specpoin.hpp spline3d.hpp splinesurface.hpp surface.hpp
triapprox.hpp vscsg.hpp
DESTINATION ${INCDIR}/csg COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/csg COMPONENT netgen_devel
)

View File

@ -8,7 +8,7 @@ add_library(gen OBJECT
set_target_properties( gen PROPERTIES POSITION_INDEPENDENT_CODE ON )
install( FILES ngexception.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel )
install( FILES ngexception.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel )
install(FILES
archive_base.hpp array.hpp autodiff.hpp autoptr.hpp bitarray.hpp
@ -17,5 +17,5 @@ install(FILES
optmem.hpp parthreads.hpp profiler.hpp seti.hpp sort.hpp
spbita2d.hpp stack.hpp symbolta.hpp table.hpp template.hpp
gzstream.h
DESTINATION ${INCDIR}/general COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/general COMPONENT netgen_devel
)

View File

@ -6,19 +6,19 @@ endif(APPLE)
if(NOT WIN32)
target_link_libraries(geom2d mesh ${PYTHON_LIBRARIES})
install( TARGETS geom2d ${ng_install_dir})
install( TARGETS geom2d ${NG_INSTALL_DIR})
endif(NOT WIN32)
if(USE_GUI)
add_library(geom2dvis ${NG_LIB_TYPE} vsgeom2d.cpp)
if(NOT WIN32)
target_link_libraries(geom2dvis geom2d)
install( TARGETS geom2dvis ${ng_install_dir})
install( TARGETS geom2dvis ${NG_INSTALL_DIR})
endif(NOT WIN32)
endif(USE_GUI)
install(FILES
geom2dmesh.hpp geometry2d.hpp spline2d.hpp
splinegeometry2.hpp vsgeom2d.hpp
DESTINATION ${INCDIR}/geom2d COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/geom2d COMPONENT netgen_devel
)

View File

@ -10,5 +10,5 @@ install(FILES
adtree.hpp geom2d.hpp geom3d.hpp geomfuncs.hpp geomobjects2.hpp
geomobjects.hpp geomops2.hpp geomops.hpp geomtest3d.hpp gprim.hpp
splinegeometry.hpp spline.hpp transform3d.hpp
DESTINATION ${INCDIR}/gprim COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/gprim COMPONENT netgen_devel
)

View File

@ -1,10 +1,10 @@
install(FILES nginterface.h nginterface_v2.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel)
install(FILES nginterface.h nginterface_v2.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
install(FILES
acisgeom.hpp csg.hpp geometry2d.hpp gprim.hpp incopengl.hpp
inctcl.hpp incvis.hpp linalg.hpp meshing.hpp myadt.hpp mydefs.hpp
mystdlib.h nginterface_v2_impl.hpp occgeom.hpp ngsimd.hpp
opti.hpp parallel.hpp parallelinterface.hpp stlgeom.hpp visual.hpp
DESTINATION ${INCDIR}/include COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel
)

View File

@ -12,10 +12,10 @@ if(NOT WIN32)
if(USE_GUI)
target_link_libraries(interface visual)
endif(USE_GUI)
install( TARGETS interface ${ng_install_dir})
install( TARGETS interface ${NG_INSTALL_DIR})
endif(NOT WIN32)
install(FILES
writeuser.hpp
DESTINATION ${INCDIR}/interface COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/interface COMPONENT netgen_devel
)

View File

@ -7,5 +7,5 @@ set_target_properties(la PROPERTIES POSITION_INDEPENDENT_CODE ON )
install(FILES
densemat.hpp linalg.hpp opti.hpp
polynomial.hpp vector.hpp
DESTINATION ${INCDIR}/linalg COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/linalg COMPONENT netgen_devel
)

View File

@ -21,6 +21,7 @@ add_library(mesh ${NG_LIB_TYPE}
topology.cpp triarls.cpp validate.cpp bcfunctions.cpp
parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp
python_mesh.cpp hexarls.cpp
../../ng/onetcl.cpp
${mesh_object_libs}
)
@ -30,7 +31,7 @@ endif(APPLE)
if(NOT WIN32)
target_link_libraries( mesh ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY})
install( TARGETS mesh ${ng_install_dir})
install( TARGETS mesh ${NG_INSTALL_DIR})
endif(NOT WIN32)
install(FILES
@ -42,5 +43,5 @@ install(FILES
localh.hpp meshclass.hpp meshfunc.hpp meshing2.hpp meshing3.hpp
meshing.hpp meshtool.hpp meshtype.hpp msghandler.hpp paralleltop.hpp
ruler2.hpp ruler3.hpp specials.hpp topology.hpp validate.hpp
DESTINATION ${INCDIR}/meshing COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/meshing COMPONENT netgen_devel
)

View File

@ -11,6 +11,8 @@
using namespace netgen;
extern const char *ngscript[];
namespace netgen
{
extern bool netgen_executable_started;
@ -51,6 +53,12 @@ static Transformation<3> global_trafo(Vec<3> (0,0,0));
DLL_HEADER void ExportNetgenMeshing(py::module &m)
{
m.attr("_netgen_executable_started") = py::cast(netgen::netgen_executable_started);
string script;
const char ** hcp = ngscript;
while (*hcp)
script += *hcp++;
m.attr("_ngscript") = py::cast(script);
py::class_<NGDummyArgument>(m, "NGDummyArgument")
.def("__bool__", []( NGDummyArgument &self ) { return false; } )

View File

@ -10,10 +10,10 @@ add_library(occvis ${NG_LIB_TYPE} vsocc.cpp)
if(NOT WIN32)
target_link_libraries( occ ${OCC_LIBRARIES} ${PYTHON_LIBRARIES})
target_link_libraries( occvis occ )
install( TARGETS occ occvis ${ng_install_dir})
install( TARGETS occ occvis ${NG_INSTALL_DIR})
endif(NOT WIN32)
install(FILES
occgeom.hpp occmeshsurf.hpp vsocc.hpp
DESTINATION ${INCDIR}/occ COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/occ COMPONENT netgen_devel
)

View File

@ -6,7 +6,7 @@ add_library(stl ${NG_LIB_TYPE}
if(NOT WIN32)
target_link_libraries( stl mesh ${PYTHON_LIBRARIES})
target_link_libraries( stl ${PYTHON_LIBRARIES})
install( TARGETS stl ${ng_install_dir})
install( TARGETS stl ${NG_INSTALL_DIR})
endif(NOT WIN32)
if(USE_GUI)
@ -15,12 +15,12 @@ if(USE_GUI)
)
if(NOT WIN32)
target_link_libraries( stlvis stl )
install( TARGETS stlvis ${ng_install_dir})
install( TARGETS stlvis ${NG_INSTALL_DIR})
endif(NOT WIN32)
endif(USE_GUI)
install(FILES
meshstlsurface.hpp stlgeom.hpp stlline.hpp
stltool.hpp stltopology.hpp vsstl.hpp
DESTINATION ${INCDIR}/stlgeom COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/stlgeom COMPONENT netgen_devel
)

View File

@ -1,5 +1,5 @@
add_definitions(-DNGINTERFACE_EXPORTS)
install(FILES soldata.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel )
install(FILES soldata.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel )
if(USE_GUI)
set( LIB_VISUAL_SOURCES meshdoc.cpp mvdraw.cpp vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp )
@ -11,11 +11,11 @@ add_library(visual ${NG_LIB_TYPE} ${LIB_VISUAL_SOURCES})
if(NOT WIN32)
target_link_libraries( visual ${PYTHON_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} )
install( TARGETS visual ${ng_install_dir})
install( TARGETS visual ${NG_INSTALL_DIR})
endif(NOT WIN32)
install(FILES
meshdoc.hpp mvdraw.hpp
vispar.hpp visual.hpp vssolution.hpp
DESTINATION ${INCDIR}/visualization COMPONENT netgen_devel
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/visualization COMPONENT netgen_devel
)

View File

@ -1,23 +1,28 @@
set(gui_sources
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp
../libsrc/stlgeom/stlpkg.cpp ../libsrc/visualization/visualpkg.cpp
../libsrc/csg/csgpkg.cpp ../libsrc/geom2d/geom2dpkg.cpp
../libsrc/occ/occpkg.cpp ../libsrc/occ/vsocc.cpp
)
if(USE_INTERNAL_TCL)
add_definitions(-DINTERNAL_TCL_DEFAULT=1)
else()
add_definitions(-DINTERNAL_TCL_DEFAULT=0)
endif()
set(netgen_sources ngappinit.cpp onetcl.cpp )
set(netgen_sources ngappinit.cpp onetcl.cpp)
if(WIN32)
# add icon to netgen executable
enable_language(RC)
set(netgen_sources ${netgen_sources} ../windows/netgen.rc)
# Don't use ccache here due to incompatiblity with the resource compiler
set_directory_properties(PROPERTIES RULE_LAUNCH_COMPILE "")
endif(WIN32)
if(USE_GUI)
if(WIN32)
# add icon to netgen executable
enable_language(RC)
set(netgen_sources ${netgen_sources} ../windows/netgen.rc)
# Don't use ccache here due to incompatiblity with the resource compiler
set_directory_properties(PROPERTIES RULE_LAUNCH_COMPILE "")
endif(WIN32)
add_library(gui SHARED ${gui_sources})
add_executable(netgen ${netgen_sources})
add_library(gui SHARED
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp
../libsrc/stlgeom/stlpkg.cpp ../libsrc/visualization/visualpkg.cpp
../libsrc/csg/csgpkg.cpp ../libsrc/geom2d/geom2dpkg.cpp
../libsrc/occ/occpkg.cpp ../libsrc/occ/vsocc.cpp
)
add_executable(netgen ngappinit.cpp onetcl.cpp)
target_link_libraries( gui PUBLIC nglib ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_X11_LIB} ${OCC_LIBRARIES} )
target_link_libraries( gui PRIVATE ${LIBTOGL})
@ -38,8 +43,8 @@ if(USE_GUI)
target_link_libraries( gui PUBLIC mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis )
endif(NOT WIN32)
install(TARGETS netgen ${ng_install_dir})
install(TARGETS gui ${ng_install_dir})
install(TARGETS netgen ${NG_INSTALL_DIR})
install(TARGETS gui ${NG_INSTALL_DIR})
if(APPLE)
set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen)
@ -59,18 +64,20 @@ if(USE_PYTHON)
set_target_properties( ngpy PROPERTIES SUFFIX ".pyd")
set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy")
endif()
install(TARGETS ngpy ${ng_install_dir})
set_target_properties(ngpy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}")
install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX})
endif(USE_PYTHON)
if(USE_GUI)
install(FILES
dialog.tcl menustat.tcl ngicon.tcl ng.tcl
ngvisual.tcl sockets.tcl nghelp.tcl ngshell.tcl
ngtesting.tcl parameters.tcl variables.tcl csgeom.tcl stlgeom.tcl
occgeom.tcl acisgeom.tcl netgen.ocf
DESTINATION ${ng_install_dir_bin} COMPONENT netgen)
if(NOT USE_INTERNAL_TCL)
install(FILES
dialog.tcl menustat.tcl ngicon.tcl ng.tcl
ngvisual.tcl sockets.tcl nghelp.tcl ngshell.tcl
ngtesting.tcl parameters.tcl variables.tcl csgeom.tcl stlgeom.tcl
occgeom.tcl acisgeom.tcl netgen.ocf drawing.tcl
DESTINATION ${NG_INSTALL_DIR_BIN} COMPONENT netgen)
endif()
add_subdirectory(Togl2.1)
install(FILES drawing.tcl DESTINATION ${ng_install_dir_bin} COMPONENT netgen)
endif(USE_GUI)

View File

@ -7,7 +7,7 @@ endif(APPLE)
if(WIN32)
add_definitions("-DBUILD_togl -DUNICODE -D_UNICODE -DTOGL_USE_FONTS=0 -DSTDC_HEADERS -DSTDC_HEADER")
add_library(togl SHARED togl.c toglProcAddr.c toglStubInit.c)
install(TARGETS togl DESTINATION ${ng_install_dir} COMPONENT netgen)
install(TARGETS togl DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen)
target_link_libraries(togl ${TCL_LIBRARY} ${TK_LIBRARY})
else(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -Wno-implicit-int")

View File

@ -1,7 +1,9 @@
catch {lappend auto_path $env(NETGENDIR) }
catch {lappend auto_path $env(NETGENDIR)/../lib }
load libgui[info sharedlibextension] gui
if {[catch {Ng_GetCommandLineParameter batchmode} result ]} {
load libgui[info sharedlibextension] gui
}
set batchmode [Ng_GetCommandLineParameter batchmode]
if {$batchmode=="undefined"} {

View File

@ -191,7 +191,7 @@ int main(int argc, char ** argv)
// parse tcl-script
int errcode;
bool internaltcl = false;
bool internaltcl = INTERNAL_TCL_DEFAULT;
if (shellmode)
internaltcl = false;

View File

@ -1,7 +1,9 @@
const char * ngscript[] = {""
,"catch {lappend auto_path $env(NETGENDIR) }\n"
,"catch {lappend auto_path $env(NETGENDIR)/../lib }\n"
,"if {[catch {Ng_GetCommandLineParameter batchmode} result ]} {\n"
,"load libgui[info sharedlibextension] gui\n"
,"}\n"
,"set batchmode [Ng_GetCommandLineParameter batchmode]\n"
,"if {$batchmode==\"undefined\"} {\n"
,"if {[catch {package require tkdnd } result ]} {\n"
@ -5971,4 +5973,5 @@ const char * ngscript[] = {""
,"source startup.tcl }\n"
,"catch { source ${ngdir}/demoapp.tcl }\n"
,"catch { source ${ngdir}/dropsexp.tcl }\n"
, nullptr
};

View File

@ -40,5 +40,6 @@ for line in tclfiles["ng.tcl"].split('\n'):
s = ',"' + line.replace('\\', r'\\').replace('"', r'\"') + '\\n"\n'
onetclcpp.write(s)
onetclcpp.write('};'+'\n');
onetclcpp.write(', nullptr\n');
onetclcpp.write('};\n');
onetclcpp.close();

View File

@ -38,5 +38,5 @@ if(USE_PYTHON)
target_link_libraries(nglib ${PYTHON_LIBRARIES})
endif(USE_PYTHON)
install(TARGETS nglib ${ng_install_dir})
install(FILES nglib.h DESTINATION ${INCDIR}/include COMPONENT netgen_devel)
install(TARGETS nglib ${NG_INSTALL_DIR})
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel)

View File

@ -1,5 +1,5 @@
install( FILES
shaft.geo mesh.py exportNeutral.py
DESTINATION share/netgen/py_tutorials
DESTINATION ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX}/py_tutorials
COMPONENT netgen_tutorial
)

View File

@ -1,5 +1,8 @@
install(FILES __init__.py meshing.py csg.py geom2d.py stl.py gui.py
DESTINATION ${PYTHON_PACKAGES_INSTALL_DIR}/netgen
configure_file(__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/__init__.py
meshing.py csg.py geom2d.py stl.py gui.py
DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}
COMPONENT netgen
)

View File

@ -1,19 +1,13 @@
import os
from sys import path
from sys import platform as __platform
import sys
if __platform.startswith('linux'):
_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'../../../../bin'))
_netgen_lib_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'../../../../lib'))
if __platform.startswith('win'):
_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__) + '/../../../bin'))
_netgen_lib_dir=_netgen_bin_dir
if __platform.startswith('darwin'):
_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__) + '/../../../../../MacOS'))
_netgen_lib_dir=_netgen_bin_dir
_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'..','@NETGEN_PYTHON_RPATH_BIN@'))
_netgen_lib_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'..','@NETGEN_PYTHON_RPATH@'))
path.append(_netgen_lib_dir)
path.append(_netgen_bin_dir)
if sys.platform.startswith('win'):
os.environ['PATH'] += ';'+os.path.realpath(os.path.join(os.path.dirname(__file__),'../../../bin'))
import libngpy
del path
del sys
del os
from . import libngpy

View File

@ -1,8 +1,7 @@
import libngpy
from libngpy._csg import *
from libngpy._meshing import MeshingParameters
from libngpy._meshing import Pnt
from libngpy._meshing import Vec
from netgen.libngpy._csg import *
from netgen.libngpy._meshing import MeshingParameters
from netgen.libngpy._meshing import Pnt
from netgen.libngpy._meshing import Vec
try:

View File

@ -1,5 +1,5 @@
from libngpy._geom2d import *
from libngpy._meshing import *
from netgen.libngpy._geom2d import *
from netgen.libngpy._meshing import *
tmp_generate_mesh = SplineGeometry.GenerateMesh

View File

@ -1,16 +1,15 @@
import netgen
def StartGUI():
import os
from tkinter import Tk
from . import _netgen_lib_dir
from . import _netgen_bin_dir
global win
win = Tk()
dir_path = os.path.dirname(os.path.realpath(__file__))
win.tk.eval("source "+os.path.realpath(os.path.join(_netgen_bin_dir, 'ng.tcl')).replace('\\','/'))
win.tk.eval('lappend ::auto_path ' + netgen._netgen_lib_dir)
win.tk.eval('lappend ::auto_path ' + netgen._netgen_bin_dir)
# load with absolute path to avoid issues on MacOS
win.tk.eval('load '+netgen._netgen_lib_dir.replace('\\','/')+'/libgui[info sharedlibextension] gui')
win.tk.eval( netgen.libngpy._meshing._ngscript)
if not netgen.libngpy._meshing._netgen_executable_started:
StartGUI()

View File

@ -1 +1 @@
from libngpy._meshing import *
from netgen.libngpy._meshing import *

View File

@ -1,6 +1,5 @@
import libngpy
from libngpy._stl import *
from libngpy._meshing import MeshingParameters
from netgen.libngpy._stl import *
from netgen.libngpy._meshing import MeshingParameters
def stl_meshing_func (geom, **args):

View File

@ -1,4 +1,4 @@
FROM ubuntu:15.10
MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk
ADD . /root/src/netgen

View File

@ -1,4 +1,4 @@
FROM ubuntu:16.04
MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk
ADD . /root/src/netgen

11
tests/pytest/test_gui.py Normal file
View File

@ -0,0 +1,11 @@
import netgen
import pytest
def test_gui():
try:
from tkinter import Tk
win = Tk()
except:
pytest.skip("can't create a window")
import netgen.gui

View File

@ -7,6 +7,6 @@ install( FILES
twobricks.geo twocubes.geo twocyl.geo boundarycondition.geo
hinge.stl part1.stl frame.step screw.step
squarehole.in2d squarecircle.in2d square.in2d
DESTINATION share/netgen
DESTINATION ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX}
COMPONENT netgen_tutorial
)