Turn some .i files into .swig
This helps with the import / export process.
This commit is contained in:
@@ -20,6 +20,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
|
||||
endif()
|
||||
|
||||
# Will need swig
|
||||
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
|
||||
set(CMAKE_SWIG_FLAGS)
|
||||
find_package(SWIG REQUIRED)
|
||||
include(UseSWIG)
|
||||
|
||||
@@ -20,6 +20,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
|
||||
endif()
|
||||
|
||||
# Will need swig
|
||||
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
|
||||
set(CMAKE_SWIG_FLAGS)
|
||||
find_package(SWIG REQUIRED)
|
||||
include(UseSWIG)
|
||||
|
||||
@@ -23,6 +23,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
|
||||
endif()
|
||||
|
||||
# Will need swig
|
||||
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
|
||||
set(CMAKE_SWIG_FLAGS)
|
||||
find_package(SWIG REQUIRED)
|
||||
include(UseSWIG)
|
||||
|
||||
@@ -17,7 +17,7 @@ load("//bazel:swig_java.bzl", "ortools_java_wrap_cc")
|
||||
|
||||
ortools_java_wrap_cc(
|
||||
name = "knapsacksolver",
|
||||
src = "knapsack_solver.i",
|
||||
src = "knapsack_solver.swig",
|
||||
module = "operations_research_algorithms",
|
||||
package = "com.google.ortools.algorithms",
|
||||
swig_includes = [
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE knapsack_solver.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE knapsack_solver.i PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE knapsack_solver.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE knapsack_solver.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE knapsack_solver.swig PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE knapsack_solver.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE knapsack_solver.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE knapsack_solver.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.algorithms)
|
||||
swig_add_library(jnialgorithms
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/algorithms
|
||||
SOURCES knapsack_solver.i)
|
||||
SOURCES knapsack_solver.swig)
|
||||
|
||||
target_include_directories(jnialgorithms PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnialgorithms PROPERTIES
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
%include "enums.swg"
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%import "ortools/util/java/vector.i"
|
||||
%import "ortools/util/java/vector.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/algorithms/knapsack_solver.h"
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// Static part of SWIG-generated C++ wrapper for Python (_module_name.cc).
|
||||
//
|
||||
// This file should only be included in base.i inside Python-specific part:
|
||||
// This file should only be included in base.swig inside Python-specific part:
|
||||
// #ifdef SWIGPYTHON
|
||||
// %{
|
||||
// #include "ortools/base/swig/python-swig.cc"
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE constraint_solver.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY SWIG_MODULE_NAME Globals)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY SWIG_MODULE_NAME Globals)
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.constraintsolver)
|
||||
swig_add_library(jniconstraint_solver
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/constraintsolver
|
||||
SOURCES constraint_solver.i)
|
||||
SOURCES constraint_solver.swig)
|
||||
|
||||
target_include_directories(jniconstraint_solver PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jniconstraint_solver PROPERTIES
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
%include "exception.i"
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/util/java/absl_string_view.i"
|
||||
%include "ortools/util/java/tuple_set.i"
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/absl_string_view.swig"
|
||||
%include "ortools/util/java/tuple_set.swig"
|
||||
%include "ortools/util/java/vector.swig"
|
||||
%include "ortools/util/java/proto.i"
|
||||
|
||||
// Make the SWIG-generated constructor public.
|
||||
@@ -82,7 +82,7 @@ class GlobalRefGuard {
|
||||
%}
|
||||
|
||||
// ############ BEGIN DUPLICATED CODE BLOCK ############
|
||||
// IMPORTANT: keep this code block in sync with the .i
|
||||
// IMPORTANT: keep this code block in sync with the .swig
|
||||
// files in ../python and ../csharp.
|
||||
|
||||
// Protect from failure.
|
||||
@@ -32,16 +32,16 @@ target_link_libraries(constraint_solver_pybind11 PRIVATE
|
||||
add_library(${PROJECT_NAMESPACE}::constraint_solver_pybind11 ALIAS constraint_solver_pybind11)
|
||||
|
||||
# legacy pywrapcp
|
||||
set_property(SOURCE constraint_solver.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY SWIG_MODULE_NAME pywrapcp)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY SWIG_MODULE_NAME pywrapcp)
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE constraint_solver.i PROPERTY COMPILE_OPTIONS -nofastunpack)
|
||||
set_property(SOURCE constraint_solver.swig PROPERTY COMPILE_OPTIONS -nofastunpack)
|
||||
swig_add_library(pywrapcp
|
||||
TYPE MODULE
|
||||
LANGUAGE python
|
||||
OUTPUT_DIR ${PYTHON_PROJECT_DIR}/constraint_solver
|
||||
SOURCES constraint_solver.i)
|
||||
SOURCES constraint_solver.swig)
|
||||
|
||||
target_include_directories(pywrapcp PRIVATE ${Python3_INCLUDE_DIRS})
|
||||
set_property(TARGET pywrapcp PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This .i file exposes the code declared in ../constraint_solver.h and
|
||||
// This .swig file exposes the code declared in ../constraint_solver.h and
|
||||
// ../constraint_solveri.h.
|
||||
//
|
||||
// It is particularly complex for a swig file, mostly because it contains a
|
||||
@@ -35,12 +35,12 @@
|
||||
%include "ortools/util/python/proto.i"
|
||||
|
||||
// PY_CONVERT_HELPER_* macros.
|
||||
%include "ortools/constraint_solver/python/constraint_solver_helpers.i"
|
||||
%include "ortools/constraint_solver/python/constraint_solver_helpers.swig"
|
||||
|
||||
%include "ortools/util/python/functions.i"
|
||||
%include "ortools/util/python/vector.i"
|
||||
%include "ortools/util/python/functions.swig"
|
||||
%include "ortools/util/python/vector.swig"
|
||||
|
||||
%include "ortools/constraint_solver/python/pywrapcp_util.i"
|
||||
%include "ortools/constraint_solver/python/pywrapcp_util.swig"
|
||||
|
||||
// We *do* need to use SWIGTYPE_... type names directly, because the
|
||||
// (recommended replacement) $descriptor macro fails, as of 2019-07, with
|
||||
@@ -103,7 +103,7 @@ struct FailureProtect {
|
||||
|
||||
// ============= Type conversions ==============
|
||||
|
||||
// See ./constraint_solver_helpers.i
|
||||
// See ./constraint_solver_helpers.swig
|
||||
PY_CONVERT_HELPER_PTR(Constraint);
|
||||
PY_CONVERT_HELPER_PTR(Decision);
|
||||
PY_CONVERT_HELPER_PTR(DecisionBuilder);
|
||||
@@ -131,7 +131,7 @@ PY_CONVERT(LocalSearchFilter);
|
||||
PY_CONVERT(LocalSearchFilterManager);
|
||||
|
||||
// Support passing std::function<void(Solver*)> as argument.
|
||||
// See ../utils/python/functions.i, from which this was copied and adapted.
|
||||
// See ../utils/python/functions.swig, from which this was copied and adapted.
|
||||
|
||||
%{
|
||||
static void PyFunctionSolverToVoid(PyObject* pyfunc,
|
||||
@@ -647,10 +647,10 @@ PY_STRINGIFY_DEBUGSTRING(Decision);
|
||||
}
|
||||
|
||||
// ############ BEGIN DUPLICATED CODE BLOCK ############
|
||||
// IMPORTANT: keep this code block in sync with the .i
|
||||
// IMPORTANT: keep this code block in sync with the .swig
|
||||
// files in ../java and ../csharp.
|
||||
// TODO(user): extract this duplicated code into a common, multi-language
|
||||
// .i file with SWIG_exception.
|
||||
// .swig file with SWIG_exception.
|
||||
|
||||
// Protect from failure.
|
||||
// TODO(user): document this further.
|
||||
@@ -1911,7 +1911,7 @@ RENAME_ASSIGNMENT_CONTAINER(
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
// ================= constraint_solver.i API =====================
|
||||
// ================= constraint_solver.swig API =====================
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -5715,7 +5715,7 @@ static const char* __doc_operations_research_Solver_SetUseFastLocalSearch =
|
||||
R"doc(enabled for metaheuristics. Disables/enables fast local search.)doc";
|
||||
|
||||
static const char* __doc_operations_research_Solver_ShouldFail =
|
||||
R"doc(See http://cs/file:constraint_solver.i%20ShouldFail.)doc";
|
||||
R"doc(See http://cs/file:constraint_solver.swig%20ShouldFail.)doc";
|
||||
|
||||
static const char* __doc_operations_research_Solver_Solve =
|
||||
R"doc(@{ Solves the problem using the given DecisionBuilder and returns true
|
||||
|
||||
@@ -32,7 +32,7 @@ PyObject* PyObjFrom<int64_t>(const int64_t& c) {
|
||||
|
||||
// Conversion of IntExpr* and IntVar* are a bit special because of the two
|
||||
// possible casts from IntExpr and Constraint. We define them here because
|
||||
// they are used by both constraint_solver.i and routing.i, but need to
|
||||
// they are used by both constraint_solver.swig and routing.swig, but need to
|
||||
// be defined at a point where IntVar/IntExpr are known.
|
||||
%define PY_CONVERT_HELPER_INTEXPR_AND_INTVAR()
|
||||
%{
|
||||
@@ -11,11 +11,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This .i file cannot be used in isolation!
|
||||
// It represents some of the inlined C++ content of ./constraint_solver.i,
|
||||
// This .swig file cannot be used in isolation!
|
||||
// It represents some of the inlined C++ content of ./constraint_solver.swig,
|
||||
// and was split out because it's a large enough chunk of C++ code.
|
||||
//
|
||||
// It can only be interpreted in the context of ./constraint_solver.i, where
|
||||
// It can only be interpreted in the context of ./constraint_solver.swig, where
|
||||
// it is included.
|
||||
%{
|
||||
#include <string>
|
||||
@@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This .i file is only used in the open-source export to OR-Tools.
|
||||
// This .swig file is only used in the open-source export to OR-Tools.
|
||||
//
|
||||
// It exposes some of the C++ classes in ../, namely :
|
||||
// - SimpleMaxFlow, from ../max_flow.h
|
||||
|
||||
@@ -19,7 +19,7 @@ load("//bazel:swig_java.bzl", "ortools_java_wrap_cc")
|
||||
|
||||
ortools_java_wrap_cc(
|
||||
name = "graph",
|
||||
src = "graph.i",
|
||||
src = "graph.swig",
|
||||
module = "graph",
|
||||
package = "com.google.ortools.graph",
|
||||
swig_includes = [
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE graph.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE graph.i PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE graph.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE graph.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE graph.swig PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE graph.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE graph.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE graph.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.graph)
|
||||
swig_add_library(jnigraph
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/graph
|
||||
SOURCES graph.i)
|
||||
SOURCES graph.swig)
|
||||
|
||||
target_include_directories(jnigraph PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnigraph PROPERTIES
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This .i files exposes some of the C++ classes in ../, namely :
|
||||
// This .swig files exposes some of the C++ classes in ../, namely :
|
||||
// - MaxFlow, from SimpleMaxFlow in ../max_flow.h
|
||||
// - MinCostFlow, from SimpleMinCostFlow in ../min_cost_flow.h
|
||||
// - LinearSumAssignment, from SimpleLinearSumAssignment in ../assignment.h
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
%include "std_string.i"
|
||||
|
||||
%include "ortools/util/java/absl_string_view.i"
|
||||
%include "ortools/util/java/absl_string_view.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/init/init.h"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Simple unit tests for python/init.i. Not exhaustive."""
|
||||
"""Simple unit tests for python/init.swig. Not exhaustive."""
|
||||
|
||||
from absl.testing import absltest
|
||||
from ortools.init.python import init
|
||||
|
||||
@@ -19,7 +19,7 @@ load("//bazel:swig_java.bzl", "ortools_java_wrap_cc")
|
||||
|
||||
ortools_java_wrap_cc(
|
||||
name = "modelbuilder",
|
||||
src = "modelbuilder.i",
|
||||
src = "modelbuilder.swig",
|
||||
module = "modelbuilder",
|
||||
package = "com.google.ortools.modelbuilder",
|
||||
swig_includes = [
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# 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 main)
|
||||
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 main)
|
||||
set_property(SOURCE linear_solver.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE linear_solver.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE linear_solver.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.linearsolver)
|
||||
swig_add_library(jnilinear_solver
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/linearsolver
|
||||
SOURCES linear_solver.i)
|
||||
SOURCES linear_solver.swig)
|
||||
|
||||
target_include_directories(jnilinear_solver PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnilinear_solver PROPERTIES
|
||||
@@ -29,17 +29,17 @@ set_target_properties(jnilinear_solver PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
target_link_libraries(jnilinear_solver PRIVATE ortools::ortools)
|
||||
|
||||
set_property(SOURCE modelbuilder.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE modelbuilder.i PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE modelbuilder.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE modelbuilder.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE modelbuilder.swig PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE modelbuilder.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE modelbuilder.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE modelbuilder.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.modelbuilder)
|
||||
swig_add_library(jnimodelbuilder
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/modelbuilder
|
||||
SOURCES modelbuilder.i)
|
||||
SOURCES modelbuilder.swig)
|
||||
|
||||
target_include_directories(jnimodelbuilder PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnimodelbuilder PROPERTIES
|
||||
|
||||
@@ -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: (there isn't
|
||||
// a java codelab yet, as of July 2014)
|
||||
//
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
// We prefer our in-house vector wrapper to std_vector.i, because it
|
||||
// converts to and from native java arrays.
|
||||
%import "ortools/util/java/vector.i"
|
||||
%import "ortools/util/java/vector.swig"
|
||||
|
||||
%include "ortools/util/java/proto.i"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "enums.swg"
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/vector.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/linear_solver/wrappers/model_builder_helper.h"
|
||||
@@ -27,7 +27,7 @@
|
||||
// The only difference is that the argument is not a basic type, and needs
|
||||
// processing to be passed to the std::function.
|
||||
//
|
||||
// TODO(user): cleanup java/functions.i and move the code there.
|
||||
// TODO(user): cleanup java/functions.swig and move the code there.
|
||||
%{
|
||||
#include <memory> // std::make_shared<GlobalRefGuard>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE routing.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE routing.i PROPERTY SWIG_MODULE_NAME Globals)
|
||||
set_property(SOURCE routing.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE routing.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE routing.swig PROPERTY SWIG_MODULE_NAME Globals)
|
||||
set_property(SOURCE routing.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE routing.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE routing.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.routing)
|
||||
swig_add_library(jnirouting
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/routing
|
||||
SOURCES routing.i)
|
||||
SOURCES routing.swig)
|
||||
|
||||
target_include_directories(jnirouting PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnirouting PROPERTIES
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// Wrapper for RoutingIndexManager.
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/routing/java/types.i"
|
||||
%include "ortools/routing/java/types.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/routing/index_manager.h"
|
||||
@@ -19,12 +19,12 @@
|
||||
%template(IntBoolPair) std::pair<int, bool>;
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/vector.swig"
|
||||
%include "ortools/util/java/proto.i"
|
||||
%import "ortools/constraint_solver/java/constraint_solver.i"
|
||||
%import "ortools/util/java/sorted_interval_list.i" // Domain
|
||||
%import "ortools/constraint_solver/java/constraint_solver.swig"
|
||||
%import "ortools/util/java/sorted_interval_list.swig" // Domain
|
||||
|
||||
%include "ortools/routing/java/index_manager.i"
|
||||
%include "ortools/routing/java/index_manager.swig"
|
||||
|
||||
// We need to forward-declare the proto here, so that PROTO_INPUT involving it
|
||||
// works correctly. The order matters very much: this declaration needs to be
|
||||
@@ -18,7 +18,7 @@
|
||||
// This file is to be %included when wrapped objects need to use these typemaps.
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%import "ortools/util/java/vector.i"
|
||||
%import "ortools/util/java/vector.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/routing/types.h"
|
||||
@@ -33,16 +33,16 @@ target_link_libraries(routing_pybind11 PRIVATE
|
||||
add_library(${PROJECT_NAMESPACE}::routing_pybind11 ALIAS routing_pybind11)
|
||||
|
||||
# legacy pywraprouting
|
||||
set_property(SOURCE routing.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE routing.i PROPERTY SWIG_MODULE_NAME pywraprouting)
|
||||
set_property(SOURCE routing.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE routing.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE routing.swig PROPERTY SWIG_MODULE_NAME pywraprouting)
|
||||
set_property(SOURCE routing.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE routing.i PROPERTY COMPILE_OPTIONS -nofastunpack)
|
||||
set_property(SOURCE routing.swig PROPERTY COMPILE_OPTIONS -nofastunpack)
|
||||
swig_add_library(pywraprouting
|
||||
TYPE MODULE
|
||||
LANGUAGE python
|
||||
OUTPUT_DIR ${PYTHON_PROJECT_DIR}/routing
|
||||
SOURCES routing.i)
|
||||
SOURCES routing.swig)
|
||||
|
||||
target_include_directories(pywraprouting PRIVATE ${Python3_INCLUDE_DIRS})
|
||||
set_property(TARGET pywraprouting PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// Wrapper for RoutingIndexManager.
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/routing/python/types.i"
|
||||
%import "ortools/util/python/vector.i"
|
||||
%include "ortools/routing/python/types.swig"
|
||||
%import "ortools/util/python/vector.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/routing/index_manager.h"
|
||||
@@ -18,19 +18,19 @@
|
||||
%include "ortools/util/python/proto.i"
|
||||
|
||||
// PY_CONVERT_HELPER_* macros.
|
||||
%include "ortools/constraint_solver/python/constraint_solver_helpers.i"
|
||||
%include "ortools/constraint_solver/python/constraint_solver_helpers.swig"
|
||||
|
||||
%include "ortools/util/python/functions.i"
|
||||
%include "ortools/util/python/pair.i"
|
||||
%include "ortools/util/python/vector.i"
|
||||
%include "ortools/util/python/functions.swig"
|
||||
%include "ortools/util/python/pair.swig"
|
||||
%include "ortools/util/python/vector.swig"
|
||||
|
||||
// While the module name will be overridden by the one specified on the cmd line,
|
||||
// without this, derived classes (e.g. TypeRequirementChecker) will import base
|
||||
// class from the module specified in the following %import.
|
||||
%module pywraprouting
|
||||
%import(module="ortools.constraint_solver.pywrapcp") "ortools/constraint_solver/python/constraint_solver.i"
|
||||
%include "ortools/routing/python/types.i"
|
||||
%include "ortools/routing/python/index_manager.i"
|
||||
%import(module="ortools.constraint_solver.pywrapcp") "ortools/constraint_solver/python/constraint_solver.swig"
|
||||
%include "ortools/routing/python/types.swig"
|
||||
%include "ortools/routing/python/index_manager.swig"
|
||||
|
||||
// We need to forward-declare the proto here, so that PROTO_INPUT involving it
|
||||
// works correctly. The order matters very much: this declaration needs to be
|
||||
@@ -69,7 +69,7 @@ DEFINE_INDEX_TYPE_TYPEDEF(
|
||||
|
||||
// ============= Type conversions ==============
|
||||
|
||||
// See ./constraint_solver_helpers.i.
|
||||
// See ./constraint_solver_helpers.swig.
|
||||
PY_CONVERT_HELPER_INTEXPR_AND_INTVAR();
|
||||
PY_CONVERT_HELPER_PTR(IntervalVar);
|
||||
PY_CONVERT_HELPER_PTR(LocalSearchFilter);
|
||||
@@ -18,7 +18,7 @@
|
||||
// This file is to be %included when wrapped objects need to use these typemaps.
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%import "ortools/util/python/vector.i"
|
||||
%import "ortools/util/python/vector.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/routing/types.h"
|
||||
@@ -19,7 +19,7 @@ load("//bazel:swig_java.bzl", "ortools_java_wrap_cc")
|
||||
|
||||
ortools_java_wrap_cc(
|
||||
name = "sat",
|
||||
src = "sat.i",
|
||||
src = "sat.swig",
|
||||
java_deps = [
|
||||
"//ortools/sat:cp_model_java_proto",
|
||||
"//ortools/sat:sat_parameters_java_proto",
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE sat.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE sat.i PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE sat.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE sat.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE sat.swig PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE sat.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE sat.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE sat.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.sat)
|
||||
swig_add_library(jnisat
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/sat
|
||||
SOURCES sat.i)
|
||||
SOURCES sat.swig)
|
||||
|
||||
target_include_directories(jnisat PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jnisat PROPERTIES
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
%include "ortools/util/java/proto.i"
|
||||
|
||||
%import "ortools/util/java/sorted_interval_list.i"
|
||||
%import "ortools/util/java/sorted_interval_list.swig"
|
||||
|
||||
%{
|
||||
#include "ortools/sat/cp_model.pb.h"
|
||||
@@ -76,7 +76,7 @@ PROTO2_RETURN(operations_research::sat::CpSolverResponse,
|
||||
// The only difference is that the argument is not a basic type, and needs
|
||||
// processing to be passed to the std::function.
|
||||
//
|
||||
// TODO(user): cleanup java/functions.i and move the code there.
|
||||
// TODO(user): cleanup java/functions.swig and move the code there.
|
||||
%{
|
||||
#include <memory> // std::make_shared<GlobalRefGuard>
|
||||
%}
|
||||
@@ -15,7 +15,7 @@
|
||||
#define OR_TOOLS_UTIL_FUNCTIONS_SWIG_HELPERS_H_
|
||||
|
||||
// This file contains class definitions for the wrapping of C++ std::functions
|
||||
// in Java. It is #included by java/functions.i.
|
||||
// in Java. It is #included by java/functions.swig.
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@@ -33,7 +33,7 @@ config_setting(
|
||||
filegroup(
|
||||
name = "vector_swig",
|
||||
srcs = [
|
||||
"vector.i",
|
||||
"vector.swig",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -49,7 +49,7 @@ filegroup(
|
||||
filegroup(
|
||||
name = "absl_string_view_swig",
|
||||
srcs = [
|
||||
"absl_string_view.i",
|
||||
"absl_string_view.swig",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -57,14 +57,14 @@ filegroup(
|
||||
filegroup(
|
||||
name = "sorted_interval_list_swig",
|
||||
srcs = [
|
||||
"sorted_interval_list.i",
|
||||
"sorted_interval_list.swig",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
ortools_java_wrap_cc(
|
||||
name = "sorted_interval_list",
|
||||
src = "sorted_interval_list.i",
|
||||
src = "sorted_interval_list.swig",
|
||||
package = "com.google.ortools.util",
|
||||
swig_includes = [
|
||||
":vector_swig",
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set_property(SOURCE sorted_interval_list.i PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE sorted_interval_list.i PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE sorted_interval_list.i PROPERTY COMPILE_DEFINITIONS
|
||||
set_property(SOURCE sorted_interval_list.swig PROPERTY CPLUSPLUS ON)
|
||||
set_property(SOURCE sorted_interval_list.swig PROPERTY SWIG_MODULE_NAME main)
|
||||
set_property(SOURCE sorted_interval_list.swig PROPERTY COMPILE_DEFINITIONS
|
||||
${OR_TOOLS_COMPILE_DEFINITIONS} ABSL_MUST_USE_RESULT=)
|
||||
set_property(SOURCE sorted_interval_list.i PROPERTY COMPILE_OPTIONS
|
||||
set_property(SOURCE sorted_interval_list.swig PROPERTY COMPILE_OPTIONS
|
||||
-package ${JAVA_PACKAGE}.util)
|
||||
swig_add_library(jniutil
|
||||
TYPE OBJECT
|
||||
LANGUAGE java
|
||||
OUTPUT_DIR ${JAVA_PROJECT_DIR}/${JAVA_SRC_PATH}/util
|
||||
SOURCES sorted_interval_list.i)
|
||||
SOURCES sorted_interval_list.swig)
|
||||
|
||||
target_include_directories(jniutil PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
set_target_properties(jniutil PROPERTIES
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* absl_string_view.i
|
||||
* absl_string_view.swig
|
||||
*
|
||||
* Typemaps for absl::string_view
|
||||
* This is mapped to a Java String and is passed around by value.
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// This is the java SWIG wrapper for ../sorted_interval_list.h. See that file.
|
||||
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/vector.swig"
|
||||
|
||||
%{
|
||||
#include <cstdint>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/vector.swig"
|
||||
|
||||
%{
|
||||
// TODO(user): see if we can remove <vector>
|
||||
Reference in New Issue
Block a user