Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and fix versioning #173

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading