CMake: Add External projects to fetch and install some dependencies automatically on Windows and MacOS

This commit is contained in:
Matthias Hochsteger 2016-12-22 19:12:11 +01:00
parent d95999161d
commit 80536a3308
6 changed files with 344 additions and 60 deletions

View File

@ -16,9 +16,8 @@ stages:
before_script:
- "echo off"
- 'call "%VS140COMNTOOLS%\..\..\VC\bin\vcvars32.bat"'
- set EXT_LIBS=C:\external_libs\x86
- set CMAKE_GENERATOR=Visual Studio 14 2015
- set INSTALL_DIR=C:/install32_%CI_BUILD_REF_NAME%
- set INSTALL_DIR=C:/install32_%CI_BUILD_REF_NAME%/
- set NETGENDIR=C:\install32_%CI_BUILD_REF_NAME%\bin
- set PYTHONPATH=C:\install32_%CI_BUILD_REF_NAME%\lib\site-packages
- set PYTHON_LIB=C:/Python3.5_32/libs/python35.lib
@ -31,9 +30,8 @@ stages:
before_script:
- "echo off"
- 'call "%VS140COMNTOOLS%\..\..\VC\bin\amd64\vcvars64.bat"'
- set EXT_LIBS=C:\external_libs\x64
- set CMAKE_GENERATOR=Visual Studio 14 2015 Win64
- set INSTALL_DIR=C:/install64_%CI_BUILD_REF_NAME%
- set INSTALL_DIR=C:/install64_%CI_BUILD_REF_NAME%/
- set NETGENDIR=C:\install64_%CI_BUILD_REF_NAME%\bin
- set PYTHONPATH=C:\install64_%CI_BUILD_REF_NAME%\lib\site-packages
- set PYTHON_LIB=C:/Python3.5/libs/python35.lib
@ -72,12 +70,11 @@ stages:
- RD /S /Q CMakeFiles
- >-
cmake ..\
-DADDITIONAL_PATHS="%EXT_LIBS%\ext_libs;%EXT_LIBS%\occ"
%PYTHON_CONFIG%
-G"%CMAKE_GENERATOR%"
-DINSTALL_DIR="%INSTALL_DIR%"
-DUSE_OCC=ON
-DCMAKE_CXX_FLAGS_RELEASE="/W0"
-DCMAKE_BUILD_TYPE=Release
- cmake --build . --target INSTALL --config Release
build_netgen_win32:
@ -126,6 +123,7 @@ build_ubuntu_1604:
stage: test
script:
- cd build
- cd netgen
- ctest -C Release -V
# skip since we have no machine with 32 bits
@ -151,7 +149,7 @@ test_netgen_win64:
.template_test_linux: &test_linux
stage: test
script:
- docker run netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION} bash -c 'cd /root/build/netgen && make test ARGS="-V"'
- docker run netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION} bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V"'
test_ubuntu_1510:
<<: *ubuntu_1510

View File

@ -3,21 +3,12 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
cmake_minimum_required(VERSION 2.8.9)
project(Netgen)
set(NETGEN_VERSION_MAJOR 6)
set(NETGEN_VERSION_MINOR 2)
string(TIMESTAMP NETGEN_VERSION_PATCH "%y%U%w" )
set(NETGEN_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-dev")
set(PACKAGE_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-${NETGEN_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
# set(CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}"
if(NOT WIN32)
option( USE_NATIVE_ARCH "build which -march=native" ON)
endif(NOT WIN32)
option( USE_GUI "don't build netgen with GUI" ON )
option( USE_PYTHON "link boost python, necessary for ngsolve" ON )
option( USE_PYTHON "build with python interface" ON )
option( USE_MPI "enable mpi parallelization" OFF )
option( USE_OCC "(not supported) compile with OpenCascade geometry kernel" OFF)
option( USE_JPEG "enable snapshots using library libjpeg" OFF )
@ -27,6 +18,26 @@ option( INSTALL_PROFILES "install environment variable settings to /etc/profile.
option( INSTALL_DEPENDENCIES "install dependencies like tcl, useful for packaging" OFF )
option( USE_CCACHE "use ccache")
option( USE_SUPERBUILD "use ccache" ON)
if (USE_SUPERBUILD)
project (SUPERBUILD)
# execute the superbuild (this script will be invoked again without the
# USE_SUPERBUILD option this time)
include (cmake_modules/SuperBuild.cmake)
return() # stop processing this file further
else()
project(Netgen)
endif()
set(NETGEN_VERSION_MAJOR 6)
set(NETGEN_VERSION_MINOR 2)
string(TIMESTAMP NETGEN_VERSION_PATCH "%y%U%w" )
set(NETGEN_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-dev")
set(PACKAGE_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-${NETGEN_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
# set(CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}"
#######################################################################
if(USE_CCACHE)
@ -146,19 +157,17 @@ if(APPLE)
endif(APPLE)
#######################################################################
find_package(ZLIB REQUIRED)
if(NOT ZLIB_INCLUDE_DIRS)
find_package(ZLIB REQUIRED)
endif(NOT ZLIB_INCLUDE_DIRS)
include_directories(${ZLIB_INCLUDE_DIRS})
#######################################################################
if (USE_GUI)
find_package(TCL 8.5)
find_package(TCL 8.5 REQUIRED)
find_package(Threads REQUIRED)
if(APPLE)
# find_library(OPENGL_gl_LIBRARY AppKit REQUIRED)
# find_library(OPENGL_gl_LIBRARY OpenGL REQUIRED)
# find_package(AppKit REQUIRED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppKit")
message("linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
else(APPLE)
find_package(X11 REQUIRED)
endif(APPLE)
@ -170,10 +179,6 @@ if (USE_GUI)
set(LIBTOGL togl)
if(WIN32)
get_filename_component(MY_LIB_DIR ${TK_LIBRARY} DIRECTORY)
install( DIRECTORY "${MY_LIB_DIR}/tcl8.6" DESTINATION lib COMPONENT netgen )
install( DIRECTORY "${MY_LIB_DIR}/tk8.6" DESTINATION lib COMPONENT netgen )
install( DIRECTORY "${MY_LIB_DIR}/../bin" DESTINATION . COMPONENT netgen )
add_definitions(-DTOGL_WGL)
else(WIN32)
if(APPLE)
@ -186,36 +191,13 @@ endif (USE_GUI)
#######################################################################
if (USE_PYTHON)
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
if( NOT PYBIND_INCLUDE_DIR )
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
endif( NOT PYBIND_INCLUDE_DIR )
if( PYBIND_INCLUDE_DIR )
message("-- Found Pybind11: ${PYBIND_INCLUDE_DIR}")
else( PYBIND_INCLUDE_DIR )
message(FATAL_ERROR "Could NOT find pybind11!")
endif( PYBIND_INCLUDE_DIR )
include_directories(${PYBIND_INCLUDE_DIR})
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules/python")
set(PYTHON_VERSION "3" CACHE STRING "")
set(Python_ADDITIONAL_VERSIONS 3.5)
if( PYTHON_VERSION VERSION_LESS 3 )
message(FATAL_ERROR "NGSolve supports only Python 3")
endif( PYTHON_VERSION VERSION_LESS 3 )
if( PYTHON_VERSION STREQUAL "3")
find_package(PythonInterp ${PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${PYTHON_VERSION} REQUIRED)
else( PYTHON_VERSION STREQUAL "3")
find_package(PythonInterp ${PYTHON_VERSION} EXACT REQUIRED)
find_package(PythonLibs ${PYTHON_VERSION} EXACT REQUIRED)
endif( PYTHON_VERSION STREQUAL "3")
add_definitions(-DNG_PYTHON)
include_directories(${PYTHON_INCLUDE_DIRS})
set(PYTHON_LIBS "${PYTHON_LIBRARIES}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
message("python install path: ${PYTHON_PACKAGES_INSTALL_DIR}")
include_directories(${PYBIND_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIR})
install(DIRECTORY ${PYBIND_INCLUDE_DIR}/pybind11 DESTINATION include COMPONENT netgen_devel)
install(FILES ${PYBIND_INCLUDE_DIR}/../LICENSE DESTINATION include/pybind11 COMPONENT netgen_devel)
endif (USE_PYTHON)
#######################################################################
@ -232,10 +214,6 @@ if (USE_OCC)
find_package(OpenCasCade REQUIRED)
add_definitions(-DOCCGEOMETRY -D_OCC64)
include_directories(${OCC_INCLUDE_DIR})
if(WIN32)
install( DIRECTORY "${OCC_LIBRARY_DIR}/../bin" DESTINATION . COMPONENT netgen )
install( FILES ${OCC_LIBRARIES_BIN} DESTINATION bin COMPONENT netgen )
endif(WIN32)
endif (USE_OCC)
#######################################################################
@ -417,6 +395,10 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/NetgenConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION share/cmake)
#######################################################################
# Configure message

View File

@ -0,0 +1,69 @@
if(APPLE)
set(HOME $ENV{HOME})
ExternalProject_Add(tcl
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tcl8.6.4-src.tar.gz"
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND make -C macosx install INSTALL_ROOT=${HOME}/ NATIVE_TCLSH=${HOME}/usr/local/bin/tclsh
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
LOG_BUILD 1
LOG_INSTALL 1
)
ExternalProject_Add(tk
DEPENDS tcl
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tk8.6.4-src.tar.gz"
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND make -C macosx install INSTALL_ROOT=${HOME}/
INSTALL_COMMAND ""#make -C macosx install
LOG_DOWNLOAD 1
LOG_BUILD 1
LOG_INSTALL 1
)
ExternalProject_Add(tkdnd
DEPENDS tcl tk
URL "http://sourceforge.net/projects/tkdnd/files/TkDND/TkDND%202.8/tkdnd2.8-src.tar.gz"
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/tkdnd_macosx.patch
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure --libdir=${HOME}/Library/Tcl --with-tcl=${HOME}/Library/Frameworks/Tcl.framework --with-tk=${HOME}/Library/Frameworks/Tk.framework --prefix=${HOME}
BUILD_COMMAND make
INSTALL_COMMAND make install
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)
list(APPEND NETGEN_DEPENDENCIES tcl tk tkdnd)
set(TCL_INCLUDE_PATH ${HOME}/Library/Frameworks/Tcl.framework/Headers)
set(TCL_LIBRARY ${HOME}/Library/Frameworks/Tcl.framework)
set(TK_LIBRARY ${HOME}/Library/Frameworks/Tk.framework)
set(TK_INCLUDE_PATH ${HOME}/Library/Frameworks/Tk.framework/Headers)
set(TCL_TCLSH ${HOME}/usr/local/bin/tclsh)
set(TK_WISH ${HOME}/usr/local/bin/wish)
elseif(WIN32)
ExternalProject_Add(win_extlibs
URL ${EXT_LIBS_DOWNLOAD_URL_WIN}
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${INSTALL_DIR}
LOG_DOWNLOAD 1
)
list(APPEND NETGEN_DEPENDENCIES win_extlibs)
else(WIN32)
find_package(TCL 8.5 REQUIRED)
endif(APPLE)
# Propagate settings to Netgen subproject
set_vars(NETGEN_CMAKE_ARGS TCL_INCLUDE_PATH TCL_LIBRARY TK_LIBRARY TK_INCLUDE_PATH TCL_TCLSH TK_WISH)

View File

@ -0,0 +1,59 @@
set(PACKAGE_VERSION "@NETGEN_VERSION@")
set(NETGEN_DIR "@CMAKE_INSTALL_PREFIX@")
set(NETGEN_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
set(NETGEN_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(CMAKE_THREAD_LIBS_INIT "@CMAKE_THREAD_LIBS_INIT@")
set(FFMPEG_LIBRARIES "@FFMPEG_LIBRARIES@")
set(JPEG_INCLUDE_DIR "@JPEG_INCLUDE_DIR@")
set(JPEG_LIBRARIES "@JPEG_LIBRARIES@")
set(LIBTOGL "@LIBTOGL@")
set(METIS_INCLUDE_DIR "@METIS_INCLUDE_DIR@")
set(METIS_LIBRARY "@METIS_LIBRARY@")
set(MKL_LIBRARIES "@MKL_LIBRARIES@")
set(MPI_CXX_INCLUDE_PATH "@MPI_CXX_INCLUDE_PATH@")
set(MPI_CXX_LIBRARIES "@MPI_CXX_LIBRARIES@")
set(NETGEN_INCLUDE_DIRS "@PROJECT_SOURCE_DIR@/libsrc/include;@PROJECT_SOURCE_DIR@/libsrc/general;@PROJECT_SOURCE_DIR@/libsrc/visualization")
set(OCC_INCLUDE_DIR "@OCC_INCLUDE_DIR@")
set(OCC_LIBRARIES_BIN "@OCC_LIBRARIES_BIN@")
set(OCC_LIBRARIES "@OCC_LIBRARIES@")
set(OCC_LIBRARY_DIR "@OCC_LIBRARY_DIR@")
set(OPENGL_LIBRARIES "@OPENGL_LIBRARIES@")
set(PYBIND_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
set(PYTHON_INCLUDE_DIRS "@PYTHON_INCLUDE_DIRS@")
set(PYTHON_LIBRARIES "@PYTHON_LIBRARIES@")
set(PYTHON_LIBS "@PYTHON_LIBS@")
set(PYTHON_PACKAGES_INSTALL_DIR "@PYTHON_PACKAGES_INSTALL_DIR@")
set(TCL_INCLUDE_PATH "@TCL_INCLUDE_PATH@")
set(TCL_LIBRARY "@TCL_LIBRARY@")
set(TK_DND_LIBRARY "@TK_DND_LIBRARY@")
set(TK_INCLUDE_PATH "@TK_INCLUDE_PATH@")
set(TK_LIBRARY "@TK_LIBRARY@")
set(X11_X11_LIB "@X11_X11_LIB@")
set(X11_Xmu_LIB "@X11_Xmu_LIB@")
set(ZLIB_INCLUDE_DIRS "@ZLIB_INCLUDE_DIRS@")
set(ZLIB_LIBRARIES "@ZLIB_LIBRARIES@")
set(USE_GUI @USE_GUI@)
set(USE_PYTHON @USE_PYTHON@)
set(USE_MPI @USE_MPI@)
set(USE_OCC @USE_OCC@)
set(USE_JPEG @USE_JPEG@)
set(USE_MPEG @USE_MPEG@)
set(NETGEN_INTEL_MIC @INTEL_MIC@)
set(NETGEN_INSTALL_PROFILES @INSTALL_PROFILES@)
set(NETGEN_INSTALL_DEPENDENCIES @INSTALL_DEPENDENCIES@)
set(USE_CCACHE @USE_CCACHE@)
if(@USE_GUI@)
find_package(TCL 8.5 REQUIRED)
endif(@USE_GUI@)
if(@USE_PYTHON@)
find_package(PythonInterp @PYTHON_VERSION@ REQUIRED)
find_package(PythonLibs @PYTHON_VERSION@ REQUIRED)
endif(@USE_PYTHON@)
include(${CMAKE_CURRENT_LIST_DIR}/netgen-targets.cmake)
message(STATUS "Found Netgen: ${NETGEN_DIR}")

View File

@ -0,0 +1,141 @@
include (ExternalProject)
set_property (DIRECTORY PROPERTY EP_PREFIX dependencies)
set (NETGEN_DEPENDENCIES)
set (LAPACK_DEPENDENCIES)
set (NETGEN_CMAKE_ARGS)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules")
macro(set_vars VAR_OUT)
foreach(varname ${ARGN})
if(NOT "${${varname}}" STREQUAL "")
string(REPLACE ";" "$<SEMICOLON>" varvalue "${${varname}}" )
list(APPEND ${VAR_OUT} -D${varname}=${varvalue})
endif()
endforeach()
endmacro()
#######################################################################
if(WIN32)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS_NEW ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_NEW} CACHE STRING "compile flags" FORCE)
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS_NEW ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_NEW} CACHE STRING "compile flags" FORCE)
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_SHARED_LINKER_FLAGS_NEW ${CMAKE_SHARED_LINKER_FLAGS})
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_NEW} /IGNORE:4217,4049" CACHE STRING "compile flags" FORCE)
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_EXE_LINKER_FLAGS_NEW ${CMAKE_EXE_LINKER_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS"${CMAKE_EXE_LINKER_FLAGS_NEW}/IGNORE:4217,4049" CACHE STRING "compile flags" FORCE)
set_vars(NETGEN_CMAKE_ARGS CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE)
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(${CMAKE_SIZEOF_VOID_P} MATCHES 4)
# 32 bit
set(EXT_LIBS_DOWNLOAD_URL_WIN "http://www.asc.tuwien.ac.at/~mhochsteger/ngsuite/ext_libs32.zip" CACHE STRING INTERNAL)
set(OCC_DOWNLOAD_URL_WIN "http://www.asc.tuwien.ac.at/~mhochsteger/ngsuite/occ32.zip" CACHE STRING INTERNAL)
else(${CMAKE_SIZEOF_VOID_P} MATCHES 4)
# 64 bit
set(EXT_LIBS_DOWNLOAD_URL_WIN "http://www.asc.tuwien.ac.at/~mhochsteger/ngsuite/ext_libs64.zip" CACHE STRING INTERNAL)
set(OCC_DOWNLOAD_URL_WIN "http://www.asc.tuwien.ac.at/~mhochsteger/ngsuite/occ64.zip" CACHE STRING INTERNAL)
endif(${CMAKE_SIZEOF_VOID_P} MATCHES 4)
endif(WIN32)
#######################################################################
# find netgen
set(INSTALL_DIR /opt/netgen CACHE PATH "Install path")
if(APPLE)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/Netgen.app/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)
if(NOT WIN32)
find_package(ZLIB REQUIRED)
set_vars(NETGEN_CMAKE_ARGS ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES)
endif(NOT WIN32)
#######################################################################
if (USE_PYTHON)
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
if( NOT PYBIND_INCLUDE_DIR )
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
endif( NOT PYBIND_INCLUDE_DIR )
if( PYBIND_INCLUDE_DIR )
message("-- Found Pybind11: ${PYBIND_INCLUDE_DIR}")
else( PYBIND_INCLUDE_DIR )
message(FATAL_ERROR "Could NOT find pybind11!")
endif( PYBIND_INCLUDE_DIR )
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules/python")
set(PYTHON_VERSION "3" CACHE STRING "Python version (only Python >= 3.0 supported)")
set(Python_ADDITIONAL_VERSIONS 3.5)
if( PYTHON_VERSION VERSION_LESS 3 )
message(FATAL_ERROR "Netgen supports only Python 3")
endif( PYTHON_VERSION VERSION_LESS 3 )
find_package(PythonInterp ${PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${PYTHON_VERSION} REQUIRED)
set(PYTHON_LIBS "${PYTHON_LIBRARIES}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
set_vars(NETGEN_CMAKE_ARGS PYTHON_LIBS PYTHON_LIBRARY PYTHON_PACKAGES_INSTALL_DIR PYTHON_INCLUDE_DIR PYBIND_INCLUDE_DIR PYTHON_LIBRARIES PYTHON_EXECUTABLE PYTHON_VERSION)
endif (USE_PYTHON)
#######################################################################
if(USE_OCC AND WIN32)
ExternalProject_Add(win_download_occ
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/tcl
URL ${OCC_DOWNLOAD_URL_WIN}
UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${INSTALL_DIR}
LOG_DOWNLOAD 1
)
list(APPEND NETGEN_DEPENDENCIES win_download_occ)
endif(USE_OCC AND WIN32)
#######################################################################
if(USE_GUI)
include(cmake_modules/ExternalProject_TCLTK.cmake)
endif(USE_GUI)
#######################################################################
# propagate cmake variables to Netgen subproject
set_vars( NETGEN_CMAKE_ARGS
USE_GUI
USE_PYTHON
USE_MPI
USE_VT
USE_VTUNE
USE_NUMA
USE_CCACHE
USE_NATIVE_ARCH
USE_OCC
INSTALL_DIR
INSTALL_DEPENDENCIES
INTEL_MIC
)
ExternalProject_Add (netgen
DEPENDS ${NETGEN_DEPENDENCIES}
SOURCE_DIR ${PROJECT_SOURCE_DIR}
CMAKE_ARGS -DUSE_SUPERBUILD=OFF ${NETGEN_CMAKE_ARGS} -DCMAKE_PREFIX_PATH=${INSTALL_DIR}
INSTALL_COMMAND ""
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/netgen
BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/netgen --config ${CMAKE_BUILD_TYPE}
STEP_TARGETS build
)
install(CODE "execute_process(COMMAND cmake --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
--target test
--config ${CMAKE_BUILD_TYPE}
)

View File

@ -0,0 +1,35 @@
diff -Naur orig/tkdnd2.8/configure changed/tkdnd2.8/configure
--- tkdnd2.8/configure 2015-05-13 19:24:32.000000000 +0200
+++ tkdnd2.8/configure 2016-02-22 15:26:37.000000000 +0100
@@ -6145,7 +6145,7 @@
- PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc"
+ PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c"
diff -Naur orig/tkdnd2.8/configure.in changed/tkdnd2.8/configure.in
--- tkdnd2.8/configure.in 2015-05-13 19:24:32.000000000 +0200
+++ tkdnd2.8/configure.in 2016-02-22 15:26:44.000000000 +0100
@@ -126,7 +126,7 @@
if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
TEA_ADD_SOURCES([macosx/macdnd.m])
- TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc])
+ TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c])
TEA_ADD_LIBS([-framework Cocoa -framework Carbon])
fi
diff -Naur orig/tkdnd2.8/macosx/macdnd.m changed/tkdnd2.8/macosx/macdnd.m
--- tkdnd2.8/macosx/macdnd.m 2015-07-06 21:49:14.000000000 +0200
+++ tkdnd2.8/macosx/macdnd.m 2016-02-22 15:27:04.000000000 +0100
@@ -16,6 +16,7 @@
#import <tcl.h>
#import <tk.h>
#import <tkInt.h>
+#undef panic
#import <tkMacOSXInt.h>
#import <Cocoa/Cocoa.h>