mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
generate version.py with cmake
This commit is contained in:
parent
1222356cf4
commit
4f4a3f7c92
@ -49,6 +49,15 @@ endif()
|
|||||||
|
|
||||||
set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH})
|
set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH})
|
||||||
|
|
||||||
|
if(NOT NETGEN_VERSION_GIT)
|
||||||
|
set(NETGEN_VERSION_GIT ${NETGEN_VERSION_LONG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT NETGEN_VERSION_PYTHON)
|
||||||
|
set(NETGEN_VERSION_PYTHON ${NETGEN_VERSION_TWEAK})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(version_file ${BDIR}/netgen_version.hpp)
|
set(version_file ${BDIR}/netgen_version.hpp)
|
||||||
set(new_version_file_string "\
|
set(new_version_file_string "\
|
||||||
#ifndef NETGEN_VERSION_HPP_INCLUDED
|
#ifndef NETGEN_VERSION_HPP_INCLUDED
|
||||||
|
@ -5,9 +5,12 @@ if(have_options)
|
|||||||
endif(have_options)
|
endif(have_options)
|
||||||
|
|
||||||
configure_file(config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
|
configure_file(config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
|
||||||
|
configure_file(version_template.py ${CMAKE_CURRENT_BINARY_DIR}/version.py @ONLY)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/config.py __main__.py __init__.py
|
${CMAKE_CURRENT_BINARY_DIR}/config.py
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/version.py
|
||||||
|
__main__.py __init__.py
|
||||||
meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py
|
meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py
|
||||||
webgui.py
|
webgui.py
|
||||||
DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}
|
DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}
|
||||||
|
2
python/version_template.py
Normal file
2
python/version_template.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
__version__ = "@NETGEN_VERSION_PYTHON@"
|
||||||
|
__package_name__ = "@NETGEN_PYTHON_PACKAGE_NAME@"
|
6
setup.py
6
setup.py
@ -31,8 +31,6 @@ if len(version)>2:
|
|||||||
version = version[:2]
|
version = version[:2]
|
||||||
version = '.dev'.join(version)
|
version = '.dev'.join(version)
|
||||||
|
|
||||||
version_file = os.path.join(os.path.dirname(__file__), "python", "version.py")
|
|
||||||
|
|
||||||
py_install_dir = get_python_lib(1,0,'').replace('\\','/')
|
py_install_dir = get_python_lib(1,0,'').replace('\\','/')
|
||||||
|
|
||||||
name = "netgen-mesher"
|
name = "netgen-mesher"
|
||||||
@ -88,10 +86,6 @@ cmake_args += [
|
|||||||
if 'PYDIR' in os.environ:
|
if 'PYDIR' in os.environ:
|
||||||
cmake_args += [f'-DCMAKE_PREFIX_PATH={os.environ["PYDIR"]}']
|
cmake_args += [f'-DCMAKE_PREFIX_PATH={os.environ["PYDIR"]}']
|
||||||
|
|
||||||
with open(version_file, "w") as f:
|
|
||||||
f.write(f'__version__ = "{version}"\n')
|
|
||||||
f.write(f'__package_name__ = "{name}"\n')
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=name,
|
name=name,
|
||||||
version=version,
|
version=version,
|
||||||
|
Loading…
Reference in New Issue
Block a user