Skip to content

Commit

Permalink
Merge pull request #2847 from jsiirola/cmake-builder-import
Browse files Browse the repository at this point in the history
Update cmake builder for recent setuptools
  • Loading branch information
blnicho authored May 26, 2023
2 parents aba4632 + 2303e4e commit 8a9747c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
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
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

0 comments on commit 8a9747c

Please sign in to comment.