X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/433017b9907c8348a48ef1a9fa7669e3d9523f1b..7dfe645b5f2fcfc320264baad73f52c8003e857f:/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b4f4ddb8..f7d396d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,20 +57,11 @@ endif() #----------------------------------------------------------------------------- -# python and pyosmium (imports/updates only) +# python (imports/updates only) #----------------------------------------------------------------------------- if (BUILD_IMPORTER) - find_package(PythonInterp 3) - - find_program(PYOSMIUM pyosmium-get-changes) - if (NOT EXISTS "${PYOSMIUM}") - set(PYOSMIUM_PATH "") - message(WARNING "pyosmium-get-changes not found (required for updates)") - else() - set(PYOSMIUM_PATH "${PYOSMIUM}") - message(STATUS "Using pyosmium-get-changes at ${PYOSMIUM_PATH}") - endif() + find_package(PythonInterp 3.5 REQUIRED) endif() #----------------------------------------------------------------------------- @@ -86,8 +77,19 @@ if (BUILD_API OR BUILD_IMPORTER) # sanity check if PHP binary exists if (NOT EXISTS ${PHP_BIN}) message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ") + else() + message (STATUS "Using PHP binary " ${PHP_BIN}) + endif() + if (NOT PHPCGI_BIN) + find_program (PHPCGI_BIN php-cgi) + endif() + # sanity check if PHP binary exists + if (NOT EXISTS ${PHPCGI_BIN}) + message(WARNING "php-cgi binary not found. nominatim tool will not provide query functions.") + set (PHPCGI_BIN "") + else() + message (STATUS "Using php-cgi binary " ${PHPCGI_BIN}) endif() - message (STATUS "Using PHP binary " ${PHP_BIN}) endif() #----------------------------------------------------------------------------- @@ -98,7 +100,6 @@ if (BUILD_IMPORTER) set(CUSTOMSCRIPTS check_import_finished.php country_languages.php - importWikipedia.php export.php query.php setup.php @@ -111,22 +112,9 @@ if (BUILD_IMPORTER) configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl ${PROJECT_BINARY_DIR}/utils/${script_source}) endforeach() -endif() -#----------------------------------------------------------------------------- -# Targets for running a development webserver from the build directory. -#----------------------------------------------------------------------------- - -if (BUILD_API) - add_custom_target(serve - php -S 127.0.0.1:8088 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/website - ) - - add_custom_target(serve-global - php -S 0.0.0.0:8088 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/website - ) + configure_file(${PROJECT_SOURCE_DIR}/cmake/tool.tmpl + ${PROJECT_BINARY_DIR}/nominatim) endif() #----------------------------------------------------------------------------- @@ -138,21 +126,60 @@ if (BUILD_TESTS) set(TEST_BDD db osm2pgsql api) - foreach (test ${TEST_BDD}) - add_test(NAME bdd_${test} - COMMAND behave ${test} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/bdd) - set_tests_properties(bdd_${test} - PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}") - endforeach() - - add_test(NAME php - COMMAND phpunit ./ - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/php) - - add_test(NAME phpcs - COMMAND phpcs --report-width=120 --colors lib website utils - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + find_program(PYTHON_BEHAVE behave) + find_program(PYLINT NAMES pylint3 pylint) + find_program(PYTEST NAMES pytest py.test-3 py.test) + find_program(PHPCS phpcs) + find_program(PHPUNIT phpunit) + + if (PYTHON_BEHAVE) + message(STATUS "Using Python behave binary ${PYTHON_BEHAVE}") + foreach (test ${TEST_BDD}) + add_test(NAME bdd_${test} + COMMAND ${PYTHON_BEHAVE} ${test} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/bdd) + set_tests_properties(bdd_${test} + PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}") + endforeach() + else() + message(WARNING "behave not found. BDD tests disabled." ) + endif() + + if (PHPUNIT) + message(STATUS "Using phpunit binary ${PHPUNIT}") + add_test(NAME php + COMMAND ${PHPUNIT} ./ + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/php) + else() + message(WARNING "phpunit not found. PHP unit tests disabled." ) + endif() + + if (PHPCS) + message(STATUS "Using phpcs binary ${PHPCS}") + add_test(NAME phpcs + COMMAND ${PHPCS} --report-width=120 --colors lib website utils + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + else() + message(WARNING "phpcs not found. PHP linting tests disabled." ) + endif() + + if (PYLINT) + message(STATUS "Using pylint binary ${PYLINT}") + add_test(NAME pylint + COMMAND ${PYLINT} --extension-pkg-whitelist=osmium nominatim + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + else() + message(WARNING "pylint not found. Python linting tests disabled.") + endif() + + if (PYTEST) + message(STATUS "Using pytest binary ${PYTEST}") + add_test(NAME pytest + COMMAND ${PYTEST} test/python + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + else() + message(WARNING "pytest not found. Python tests disabled." ) + endif() endif() #-----------------------------------------------------------------------------