Commit 78c88e69 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'master' into tasmanian

Conflicts:
	TPLsList.cmake
	cmake/Dependencies.cmake
parents ca4c6804 5cc877f9
Pipeline #52722 failed with stages
in 2 minutes and 57 seconds
......@@ -4,3 +4,6 @@ testframework
CMakeLists.txt.user
.vscode
build/
CMakeSettings.json
.vs/
.DS_Store
stages:
- test
- analysis
.windows_before_script: &windows_before_script
before_script:
- set PATH=%PATH%;c:\vendors\mingw-w64\x86_64-4.8.5-posix-seh-rt_v4-rev0\mingw64\bin;c:\vendors\mingw-w64\qt\5.9.1\bin
.windows_msvc_before_script: &windows_msvc_before_script
before_script:
- set PATH=c:\Qt\5.9.1\msvc2013_64\bin;%PATH%;c:\Program Files (x86)\NSIS\Bin
mac_gcc_testing:
tags:
......@@ -9,14 +16,14 @@ mac_gcc_testing:
- which git
- git --version
- git clone https://github.com/lefebvre/TriBITS.git TriBITS
- module load cmake gcc/4.8.5
- module load cmake gcc/4.8.5 qt/5.9.1 vtk/8.1.0
- which cmake
- which python
- python --version
- python TriBITS/tribits/ci_support/clone_extra_repos.py
- mkdir build
- cd build
- cmake -DDEBUG_OUTPUT=1 -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixams=ON -Dradix_ENABLE_radixio=ON -Dradix_ENABLE_radixmath=ON -Dradix_ENABLE_radixpara=ON -Dradix_ENABLE_radixgeometry=ON -Dradix_ENABLE_radixglls=ON -Dradix_ENABLE_radixcommand=ON -Dradix_ENABLE_googletest=ON -Dradix_ENABLE_radixdl=ON -Dradix_ENABLE_radixcore=ON ..
- cmake -DDEBUG_OUTPUT=1 -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -DExperimentalMemCheck -D ExperimentalSubmit
mac_llvm_testing:
......@@ -26,18 +33,38 @@ mac_llvm_testing:
- which git
- git --version
- git clone https://github.com/lefebvre/TriBITS.git TriBITS
- module load cmake
- module load cmake qt/5.9.1 vtk/8.1.0
- which python
- python --version
- python TriBITS/tribits/ci_support/clone_extra_repos.py
- mkdir build
- cd build
- which cmake
- cmake -DDEBUG_OUTPUT=1 -DBUILDNAME=$(uname -s)-LLVM-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixams=ON -Dradix_ENABLE_radixio=ON -Dradix_ENABLE_radixmath=ON -Dradix_ENABLE_radixpara=ON -Dradix_ENABLE_radixgeometry=ON -Dradix_ENABLE_radixglls=ON -Dradix_ENABLE_radixcommand=ON -Dradix_ENABLE_googletest=ON -Dradix_ENABLE_radixdl=ON -Dradix_ENABLE_radixcore=ON ..
- export radix_ENABLE_Fortran=OFF
- cmake -DDEBUG_OUTPUT=1 -DBUILDNAME=$(uname -s)-LLVM-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -DExperimentalMemCheck -D ExperimentalSubmit
linux_gcc_testing:
tags:
- linux
script:
- which git
- git --version
- git clone https://github.com/lefebvre/TriBITS.git TriBITS
- which python
- python --version
- python TriBITS/tribits/ci_support/clone_extra_repos.py
- mkdir build
- cd build
- module load cmake qt/5.9.0 vtk/8.1.0
- which cmake
- module load valgrind
- cmake -DBUILDNAME=$(uname -s)-GCC-4.8.5-Release-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=Release -Dradix_ENABLE_TESTS=ON -DENABLE_PYTHON_WRAPPERS=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
linux_analysis:
stage: analysis
tags:
- linux
script:
......@@ -52,8 +79,9 @@ linux_gcc_testing:
- module load cmake
- which cmake
- module load valgrind
- cmake -DDEBUG_OUTPUT=1 -D COVERAGE_EXTRA_FLAGS="-s ${CI_PROJECT_DIR}/googletest -d" -D MEMCHECK_COMMAND=$(which valgrind) -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_COVERAGE_TESTING=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixams=ON -Dradix_ENABLE_radixio=ON -Dradix_ENABLE_radixmath=ON -Dradix_ENABLE_radixpara=ON -Dradix_ENABLE_radixgeometry=ON -Dradix_ENABLE_radixglls=ON -Dradix_ENABLE_radixcommand=ON -Dradix_ENABLE_googletest=ON -Dradix_ENABLE_radixdl=ON -Dradix_ENABLE_radixcore=ON ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalMemCheck -D ExperimentalSubmit
- cmake -DDEBUG_OUTPUT=1 -D COVERAGE_EXTRA_FLAGS="-s ${CI_PROJECT_DIR}/googletest -d" -D MEMCHECK_COMMAND=$(which valgrind) -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_COVERAGE_TESTING=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalMemCheck -D ExperimentalCoverage -D ExperimentalSubmit
allow_failure: true
linux_openmpi_testing:
tags:
......@@ -86,12 +114,32 @@ windows_mingw_testing:
- git clone https://github.com/lefebvre/googletest googletest
- mkdir build
- cd build
- cmake -DDEBUG_OUTPUT=1 -DTPL_LAPACK_LIBRARIES=c:/vendors/mingw-w64/lapack/3.5.0/lib/liblapack.a\\\;c:/vendors/mingw-w64/lapack/3.5.0/lib/libblas.a\\\;-lgfortran -DBUILDNAME=Windows-MinGW-GCC-4.8.5-Debug-%CI_BUILD_REF_NAME% -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_COVERAGE_TESTING=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixams=ON -Dradix_ENABLE_radixio=ON -Dradix_ENABLE_radixmath=ON -Dradix_ENABLE_radixpara=ON -Dradix_ENABLE_radixgeometry=ON -Dradix_ENABLE_radixglls=ON -Dradix_ENABLE_radixcommand=ON -Dradix_ENABLE_googletest=ON -Dradix_ENABLE_radixdl=ON -Dradix_ENABLE_radixcore=ON -G "MinGW Makefiles" ..
- cmake -DDEBUG_OUTPUT=1 -DTPL_LAPACK_LIBRARIES=c:/vendors/mingw-w64/lapack/3.5.0/lib/liblapack.a\\\;c:/vendors/mingw-w64/lapack/3.5.0/lib/libblas.a\\\;-lgfortran -DBUILDNAME=Windows-MinGW-GCC-4.8.5-Debug-%CI_BUILD_REF_NAME% -DCMAKE_BUILD_TYPE=DEBUG -Dradix_ENABLE_COVERAGE_TESTING=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF -G "MinGW Makefiles" ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
windows_msvc_testing:
tags:
- nsmwin10
<<: *windows_msvc_before_script
script:
- 'call "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/vcvarsall.bat" amd64'
- where git
- git --version
- cmake --version
- git clone https://github.com/lefebvre/TriBITS.git TriBITS
- git clone https://github.com/lefebvre/testframework testframework
- git clone https://github.com/lefebvre/googletest googletest
- mkdir build
- cd build
- SET VTK_DIR=c:\vendors\cl\vtk\8.1.0\
- SET radix_ENABLE_Fortran=OFF
- cmake -DBUILD_SHARED_LIBS=ON -DBUILDNAME=Windows-CL-18-Release-%CI_BUILD_REF_NAME% -DCMAKE_BUILD_TYPE=RELEASE -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF -Dradix_ENABLE_radixglls=OFF -G "NMake Makefiles" ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
windows_intel_shared_testing:
tags:
- nsmwin10
<<: *windows_msvc_before_script
script:
- 'call "c:/Program Files (x86)/Intel/Composer XE 2015/bin/ipsxe-comp-vars.bat" intel64 vs2013'
- where git
......@@ -103,5 +151,6 @@ windows_intel_shared_testing:
- git clone https://github.com/lefebvre/googletest googletest
- mkdir build
- cd build
- cmake -DBUILD_SHARED_LIBS=ON -DTPL_LAPACK_LIBRARIES=c:/vendors/intel/lapack/3.5.0/lib/lapack.lib -DTPL_BLAS_LIBRARIES=c:/vendors/intel/lapack/3.5.0/lib/blas.lib -DBUILDNAME=Windows-Intel-15-Release-%CI_BUILD_REF_NAME% -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl -DCMAKE_BUILD_TYPE=RELEASE -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_radixdl=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF -Dradix_ENABLE_radixglls=OFF -G "NMake Makefiles" ..
- SET VTK_DIR=c:\vendors\cl\vtk\8.1.0\
- cmake -DBUILD_SHARED_LIBS=ON -DTPL_LAPACK_LIBRARIES=c:/vendors/intel/lapack/3.5.0/lib/lapack.lib\\\;c:/vendors/intel/lapack/3.5.0/lib/blas.lib -DBUILDNAME=Windows-Intel-15-Release-%CI_BUILD_REF_NAME% -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl -DCMAKE_BUILD_TYPE=RELEASE -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixwidgets=OFF -G "NMake Makefiles" ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
......@@ -12,6 +12,7 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE)
PROJECT(${PROJECT_NAME} NONE)
# enable C++11 by default
SET(radix_ENABLE_CXX11 ON CACHE BOOL "Compile using the C++11 standard" FORCE)
#SET(USE_QT5 TRUE)
# disable generating HTML dependencies webpage and xml files
SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE OFF CACHE BOOL "")
......@@ -51,6 +52,7 @@ ELSE()
# Process subpackages
#
TRIBITS_PROCESS_SUBPACKAGES()
TRIBITS_PACKAGE_DEF()
TRIBITS_PACKAGE_POSTPROCESS()
ENDIF()
......
......@@ -56,6 +56,10 @@
SET(radix_TPLS_FINDMODS_CLASSIFICATIONS
LAPACK "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" PT
Tasmanian "cmake/" ST
Qt5Core "cmake/TPLs/" ST
Qt5Gui "cmake/TPLs/" ST
Qt5Widgets "cmake/TPLs/" ST
VTK "cmake/TPLs/" ST
)
##---------------------------------------------------------------------------##
......
......@@ -64,8 +64,10 @@ MACRO(TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS)
IF(NOT "$ENV{${PROJECT_NAME}_ENABLE_Fortran}" STREQUAL "" )
SET(${PROJECT_NAME}_ENABLE_Fortran $ENV{${PROJECT_NAME}_ENABLE_Fortran})
ELSE()
# ensure fortran compiler is set on
SET(${PROJECT_NAME}_ENABLE_Fortran OFF CACHE BOOL "" FORCE)
# allow fortran compiler to be set on
IF(NOT ${PROJECT_NAME}_ENABLE_Fortran)
SET(${PROJECT_NAME}_ENABLE_Fortran OFF CACHE BOOL "" FORCE)
ENDIF()
ENDIF()
# Set up radix cmake directory, used by default option scripts
SET(radix_CMAKE_DIR "${radix_SOURCE_DIR}/cmake" CACHE PATH "")
......
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
bug radixbug SS OPTIONAL
dl radixdl SS OPTIONAL
core radixcore SS OPTIONAL
dl radixdl SS OPTIONAL
pattern radixpattern SS OPTIONAL
algorithm radixalgorithm SS OPTIONAL
para radixpara SS OPTIONAL
command radixcommand SS OPTIONAL
math radixmath SS OPTIONAL
geo radixgeo SS OPTIONAL
glls radixglls SS OPTIONAL
io radixio SS OPTIONAL
geometry radixgeometry SS OPTIONAL
......
##---------------------------------------------------------------------------##
## FindPythonLibsFromExe.cmake
## --------------------------------------------------------------------------##
# FindPythonLibsFromExe is loosely adapted from Trilinos' FindPythonInclude
#
# This module uses the Python executable (if already loaded with
# FindPythonInterp) to determine the default library and include paths if not
# already set
#
# - PYTHON_LIBRARY
# - PYTHON_INCLUDE_DIR
#
# It then calls FindPythonLibs, which will set all the other required variables,
# and set the PYTHON_XXX variables if we had trouble finding them in this script
IF(PYTHON_EXECUTABLE AND (NOT PYTHON_LIBRARY OR NOT PYTHON_INCLUDE_DIR))
# Get the Python installation prefix and version
IF(NOT EXISTS "${PYTHON_EXECUTABLE}")
MESSAGE(FATAL_ERROR "Python executable specified "
"at '${PYTHON_EXECUTABLE}' does not exist")
ENDIF()
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c
"import sys; sys.stdout.write(sys.prefix + ';' + sys.version[:3])"
OUTPUT_VARIABLE PREFIX_AND_VERSION
)
LIST(GET "${PREFIX_AND_VERSION}" 0 _PY_PREFIX)
LIST(GET "${PREFIX_AND_VERSION}" 1 _PY_VERSION)
# Attempt to find the include directories
SET(_PYINC "${_PY_PREFIX}/include/python${_PY_VERSION}" )
IF(EXISTS "${_PYINC}" AND EXISTS "${_PYINC}/Python.h")
SET(PYTHON_INCLUDE_DIR ${_PYINC} CACHE FILEPATH
"Path to the Python include directory" FORCE)
MESSAGE(STATUS "Found Python include directory: ${PYTHON_INCLUDE_DIR}")
ENDIF()
# Attempt to find the library
FOREACH(_PYLIB_BASE
"${_PY_PREFIX}/lib"
"${_PY_PREFIX}/lib64"
"${_PY_PREFIX}/lib/python${_PY_VERSION}/config" )
FOREACH(SUFFIX dll dylib so a)
SET(_PYLIB "${_PYLIB_BASE}/libpython${_PY_VERSION}.${SUFFIX}")
IF(EXISTS "${_PYLIB}")
SET(PYTHON_LIBRARY ${_PYLIB} CACHE FILEPATH
"Path to the Python Library" FORCE)
MESSAGE(STATUS "Found Python library: ${PYTHON_LIBRARY}")
BREAK()
ENDIF()
ENDFOREACH()
IF(PYTHON_LIBRARY)
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
# Set the version for FindPythonLibs to match the one we found
# The PYTHON_LIBRARY and PYTHON_INCLUDE_DIR values, if set, will be used
# Otherwise, standard CMake logic will work
SET(PythonLibs_FIND_VERSION ${_PY_VERSION})
FIND_PACKAGE(PythonLibs ${ARGN})
INCLUDE(FindPackageHandleStandardArgs)
# Process REQUIRED etc.
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
VERSION_VAR PYTHONLIBS_VERSION_STRING)
##---------------------------------------------------------------------------##
## end of FindPythonLibsFromExe.cmake
##---------------------------------------------------------------------------##
IF(COMMAND QT_PRL_ADDITIONS)
RETURN()
ENDIF()
FUNCTION(QT_PRL_ADDITIONS LIB_NAME LIB_DIR ADDITIONS_OUT)
#platform dependent component configuration name
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(component_pkg ${component_lib_dir}/${component}.prl)
ELSEIF( EXISTS "${component_lib_dir}/${component}.prl")
SET(component_pkg ${component_lib_dir}/${component}.prl)
ELSE()
SET(component_pkg ${component_lib_dir}/lib${component}.prl)
ENDIF()
MESSAGE(STATUS "Searching for component: ${component_pkg}")
#Check if this componet configuration exists
IF( EXISTS ${component_pkg} )
MESSAGE("-- Found component(${component}) configuration: ${component_pkg}")
#read the component description file
FILE(STRINGS ${component_pkg} file_lines)
SET(FRAMEWORK FALSE)
#loop over each line
FOREACH(line ${file_lines})
#only pay attention to library line
IF(line MATCHES "QMAKE_PRL_LIBS")
STRING(REGEX REPLACE "^.*=" "" line_pruned ${line})
SPLIT( "${line_pruned}" " +" field_list)
#
# Process field list to remove qt libraries
#
SET(processed_field_list ${field_list})
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
LIST(APPEND ADDITIONAL_LIBS ${field_list})
ELSE()
FOREACH(field ${field_list})
IF( field MATCHES "-l" )
STRING(REGEX REPLACE "-l" "" field ${field})
# Ignore internal qt module dependencies
IF(NOT field MATCHES "^Qt")
LIST(APPEND ADDITIONAL_LIBS ${field})
ENDIF()
ELSEIF( field MATCHES "-F" )
# check for Darwin frameworks directory "-F/opt/local/..."
# ignore internal qt module directories
IF(NOT field MATCHES "QT")
LIST(APPEND ADDITIONAL_LIBS "${field}")
ENDIF()
ELSEIF( field MATCHES "-framework" )
# check for Darwin frameworks "-framework ApplicationServices"
SET(FRAMEWORK TRUE)
ELSEIF( FRAMEWORK ) # check for Darwin frameworks
# Ignore internal qt module dependencies
IF(NOT field MATCHES "^Qt")
LIST(APPEND ADDITIONAL_LIBS "-framework ${field}")
ENDIF()
SET(FRAMEWORK FALSE)
ENDIF()
ENDFOREACH()
ENDIF()
BREAK()
ENDIF()
ENDFOREACH()
ELSE()
MESSAGE("-- Did not find component(${component})")
MESSAGE("-- System libraries may not be included correctly!")
MESSAGE("-- Resulting in undefined symbols at link time.")
ENDIF()
SET(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} PARENT_SCOPE)
ENDFUNCTION()
##---------------------------------------------------------------------------##
## RadixSWIGPyModules.cmake
## --------------------------------------------------------------------------##
#
# Find required Python libraries
FIND_PACKAGE(PythonLibsFromExe REQUIRED)
#
# Find the SWIG package for language bindings
FIND_PACKAGE(SWIG REQUIRED)
#
# Ensure that PYTHON wrappers are enabled
IF (ENABLE_PYTHON_WRAPPERS)
IF (NOT DEFINED SWIG_DIR)
MESSAGE(FATAL_ERROR "SWIG not loaded.")
ENDIF()
# Load SWIG and other modules we need
INCLUDE(${SWIG_USE_FILE})
INCLUDE(CMakeParseArguments)
INCLUDE(CheckCXXCompilerFlag)
# Prepare to turn off some warnings that commonly show up in SWIG wrapper code
SET(SWIG_CXX_FLAGS)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(WARNING_FLAGS
-Wno-unused-label
-Wno-unused-parameter
-Wno-unused-but-set-variable
-Wno-maybe-uninitialized
-Wno-uninitialized
-Wno-unused-value
)
FOREACH(COMPILER_FLAG ${WARNING_FLAGS})
# The ${COMPILER_FLAG} variable is cached, so the variable must be
# unique between flags.
check_cxx_compiler_flag("${COMPILER_FLAG}" RADIXSWIG_USE_FLAG_${COMPILER_FLAG})
IF(RADIXSWIG_USE_FLAG_${COMPILER_FLAG})
SET(SWIG_CXX_FLAGS "${SWIG_CXX_FLAGS} ${COMPILER_FLAG}")
ENDIF()
ENDFOREACH()
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)
SET(SWIG_CXX_FLAGS "${SWIG_CXX_FLAGS} -diag-disable 955")
ENDIF()
# Tell SWIG to use modern Python code
LIST(APPEND CMAKE_SWIG_FLAGS "-modern" "-noproxydel")
# If python version is high enough, add -py3 flag
IF(PYTHON_VERSION_STRING VERSION_GREATER 3.0)
LIST(APPEND CMAKE_SWIG_FLAGS "-py3")
ENDIF()
ENDIF()
##---------------------------------------------------------------------------##
# Look through a header/SWIG file and find dependencies
MACRO(get_swig_dependencies _RESULT_VAR _SOURCE)
# Search for dependencies in the SWIG file
FILE(STRINGS ${_SOURCE} HEADER_FILES
REGEX "^[ \t]*%include *\""
)
LIST(REMOVE_DUPLICATES HEADER_FILES)
# Set up test directories
SET(TEST_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${SCALE_SOURCE_DIR}/Exnihilo/packages
${SCALE_SOURCE_DIR}/packages
)
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/python")
LIST(APPEND TEST_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/python")
ENDIF()
# Get just the file names inside each "include"
SET(${_RESULT_VAR})
FOREACH(THEFILE ${HEADER_FILES})
STRING(REGEX REPLACE "^.*\"([^\"]+)\".*$" "\\1" THEFILE ${THEFILE})
IF( THEFILE )
FOREACH(TESTDIR ${TEST_DIRS})
IF(EXISTS ${TESTDIR}/${THEFILE})
LIST(APPEND ${_RESULT_VAR} ${TESTDIR}/${THEFILE})
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
ENDFOREACH()
ENDMACRO()
##---------------------------------------------------------------------------##
## ADDING SWIG MODULES
##---------------------------------------------------------------------------##
# RADIX_ADD_SWIG(
# MODULE module
# [SOURCE src.i]
# [DEPLIBS lib1 [lib2 ...]]
# [DEPMODULES module1 [module2 ...]]
# [EXTRASRC file1 [file2 ...]]
# )
#
# Create a SWIG-generated python module and shared object.
#
# The MODULE argument is the name of the resulting module file. By default it
# assumes the name "module.i", but that can be overriden with the SOURCE
# argument.
#
# All libraries in DEPLIBS will be linked against each target.
#
# Because TriBITS doesn't handle intra-SWIG module dependencies, we add a
# provision for extra dependency generation using the DEPMODULES list. For
# example, kba_utils will have "DEPMODULES denovo_utils ".
#
# The EXTRASRC argument allows additional sources to be compiled into the SWIG
# module target.
IF(ENABLE_PYTHON_WRAPPERS)
MACRO(RADIX_ADD_SWIG)
_RADIX_ADD_SWIG(${ARGN})
ENDMACRO()
# Bug fix: version of CMake older than 2.8.8 don't support the
# INCLUDE_DIRECTORIES property
IF(CMAKE_MAJOR_VERSION LESS 3
AND CMAKE_MINOR_VERSION LESS 9
AND CMAKE_PATCH_VERSION LESS 9)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
ENDIF()
ELSE()
MACRO(RADIX_ADD_SWIG)
# no-op
MESSAGE(STATUS "Skipping python module setup for ${SUBPACKAGE_FULLNAME}")
ENDMACRO()
ENDIF()
##---------------------------------------------------------------------------##
FUNCTION(_RADIX_ADD_SWIG)
cmake_parse_arguments(MKSWIG "NO_ADD_OMPI" "MODULE;SOURCE"
"DEPLIBS;DEPMODULES;EXTRASRC" ${ARGN})
IF(NOT MKSWIG_MODULE)
MESSAGE(SEND_ERROR "Cannot call RADIX_ADD_SWIG without TARGET")
ENDIF()
SET(MODULE_NAME ${MKSWIG_MODULE})
IF(MKSWIG_SOURCE)
SET(SRC_FILE "${MKSWIG_SOURCE}")
ELSE()
SET(SRC_FILE "${MODULE_NAME}.i")
ENDIF()
# Let SWIG know that we're compiling C++ files
SET_SOURCE_FILES_PROPERTIES(${SRC_FILE} PROPERTIES CPLUSPLUS TRUE)
# Get dependencies of main SWIG source file and the files it includes
# we can't do recursive
SET(SUBDEPS ${SRC_FILE})
SET(DEPENDENCIES)
FOREACH(RECURSION 0 1 2)
SET(OLD_SUBDEPS ${SUBDEPS})
SET(SUBDEPS)
FOREACH(DEPENDENCY ${OLD_SUBDEPS})
IF(DEPENDENCY MATCHES "\\.i$")
get_swig_dependencies(SUBSUBDEPS ${DEPENDENCY})
LIST(APPEND SUBDEPS ${SUBSUBDEPS})
ENDIF()
ENDFOREACH()
LIST(APPEND DEPENDENCIES ${SUBDEPS})
ENDFOREACH()
SET(SWIG_MODULE_${MODULE_NAME}_EXTRA_DEPS ${DEPENDENCIES} )
# Add the new python target
IF("${CMAKE_VERSION}" VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(${MODULE_NAME} python
${SRC_FILE} ${MKSWIG_EXTRASRC})
ELSE()
SWIG_ADD_LIBRARY(${MODULE_NAME}
LANGUAGE python
TYPE MODULE
SOURCES ${SRC_FILE} ${MKSWIG_EXTRASRC})
ENDIF()
# Mangled name of the SWIG target
SET(MKSWIG_TARGET ${SWIG_MODULE_${MODULE_NAME}_REAL_NAME})
# It's not always necessary to link against SWIG libraries, but doing so
# can turn unfortunate run-time errors (dlopen) into link-time errors.
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
IF(NOT ${PYTHON_LIBRARIES} MATCHES ".framework")
# Turn off undefined symbol errors on Mac systems where
# Python is not installed as a framework
# see http://bugs.python.org/issue1602133 about _initposix issues
SET_TARGET_PROPERTIES(${MKSWIG_TARGET}
PROPERTIES LINK_FLAGS "-undefined suppress -flat_namespace")
ELSE()
# Otherwise, link against Python libraries
SWIG_LINK_LIBRARIES(${MODULE_NAME} ${PYTHON_LIBRARIES})
ENDIF()
ENDIF()
# Link against other dependent libraries
SWIG_LINK_LIBRARIES(${MODULE_NAME} ${MKSWIG_DEPLIBS})
# Add intra-module dependencies
FOREACH(DEPMODULE ${MKSWIG_DEPMODULES})
ADD_DEPENDENCIES(${MKSWIG_TARGET} _${DEPMODULE})
ENDFOREACH()
# Include the Python directory and current source directory for the SWIG
# targets (SWIG processor and compilation of the resulting CXX file.) We don't
# use the INCLUDE_DIRECTORIES command because because TriBITS will
# propagate the path if we use INCLUDE_DIRECTORIES.
# Apply SWIG_CXX_FLAGS to hide warnings and such.
GET_TARGET_PROPERTY(INCL_DIR _${MODULE_NAME} INCLUDE_DIRECTORIES)
LIST(APPEND INCL_DIR ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
LIST(REMOVE_DUPLICATES INCL_DIR)
SET_TARGET_PROPERTIES(_${MODULE_NAME} PROPERTIES
INCLUDE_DIRECTORIES "${INCL_DIR}"
COMPILE_FLAGS "${SWIG_CXX_FLAGS}")
# define the install targets
INSTALL(TARGETS ${MKSWIG_TARGET}
DESTINATION python)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
DESTINATION python)
# clean up after SWIG (in cmake 2.6 - 2.8)
SET(swig_extra_generated_files)
ENDFUNCTION()
##---------------------------------------------------------------------------##
## end of RadixSWIGPyModules.cmake
##---------------------------------------------------------------------------##
INCLUDE(QtPrlAdditions)
IF(Qt5Core_LIBRARY_DIRS)
SET(Qt5Core_LIBRARY_DIR ${Qt5Core_LIBRARY_DIRS})
ENDIF()
IF(TPL_Qt5Core_LIBRARY_DIRS)
SET(Qt5Core_LIBRARY_DIR ${TPL_Qt5Core_LIBRARY_DIRS})
ENDIF()
IF(Qt5Core_INCLUDE_DIRS)
SET(Qt5Core_INCLUDE_DIR ${Qt5Core_INCLUDE_DIRS})
ENDIF()
IF(TPL_Qt5Core_INCLUDE_DIRS)
SET(Qt5Core_INCLUDE_DIR ${TPL_Qt5Core_INCLUDE_DIRS})
ENDIF()
IF(TPL_Qt5Core_LIBRARIES)
SET(Qt5Core_LIBRARIES ${TPL_Qt5Core_LIBRARIES})
ENDIF()
IF(NOT Qt5Core_REQUIRED_VERSION)
SET(Qt5Core_REQUIRED_VERSION 5.1.0)
ENDIF()
MESSAGE("REQUIRED Qt5Core version: ${Qt5Core_REQUIRED_VERSION}")
FIND_PACKAGE(Qt5Core "${Qt5Core_REQUIRED_VERSION}")
if(NOT Qt5Core_FOUND)
message(" ____")
message(" __,-~~/~ `---.")
message(" _/_,---( , )")
message(" __ / < / ) \\___")
message("- ------===;;;'====------------------===;;;===----- - -")
message(" \\/ ~\"~\"~\"~\"~\"~\\~\"~)~\"/")
message(" (_ ( \\ ( > \\)")
message(" \\_( _ < >_>'")
message(" ~ `-i' ::>|--\"")
message(" I;|.|.|")
message(" <|i::|i|`.")
message(" (` ^'`-' )")
MESSAGE(FATAL_ERROR "Couldn't find Qt5Core. This causes explosions.")
endif()
#
# Bug fix for Qt5 cmake configuration. They do not cache their variables for project use
#
SET(Qt5Core_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} CACHE STRING "")
SET(Qt5Core_MOC_EXECUTABLE ${Qt5Core_MOC_EXECUTABLE} CACHE STRING "")
SET(Qt5Core_RCC_EXECUTABLE ${Qt5Core_RCC_EXECUTABLE} CACHE STRING "")