diff --git a/cmake/dotnet.cmake b/cmake/dotnet.cmake index 12ead2117a8..e241e01c260 100644 --- a/cmake/dotnet.cmake +++ b/cmake/dotnet.cmake @@ -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) diff --git a/cmake/java.cmake b/cmake/java.cmake index ae7f023c9d4..bd73e09dd2f 100644 --- a/cmake/java.cmake +++ b/cmake/java.cmake @@ -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) diff --git a/cmake/python.cmake b/cmake/python.cmake index 6d4fbde01e3..d7173f9abe2 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -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) diff --git a/ortools/algorithms/java/BUILD.bazel b/ortools/algorithms/java/BUILD.bazel index dd3cb9da808..5b84c09b2f7 100644 --- a/ortools/algorithms/java/BUILD.bazel +++ b/ortools/algorithms/java/BUILD.bazel @@ -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 = [ diff --git a/ortools/algorithms/java/CMakeLists.txt b/ortools/algorithms/java/CMakeLists.txt index cfae6f41617..82c9e266919 100644 --- a/ortools/algorithms/java/CMakeLists.txt +++ b/ortools/algorithms/java/CMakeLists.txt @@ -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 diff --git a/ortools/algorithms/java/knapsack_solver.i b/ortools/algorithms/java/knapsack_solver.swig similarity index 98% rename from ortools/algorithms/java/knapsack_solver.i rename to ortools/algorithms/java/knapsack_solver.swig index 429098139e3..17b4d45c423 100644 --- a/ortools/algorithms/java/knapsack_solver.i +++ b/ortools/algorithms/java/knapsack_solver.swig @@ -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" diff --git a/ortools/base/python-swig.h b/ortools/base/python-swig.h index 8c7003691a9..38dc43b8f56 100644 --- a/ortools/base/python-swig.h +++ b/ortools/base/python-swig.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" diff --git a/ortools/constraint_solver/java/CMakeLists.txt b/ortools/constraint_solver/java/CMakeLists.txt index e1116674378..61e0ae1957d 100644 --- a/ortools/constraint_solver/java/CMakeLists.txt +++ b/ortools/constraint_solver/java/CMakeLists.txt @@ -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 diff --git a/ortools/constraint_solver/java/constraint_solver.i b/ortools/constraint_solver/java/constraint_solver.swig similarity index 99% rename from ortools/constraint_solver/java/constraint_solver.i rename to ortools/constraint_solver/java/constraint_solver.swig index 88f8540460d..f27f5415ff6 100644 --- a/ortools/constraint_solver/java/constraint_solver.i +++ b/ortools/constraint_solver/java/constraint_solver.swig @@ -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. diff --git a/ortools/constraint_solver/python/CMakeLists.txt b/ortools/constraint_solver/python/CMakeLists.txt index 8fe4444aa78..f40645ab1b1 100644 --- a/ortools/constraint_solver/python/CMakeLists.txt +++ b/ortools/constraint_solver/python/CMakeLists.txt @@ -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) diff --git a/ortools/constraint_solver/python/constraint_solver.i b/ortools/constraint_solver/python/constraint_solver.swig similarity index 99% rename from ortools/constraint_solver/python/constraint_solver.i rename to ortools/constraint_solver/python/constraint_solver.swig index 498e4af1466..c4e8c5bb04e 100644 --- a/ortools/constraint_solver/python/constraint_solver.i +++ b/ortools/constraint_solver/python/constraint_solver.swig @@ -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 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 { diff --git a/ortools/constraint_solver/python/constraint_solver_doc.h b/ortools/constraint_solver/python/constraint_solver_doc.h index c8dff6346f2..73d207c446d 100644 --- a/ortools/constraint_solver/python/constraint_solver_doc.h +++ b/ortools/constraint_solver/python/constraint_solver_doc.h @@ -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 diff --git a/ortools/constraint_solver/python/constraint_solver_helpers.i b/ortools/constraint_solver/python/constraint_solver_helpers.swig similarity index 97% rename from ortools/constraint_solver/python/constraint_solver_helpers.i rename to ortools/constraint_solver/python/constraint_solver_helpers.swig index 22f0e21189c..576a912ec3b 100644 --- a/ortools/constraint_solver/python/constraint_solver_helpers.i +++ b/ortools/constraint_solver/python/constraint_solver_helpers.swig @@ -32,7 +32,7 @@ PyObject* PyObjFrom(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() %{ diff --git a/ortools/constraint_solver/python/pywrapcp_util.i b/ortools/constraint_solver/python/pywrapcp_util.swig similarity index 92% rename from ortools/constraint_solver/python/pywrapcp_util.i rename to ortools/constraint_solver/python/pywrapcp_util.swig index 9ecb76dd590..dedd8006b98 100644 --- a/ortools/constraint_solver/python/pywrapcp_util.i +++ b/ortools/constraint_solver/python/pywrapcp_util.swig @@ -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 diff --git a/ortools/graph/csharp/graph.i b/ortools/graph/csharp/graph.i index d51b07c3b5e..791c3225136 100644 --- a/ortools/graph/csharp/graph.i +++ b/ortools/graph/csharp/graph.i @@ -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 diff --git a/ortools/graph/java/BUILD.bazel b/ortools/graph/java/BUILD.bazel index 25e7ba18ae3..4818a860925 100644 --- a/ortools/graph/java/BUILD.bazel +++ b/ortools/graph/java/BUILD.bazel @@ -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 = [ diff --git a/ortools/graph/java/CMakeLists.txt b/ortools/graph/java/CMakeLists.txt index 6054afd20d2..0dfe0486365 100644 --- a/ortools/graph/java/CMakeLists.txt +++ b/ortools/graph/java/CMakeLists.txt @@ -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 diff --git a/ortools/graph/java/graph.i b/ortools/graph/java/graph.swig similarity index 99% rename from ortools/graph/java/graph.i rename to ortools/graph/java/graph.swig index db096aa6448..222e968fbed 100644 --- a/ortools/graph/java/graph.i +++ b/ortools/graph/java/graph.swig @@ -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 diff --git a/ortools/init/java/init.i b/ortools/init/java/init.i index 5f16276062a..d042d3afab2 100644 --- a/ortools/init/java/init.i +++ b/ortools/init/java/init.i @@ -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" diff --git a/ortools/init/python/init_test.py b/ortools/init/python/init_test.py index 18708e4ffae..9988e6b6b72 100755 --- a/ortools/init/python/init_test.py +++ b/ortools/init/python/init_test.py @@ -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 diff --git a/ortools/linear_solver/java/BUILD.bazel b/ortools/linear_solver/java/BUILD.bazel index cad9cc2a3ad..0cf3c002268 100644 --- a/ortools/linear_solver/java/BUILD.bazel +++ b/ortools/linear_solver/java/BUILD.bazel @@ -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 = [ diff --git a/ortools/linear_solver/java/CMakeLists.txt b/ortools/linear_solver/java/CMakeLists.txt index 9b10ca3b966..a09642c0d72 100644 --- a/ortools/linear_solver/java/CMakeLists.txt +++ b/ortools/linear_solver/java/CMakeLists.txt @@ -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 diff --git a/ortools/linear_solver/java/linear_solver.i b/ortools/linear_solver/java/linear_solver.swig similarity index 99% rename from ortools/linear_solver/java/linear_solver.i rename to ortools/linear_solver/java/linear_solver.swig index 5c4b24c4158..958239412cb 100644 --- a/ortools/linear_solver/java/linear_solver.i +++ b/ortools/linear_solver/java/linear_solver.swig @@ -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" diff --git a/ortools/linear_solver/java/modelbuilder.i b/ortools/linear_solver/java/modelbuilder.swig similarity index 99% rename from ortools/linear_solver/java/modelbuilder.i rename to ortools/linear_solver/java/modelbuilder.swig index f8c526c1b05..441039dba60 100644 --- a/ortools/linear_solver/java/modelbuilder.i +++ b/ortools/linear_solver/java/modelbuilder.swig @@ -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 // std::make_shared diff --git a/ortools/linear_solver/python/CMakeLists.txt b/ortools/linear_solver/python/CMakeLists.txt index b7f0b586e4b..9a7b45984d5 100644 --- a/ortools/linear_solver/python/CMakeLists.txt +++ b/ortools/linear_solver/python/CMakeLists.txt @@ -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) diff --git a/ortools/linear_solver/python/linear_solver.i b/ortools/linear_solver/python/linear_solver.swig similarity index 99% rename from ortools/linear_solver/python/linear_solver.i rename to ortools/linear_solver/python/linear_solver.swig index 2309ea3e4c1..028b3dbd96a 100644 --- a/ortools/linear_solver/python/linear_solver.i +++ b/ortools/linear_solver/python/linear_solver.swig @@ -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 diff --git a/ortools/linear_solver/python/linear_solver_natural_api.py b/ortools/linear_solver/python/linear_solver_natural_api.py index 45e92652897..42a56a8697d 100644 --- a/ortools/linear_solver/python/linear_solver_natural_api.py +++ b/ortools/linear_solver/python/linear_solver_natural_api.py @@ -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. diff --git a/ortools/linear_solver/python/pywraplp_test.py b/ortools/linear_solver/python/pywraplp_test.py index 1f98234375a..ff35260334a 100644 --- a/ortools/linear_solver/python/pywraplp_test.py +++ b/ortools/linear_solver/python/pywraplp_test.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 diff --git a/ortools/routing/java/CMakeLists.txt b/ortools/routing/java/CMakeLists.txt index 90aaca3e430..1d0b7e8dacc 100644 --- a/ortools/routing/java/CMakeLists.txt +++ b/ortools/routing/java/CMakeLists.txt @@ -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 diff --git a/ortools/routing/java/index_manager.i b/ortools/routing/java/index_manager.swig similarity index 97% rename from ortools/routing/java/index_manager.i rename to ortools/routing/java/index_manager.swig index 4e1670c0c73..f598513b304 100644 --- a/ortools/routing/java/index_manager.i +++ b/ortools/routing/java/index_manager.swig @@ -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" diff --git a/ortools/routing/java/routing.i b/ortools/routing/java/routing.swig similarity index 99% rename from ortools/routing/java/routing.i rename to ortools/routing/java/routing.swig index fcb6f6c2a3c..abc131dd948 100644 --- a/ortools/routing/java/routing.i +++ b/ortools/routing/java/routing.swig @@ -19,12 +19,12 @@ %template(IntBoolPair) std::pair; %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 diff --git a/ortools/routing/java/types.i b/ortools/routing/java/types.swig similarity index 98% rename from ortools/routing/java/types.i rename to ortools/routing/java/types.swig index 45e27fbdfae..f9f6d0e3d35 100644 --- a/ortools/routing/java/types.i +++ b/ortools/routing/java/types.swig @@ -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" diff --git a/ortools/routing/python/CMakeLists.txt b/ortools/routing/python/CMakeLists.txt index 9fe346f31bf..2c7e9e9dbb2 100644 --- a/ortools/routing/python/CMakeLists.txt +++ b/ortools/routing/python/CMakeLists.txt @@ -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) diff --git a/ortools/routing/python/index_manager.i b/ortools/routing/python/index_manager.swig similarity index 95% rename from ortools/routing/python/index_manager.i rename to ortools/routing/python/index_manager.swig index 02dc547d8bf..27b1114f0f4 100644 --- a/ortools/routing/python/index_manager.i +++ b/ortools/routing/python/index_manager.swig @@ -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" diff --git a/ortools/routing/python/routing.i b/ortools/routing/python/routing.swig similarity index 93% rename from ortools/routing/python/routing.i rename to ortools/routing/python/routing.swig index 4b49f36ab9f..417050ed1c3 100644 --- a/ortools/routing/python/routing.i +++ b/ortools/routing/python/routing.swig @@ -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); diff --git a/ortools/routing/python/types.i b/ortools/routing/python/types.swig similarity index 98% rename from ortools/routing/python/types.i rename to ortools/routing/python/types.swig index c7949de427c..09e0d4b617a 100644 --- a/ortools/routing/python/types.i +++ b/ortools/routing/python/types.swig @@ -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" diff --git a/ortools/sat/java/BUILD.bazel b/ortools/sat/java/BUILD.bazel index dc1589eb1ef..76bc1a8521b 100644 --- a/ortools/sat/java/BUILD.bazel +++ b/ortools/sat/java/BUILD.bazel @@ -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", diff --git a/ortools/sat/java/CMakeLists.txt b/ortools/sat/java/CMakeLists.txt index ea6aeec7bfb..6f7243292b6 100644 --- a/ortools/sat/java/CMakeLists.txt +++ b/ortools/sat/java/CMakeLists.txt @@ -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 diff --git a/ortools/sat/java/sat.i b/ortools/sat/java/sat.swig similarity index 98% rename from ortools/sat/java/sat.i rename to ortools/sat/java/sat.swig index af1b325e2bc..f2def937a9b 100644 --- a/ortools/sat/java/sat.i +++ b/ortools/sat/java/sat.swig @@ -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 // std::make_shared %} diff --git a/ortools/util/functions_swig_helpers.h b/ortools/util/functions_swig_helpers.h index a3451091b62..41423970eaf 100644 --- a/ortools/util/functions_swig_helpers.h +++ b/ortools/util/functions_swig_helpers.h @@ -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 #include diff --git a/ortools/util/java/BUILD.bazel b/ortools/util/java/BUILD.bazel index 748abcbad6a..1496f519235 100644 --- a/ortools/util/java/BUILD.bazel +++ b/ortools/util/java/BUILD.bazel @@ -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", diff --git a/ortools/util/java/CMakeLists.txt b/ortools/util/java/CMakeLists.txt index 5964336095d..6f99f53adf7 100644 --- a/ortools/util/java/CMakeLists.txt +++ b/ortools/util/java/CMakeLists.txt @@ -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 diff --git a/ortools/util/java/absl_string_view.i b/ortools/util/java/absl_string_view.swig similarity index 99% rename from ortools/util/java/absl_string_view.i rename to ortools/util/java/absl_string_view.swig index 311a31d40b2..6d3dc12ed03 100644 --- a/ortools/util/java/absl_string_view.i +++ b/ortools/util/java/absl_string_view.swig @@ -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. diff --git a/ortools/util/java/functions.i b/ortools/util/java/functions.swig similarity index 100% rename from ortools/util/java/functions.i rename to ortools/util/java/functions.swig diff --git a/ortools/util/java/sorted_interval_list.i b/ortools/util/java/sorted_interval_list.swig similarity index 98% rename from ortools/util/java/sorted_interval_list.i rename to ortools/util/java/sorted_interval_list.swig index 97f38b0f10e..f9c1e07a097 100644 --- a/ortools/util/java/sorted_interval_list.i +++ b/ortools/util/java/sorted_interval_list.swig @@ -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 diff --git a/ortools/util/java/tuple_set.i b/ortools/util/java/tuple_set.swig similarity index 97% rename from ortools/util/java/tuple_set.i rename to ortools/util/java/tuple_set.swig index 95e3d72c2c2..110eb497b57 100644 --- a/ortools/util/java/tuple_set.i +++ b/ortools/util/java/tuple_set.swig @@ -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 diff --git a/ortools/util/java/vector.i b/ortools/util/java/vector.swig similarity index 100% rename from ortools/util/java/vector.i rename to ortools/util/java/vector.swig diff --git a/ortools/util/python/functions.i b/ortools/util/python/functions.swig similarity index 100% rename from ortools/util/python/functions.i rename to ortools/util/python/functions.swig diff --git a/ortools/util/python/pair.i b/ortools/util/python/pair.swig similarity index 100% rename from ortools/util/python/pair.i rename to ortools/util/python/pair.swig diff --git a/ortools/util/python/vector.i b/ortools/util/python/vector.swig similarity index 100% rename from ortools/util/python/vector.i rename to ortools/util/python/vector.swig