Skip to content

Commit

Permalink
Simplify and fix versioning (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Aug 12, 2023
1 parent 7b8055f commit 3429948
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ option(pyAMReX_IPO
ON
)

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

Expand Down Expand Up @@ -185,11 +183,7 @@ endforeach()

# Defines #####################################################################
#
# for module __version__
foreach(D IN LISTS AMReX_SPACEDIM)
target_compile_definitions(pyAMReX_${D}d PRIVATE
PYAMReX_VERSION_INFO=${pyAMReX_VERSION_INFO})
endforeach()
# none needed - please use AMReX_Config.H


# Warnings ####################################################################
Expand Down
1 change: 1 addition & 0 deletions src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ foreach(D IN LISTS AMReX_SPACEDIM)
PODVector.cpp
Utility.cpp
Vector.cpp
Version.cpp
)
endforeach()
17 changes: 17 additions & 0 deletions src/Base/Version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright 2021-2023 The AMReX Community
*
* License: BSD-3-Clause-LBNL
* Authors: Axel Huebl
*/
#include "pyAMReX.H"

#include <AMReX.H>
#include <AMReX_Version.H>


void init_Version (py::module& m)
{
// API runtime version
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
m.attr("__version__") = amrex::Version();
}
10 changes: 2 additions & 8 deletions src/pyAMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void init_PlotFileUtil(py::module &);
void init_PODVector(py::module &);
void init_Utility(py::module &);
void init_Vector(py::module &);
void init_Version(py::module &);


#if AMREX_SPACEDIM == 1
Expand Down Expand Up @@ -117,14 +118,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
// Wrappers around standalone functions
init_PlotFileUtil(m);
init_Utility(m);

// API runtime version
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
#ifdef PYAMReX_VERSION_INFO
m.attr("__version__") = MACRO_STRINGIFY(PYAMReX_VERSION_INFO);
#else
m.attr("__version__") = "dev";
#endif
init_Version(m);

// authors
m.attr("__author__") =
Expand Down

0 comments on commit 3429948

Please sign in to comment.