Skip to content

Commit 3429948

Browse files
authored
Simplify and fix versioning (#173)
1 parent 7b8055f commit 3429948

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ option(pyAMReX_IPO
5959
ON
6060
)
6161

62-
set(pyAMReX_VERSION_INFO "" CACHE STRING
63-
"PEP-440 conformant version (set by distutils)")
6462
# change the default build type to Release (or RelWithDebInfo) instead of Debug
6563
set_default_build_type("Release")
6664

@@ -185,11 +183,7 @@ endforeach()
185183

186184
# Defines #####################################################################
187185
#
188-
# for module __version__
189-
foreach(D IN LISTS AMReX_SPACEDIM)
190-
target_compile_definitions(pyAMReX_${D}d PRIVATE
191-
PYAMReX_VERSION_INFO=${pyAMReX_VERSION_INFO})
192-
endforeach()
186+
# none needed - please use AMReX_Config.H
193187

194188

195189
# Warnings ####################################################################

src/Base/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ foreach(D IN LISTS AMReX_SPACEDIM)
2424
PODVector.cpp
2525
Utility.cpp
2626
Vector.cpp
27+
Version.cpp
2728
)
2829
endforeach()

src/Base/Version.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Copyright 2021-2023 The AMReX Community
2+
*
3+
* License: BSD-3-Clause-LBNL
4+
* Authors: Axel Huebl
5+
*/
6+
#include "pyAMReX.H"
7+
8+
#include <AMReX.H>
9+
#include <AMReX_Version.H>
10+
11+
12+
void init_Version (py::module& m)
13+
{
14+
// API runtime version
15+
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
16+
m.attr("__version__") = amrex::Version();
17+
}

src/pyAMReX.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void init_PlotFileUtil(py::module &);
4141
void init_PODVector(py::module &);
4242
void init_Utility(py::module &);
4343
void init_Vector(py::module &);
44+
void init_Version(py::module &);
4445

4546

4647
#if AMREX_SPACEDIM == 1
@@ -117,14 +118,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
117118
// Wrappers around standalone functions
118119
init_PlotFileUtil(m);
119120
init_Utility(m);
120-
121-
// API runtime version
122-
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
123-
#ifdef PYAMReX_VERSION_INFO
124-
m.attr("__version__") = MACRO_STRINGIFY(PYAMReX_VERSION_INFO);
125-
#else
126-
m.attr("__version__") = "dev";
127-
#endif
121+
init_Version(m);
128122

129123
// authors
130124
m.attr("__author__") =

0 commit comments

Comments
 (0)