+# 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
+ )
+endif()
+
+#-----------------------------------------------------------------------------
+# Tests
+#-----------------------------------------------------------------------------
+
+if (BUILD_TESTS)
+ include(CTest)
+
+ 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})
+endif()
+
+#-----------------------------------------------------------------------------
+# Postgres module
+#-----------------------------------------------------------------------------
+
+if (BUILD_MODULE)
+ add_subdirectory(module)
+endif()
+
+#-----------------------------------------------------------------------------
+# Documentation
+#-----------------------------------------------------------------------------
+
+if (BUILD_DOCS)
+ add_subdirectory(docs)
+endif()