cmake: examples management cleanup

This commit is contained in:
Mizux Seiha
2020-09-11 22:49:17 +02:00
parent fff7b6ad8b
commit 7d149a6530
8 changed files with 18 additions and 39 deletions

View File

@@ -240,8 +240,11 @@ include(dotnet)
# Since samples mix all languages we must parse them once we have included all
# <language>.cmake files
if(BUILD_SAMPLES)
foreach(SAMPLES IN ITEMS algorithms graph linear_solver constraint_solver sat)
add_subdirectory(ortools/${SAMPLES}/samples)
endforeach()
endif()
foreach(SAMPLES IN ITEMS algorithms graph linear_solver constraint_solver sat)
add_subdirectory(ortools/${SAMPLES}/samples)
endforeach()
# Same for examples/contrib
foreach(EXAMPLES IN ITEMS contrib cpp python java dotnet)
add_subdirectory(examples/${EXAMPLES})
endforeach()

View File

@@ -304,14 +304,8 @@ foreach(SUBPROJECT IN ITEMS
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}::${SUBPROJECT})
endforeach()
# Examples
if(BUILD_EXAMPLES)
add_subdirectory(examples/cpp)
endif()
# Install rules
include(GNUInstallDirs)
include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(${PROJECT_NAME})
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_export.h

View File

@@ -199,7 +199,3 @@ add_custom_target(dotnet_package ALL
dotnet/packages
WORKING_DIRECTORY dotnet
)
if(BUILD_EXAMPLES)
#add_subdirectory(examples/dotnet)
endif()

View File

@@ -213,7 +213,3 @@ if(BUILD_TESTING)
COMMAND ${MAVEN_EXECUTABLE} exec:java -Dexec.mainClass=com.google.ortools.Test
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/java/${JAVA_TEST_PROJECT})
endif()
if(BUILD_EXAMPLES)
#add_subdirectory(examples/java)
endif()

View File

@@ -184,8 +184,3 @@ if(BUILD_TESTING)
add_test(NAME pytest_venv
COMMAND ${VENV_Python_EXECUTABLE} ${VENV_DIR}/test.py)
endif()
if(BUILD_EXAMPLES)
#add_subdirectory(examples/python)
#add_subdirectory(examples/notebook)
endif()

View File

@@ -1,4 +1,4 @@
if (NOT BUILD_EXAMPLES)
if(NOT BUILD_EXAMPLES)
return()
endif()
@@ -6,23 +6,18 @@ if(BUILD_CXX_EXAMPLES)
endif()
if(BUILD_PYTHON)
if(BUILD_PYTHON_EXAMPLES)
foreach(TEST IN ITEMS
hidato_table
integer_programming
knapsack
linear_programming
pyflow_example
tsp
vrp
vrpgs
cvrp
cvrptw)
assignment
costas_array
hidato
knapsack_cp
knapsack_mip
)
add_test(py${TEST}_venv ${VENV_BIN_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/${TEST}.py)
set_tests_properties(py${TEST}_venv PROPERTIES DEPENDS build_venv)
endforeach()
include(GNUInstallDirs)
install(DIRECTORY .
DESTINATION ${CMAKE_INSTALL_DATADIR}/ortools/examples/python
FILES_MATCHING PATTERN "*.py")

View File

@@ -1,4 +1,4 @@
if (NOT BUILD_PYTHON)
if(NOT BUILD_PYTHON_EXAMPLES)
return()
endif()

View File

@@ -1,4 +1,4 @@
if (NOT BUILD_PYTHON)
if(NOT BUILD_PYTHON_EXAMPLES)
return()
endif()