build: Allow disabling documentation build + print more build flags (#13871)

* build: permit to disable documentation build

* build: add a message about some BUILD_* flags
This commit is contained in:
Loïc Blot 2023-10-09 15:35:12 +02:00 committed by GitHub
parent 2c74797d34
commit 929a13a9a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 17 deletions

@ -37,10 +37,13 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(VERSION_STRING "${VERSION_STRING}-debug") set(VERSION_STRING "${VERSION_STRING}-debug")
endif() endif()
message(STATUS "*** Will build version ${VERSION_STRING} ***")
# Configuration options # Configuration options
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
set(BUILD_DOCUMENTATION TRUE CACHE BOOL "Build documentation")
set(DEFAULT_RUN_IN_PLACE FALSE) set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32) if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE) set(DEFAULT_RUN_IN_PLACE TRUE)
@ -48,11 +51,13 @@ endif()
set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
"Run directly in source directory structure") "Run directly in source directory structure")
message(STATUS "*** Will build version ${VERSION_STRING} ***")
set(BUILD_CLIENT TRUE CACHE BOOL "Build client") message(STATUS "BUILD_CLIENT: " ${BUILD_CLIENT})
set(BUILD_SERVER FALSE CACHE BOOL "Build server") message(STATUS "BUILD_SERVER: " ${BUILD_SERVER})
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests") message(STATUS "BUILD_UNITTESTS: " ${BUILD_UNITTESTS})
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks") message(STATUS "BUILD_BENCHMARKS: " ${BUILD_BENCHMARKS})
message(STATUS "BUILD_DOCUMENTATION: " ${BUILD_DOCUMENTATION})
message(STATUS "RUN_IN_PLACE: " ${RUN_IN_PLACE})
set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build") set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")
@ -394,13 +399,15 @@ include(CPack)
# Add a target to generate API documentation with Doxygen # Add a target to generate API documentation with Doxygen
find_package(Doxygen) if(BUILD_DOCUMENTATION)
if(DOXYGEN_FOUND) find_package(Doxygen)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in if(DOXYGEN_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in
add_custom_target(doc ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile add_custom_target(doc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
COMMENT "Generating API documentation with Doxygen" VERBATIM WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
) COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif()
endif() endif()

@ -13,6 +13,7 @@ General options and their default values:
BUILD_SERVER=FALSE - Build Minetest server BUILD_SERVER=FALSE - Build Minetest server
BUILD_UNITTESTS=TRUE - Build unittest sources BUILD_UNITTESTS=TRUE - Build unittest sources
BUILD_BENCHMARKS=FALSE - Build benchmark sources BUILD_BENCHMARKS=FALSE - Build benchmark sources
BUILD_DOCUMENTATION=TRUE - Build doxygen documentation
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug) CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
Release - Release build Release - Release build
Debug - Debug build Debug - Debug build