diff --git a/include/GooseFEM/version.h b/include/GooseFEM/version.h index 374f3b8..72fe543 100644 --- a/include/GooseFEM/version.h +++ b/include/GooseFEM/version.h @@ -1,62 +1,62 @@ /** Version information. \file version.h \copyright Copyright 2017. Tom de Geus. All rights reserved. \license This project is released under the GNU Public License (GPLv3). */ #ifndef GOOSEFEM_VERSION_H #define GOOSEFEM_VERSION_H #include "config.h" /** Current version. Either: - Configure using CMake at install time. Internally uses:: python -c "from setuptools_scm import get_version; print(get_version())" - Define externally using:: -DGOOSEFEM_VERSION="`python -c "from setuptools_scm import get_version; print(get_version())"`" From the root of this project. This is what ``setup.py`` does. Note that both ``CMakeLists.txt`` and ``setup.py`` will construct the version string using -*setuptools_scm* **unless** an environment ``PKG_VERSION`` is defined. +``setuptools_scm`` **unless** an environment ``PKG_VERSION`` is defined. If ``PKG_VERSION`` is defined the version string will be read from that variable. */ #ifndef GOOSEFEM_VERSION #define GOOSEFEM_VERSION "@GOOSEFEM_VERSION@" #endif namespace GooseFEM { /** Return version string, e.g. "0.8.0" \return std::string */ inline std::string version(); /** Return versions of this library and of all of its dependencies. The output is a list of strings, e.g.:: "goosefem=0.7.0", "xtensor=0.20.1" ... \return List of strings. */ inline std::vector version_dependencies(); } // namespace GooseFEM #include "version.hpp" #endif diff --git a/setup.py b/setup.py index c906452..f544db9 100644 --- a/setup.py +++ b/setup.py @@ -1,55 +1,55 @@ from setuptools import setup, Extension import re import os import pybind11 import pyxtensor from os import environ version = environ.get('PKG_VERSION') if version is None: from setuptools_scm import get_version version = get_version() include_dirs = [ os.path.abspath('include/'), pyxtensor.find_pyxtensor(), pyxtensor.find_pybind11(), pyxtensor.find_xtensor(), pyxtensor.find_xtl(), pyxtensor.find_eigen()] build = pyxtensor.BuildExt xsimd = pyxtensor.find_xsimd() if xsimd: if len(xsimd) > 0: include_dirs += [xsimd] build.c_opts['unix'] += ['-march=native', '-DXTENSOR_USE_XSIMD'] build.c_opts['msvc'] += ['/DXTENSOR_USE_XSIMD'] build.c_opts['unix'] += ['-DGOOSEFEM_VERSION="{0:s}"'.format(version)] -build.c_opts['msvc'] += ['/DGOOSEFEM_VERSION="{0:s}"'.format(version)] +build.c_opts['msvc'] += ['/DGOOSEFEM_VERSION=\\"{0:s}\\"'.format(version)] ext_modules = [Extension( 'GooseFEM', ['python/main.cpp'], include_dirs = include_dirs, language = 'c++')] setup( name = 'GooseFEM', description = 'Finite element meshes, quadrature, and assembly tools', long_description = 'Finite element meshes, quadrature, and assembly tools', version = version, license = 'GPLv3', author = 'Tom de Geus', author_email = 'tom@geus.me', url = 'https://github.com/tdegeus/GooseFEM', ext_modules = ext_modules, install_requires = ['pybind11', 'pyxtensor'], cmdclass = {'build_ext': build}, zip_safe = False)