Skip to content

Commit

Permalink
Merge pull request #54 from andrsd/python-version
Browse files Browse the repository at this point in the history
Python module reports package version
  • Loading branch information
andrsd authored Mar 5, 2024
2 parents ab47f73 + 001e1a7 commit e8d2818
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ target_include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
)

target_link_libraries(
Expand All @@ -18,6 +19,8 @@ target_link_libraries(
libfprops
)

configure_file(version.h.in version.h)

install(
TARGETS fprops
COMPONENT python
Expand Down
2 changes: 2 additions & 0 deletions python/src/fprops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "fprops/Nitrogen.h"
#include "fprops/Helium.h"
#include "fprops/CarbonDioxide.h"
#include "version.h"

using namespace fprops;

Expand All @@ -14,6 +15,7 @@ namespace py = pybind11;
PYBIND11_MODULE(fprops, m)
{
m.doc() = "pybind11 plugin for fprops";
py::setattr(m, "version", py::str(FPROPS_VERSION));

py::class_<SinglePhaseFluidProperties> spfp(m, "SinglePhaseFluidProperties");

Expand Down
3 changes: 3 additions & 0 deletions python/src/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define FPROPS_VERSION "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.0"

0 comments on commit e8d2818

Please sign in to comment.