mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
CMake support
This commit is contained in:
parent
0a9b74185f
commit
b870bcee0f
351
CMakeLists.txt
Normal file
351
CMakeLists.txt
Normal file
@ -0,0 +1,351 @@
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING INTERNAL)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
project(Netgen)
|
||||
set(NETGEN_VERSION_MAJOR 6)
|
||||
set(NETGEN_VERSION_MINOR 1)
|
||||
set(NETGEN_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-dev")
|
||||
set(PACKAGE_VERSION "${NETGEN_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_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 )
|
||||
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 )
|
||||
|
||||
#######################################################################
|
||||
if(USE_NATIVE_ARCH)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||
endif(USE_NATIVE_ARCH)
|
||||
|
||||
#######################################################################
|
||||
if(INTEL_MIC)
|
||||
set(MKL_ARCH "mic")
|
||||
include(cmake_modules/mic.cmake)
|
||||
else(INTEL_MIC)
|
||||
set(MKL_ARCH "intel64")
|
||||
endif(INTEL_MIC)
|
||||
|
||||
#######################################################################
|
||||
# Append install paths of software in non-standard paths (e.g. openmpi, metis, intel mkl, ...)
|
||||
# cmake -DUSE_MPI=ON -DADDITIONAL_PATHS="/opt/openmpi165;/opt/metis51" ../
|
||||
set(ADDITIONAL_PATHS "" CACHE PATH "List of paths to additional libraries in non-standard locations, seperated by ';'")
|
||||
if (ADDITIONAL_PATHS)
|
||||
list(REVERSE CMAKE_SYSTEM_PREFIX_PATH)
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ADDITIONAL_PATHS})
|
||||
list(REVERSE CMAKE_SYSTEM_PREFIX_PATH)
|
||||
endif (ADDITIONAL_PATHS)
|
||||
|
||||
#######################################################################
|
||||
# install dir
|
||||
if(NOT INSTALL_DIR)
|
||||
set(INSTALL_DIR "/opt/netgen" CACHE PATH "Prefix prepended to install directories")
|
||||
endif(NOT INSTALL_DIR)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
|
||||
|
||||
#######################################################################
|
||||
# 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(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules")
|
||||
set(ng_install_dir RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
|
||||
include (CheckIncludeFiles)
|
||||
check_include_files (dlfcn.h HAVE_DLFCN_H)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
#######################################################################
|
||||
# platform specific definitions and flags
|
||||
macro(get_WIN32_WINNT version)
|
||||
if (WIN32 AND CMAKE_SYSTEM_VERSION)
|
||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||
string(REPLACE "." "" ver ${ver})
|
||||
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
|
||||
|
||||
set(${version} "0x${ver}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(get_dll_from_lib dll_path lib_path)
|
||||
get_filename_component(parent_lib_path ${lib} DIRECTORY)
|
||||
get_filename_component(lib_name ${lib} name)
|
||||
endmacro()
|
||||
|
||||
if(WIN32)
|
||||
get_WIN32_WINNT(ver)
|
||||
add_definitions(-D_WIN32_WINNT=${ver})
|
||||
set(CMAKE_MFC_FLAG 0)
|
||||
# add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
# add_definitions(-DNGLIB_EXPORTS)
|
||||
add_definitions(-DMSVC_EXPRESS -D_CRT_SECURE_NO_WARNINGS)
|
||||
# build convenience (aka object) libraries in windows)
|
||||
set(NG_LIB_TYPE OBJECT)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4244 /wd4800")
|
||||
else(WIN32)
|
||||
# build shared libraries
|
||||
set(NG_LIB_TYPE SHARED)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif(WIN32)
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -undefined dynamic_lookup")
|
||||
# set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||
endif(APPLE)
|
||||
|
||||
#######################################################################
|
||||
if(NOT INTEL_MIC AND NOT WIN32)
|
||||
find_package(OpenMP)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif(NOT INTEL_MIC AND NOT WIN32)
|
||||
|
||||
#######################################################################
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
#######################################################################
|
||||
if (USE_GUI)
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
find_package(TclStub 8.5 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
if(APPLE)
|
||||
set(OPENGL_glu_LIBRARY "/opt/X11/lib/libGLU.dylib")
|
||||
set(OPENGL_gl_LIBRARY "/opt/X11/lib/libGL.dylib")
|
||||
endif(APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_library(LIBPTHREAD NAMES pthread HINTS ${MY_LIB_DIR} )
|
||||
|
||||
add_definitions(-DTCL -DOPENGL)
|
||||
include_directories(${TCL_INCLUDE_PATH})
|
||||
# include_directories(${TK_INCLUDE_PATH})
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(MY_LIB_DIR ${TK_LIBRARY} DIRECTORY)
|
||||
find_library(LIBTOGL NAMES togl togl17 HINTS ${MY_LIB_DIR} )
|
||||
install( DIRECTORY "${MY_LIB_DIR}/tcl8.5" DESTINATION lib )
|
||||
install( DIRECTORY "${MY_LIB_DIR}/tk8.5" DESTINATION lib )
|
||||
install( DIRECTORY "${MY_LIB_DIR}/tix8.4.3" DESTINATION lib )
|
||||
install( DIRECTORY "${MY_LIB_DIR}/../bin" DESTINATION .)
|
||||
else(WIN32)
|
||||
set(LIBTOGL togl)
|
||||
ADD_DEFINITIONS(-DTOGL_X11)
|
||||
endif(WIN32)
|
||||
endif (USE_GUI)
|
||||
|
||||
#######################################################################
|
||||
if (USE_PYTHON)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules/python")
|
||||
set(PYTHON_VERSION "3" CACHE STRING "")
|
||||
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")
|
||||
set(Boost_FIND_QUIETLY ON)
|
||||
if(NOT Boost_LIBRARIES)
|
||||
find_package(Boost COMPONENTS python${PYTHON_VERSION_MAJOR})
|
||||
endif(NOT Boost_LIBRARIES)
|
||||
if(NOT Boost_LIBRARIES)
|
||||
find_package(Boost COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
|
||||
endif(NOT Boost_LIBRARIES)
|
||||
if(NOT Boost_LIBRARIES)
|
||||
find_package(Boost COMPONENTS python)
|
||||
endif(NOT Boost_LIBRARIES)
|
||||
if(NOT Boost_LIBRARIES)
|
||||
message(FATAL_ERROR "Could NOT find Boost-Python" )
|
||||
endif(NOT Boost_LIBRARIES)
|
||||
|
||||
add_definitions(-DNG_PYTHON)
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
set(PYTHON_LIBS "${PYTHON_LIBRARIES};${Boost_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}")
|
||||
endif (USE_PYTHON)
|
||||
|
||||
#######################################################################
|
||||
if (USE_MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
find_package(METIS REQUIRED)
|
||||
add_definitions(-DPARALLEL -DMETIS)
|
||||
include_directories(${MPI_CXX_INCLUDE_PATH})
|
||||
include_directories(${METIS_INCLUDE_DIR})
|
||||
endif (USE_MPI)
|
||||
|
||||
#######################################################################
|
||||
if (USE_JPEG)
|
||||
find_package(JPEG REQUIRED)
|
||||
add_definitions(-DJPEGLIB)
|
||||
include_directories(${JPEG_INCLUDE_DIR})
|
||||
endif (USE_JPEG)
|
||||
|
||||
#######################################################################
|
||||
if (USE_MPEG)
|
||||
find_package(FFMPEG REQUIRED)
|
||||
add_definitions(-DFFMPEG -D__STDC_CONSTANT_MACROS)
|
||||
include_directories(${FFMPEG_INCLUDE_DIR})
|
||||
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")
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh DESTINATION /etc/profile.d)
|
||||
|
||||
string(ASCII 27 Esc)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postinst "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/postinst "echo \"${Esc}[0;31mPlease log out and in again or do 'source /etc/profile.d/netgen.sh' to load the correct environment variables!${Esc}[m\"")
|
||||
set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/postinst")
|
||||
endif(INSTALL_PROFILES)
|
||||
|
||||
#######################################################################
|
||||
|
||||
add_subdirectory(libsrc)
|
||||
add_subdirectory(ng)
|
||||
add_subdirectory(tutorials)
|
||||
add_subdirectory(python)
|
||||
add_subdirectory(py_tutorials)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(windows)
|
||||
add_subdirectory(nglib)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# CTest
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
#######################################################################
|
||||
# Debian packager
|
||||
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "/cmake/;/build/;/.gz/;~$;${CPACK_SOURCE_IGNORE_FILES}")
|
||||
set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION} )
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "${INSTALL_DIR}")
|
||||
|
||||
set(CPACK_PACKAGE_NAME netgen)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "automatic 3d tetrahedral mesh generator")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from constructive solid geometry (CSG) or boundary representation (BRep) from STL file format. The connection to a geometry kernel allows the handling of IGES and STEP files. NETGEN contains modules for mesh optimization and hierarchical mesh refinement. Netgen is open source based on the LGPL license. It is available for Unix/Linux and Windows.")
|
||||
if(UNIX)
|
||||
execute_process(COMMAND grep CODENAME /etc/lsb-release OUTPUT_VARIABLE temp OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(temp)
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
string(SUBSTRING ${temp} 17 -1 UBUNTU_VERSION)
|
||||
message("ubuntu version: ${UBUNTU_VERSION}")
|
||||
if(${UBUNTU_VERSION} STREQUAL "utopic")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3, libboost-python1.55.0, libtk8.5, libtcl8.5, tix, libxmu6")
|
||||
endif(${UBUNTU_VERSION} STREQUAL "utopic")
|
||||
if(${UBUNTU_VERSION} STREQUAL "trusty")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3, libboost-python1.54.0, libtk8.5, libtcl8.5, tix, libxmu6")
|
||||
endif(${UBUNTU_VERSION} STREQUAL "trusty")
|
||||
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>)
|
||||
# TODO (use dpkg -s <packagename> to retrieve version)
|
||||
if(USE_MPI)
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libmetis5, openmpi-bin")
|
||||
set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}_mpi")
|
||||
endif(USE_MPI)
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION Science)
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
endif(temp)
|
||||
endif(UNIX)
|
||||
if(WIN32)
|
||||
set(CPACK_GENERATOR "NSIS")
|
||||
endif(WIN32)
|
||||
|
||||
include(CPack)
|
||||
|
||||
#######################################################################
|
||||
# uninstall target
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Configure message
|
||||
# TODO: other message in case of failure
|
||||
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" name)
|
||||
set(flags "${${name}} ${CMAKE_CXX_FLAGS}")
|
||||
message("
|
||||
------------------------------------------------------------------------
|
||||
${PROJECT_NAME} ${PACKAGE_VERSION}: Automatic configuration OK.
|
||||
|
||||
Build type: ${CMAKE_BUILD_TYPE}
|
||||
Flags: ${flags}
|
||||
|
||||
Enabled functionality:
|
||||
|
||||
OCC: ............... ${USE_OCC}
|
||||
JPEGlib: ........... ${USE_JPEG}
|
||||
FFMPEG: ............ ${USE_MPEG}
|
||||
GUI: ............... ${USE_GUI}
|
||||
MPI: ............... ${USE_MPI}
|
||||
PYTHON: ............ ${USE_PYTHON}
|
||||
|
||||
|
||||
Building: ")
|
||||
if(WIN32)
|
||||
message("
|
||||
Open ${CMAKE_BINARY_DIR}/Netgen.sln and build solution to compile ${PROJECT_NAME}.
|
||||
|
||||
Build \"INSTALL\" to install ${PROJECT_NAME}.
|
||||
")
|
||||
else(WIN32)
|
||||
message("
|
||||
Type 'make' to compile ${PROJECT_NAME}.
|
||||
|
||||
Type 'make install' to install ${PROJECT_NAME}.
|
||||
")
|
||||
endif(WIN32)
|
||||
message("
|
||||
Install directory:
|
||||
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
|
||||
Please set the following environment variables:
|
||||
|
||||
NETGENDIR=${CMAKE_INSTALL_PREFIX}/bin")
|
||||
if(USE_PYTHON)
|
||||
message(" PYTHONPATH=.:${CMAKE_INSTALL_PREFIX}/${PYTHON_PACKAGES_INSTALL_DIR}")
|
||||
endif(USE_PYTHON)
|
||||
message("
|
||||
------------------------------------------------------------------------
|
||||
")
|
||||
|
87
cmake_modules/FindFFMPEG.cmake
Normal file
87
cmake_modules/FindFFMPEG.cmake
Normal file
@ -0,0 +1,87 @@
|
||||
# - Try to find ffmpeg libraries (libavcodec, libavformat, libavutil and swscale)
|
||||
# Once done this will define
|
||||
#
|
||||
# FFMPEG_FOUND - system has ffmpeg or libav
|
||||
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
|
||||
# FFMPEG_LIBRARIES - Link these to use ffmpeg
|
||||
# FFMPEG_LIBAVCODEC
|
||||
# FFMPEG_LIBAVFORMAT
|
||||
# FFMPEG_LIBAVUTIL
|
||||
# FFMPEG_SWSCALE
|
||||
#
|
||||
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||
# Modified for other libraries by Lasse Kärkkäinen <tronic>
|
||||
# Modified for Hedgewars by Stepik777
|
||||
# Modified for Netgen by Christoph Lehrenfeld (2015) (current version)
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
#
|
||||
|
||||
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||
# in cache already
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
|
||||
pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
|
||||
pkg_check_modules(_FFMPEG_AVUTIL libavutil)
|
||||
pkg_check_modules(SWSCALE libswscale)
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
|
||||
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
|
||||
NAMES libavcodec/avcodec.h
|
||||
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav
|
||||
)
|
||||
|
||||
find_library(FFMPEG_LIBAVCODEC
|
||||
NAMES avcodec
|
||||
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
)
|
||||
|
||||
find_library(FFMPEG_LIBAVFORMAT
|
||||
NAMES avformat
|
||||
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
)
|
||||
|
||||
find_library(FFMPEG_LIBAVUTIL
|
||||
NAMES avutil
|
||||
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
)
|
||||
|
||||
find_library(FFMPEG_SWSCALE
|
||||
NAMES swscale
|
||||
PATHS ${SWSCALE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
)
|
||||
|
||||
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if (FFMPEG_FOUND)
|
||||
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
|
||||
|
||||
set(FFMPEG_LIBRARIES
|
||||
${FFMPEG_LIBAVCODEC}
|
||||
${FFMPEG_LIBAVFORMAT}
|
||||
${FFMPEG_LIBAVUTIL}
|
||||
${FFMPEG_SWSCALE}
|
||||
)
|
||||
|
||||
endif (FFMPEG_FOUND)
|
||||
|
||||
if (FFMPEG_FOUND)
|
||||
if (NOT FFMPEG_FIND_QUIETLY)
|
||||
message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
|
||||
endif (NOT FFMPEG_FIND_QUIETLY)
|
||||
else (FFMPEG_FOUND)
|
||||
if (FFMPEG_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil")
|
||||
endif (FFMPEG_FIND_REQUIRED)
|
||||
endif (FFMPEG_FOUND)
|
||||
|
||||
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
145
cmake_modules/FindMETIS.cmake
Normal file
145
cmake_modules/FindMETIS.cmake
Normal file
@ -0,0 +1,145 @@
|
||||
# -*- mode: cmake -*-
|
||||
#
|
||||
# METIS Find Module for MSTK
|
||||
# Shamelessly stolen from Amanzi open source code https://software.lanl.gov/ascem/trac
|
||||
#
|
||||
# Usage:
|
||||
# Control the search through METIS_DIR or setting environment variable
|
||||
# METIS_ROOT to the METIS installation prefix.
|
||||
#
|
||||
# This module does not search default paths!
|
||||
#
|
||||
# Following variables are set:
|
||||
# METIS_FOUND (BOOL) Flag indicating if METIS was found
|
||||
# METIS_INCLUDE_DIR (PATH) Path to the METIS include file
|
||||
# METIS_INCLUDE_DIRS (LIST) List of all required include files
|
||||
# METIS_LIBRARY_DIR (PATH) Path to the METIS library
|
||||
# METIS_LIBRARY (FILE) METIS library
|
||||
# METIS_LIBRARIES (LIST) List of all required METIS libraries
|
||||
#
|
||||
# #############################################################################
|
||||
# Standard CMake modules see CMAKE_ROOT/Modules
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# Amanzi CMake functions see <root>/tools/cmake for source
|
||||
# include(PrintVariable)
|
||||
if ( METIS_LIBRARIES AND METIS_INCLUDE_DIRS )
|
||||
# Do nothing. Variables are set. No need to search again
|
||||
else(METIS_LIBRARIES AND METIS_INCLUDE_DIRS)
|
||||
# Cache variables
|
||||
if(METIS_DIR)
|
||||
set(METIS_DIR "${METIS_DIR}" CACHE PATH "Path to search for METIS include and library files")
|
||||
endif()
|
||||
if(METIS_INCLUDE_DIR)
|
||||
set(METIS_INCLUDE_DIR "${METIS_INCLUDE_DIR}" CACHE PATH "Path to search for METIS include files")
|
||||
endif()
|
||||
if(METIS_LIBRARY_DIR)
|
||||
set(METIS_LIBRARY_DIR "${METIS_LIBRARY_DIR}" CACHE PATH "Path to search for METIS library files")
|
||||
endif()
|
||||
|
||||
# Search for include files
|
||||
# Search order preference:
|
||||
# (1) METIS_INCLUDE_DIR - check existence of path AND if the include files exist
|
||||
# (2) METIS_DIR/<include>
|
||||
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
|
||||
#
|
||||
set(metis_inc_names "metis.h")
|
||||
if (METIS_INCLUDE_DIR)
|
||||
if (EXISTS "${METIS_INCLUDE_DIR}")
|
||||
find_path(metis_test_include_path
|
||||
NAMES ${metis_inc_names}
|
||||
HINTS ${METIS_INCLUDE_DIR}
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT metis_test_include_path)
|
||||
message(SEND_ERROR "Can not locate ${metis_inc_names} in ${METIS_INCLUDE_DIR}")
|
||||
endif()
|
||||
set(METIS_INCLUDE_DIR "${metis_test_include_path}")
|
||||
else()
|
||||
message(SEND_ERROR "METIS_INCLUDE_DIR=${METIS_INCLUDE_DIR} does not exist")
|
||||
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
# Metis sometimes puts the include files in a subdir called Lib
|
||||
set(metis_inc_suffixes "include" "Lib")
|
||||
if(METIS_DIR)
|
||||
if (EXISTS "${METIS_DIR}" )
|
||||
find_path(METIS_INCLUDE_DIR
|
||||
NAMES ${metis_inc_names}
|
||||
HINTS ${METIS_DIR}
|
||||
PATH_SUFFIXES ${metis_inc_suffixes}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
|
||||
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
find_path(METIS_INCLUDE_DIR
|
||||
NAMES ${metis_inc_names}
|
||||
PATH_SUFFIXES ${metis_inc_suffixes})
|
||||
endif()
|
||||
endif()
|
||||
if ( NOT METIS_INCLUDE_DIR )
|
||||
message(SEND_ERROR "Can not locate METIS include directory")
|
||||
endif()
|
||||
# Search for libraries
|
||||
# Search order preference:
|
||||
# (1) METIS_LIBRARY_DIR - check existence of path AND if the library file exists
|
||||
# (2) METIS_DIR/<lib,Lib>
|
||||
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
|
||||
#
|
||||
set(metis_lib_names "metis5" "metis")
|
||||
if (METIS_LIBRARY_DIR)
|
||||
if (EXISTS "${METIS_LIBRARY_DIR}")
|
||||
find_library(METIS_LIBRARY
|
||||
NAMES ${metis_lib_names}
|
||||
HINTS ${METIS_LIBRARY_DIR}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(SEND_ERROR "METIS_LIBRARY_DIR=${METIS_LIBRARY_DIR} does not exist")
|
||||
set(METIS_LIBRARY "METIS_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND metis_lib_suffixes "lib" "Lib")
|
||||
if(METIS_DIR)
|
||||
if (EXISTS "${METIS_DIR}" )
|
||||
find_library(METIS_LIBRARY
|
||||
NAMES ${metis_lib_names}
|
||||
HINTS ${METIS_DIR}
|
||||
PATH_SUFFIXES ${metis_lib_suffixes}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
|
||||
set(METISLIBRARY "METIS_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
find_library(METIS_LIBRARY
|
||||
NAMES ${metis_lib_names}
|
||||
PATH_SUFFIXES ${metis_lib_suffixes})
|
||||
endif()
|
||||
endif()
|
||||
if ( NOT METIS_LIBRARY )
|
||||
message(SEND_ERROR "Can not locate METIS library")
|
||||
endif()
|
||||
|
||||
# Define prerequisite packages
|
||||
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
|
||||
set(METIS_LIBRARIES ${METIS_LIBRARY})
|
||||
|
||||
endif(METIS_LIBRARIES AND METIS_INCLUDE_DIRS )
|
||||
# Send useful message if everything is found
|
||||
find_package_handle_standard_args(METIS DEFAULT_MSG
|
||||
METIS_LIBRARIES
|
||||
METIS_INCLUDE_DIRS)
|
||||
# find_package_handle_standard_args should set METIS_FOUND but it does not!
|
||||
if ( METIS_LIBRARIES AND METIS_INCLUDE_DIRS)
|
||||
set(METIS_FOUND TRUE)
|
||||
else()
|
||||
set(METIS_FOUND FALSE)
|
||||
endif()
|
||||
# Define the version
|
||||
mark_as_advanced(
|
||||
METIS_INCLUDE_DIR
|
||||
METIS_INCLUDE_DIRS
|
||||
METIS_LIBRARY
|
||||
METIS_LIBRARIES
|
||||
METIS_LIBRARY_DIR
|
||||
)
|
21
cmake_modules/cmake_uninstall.cmake.in
Normal file
21
cmake_modules/cmake_uninstall.cmake.in
Normal file
@ -0,0 +1,21 @@
|
||||
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif(NOT "${rm_retval}" STREQUAL 0)
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
15
cmake_modules/mic.cmake
Normal file
15
cmake_modules/mic.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR k1om)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# specify the cross compiler
|
||||
set(CMAKE_C_COMPILER icc)
|
||||
set(CMAKE_CXX_COMPILER icpc)
|
||||
set(MPI_C_COMPILER mpiicc)
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX x86_64-k1om-linux-)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmic")
|
||||
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -limf -lsvml -lirng -lintlc")
|
||||
|
||||
# where is the target environment
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/linux-k1om-4.7)
|
||||
|
141
cmake_modules/python/FindPythonInterp.cmake
Normal file
141
cmake_modules/python/FindPythonInterp.cmake
Normal file
@ -0,0 +1,141 @@
|
||||
# - Find python interpreter
|
||||
# This module finds if Python interpreter is installed and determines where the
|
||||
# executables are. This code sets the following variables:
|
||||
#
|
||||
# PYTHONINTERP_FOUND - Was the Python executable found
|
||||
# PYTHON_EXECUTABLE - path to the Python interpreter
|
||||
#
|
||||
# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
|
||||
# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
|
||||
# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
|
||||
# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
|
||||
#
|
||||
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
|
||||
# version numbers that should be taken into account when searching for Python.
|
||||
# You need to set this variable before calling find_package(PythonInterp).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2010 Kitware, Inc.
|
||||
# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
|
||||
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonInterp_FIND_VERSION)
|
||||
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
|
||||
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||
list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
if(NOT PythonInterp_FIND_VERSION_EXACT)
|
||||
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_PYTHON_FIND_MAJ_MIN)
|
||||
unset(_PYTHON_FIND_MAJ)
|
||||
else()
|
||||
list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
|
||||
endif()
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||
endif()
|
||||
|
||||
list(APPEND _Python_NAMES python)
|
||||
|
||||
# Search for the current active python version first
|
||||
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
|
||||
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
set(_Python_VERSIONS
|
||||
${Python_ADDITIONAL_VERSIONS}
|
||||
${_PYTHON_FIND_OTHER_VERSIONS}
|
||||
)
|
||||
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
unset(_PYTHON1_VERSIONS)
|
||||
unset(_PYTHON2_VERSIONS)
|
||||
unset(_PYTHON3_VERSIONS)
|
||||
|
||||
# Search for newest python version if python executable isn't found
|
||||
if(NOT PYTHON_EXECUTABLE)
|
||||
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
set(_Python_NAMES python${_CURRENT_VERSION})
|
||||
if(WIN32)
|
||||
list(APPEND _Python_NAMES python)
|
||||
endif()
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES ${_Python_NAMES}
|
||||
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# determine python version string
|
||||
if(PYTHON_EXECUTABLE)
|
||||
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
|
||||
"import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||
ERROR_QUIET)
|
||||
if(NOT _PYTHON_VERSION_RESULT)
|
||||
string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}")
|
||||
list(GET _VERSION 0 PYTHON_VERSION_MAJOR)
|
||||
list(GET _VERSION 1 PYTHON_VERSION_MINOR)
|
||||
list(GET _VERSION 2 PYTHON_VERSION_PATCH)
|
||||
if(PYTHON_VERSION_PATCH EQUAL 0)
|
||||
# it's called "Python 2.7", not "2.7.0"
|
||||
string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}")
|
||||
endif()
|
||||
else()
|
||||
# sys.version predates sys.version_info, so use that
|
||||
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||
ERROR_QUIET)
|
||||
if(NOT _PYTHON_VERSION_RESULT)
|
||||
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
|
||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
|
||||
if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
|
||||
else()
|
||||
set(PYTHON_VERSION_PATCH "0")
|
||||
endif()
|
||||
else()
|
||||
# sys.version was first documented for Python 1.5, so assume
|
||||
# this is older.
|
||||
set(PYTHON_VERSION_STRING "1.4")
|
||||
set(PYTHON_VERSION_MAJOR "1")
|
||||
set(PYTHON_VERSION_MAJOR "4")
|
||||
set(PYTHON_VERSION_MAJOR "0")
|
||||
endif()
|
||||
endif()
|
||||
unset(_PYTHON_VERSION_RESULT)
|
||||
unset(_VERSION)
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
297
cmake_modules/python/FindPythonLibs.cmake
Normal file
297
cmake_modules/python/FindPythonLibs.cmake
Normal file
@ -0,0 +1,297 @@
|
||||
# - Find python libraries
|
||||
# This module finds if Python is installed and determines where the
|
||||
# include files and libraries are. It also determines what the name of
|
||||
# the library is. This code sets the following variables:
|
||||
#
|
||||
# PYTHONLIBS_FOUND - have the Python libs been found
|
||||
# PYTHON_LIBRARIES - path to the python library
|
||||
# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
|
||||
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
|
||||
# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
|
||||
# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
|
||||
#
|
||||
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
|
||||
# version numbers that should be taken into account when searching for Python.
|
||||
# You need to set this variable before calling find_package(PythonLibs).
|
||||
#
|
||||
# If you'd like to specify the installation of Python to use, you should modify
|
||||
# the following cache variables:
|
||||
# PYTHON_LIBRARY - path to the python library
|
||||
# PYTHON_INCLUDE_DIR - path to where Python.h is found
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CMakeFindFrameworks)
|
||||
# Search for the python framework on Apple.
|
||||
CMAKE_FIND_FRAMEWORKS(Python)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
|
||||
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
if(PythonLibs_FIND_VERSION_EXACT)
|
||||
if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}")
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
|
||||
endif()
|
||||
else()
|
||||
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_PYTHON_FIND_MAJ_MIN)
|
||||
unset(_PYTHON_FIND_MAJ)
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
|
||||
endif()
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||
endif()
|
||||
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
set(_Python_VERSIONS
|
||||
${Python_ADDITIONAL_VERSIONS}
|
||||
${_PYTHON_FIND_OTHER_VERSIONS}
|
||||
)
|
||||
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
unset(_PYTHON1_VERSIONS)
|
||||
unset(_PYTHON2_VERSIONS)
|
||||
unset(_PYTHON3_VERSIONS)
|
||||
|
||||
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
|
||||
if(WIN32)
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
)
|
||||
endif()
|
||||
|
||||
find_library(PYTHON_LIBRARY
|
||||
NAMES
|
||||
python${_CURRENT_VERSION_NO_DOTS}
|
||||
python${_CURRENT_VERSION}mu
|
||||
python${_CURRENT_VERSION}m
|
||||
python${_CURRENT_VERSION}u
|
||||
python${_CURRENT_VERSION}
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
# Avoid finding the .dll in the PATH. We want the .lib.
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
# Look for the static library in the Python config directory
|
||||
find_library(PYTHON_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
|
||||
# Avoid finding the .dll in the PATH. We want the .lib.
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
# This is where the static library is usually located
|
||||
PATH_SUFFIXES python${_CURRENT_VERSION}/config
|
||||
)
|
||||
|
||||
# For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if
|
||||
# PYTHON_INCLUDE_DIR is not set.
|
||||
if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
|
||||
set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
|
||||
"Path to where Python.h is found" FORCE)
|
||||
endif()
|
||||
|
||||
set(PYTHON_FRAMEWORK_INCLUDES)
|
||||
if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
|
||||
foreach(dir ${Python_FRAMEWORKS})
|
||||
set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
|
||||
${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_path(PYTHON_INCLUDE_DIR
|
||||
NAMES Python.h
|
||||
PATHS
|
||||
${PYTHON_FRAMEWORK_INCLUDES}
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||
PATH_SUFFIXES
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}mu
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}m
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}u
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION}mu
|
||||
python${_CURRENT_VERSION}m
|
||||
python${_CURRENT_VERSION}u
|
||||
python${_CURRENT_VERSION}
|
||||
)
|
||||
|
||||
find_path(PYTHON_INCLUDE_DIR2
|
||||
NAMES pyconfig.h
|
||||
PATHS
|
||||
${PYTHON_FRAMEWORK_INCLUDES}
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||
PATH_SUFFIXES
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}mu
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}m
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}u
|
||||
${CMAKE_LIBRARY_ARCHITECTURE}/python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION}mu
|
||||
python${_CURRENT_VERSION}m
|
||||
python${_CURRENT_VERSION}u
|
||||
python${_CURRENT_VERSION}
|
||||
)
|
||||
|
||||
# For backward compatibility, set PYTHON_INCLUDE_PATH.
|
||||
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
|
||||
|
||||
if(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
|
||||
file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str
|
||||
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
|
||||
string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
|
||||
PYTHONLIBS_VERSION_STRING "${python_version_str}")
|
||||
unset(python_version_str)
|
||||
endif()
|
||||
|
||||
if(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(
|
||||
PYTHON_DEBUG_LIBRARY
|
||||
PYTHON_LIBRARY
|
||||
PYTHON_INCLUDE_DIR
|
||||
PYTHON_INCLUDE_DIR2
|
||||
)
|
||||
|
||||
# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
|
||||
# cache entries because they are meant to specify the location of a single
|
||||
# library. We now set the variables listed by the documentation for this
|
||||
# module.
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}" "${PYTHON_INCLUDE_DIR2}")
|
||||
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|
||||
|
||||
# These variables have been historically named in this module different from
|
||||
# what SELECT_LIBRARY_CONFIGURATIONS() expects.
|
||||
set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
|
||||
set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
|
||||
include(SelectLibraryConfigurations)
|
||||
SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
|
||||
# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
|
||||
# Unset this, this prefix doesn't match the module prefix, they are different
|
||||
# for historical reasons.
|
||||
unset(PYTHON_FOUND)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
|
||||
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
|
||||
VERSION_VAR PYTHONLIBS_VERSION_STRING)
|
||||
|
||||
# PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python.
|
||||
# PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include
|
||||
# in your sources to initialize the static python modules
|
||||
function(PYTHON_ADD_MODULE _NAME )
|
||||
get_property(_TARGET_SUPPORTS_SHARED_LIBS
|
||||
GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||
option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
|
||||
option(PYTHON_MODULE_${_NAME}_BUILD_SHARED
|
||||
"Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
|
||||
|
||||
# Mark these options as advanced
|
||||
mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME}
|
||||
PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
|
||||
if(PYTHON_ENABLE_MODULE_${_NAME})
|
||||
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
set(PY_MODULE_TYPE MODULE)
|
||||
else()
|
||||
set(PY_MODULE_TYPE STATIC)
|
||||
set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
|
||||
add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
|
||||
# target_link_libraries(${_NAME} ${PYTHON_LIBRARIES})
|
||||
|
||||
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(PYTHON_WRITE_MODULES_HEADER _filename)
|
||||
|
||||
get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
|
||||
|
||||
get_filename_component(_name "${_filename}" NAME)
|
||||
string(REPLACE "." "_" _name "${_name}")
|
||||
string(TOUPPER ${_name} _nameUpper)
|
||||
set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename})
|
||||
|
||||
set(_filenameTmp "${_filename}.in")
|
||||
file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
|
||||
file(APPEND ${_filenameTmp}
|
||||
"#ifndef ${_nameUpper}
|
||||
#define ${_nameUpper}
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern \"C\" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
")
|
||||
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${_filenameTmp}
|
||||
"#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
")
|
||||
|
||||
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
|
||||
endforeach()
|
||||
file(APPEND ${_filenameTmp} "}\n\n")
|
||||
file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
|
||||
|
||||
# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
endfunction()
|
2
config.h.cmake
Normal file
2
config.h.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
#cmakedefine HAVE_DLFCN_H 1
|
||||
#define PACKAGE_VERSION "${PACKAGE_VERSION}"
|
1
doc/CMakeLists.txt
Normal file
1
doc/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
INSTALL(FILES ng4.pdf DESTINATION doc)
|
12
libsrc/CMakeLists.txt
Normal file
12
libsrc/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
add_subdirectory(general)
|
||||
add_subdirectory(gprim)
|
||||
add_subdirectory(linalg)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(meshing)
|
||||
add_subdirectory(visualization)
|
||||
add_subdirectory(csg)
|
||||
add_subdirectory(geom2d)
|
||||
add_subdirectory(occ)
|
||||
add_subdirectory(stlgeom)
|
||||
add_subdirectory(interface)
|
||||
|
31
libsrc/csg/CMakeLists.txt
Normal file
31
libsrc/csg/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
add_library(csg ${NG_LIB_TYPE}
|
||||
algprim.cpp brick.cpp
|
||||
bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp
|
||||
explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp
|
||||
manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp
|
||||
solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp zrefine.cpp
|
||||
python_csg.cpp
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties( csg PROPERTIES SUFFIX ".so")
|
||||
endif(APPLE)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(csg mesh ${PYTHON_LIBS})
|
||||
target_link_libraries(csg ${PYTHON_LIBS})
|
||||
install( TARGETS csg DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
||||
|
||||
if(USE_GUI)
|
||||
add_library(csgvis ${NG_LIB_TYPE} vscsg.cpp csgpkg.cpp)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(csgvis csg visual)
|
||||
if(APPLE)
|
||||
set_target_properties( csgvis PROPERTIES SUFFIX ".so")
|
||||
endif(APPLE)
|
||||
install( TARGETS csgvis DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
endif(USE_GUI)
|
||||
|
12
libsrc/general/CMakeLists.txt
Normal file
12
libsrc/general/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
add_library(gen OBJECT
|
||||
array.cpp bitarray.cpp dynamicmem.cpp flags.cpp
|
||||
hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp
|
||||
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp
|
||||
mpi_interface.cpp gzstream.cpp
|
||||
)
|
||||
|
||||
set_target_properties( gen PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
||||
|
||||
install( FILES ngexception.hpp DESTINATION include )
|
||||
|
16
libsrc/geom2d/CMakeLists.txt
Normal file
16
libsrc/geom2d/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
add_definitions(-DNGLIB_EXPORTS)
|
||||
add_library(geom2d ${NG_LIB_TYPE} genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp python_geom2d.cpp )
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(geom2d mesh ${PYTHON_LIBS})
|
||||
install( TARGETS geom2d DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(USE_GUI)
|
||||
add_library(geom2dvis ${NG_LIB_TYPE} geom2dpkg.cpp vsgeom2d.cpp)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(geom2dvis geom2d)
|
||||
install( TARGETS geom2dvis DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
endif(USE_GUI)
|
||||
|
8
libsrc/gprim/CMakeLists.txt
Normal file
8
libsrc/gprim/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
add_library(gprim OBJECT
|
||||
adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp
|
||||
geomtest3d.cpp transform3d.cpp spline.cpp splinegeometry.cpp
|
||||
)
|
||||
|
||||
set_target_properties( gprim PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
||||
|
2
libsrc/include/CMakeLists.txt
Normal file
2
libsrc/include/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
install(FILES nginterface.h nginterface_v2.hpp DESTINATION include)
|
||||
|
25
libsrc/interface/CMakeLists.txt
Normal file
25
libsrc/interface/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
add_library(interface ${NG_LIB_TYPE}
|
||||
# $<TARGET_OBJECTS:mesh>
|
||||
# $<TARGET_OBJECTS:csg>
|
||||
# $<TARGET_OBJECTS:visual>
|
||||
# $<TARGET_OBJECTS:la>
|
||||
# $<TARGET_OBJECTS:gprim>
|
||||
# $<TARGET_OBJECTS:gen>
|
||||
nginterface.cpp nginterface_v2.cpp
|
||||
read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp
|
||||
writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp
|
||||
writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp
|
||||
wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp
|
||||
)
|
||||
|
||||
# TARGET_LINK_LIBRARIES(interface ${MPI_CXX_LIBRARIES} ${PYTHON_LIBS})
|
||||
# TARGET_LINK_LIBRARIES( interface ${LIBPTHREAD} ${OCCLIBS} ${LIBTOGL} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} )
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(interface mesh csg)
|
||||
if(USE_GUI)
|
||||
target_link_libraries(interface visual)
|
||||
endif(USE_GUI)
|
||||
install( TARGETS interface DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
5
libsrc/linalg/CMakeLists.txt
Normal file
5
libsrc/linalg/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_library( la OBJECT
|
||||
densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp
|
||||
)
|
||||
|
||||
set_target_properties(la PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
35
libsrc/meshing/CMakeLists.txt
Normal file
35
libsrc/meshing/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
if(NOT WIN32)
|
||||
set(mesh_object_libs
|
||||
$<TARGET_OBJECTS:la>
|
||||
$<TARGET_OBJECTS:gprim>
|
||||
$<TARGET_OBJECTS:gen>
|
||||
)
|
||||
endif(NOT WIN32)
|
||||
|
||||
add_library(mesh ${NG_LIB_TYPE}
|
||||
adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp
|
||||
clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp
|
||||
geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp
|
||||
improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp
|
||||
meshfunc.cpp meshfunc2d.cpp meshing2.cpp meshing3.cpp
|
||||
meshtool.cpp meshtype.cpp msghandler.cpp netrule2.cpp
|
||||
netrule3.cpp parser2.cpp parser3.cpp prism2rls.cpp
|
||||
pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp
|
||||
ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp
|
||||
smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp
|
||||
topology.cpp triarls.cpp validate.cpp bcfunctions.cpp
|
||||
parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp
|
||||
python_mesh.cpp
|
||||
${mesh_object_libs}
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties( mesh PROPERTIES SUFFIX ".so")
|
||||
endif(APPLE)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( mesh ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBS} ${METIS_LIBRARY})
|
||||
install( TARGETS mesh DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
14
libsrc/occ/CMakeLists.txt
Normal file
14
libsrc/occ/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
add_library(occ ${NG_LIB_TYPE}
|
||||
Partition_Inter2d.cxx Partition_Inter3d.cxx
|
||||
Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx
|
||||
occconstruction.cpp occgenmesh.cpp occgeom.cpp occmeshsurf.cpp
|
||||
)
|
||||
|
||||
add_library(occvis ${NG_LIB_TYPE} occpkg.cpp vsocc.cpp)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( occ ${OCCLIBS} ${PYTHON_LIBS})
|
||||
target_link_libraries( occvis occ )
|
||||
install( TARGETS occ occvis DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
21
libsrc/stlgeom/CMakeLists.txt
Normal file
21
libsrc/stlgeom/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
add_library(stl ${NG_LIB_TYPE}
|
||||
meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp
|
||||
stlgeommesh.cpp stlline.cpp stltool.cpp stltopology.cpp
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( stl mesh ${PYTHON_LIBS})
|
||||
target_link_libraries( stl ${PYTHON_LIBS})
|
||||
install( TARGETS stl DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(USE_GUI)
|
||||
add_library(stlvis ${NG_LIB_TYPE}
|
||||
stlpkg.cpp vsstl.cpp
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( stlvis stl )
|
||||
install( TARGETS stlvis DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
endif(USE_GUI)
|
||||
|
20
libsrc/visualization/CMakeLists.txt
Normal file
20
libsrc/visualization/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
install(FILES soldata.hpp DESTINATION include)
|
||||
|
||||
# AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(OCCFLAGS) $(TCL_INCLUDES)
|
||||
|
||||
if(USE_GUI)
|
||||
add_library(visual ${NG_LIB_TYPE}
|
||||
meshdoc.cpp mvdraw.cpp
|
||||
vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp visualpkg.cpp
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( visual ${PYTHON_LIBS} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TCL_LIBRARY} )
|
||||
install( TARGETS visual DESTINATION lib )
|
||||
endif(NOT WIN32)
|
||||
endif(USE_GUI)
|
||||
|
||||
|
||||
|
||||
|
||||
|
68
ng/CMakeLists.txt
Normal file
68
ng/CMakeLists.txt
Normal file
@ -0,0 +1,68 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
|
||||
set(netgen_sources main.cpp )
|
||||
set(netgenlib_sources demoview.cpp ngappinit.cpp onetcl.cpp parallelfunc.cpp ngpkg.cpp )
|
||||
|
||||
if(USE_GUI)
|
||||
if(WIN32)
|
||||
set(netgenlib_objects
|
||||
$<TARGET_OBJECTS:mesh>
|
||||
$<TARGET_OBJECTS:stlvis>
|
||||
$<TARGET_OBJECTS:stl>
|
||||
$<TARGET_OBJECTS:geom2dvis>
|
||||
$<TARGET_OBJECTS:interface>
|
||||
$<TARGET_OBJECTS:geom2d>
|
||||
$<TARGET_OBJECTS:csg>
|
||||
$<TARGET_OBJECTS:stl>
|
||||
$<TARGET_OBJECTS:gen>
|
||||
$<TARGET_OBJECTS:la>
|
||||
$<TARGET_OBJECTS:gprim>
|
||||
|
||||
$<TARGET_OBJECTS:visual>
|
||||
$<TARGET_OBJECTS:csgvis>
|
||||
|
||||
# $<TARGET_OBJECTS:occ>
|
||||
# $<TARGET_OBJECTS:occvis>
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
add_executable(netgen ${netgen_sources})
|
||||
add_library(netgenlib SHARED ${netgenlib_sources} ${netgenlib_objects})
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties( netgenlib PROPERTIES OUTPUT_NAME interface )
|
||||
else(WIN32)
|
||||
target_link_libraries( netgenlib visual csgvis csg interface mesh togl)
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries( netgenlib ${LIBPTHREAD} ${OCCLIBS} ${LIBTOGL} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${PYTHON_LIBS} ${FFMPEG_LIBRARIES})
|
||||
target_link_libraries( netgen netgenlib )
|
||||
|
||||
install(TARGETS netgenlib ${ng_install_dir})
|
||||
install(TARGETS netgen ${ng_install_dir})
|
||||
|
||||
endif(USE_GUI)
|
||||
|
||||
if(USE_PYTHON)
|
||||
add_library(pynglib MODULE netgenpy.cpp)
|
||||
target_link_libraries( pynglib nglib )
|
||||
if(APPLE)
|
||||
set_target_properties( pynglib PROPERTIES SUFFIX ".so")
|
||||
elseif(WIN32)
|
||||
set_target_properties( pynglib PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
set_target_properties( pynglib PROPERTIES OUTPUT_NAME "nglib")
|
||||
install(TARGETS pynglib ${ng_install_dir})
|
||||
endif(USE_PYTHON)
|
||||
|
||||
install(FILES
|
||||
dialog.tcl menustat.tcl ngicon.tcl ng.tcl
|
||||
ngvisual.tcl sockets.tcl drawing.tcl nghelp.tcl ngshell.tcl
|
||||
ngtesting.tcl parameters.tcl variables.tcl csgeom.tcl stlgeom.tcl
|
||||
occgeom.tcl acisgeom.tcl netgen.ocf
|
||||
DESTINATION bin)
|
||||
|
||||
if(USE_GUI AND NOT WIN32)
|
||||
add_subdirectory(Togl-1.7)
|
||||
endif(USE_GUI AND NOT WIN32)
|
||||
|
18
ng/Togl-1.7/CMakeLists.txt
Normal file
18
ng/Togl-1.7/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
add_definitions("-DPACKAGE_NAME=\"Togl\" -DPACKAGE_TARNAME=\"togl\" -DPACKAGE_VERSION=\"1.7\" -DPACKAGE_STRING=\"Togl\ 1.7\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_THREADS=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_IS_LONG=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1")
|
||||
|
||||
# include_directories("/usr/include/tcl8.5" "/usr/include/tcl8.5/tk-private/generic" "/usr/include/tcl8.5/tk-private/unix")
|
||||
# SET(CMAKE_CXX_FLAGS "-O2 -fomit-frame-pointer -Wall -Wno-implicit-int -fPIC -c")
|
||||
include_directories("${TCL_INCLUDE_PATH}/tk-private/generic" "${TCL_INCLUDE_PATH}/tk-private/unix")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fomit-frame-pointer -Wall -Wno-implicit-int")
|
||||
add_library(togl togl.c)
|
||||
target_link_libraries(togl ${OPENGL_LIBRARIES})
|
||||
set_target_properties(togl PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
||||
#
|
||||
# gcc -DPACKAGE_NAME=\"Togl\" -DPACKAGE_TARNAME=\"togl\" -DPACKAGE_VERSION=\"1.7\" -DPACKAGE_STRING=\"Togl\ 1.7\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_THREADS=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_IS_LONG=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1
|
||||
# -I"/usr/include/tcl8.6" -I"/usr/include/tcl8.6/tk-private/generic" -I"/usr/include/tcl8.6/tk-private/unix"
|
||||
# -O2 -fomit-frame-pointer -Wall -Wno-implicit-int -fPIC -c `echo togl.c` -o togl.o
|
||||
# rm -f libTogl1.7.so
|
||||
# gcc -pipe -shared -o libTogl1.7.so togl.o -lX11 -lGL -lXmu -L/usr/lib/x86_64-linux-gnu -ltclstub8.6 -L/usr/lib/x86_64-linux-gnu -ltkstub8.6
|
||||
# : libTogl1.7.so
|
||||
|
||||
|
48
nglib/CMakeLists.txt
Normal file
48
nglib/CMakeLists.txt
Normal file
@ -0,0 +1,48 @@
|
||||
# dist_pkgdata_DATA = cube.surf
|
||||
|
||||
add_definitions(-DNGLIB_EXPORTS)
|
||||
# ADD_LIBRARY(nglib SHARED nglib.cpp)
|
||||
# TARGET_LINK_LIBRARIES( nglib interface geom2d csg stl occ mesh ${OCCLIBS} ${MPI_CXX_LIBRARIES} )
|
||||
set(nglib_sources nglib.cpp)
|
||||
|
||||
if(WIN32)
|
||||
set(nglib_objects
|
||||
$<TARGET_OBJECTS:interface>
|
||||
$<TARGET_OBJECTS:geom2d>
|
||||
$<TARGET_OBJECTS:csg>
|
||||
$<TARGET_OBJECTS:stl>
|
||||
$<TARGET_OBJECTS:occ>
|
||||
$<TARGET_OBJECTS:mesh>
|
||||
$<TARGET_OBJECTS:gen>
|
||||
$<TARGET_OBJECTS:la>
|
||||
$<TARGET_OBJECTS:gprim>
|
||||
|
||||
$<TARGET_OBJECTS:visual>
|
||||
$<TARGET_OBJECTS:csgvis>
|
||||
# $<TARGET_OBJECTS:geom2dvis>
|
||||
# $<TARGET_OBJECTS:occvis>
|
||||
# $<TARGET_OBJECTS:stlvis>
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
add_library(nglib SHARED ${nglib_sources} ${nglib_objects})
|
||||
|
||||
target_link_libraries( nglib ${LIBPTHREAD} ${OCCLIBS} ${LIBTOGL} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} )
|
||||
|
||||
if(USE_PYTHON)
|
||||
target_link_libraries(nglib ${PYTHON_LIBS})
|
||||
endif(USE_PYTHON)
|
||||
|
||||
if(NOT WIN32)
|
||||
add_executable(ng_vol ng_vol.cpp ${nglib_objects})
|
||||
target_link_libraries( ng_vol nglib ${OCCLIBS} ${MPI_CXX_LIBRARIES} )
|
||||
target_link_libraries( ng_vol nglib interface geom2d csg stl occ mesh )
|
||||
|
||||
add_executable(ng_stl ng_stl.cpp ${nglib_objects})
|
||||
target_link_libraries( ng_stl nglib ${OCCLIBS} ${MPI_CXX_LIBRARIES} )
|
||||
target_link_libraries( ng_stl nglib interface geom2d csg stl occ mesh )
|
||||
|
||||
install(TARGETS nglib ng_vol ng_stl ${ng_install_dir})
|
||||
endif(NOT WIN32)
|
||||
|
||||
install(TARGETS nglib ${ng_install_dir})
|
4
py_tutorials/CMakeLists.txt
Normal file
4
py_tutorials/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
install( FILES
|
||||
shaft.geo mesh.py exportNeutral.py
|
||||
DESTINATION share/netgen/py_tutorials
|
||||
)
|
5
python/CMakeLists.txt
Normal file
5
python/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
install(FILES
|
||||
__init__.py meshing.py csg.py
|
||||
DESTINATION ${PYTHON_PACKAGES_INSTALL_DIR}/netgen
|
||||
)
|
||||
|
11
tutorials/CMakeLists.txt
Normal file
11
tutorials/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
install( FILES
|
||||
boxcyl.geo circle_on_cube.geo cone.geo cube.geo
|
||||
cubeandring.geo cubeandspheres.geo cubemcyl.geo cubemsphere.geo cylinder.geo
|
||||
cylsphere.geo ellipsoid.geo ellipticcyl.geo extrusion.geo fichera.geo lshape3d.geo
|
||||
manyholes.geo manyholes2.geo matrix.geo ortho.geo period.geo revolution.geo
|
||||
sculpture.geo shaft.geo shell.geo sphere.geo sphereincube.geo torus.geo trafo.geo
|
||||
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
|
||||
)
|
3
windows/CMakeLists.txt
Normal file
3
windows/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# dist_noinst_DATA = netgen.sln netgen.vcproj \
|
||||
# postBuild_netgen.bat nglib.sln nglib.vcproj \
|
||||
# postBuild_nglib.bat netgen.ico netgen.rc
|
Loading…
Reference in New Issue
Block a user