Turn some .i files into .swig

This helps with the import / export process.
This commit is contained in:
Guillaume Chatelet
2025-07-02 12:20:11 +00:00
parent b644c5fb1e
commit 6af8bd54b4
50 changed files with 121 additions and 118 deletions

View File

@@ -11,15 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set_property(SOURCE linear_solver.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE linear_solver.i PROPERTY SWIG_MODULE_NAME pywraplp)
set_property(SOURCE linear_solver.i PROPERTY COMPILE_DEFINITIONS
set_property(SOURCE linear_solver.swig PROPERTY CPLUSPLUS ON)
set_property(SOURCE linear_solver.swig PROPERTY SWIG_MODULE_NAME pywraplp)
set_property(SOURCE linear_solver.swig PROPERTY COMPILE_DEFINITIONS
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
swig_add_library(pywraplp
TYPE MODULE
LANGUAGE python
OUTPUT_DIR ${PYTHON_PROJECT_DIR}/linear_solver
SOURCES linear_solver.i)
SOURCES linear_solver.swig)
target_include_directories(pywraplp PRIVATE ${Python3_INCLUDE_DIRS})
set_property(TARGET pywraplp PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)

View File

@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// This .i file exposes the linear programming and integer programming
// This .swig file exposes the linear programming and integer programming
// solver. See the C++/Python codelab: .
//
// The python API is enriched by custom code defined here, making it
@@ -35,7 +35,7 @@
%include "ortools/util/python/proto.i"
%import "ortools/util/python/vector.i"
%import "ortools/util/python/vector.swig"
// We need to forward-declare the proto here, so that the PROTO_* macros
// involving them work correctly. The order matters very much: this declaration

View File

@@ -13,7 +13,7 @@
"""Patch to the python wrapper of ../linear_solver.h providing an algebraic API.
This is directly imported, and use exclusively in ./linear_solver.i. See that
This is directly imported, and use exclusively in ./linear_solver.swig. See that
file.
For examples leveraging the code defined here, see ./pywraplp_test.py and
../../../python/linear_programming.py.

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Simple unit tests for python/linear_solver.i. Not exhaustive."""
"""Simple unit tests for python/linear_solver.swig. Not exhaustive."""
import unittest
from ortools.linear_solver import linear_solver_pb2