netgen/ng/CMakeLists.txt
Matthias Hochsteger e1d7cd879d Don't link TCL/TK to gui lib on MacOS
In case there are multiple versions of tcl/tk available on MacOS, the
system complains about it if we link against one version and
python/tkinter links against another.
Thus don't link with any tcl at all in the gui library. This means the
library will use the version loaded by tkinter.
2017-05-12 13:10:10 +02:00

77 lines
2.7 KiB
CMake

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
)
set(netgen_sources ngappinit.cpp onetcl.cpp )
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})
target_link_libraries( gui PUBLIC nglib ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_X11_LIB} ${OCC_LIBRARIES} )
target_link_libraries( gui PRIVATE ${LIBTOGL})
target_link_libraries( netgen nglib gui )
if(APPLE)
# Leave decision about which tcl/tk version to use open to python (and it's tkinter package).
# Thus, only link tcl/tk to the netgen executable and not to the gui library.
target_link_libraries( netgen ${TK_LIBRARY} ${TCL_LIBRARY})
else(APPLE)
# On other systems assume that the found libraries are compatible with python/tkinter
target_link_libraries( gui PUBLIC ${TK_LIBRARY} ${TCL_LIBRARY})
endif(APPLE)
if(NOT WIN32)
target_link_libraries( netgen mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis )
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})
if(APPLE)
set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen)
endif(APPLE)
if(WIN32)
set_target_properties( gui PROPERTIES OUTPUT_NAME libgui )
endif(WIN32)
endif(USE_GUI)
if(USE_PYTHON)
add_library(ngpy SHARED netgenpy.cpp)
target_link_libraries( ngpy nglib )
if(APPLE)
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
elseif(WIN32)
set_target_properties( ngpy PROPERTIES SUFFIX ".pyd")
set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy")
endif()
install(TARGETS ngpy ${ng_install_dir})
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)
add_subdirectory(Togl2.1)
install(FILES drawing.tcl DESTINATION ${ng_install_dir_bin} COMPONENT netgen)
endif(USE_GUI)