cmake: math_opt python fix
This commit is contained in:
@@ -162,6 +162,11 @@ if(USE_PDLP OR BUILD_MATH_OPT)
|
||||
file(GLOB_RECURSE PDLP_PROTO_PY_FILES RELATIVE ${PROJECT_SOURCE_DIR} "ortools/pdlp/*.proto")
|
||||
list(APPEND OR_TOOLS_PROTO_PY_FILES ${PDLP_PROTO_PY_FILES})
|
||||
endif()
|
||||
if(USE_SCIP OR BUILD_MATH_OPT)
|
||||
file(GLOB_RECURSE GSCIP_PROTO_PY_FILES RELATIVE ${PROJECT_SOURCE_DIR} "ortools/gscip/*.proto")
|
||||
list(APPEND OR_TOOLS_PROTO_PY_FILES ${GSCIP_PROTO_PY_FILES})
|
||||
endif()
|
||||
|
||||
foreach(PROTO_FILE IN LISTS OR_TOOLS_PROTO_PY_FILES)
|
||||
#message(STATUS "protoc proto(py): ${PROTO_FILE}")
|
||||
get_filename_component(PROTO_DIR ${PROTO_FILE} DIRECTORY)
|
||||
@@ -294,13 +299,17 @@ file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/constraint_solver/__init__.py CONTENT
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/glop/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/graph/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/graph/python/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/gscip/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/init/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/init/python/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/linear_solver/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/linear_solver/python/__init__.py CONTENT "")
|
||||
if(BUILD_MATH_OPT)
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/math_opt/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/math_opt/core/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/math_opt/core/python/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/math_opt/python/__init__.py CONTENT "")
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/math_opt/solvers/__init__.py CONTENT "")
|
||||
endif()
|
||||
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/packing/__init__.py CONTENT "")
|
||||
if(USE_PDLP OR BUILD_MATH_OPT)
|
||||
|
||||
@@ -15,32 +15,5 @@ if(NOT BUILD_SAMPLES)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(BUILD_CXX_SAMPLES)
|
||||
file(GLOB CXX_SRCS "*.cc")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "area_socp.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "branch_and_bound.*$")
|
||||
if(NOT USE_SCIP)
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "cocktail_hour.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "lagrangian_relaxation.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "time_indexed_scheduling.cc$")
|
||||
endif()
|
||||
|
||||
# conflict name
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "basic_example.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "tsp.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "integer_programming.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "linear_programming.cc$")
|
||||
list(FILTER CXX_SRCS EXCLUDE REGEX "linear_regression.cc$")
|
||||
|
||||
|
||||
foreach(SAMPLE IN LISTS CXX_SRCS)
|
||||
add_cxx_sample(${SAMPLE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(BUILD_PYTHON_SAMPLES)
|
||||
file(GLOB PYTHON_SRCS "*.py")
|
||||
foreach(SAMPLE IN LISTS PYTHON_SRCS)
|
||||
add_python_sample(${SAMPLE})
|
||||
endforeach()
|
||||
endif()
|
||||
add_subdirectory(cpp)
|
||||
add_subdirectory(python)
|
||||
|
||||
@@ -31,10 +31,3 @@ if(BUILD_CXX_SAMPLES)
|
||||
add_cxx_sample(${SAMPLE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(BUILD_PYTHON_SAMPLES)
|
||||
file(GLOB PYTHON_SRCS "*.py")
|
||||
foreach(SAMPLE IN LISTS PYTHON_SRCS)
|
||||
add_python_sample(${SAMPLE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
23
ortools/math_opt/samples/python/CMakeLists.txt
Normal file
23
ortools/math_opt/samples/python/CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2010-2024 Google LLC
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if(NOT BUILD_SAMPLES)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(BUILD_PYTHON_SAMPLES)
|
||||
file(GLOB PYTHON_SRCS "*.py")
|
||||
foreach(SAMPLE IN LISTS PYTHON_SRCS)
|
||||
add_python_sample(${SAMPLE})
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -47,6 +47,7 @@ setup(
|
||||
'numpy >= 1.13.3',
|
||||
'pandas >= 2.0.0',
|
||||
'protobuf >= 4.25.1',
|
||||
'immutabledict >= 3.0.0',
|
||||
],
|
||||
package_data={
|
||||
'@PYTHON_PROJECT@':[$<$<STREQUAL:$<TARGET_PROPERTY:@PROJECT_NAME@,TYPE>,SHARED_LIBRARY>:'.libs/*','../$<TARGET_SONAME_FILE_NAME:@PROJECT_NAME@>'>],
|
||||
@@ -65,6 +66,7 @@ setup(
|
||||
'$<TARGET_FILE_NAME:max_flow_pybind11>',
|
||||
'$<TARGET_FILE_NAME:min_cost_flow_pybind11>',
|
||||
'*.pyi'],
|
||||
'@PYTHON_PROJECT@.gscip':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.constraint_solver':[
|
||||
'$<TARGET_FILE_NAME:pywrapcp>',
|
||||
'*.pyi'
|
||||
@@ -78,6 +80,13 @@ setup(
|
||||
'*.pyi',
|
||||
'py.typed'
|
||||
],
|
||||
'@PYTHON_PROJECT@.math_opt':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.math_opt.core.python':[
|
||||
'$<TARGET_FILE_NAME:math_opt_pybind11>',
|
||||
'*.pyi'
|
||||
],
|
||||
'@PYTHON_PROJECT@.math_opt.python':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.math_opt.solvers':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.packing':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.pdlp':['*.pyi'],
|
||||
'@PYTHON_PROJECT@.pdlp.python':[
|
||||
|
||||
Reference in New Issue
Block a user