Skip to content

Commit

Permalink
fix loggin level and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
fnrizzi committed Jan 26, 2021
1 parent 8fce926 commit af8f93a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ pybind11_add_module(pressio4py ${PRESSIO4PY_SRC_DIR}/pressio4py.cc)
# VERSION_INFO is defined by setup.py and passed into the C++ code
target_compile_definitions(pressio4py PRIVATE VERSION_IN=${VERSION_INFO})

if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
# 2 corresponds to info which is on for release
target_compile_definitions(pressio4py PRIVATE PRESSIO_LOG_ACTIVE_MIN_LEVEL=2)
endif()

#=====================================================================
### display some info
#=====================================================================
Expand Down
2 changes: 1 addition & 1 deletion pressio
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def build_extension(self, ext):
# Can be set with Conda-Build, for example.
cmake_generator = os.environ.get("CMAKE_GENERATOR", "")

cfg = "Debug" if self.debug else "Release"

#------------------------
# --- pressio ---
#------------------------
Expand All @@ -43,6 +45,7 @@ def build_extension(self, ext):
cmake_args = [
"-DPRESSIO_ENABLE_TPL_EIGEN=OFF",
"-DPRESSIO_ENABLE_TPL_PYBIND11=ON",
"-DCMAKE_BUILD_TYPE={}".format(cfg),
"-DCMAKE_INSTALL_PREFIX={}".format(pressioPfxDir),
]
if not os.path.exists(pressioBuildDir): os.makedirs(pressioBuildDir)
Expand All @@ -58,8 +61,6 @@ def build_extension(self, ext):
#------------------------
# --- pressio4py ---
#------------------------
cfg = "Debug" if self.debug else "Release"

# Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON
# EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code
# from Python.
Expand Down Expand Up @@ -99,7 +100,7 @@ def build_extension(self, ext):

setup(
name="pressio4py",
version="0.6.1rc5",
version="0.6.2rc1",
author="Francesco Rizzi",
author_email="[email protected]",
description="pressio4py: projection-based model reduction for Python",
Expand All @@ -119,7 +120,6 @@ def build_extension(self, ext):
classifiers=[
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Environment :: MacOS X",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
Expand Down
6 changes: 3 additions & 3 deletions src/pressio4py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ PYBIND11_MODULE(pressio4py, mParent)
//*****************
// bind logging
//*****************
// make sure to redirect stdout/stderr streams to python stdout
pybind11::add_ostream_redirect(mParent, "ostream_redirect");

pybind11::module loggerModule = mParent.def_submodule("logger");
pybind11::enum_<pressio::logto>(loggerModule, "logto")
.value("terminal", pressio::logto::terminal)
Expand All @@ -102,9 +105,6 @@ PYBIND11_MODULE(pressio4py, mParent)
.value("off", pressio::log::level::off)
.export_values();

// make sure to redirect stdout/stderr streams to python stdout
pybind11::add_ostream_redirect(mParent, "ostream_redirect");

// bind the initialization and setVerbosity functions
loggerModule.def("initialize",
&pressio::log::initialize);
Expand Down

0 comments on commit af8f93a

Please sign in to comment.