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

Update cmake builder for recent setuptools #2847

Merged
merged 2 commits into from
May 26, 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
21 changes: 18 additions & 3 deletions doc/OnlineDocs/contributed_packages/pynumero/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ https://github.com/Pyomo/pyomo/blob/main/pyomo/contrib/pynumero/build.py
and
https://github.com/Pyomo/pyomo/blob/main/pyomo/contrib/pynumero/src/CMakeLists.txt.

Note that you will need a C++ compiler and CMake installed to build the
PyNumero libraries.

Method 1
--------

One way to build PyNumero extensions is with the pyomo
download-extensions and build-extensions subcommands. Note that
`download-extensions` and `build-extensions` subcommands. Note that
this approach will build PyNumero without support for the HSL linear
solvers. ::

Expand All @@ -27,6 +30,18 @@ Method 2
If you want PyNumero support for the HSL solvers and you have an IPOPT compilation
for your machine, you can build PyNumero using the build script ::

cd pyomo/contrib/pynumero/
python build.py -DBUILD_ASL=ON -DBUILD_MA27=ON -DIPOPT_DIR=<path/to/ipopt/build/>
python -m pyomo.contrib.pynumero.build -DBUILD_ASL=ON -DBUILD_MA27=ON -DIPOPT_DIR=<path/to/ipopt/build/>

Method 3
--------

You can build the PyNumero libraries from source using `cmake`. This
generally works best when building from a source distribution of Pyomo.
Assuming that you are starting in the root of the Pyomo source
distribution, you can follow the normal CMake build process ::

mkdir build
cd build
ccmake ../pyomo/contrib/pynumero/src
blnicho marked this conversation as resolved.
Show resolved Hide resolved
make
make install
4 changes: 3 additions & 1 deletion pyomo/common/cmake_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def handleReadonly(function, path, excinfo):
def build_cmake_project(
targets, package_name=None, description=None, user_args=[], parallel=None
):
import distutils.core
# Note: setuptools must be imported before distutils to avoid
# warnings / errors with recent setuptools distributions
from setuptools import Extension
import distutils.core
from distutils.command.build_ext import build_ext

class _CMakeBuild(build_ext, object):
Expand Down