Skip to content
Snippets Groups Projects
Commit fe46a4c0 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

Merge remote-tracking branch 'origin/dynamic_module_version' into update-functions-bindings

parents 2d662f72 e187dd8f
No related branches found
No related tags found
1 merge request!83update-functions-bindings-into-master
...@@ -39,10 +39,15 @@ list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH} ${PROJECT_SOURCE_DIR}/c ...@@ -39,10 +39,15 @@ list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH} ${PROJECT_SOURCE_DIR}/c
# include the dune macros # include the dune macros
include(DuneMacros) include(DuneMacros)
include(DuneUtils)
# start a dune project with information from dune.module # start a dune project with information from dune.module
dune_project() dune_project()
# (re-)set version info from git if available
include(DuneXtVersionHelper)
dune_xt_module_version_from_git(dune-xt)
# dune-xt cmake includes # dune-xt cmake includes
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
......
...@@ -15,6 +15,7 @@ install(FILES AddALUGridCompileFlags.cmake ...@@ -15,6 +15,7 @@ install(FILES AddALUGridCompileFlags.cmake
DuneTBB.cmake DuneTBB.cmake
DuneUtils.cmake DuneUtils.cmake
DuneXtMacros.cmake DuneXtMacros.cmake
DuneXtVersionHelper.cmake
DunePybindxiMacros.cmake DunePybindxiMacros.cmake
DunePybindxiUtils.cmake DunePybindxiUtils.cmake
FindPythonLibsNew.cmake FindPythonLibsNew.cmake
......
...@@ -108,3 +108,18 @@ macro(add_pylicense) ...@@ -108,3 +108,18 @@ macro(add_pylicense)
endforeach(cfg ${configs}) endforeach(cfg ${configs})
add_custom_target(license DEPENDS ${cfg_targets}) add_custom_target(license DEPENDS ${cfg_targets})
endmacro(add_pylicense) endmacro(add_pylicense)
function(dump_cmake_variables)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
endfunction()
...@@ -19,6 +19,8 @@ include(XtCompilerSupport) ...@@ -19,6 +19,8 @@ include(XtCompilerSupport)
include(XtTooling) include(XtTooling)
include(Hints) include(Hints)
set(DXT_DONT_LINK_PYTHON_LIB ${DXT_DONT_LINK_PYTHON_LIB} CACHE STRING "wheelbuilders want to set this to 1")
# library checks ######################################################################### # library checks #########################################################################
find_package(PkgConfig) find_package(PkgConfig)
......
macro(dune_xt_module_version_from_git TARGET_MODULE)
dune_module_to_uppercase(TARGET_MODULE_UPPER ${TARGET_MODULE})
if(dune-xt_MODULE_PATH)
set(VERSIONEER_DIR ${dune-xt_MODULE_PATH})
else()
set(VERSIONEER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
endif()
if(${TARGET_MODULE}_SOURCE_DIR)
# the "self" case
set(_MODULE_SOURCE_DIR ${${TARGET_MODULE}_SOURCE_DIR})
else()
# the "other module" case
set(_MODULE_SOURCE_DIR ${${TARGET_MODULE}_PPREFIX})
endif()
execute_process(COMMAND
${PYTHON_EXECUTABLE}
${VERSIONEER_DIR}/versioneer.py
${_MODULE_SOURCE_DIR}
WORKING_DIRECTORY ${_MODULE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
ERROR_VARIABLE GIT_DESCRIBE_ERROR
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(GIT_DESCRIBE_ERROR_CODE)
message(FATAL_ERROR "Extracting version information failed: ${GIT_DESCRIBE_ERROR}")
endif()
foreach(_MOD_VAR ${TARGET_MODULE} ${TARGET_MODULE_UPPER})
set(${_MOD_VAR}_VERSION ${GIT_DESCRIBE_VERSION})
# Reset variables from dune-common/cmake/modules/DuneMacros.cmake:dune_module_information
extract_major_minor_version("${GIT_DESCRIBE_VERSION}" DUNE_VERSION)
set(${_MOD_VAR}_VERSION_MAJOR "${DUNE_VERSION_MAJOR}")
set(${_MOD_VAR}_VERSION_MINOR "${DUNE_VERSION_MINOR}")
set(${_MOD_VAR}_VERSION_REVISION "${DUNE_VERSION_REVISION}")
endforeach(_MOD_VAR)
set(CPACK_PACKAGE_NAME "${DUNE_MOD_NAME}")
set(CPACK_PACKAGE_VERSION "${DUNE_VERSION_MAJOR}.${DUNE_VERSION_MINOR}.${DUNE_VERSION_REVISION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}" "\\\\.svn" "\\\\.git" ".*/*\\\\.gitignore")
# reset variables from dune-common/cmake/modules/DuneMacros.cmake:dune_project
set(ProjectVersion "${GIT_DESCRIBE_VERSION}")
set(ProjectVersionString "${DUNE_VERSION_MAJOR}.${DUNE_VERSION_MINOR}.${DUNE_VERSION_REVISION}")
set(ProjectVersionMajor "${DUNE_VERSION_MAJOR}")
set(ProjectVersionMinor "${DUNE_VERSION_MINOR}")
set(ProjectVersionRevision "${DUNE_VERSION_REVISION}")
# need to re-run template insertion
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/${ProjectName}-config-version.cmake.in)
file(WRITE ${PROJECT_BINARY_DIR}/CMakeFiles/${ProjectName}-config-version.cmake.in
"set(PACKAGE_VERSION \"${ProjectVersionString}\")
if(\"\${PACKAGE_FIND_VERSION_MAJOR}\" EQUAL \"${ProjectVersionMajor}\" AND
\"\${PACKAGE_FIND_VERSION_MINOR}\" EQUAL \"${ProjectVersionMinor}\")
set (PACKAGE_VERSION_COMPATIBLE 1) # compatible with newer
if (\"\${PACKAGE_FIND_VERSION}\" VERSION_EQUAL \"${ProjectVersionString}\")
set(PACKAGE_VERSION_EXACT 1) #exact match for this version
endif()
endif()
")
set(CONFIG_VERSION_FILE ${PROJECT_BINARY_DIR}/CMakeFiles/${ProjectName}-config-version.cmake.in)
else()
set(CONFIG_VERSION_FILE ${PROJECT_SOURCE_DIR}/${ProjectName}-config-version.cmake.in)
endif()
configure_file(
${CONFIG_VERSION_FILE}
${PROJECT_BINARY_DIR}/${ProjectName}-config-version.cmake @ONLY)
endmacro(dune_xt_module_version_from_git)
This diff is collapsed.
...@@ -18,4 +18,4 @@ add_subdirectory(grid) ...@@ -18,4 +18,4 @@ add_subdirectory(grid)
add_subdirectory(la) add_subdirectory(la)
add_subdirectory(test) add_subdirectory(test)
dune_pybindxi_add_module(_version EXCLUDE_FROM_ALL version.cc) configure_file(_version.py.in _version.py)
# ~~~
# This file is part of the dune-xt project:
# https://github.com/dune-community/dune-xt
# Copyright 2009-2020 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# Felix Schindler (2014, 2016 - 2017, 2019)
# René Fritze (2012, 2015 - 2016, 2018 - 2019)
# Tim Keil (2019)
# Tobias Leibner (2019 - 2020)
# ~~~
__version__ = "${dune-xt_VERSION}"
...@@ -14,7 +14,6 @@ from pkg_resources import resource_filename, resource_stream ...@@ -14,7 +14,6 @@ from pkg_resources import resource_filename, resource_stream
import pkgutil import pkgutil
import logging import logging
import pprint import pprint
from loguru import logger
def load_all_submodule(module): def load_all_submodule(module):
......
// This file is part of the dune-xt project:
// https://github.com/dune-community/dune-xt
// Copyright 2009-2018 dune-xt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2020)
#include "config.h"
#include <dune/pybindxi/pybind11.h>
// see https://stackoverflow.com/questions/240353/convert-a-preprocessor-token-to-a-string
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
PYBIND11_MODULE(_version, m)
{
m.attr("__version__") = pybind11::str(TOSTRING(DUNE_XT_VERSION));
}
#undef TOSTRING
#undef STRINGIFY
# This file is autogenerated. Edit dependencies.py instead
[build-system]
requires = ['setuptools', 'wheel', 'packaging']
build-backend = "setuptools.build_meta"
...@@ -17,13 +17,20 @@ from setuptools import setup, find_packages ...@@ -17,13 +17,20 @@ from setuptools import setup, find_packages
from setuptools.dist import Distribution from setuptools.dist import Distribution
from setuptools.command.install import install from setuptools.command.install import install
requires=['binpacking==1.3', 'cython', 'jinja2', 'docopt', 'pylicense3>=0.4.1', requires=['ipython','numpy', 'scipy']
'ipython', 'pytest', 'pytest-cov', 'cmake_format==0.4.1',
'codecov', 'yapf==0.25', 'loguru', 'numpy', 'scipy', 'matplotlib', extras_require = {
'k3d==2.6.6', 'vtk', 'ipywidgets', 'lxml', 'xmljson'] 'visualisation': ( 'k3d', 'vtk', 'ipywidgets', 'lxml', 'xmljson',
extras_require = [] 'matplotlib',),
'infrastructure': ('pylicense3>=0.4.1', 'pytest', 'pytest-cov',
'cmake_format==0.4.1', 'codecov', 'yapf==0.25',
'jinja2', ),
}
if '${HAVE_MPI}' == 'TRUE': if '${HAVE_MPI}' == 'TRUE':
extras_require.append('mpi4py') extras_require['parallel'] = ('mpi4py',)
extras_require['all'] = [p for plist in extras_require.values() for p in plist]
class BinaryDistribution(Distribution): class BinaryDistribution(Distribution):
"""Distribution which always forces a binary package with platform name""" """Distribution which always forces a binary package with platform name"""
...@@ -40,7 +47,7 @@ class InstallPlatlib(install): ...@@ -40,7 +47,7 @@ class InstallPlatlib(install):
setup(name='dune-xt', setup(name='dune-xt',
version='${DUNE_XT_VERSION}', version='${dune-xt_VERSION}',
namespace_packages=['dune'], namespace_packages=['dune'],
setup_requires=['wheel'], setup_requires=['wheel'],
description='Python for Dune-Xt', description='Python for Dune-Xt',
...@@ -55,7 +62,7 @@ setup(name='dune-xt', ...@@ -55,7 +62,7 @@ setup(name='dune-xt',
}, },
distclass=BinaryDistribution, distclass=BinaryDistribution,
install_requires=requires, install_requires=requires,
extras_require={'parallel': extras_require}, extras_require=extras_require,
scripts=['./scripts/generate_compare_functions.py', scripts=['./scripts/generate_compare_functions.py',
'./scripts/distribute_testing.py', './scripts/distribute_testing.py',
'./scripts/dxt_code_generation.py', './scripts/dxt_code_generation.py',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment