aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QbsBuildConfig.cmake11
-rw-r--r--cmake/QbsDocumentation.cmake44
2 files changed, 29 insertions, 26 deletions
diff --git a/cmake/QbsBuildConfig.cmake b/cmake/QbsBuildConfig.cmake
index a29f550f2..e0a7d76d7 100644
--- a/cmake/QbsBuildConfig.cmake
+++ b/cmake/QbsBuildConfig.cmake
@@ -2,7 +2,9 @@ option(WITH_TESTS "Build Tests" ON)
option(WITH_UNIT_TESTS "Build Unit Tests" OFF)
option(INSTALL_PUBLIC_HEADERS "Whether to install public headers" ON)
option(QBS_ENABLE_RPATH "Whether to enable RPATH" ON)
-option(QBS_USE_BUNDLED_QT_SCRIPT "Whether to use bundled QtScript module" OFF)
+
+include(CMakeDependentOption)
+cmake_dependent_option(QBS_QUICKJS_LEAK_CHECK "Whether to check for quickjs leaks at the end" ON "CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
set(QBS_APP_INSTALL_DIR "bin" CACHE STRING "Relative install location for Qbs binaries.")
# default paths
@@ -24,6 +26,7 @@ set(QBS_PLUGINS_INSTALL_BASE "${QBS_LIBDIR_NAME}" CACHE STRING "Relative install
set(QBS_RESOURCES_INSTALL_BASE "." CACHE STRING "Relative install location for Qbs resources.")
set(QBS_HEADERS_INSTALL_DIR "include/qbs" CACHE STRING "Relative install location for Qbs headers.")
set(QBS_DOC_INSTALL_DIR "${QBS_RESOURCES_INSTALL_BASE}/share/doc/qbs" CACHE STRING "Relative install location for Qbs documentation.")
+set(QBS_DOC_HTML_DIR_NAME "html" CACHE STRING "The name of the dir with HTML files, appended to QBS_DOC_INSTALL_DIR.")
set(QBS_PLUGINS_INSTALL_DIR "${QBS_PLUGINS_INSTALL_BASE}/qbs/plugins")
set(QBS_RESOURCES_INSTALL_DIR "${QBS_RESOURCES_INSTALL_BASE}/share")
@@ -82,6 +85,9 @@ set(DEFAULT_DEFINES "")
if(WIN32)
list(APPEND DEFAULT_DEFINES UNICODE _UNICODE _SCL_SECURE_NO_WARNINGS)
endif()
+if(WITH_TESTS)
+ list(APPEND DEFAULT_DEFINES QBS_WITH_TESTS)
+endif()
# CMake 3.10 doesn't have list(TRANSFORM)
function(list_transform_prepend var prefix)
@@ -172,6 +178,9 @@ function(add_qbs_library target_name)
RUNTIME DESTINATION ${QBS_DLL_INSTALL_DIR}
)
endif()
+ if(MSVC)
+ target_compile_options(${target_name} PUBLIC /EHsc)
+ endif()
endfunction()
function(add_qbs_plugin target_name)
diff --git a/cmake/QbsDocumentation.cmake b/cmake/QbsDocumentation.cmake
index a1ce44057..bdcec664f 100644
--- a/cmake/QbsDocumentation.cmake
+++ b/cmake/QbsDocumentation.cmake
@@ -1,6 +1,7 @@
# Options:
option(QBS_INSTALL_HTML_DOCS "Whether to install Qbs HTML Documentation" OFF)
option(QBS_INSTALL_QCH_DOCS "Whether to install Qbs QCH Documentation" OFF)
+option(QBS_INSTALL_MAN_PAGE "Whether to install Qbs man page" OFF)
# Get information on directories from qmake
# as this is not yet exported by cmake.
@@ -39,23 +40,6 @@ function(qt_query_qmake)
endforeach()
endfunction()
-# Find programs:
-function(_qbs_doc_find_program result_var)
- if (NOT TARGET Qt${QT_VERSION_MAJOR}::qmake)
- message(FATAL_ERROR "QDoc is only available in Qt projects")
- endif()
-
- get_target_property(_qmake_binary Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
- get_filename_component(_qmake_dir "${_qmake_binary}" DIRECTORY)
- find_program("_prg_${result_var}" ${ARGN} HINTS "${_qmake_dir}")
- if ("_prg_${result_var}" STREQUAL "_prg_${result_var}-NOTFOUND")
- set("_prg_${result_var}" "${result_var}-NOTFOUND")
- message(WARNING "Could not find binary for ${result_var}")
- endif()
-
- set(${result_var} "${_prg_${result_var}}" PARENT_SCOPE)
-endfunction()
-
function(_qbs_setup_doc_targets)
# Set up important targets:
if (NOT TARGET qbs_html_docs)
@@ -69,6 +53,11 @@ function(_qbs_setup_doc_targets)
BuildQbsDocumentation ALL COMMENT "Build Qbs documentation")
add_dependencies(BuildQbsDocumentation qbs_html_docs qbs_qch_docs)
endif()
+ if (NOT TARGET qbs_docs)
+ add_custom_target(
+ qbs_docs ALL COMMENT "Build Qbs documentation")
+ add_dependencies(qbs_docs BuildQbsDocumentation)
+ endif()
endfunction()
function(_find_python_module module)
@@ -108,6 +97,8 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval)
list(APPEND _env "${_export}=${${_export}}")
endforeach()
+ get_target_property(_qdoc Qt${QT_VERSION_MAJOR}::qdoc IMPORTED_LOCATION)
+
set(_full_qdoc_command "${_qdoc}")
if (_env)
set(_full_qdoc_command "${CMAKE_COMMAND}" "-E" "env" ${_env} "${_qdoc}")
@@ -119,8 +110,6 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval)
get_filename_component(_target "${_qdocconf_file}" NAME_WE)
- # message(${_target})
- # set(_html_outputdir "${_arg_HTML_DIR}/${_target}${_arg_POSTFIX}")
set(_html_outputdir "${_arg_HTML_DIR}")
file(MAKE_DIRECTORY "${_html_outputdir}")
@@ -183,6 +172,13 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval)
add_custom_target(${_html_target} DEPENDS "${_fixed_html_artifact}")
add_dependencies(qbs_html_docs "${_html_target}")
+ # artifacts might be required for QCH-only installation, so we build them
+ # always, and skip HTML docs installation here
+ if (QBS_INSTALL_HTML_DOCS)
+ install(DIRECTORY "${_html_outputdir}" DESTINATION "${_arg_INSTALL_DIR}"
+ COMPONENT qbs_docs)
+ endif()
+
set("${_retval}" "${_html_outputdir}" PARENT_SCOPE)
endfunction()
@@ -228,17 +224,14 @@ function(_qbs_setup_qhelpgenerator_targets _qdocconf_file _html_outputdir)
add_dependencies(qbs_qch_docs "${_qch_target}")
install(FILES "${_qch_outputdir}/${_target}.qch" DESTINATION "${_arg_INSTALL_DIR}"
- COMPONENT qbs_qch_docs)
- install(DIRECTORY "${_qch_outputdir}/html" DESTINATION "${_arg_INSTALL_DIR}"
- COMPONENT qbs_html_docs)
+ COMPONENT qbs_docs)
endfunction()
# Helper functions:
function(_qbs_qdoc_build_qdocconf_file _qdocconf_file)
_qbs_setup_doc_targets()
- _qbs_doc_find_program(_qdoc NAMES qdoc qdoc-qt5)
- if (_qdoc STREQUAL "_prg__qdoc-NOTFOUND")
+ if (NOT TARGET Qt${QT_VERSION_MAJOR}::qdoc)
message(WARNING "No qdoc binary found: No documentation targets were generated")
return()
endif()
@@ -285,10 +278,11 @@ function(add_qbs_documentation qdocconf_file)
set(SRCDIR "${Qbs_SOURCE_DIR}/doc")
set(_qch_params)
+ # if QBS_INSTALL_QCH_DOCS is No, qch generation will be skipped entirely
if (QBS_INSTALL_QCH_DOCS)
set(_qch_params QCH QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif()
- set(_qdoc_params HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
+ set(_qdoc_params HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/${QBS_DOC_HTML_DIR_NAME}")
list(APPEND _qdoc_params INSTALL_DIR "${QBS_DOC_INSTALL_DIR}")
# Set up environment for qdoc: