aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindClangTidy.cmake26
-rw-r--r--cmake/modules/FindCppcheck.cmake32
-rw-r--r--cmake/modules/FindIncludeWhatYouUse.cmake26
-rw-r--r--cmake/modules/FindLCMS2.cmake4
-rw-r--r--cmake/platform/windows/defines.txt2
-rw-r--r--cmake/platform/windowsstore/defines.txt2
-rw-r--r--cmake/scripts/android/ArchSetup.cmake1
-rw-r--r--cmake/scripts/common/CompilerSettings.cmake4
-rw-r--r--cmake/scripts/common/ProjectMacros.cmake8
-rw-r--r--cmake/scripts/windowsstore/ArchSetup.cmake1
-rw-r--r--cmake/treedata/common/subdirs.txt1
11 files changed, 98 insertions, 9 deletions
diff --git a/cmake/modules/FindClangTidy.cmake b/cmake/modules/FindClangTidy.cmake
new file mode 100644
index 0000000000..6ea614d7c6
--- /dev/null
+++ b/cmake/modules/FindClangTidy.cmake
@@ -0,0 +1,26 @@
+#.rst:
+# FindClangTidy
+# -------------
+# Finds clang-tidy and sets it up to run along with the compiler for C and CXX.
+
+find_program(CLANG_TIDY_EXECUTABLE clang-tidy)
+
+if(CLANG_TIDY_EXECUTABLE)
+ execute_process(COMMAND "${CLANG_TIDY_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CLANG_TIDY_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]* version [^\n]*" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}")
+ string(REGEX REPLACE ".* version (.*)" "\\1" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ClangTidy REQUIRED_VARS CLANG_TIDY_EXECUTABLE
+ VERSION_VAR CLANG_TIDY_VERSION)
+
+if(CLANGTIDY_FOUND)
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE)
+ set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(CLANG_TIDY_EXECUTABLE)
diff --git a/cmake/modules/FindCppcheck.cmake b/cmake/modules/FindCppcheck.cmake
new file mode 100644
index 0000000000..d3b6e84e4b
--- /dev/null
+++ b/cmake/modules/FindCppcheck.cmake
@@ -0,0 +1,32 @@
+#.rst:
+# FindCppcheck
+# ------------
+# Finds cppcheck and sets it up to run along with the compiler for C and CXX.
+
+find_program(CPPCHECK_EXECUTABLE cppcheck)
+
+if(CPPCHECK_EXECUTABLE)
+ execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CPPCHECK_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "Cppcheck (.*)" "\\1" CPPCHECK_VERSION "${CPPCHECK_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Cppcheck REQUIRED_VARS CPPCHECK_EXECUTABLE
+ VERSION_VAR CPPCHECK_VERSION)
+
+if(CPPCHECK_FOUND)
+ # CMake < 3.16 treats Objective-C (OBJC) files as C files and Objective-C++ (OBJCXX) files as C++ files,
+ # but cppcheck doesn't support Objective-C and Objective-C++.
+ # CMake >= 3.16 added support for Objective-C and Objective-C++ language,
+ # but doesn't support OBJC and OBJCXX for <LANG>_CLANG_TIDY.
+ file(WRITE "${CMAKE_BINARY_DIR}/cppcheck" "case \"$@\" in *.m|*.mm) exit 0; esac\nexec \"${CPPCHECK_EXECUTABLE}\" --quiet --relative-paths=\"${CMAKE_SOURCE_DIR}\" \"$@\"\n")
+ execute_process(COMMAND chmod +x "${CMAKE_BINARY_DIR}/cppcheck")
+
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_CPPCHECK "${CMAKE_BINARY_DIR}/cppcheck" PARENT_SCOPE)
+ set(CMAKE_CXX_CPPCHECK "${CMAKE_BINARY_DIR}/cppcheck" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(CPPCHECK_EXECUTABLE)
diff --git a/cmake/modules/FindIncludeWhatYouUse.cmake b/cmake/modules/FindIncludeWhatYouUse.cmake
new file mode 100644
index 0000000000..b22225ae5c
--- /dev/null
+++ b/cmake/modules/FindIncludeWhatYouUse.cmake
@@ -0,0 +1,26 @@
+#.rst:
+# FindIncludeWhatYouUse
+# ---------------------
+# Finds include-what-you-use and sets it up to run along with the compiler for C and CXX.
+
+find_program(IWYU_EXECUTABLE NAMES include-what-you-use iwyu)
+
+if(IWYU_EXECUTABLE)
+ execute_process(COMMAND "${IWYU_EXECUTABLE}" --version
+ OUTPUT_VARIABLE IWYU_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]*include-what-you-use [^\n]*" IWYU_VERSION "${IWYU_VERSION}")
+ string(REGEX REPLACE "include-what-you-use ([^ \n\r\t]+).*" "\\1" IWYU_VERSION "${IWYU_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(IncludeWhatYouUse REQUIRED_VARS IWYU_EXECUTABLE
+ VERSION_VAR IWYU_VERSION)
+
+if(INCLUDEWHATYOUUSE_FOUND)
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE)
+ set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(IWYU_EXECUTABLE)
diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
index d02515815d..7cc1497333 100644
--- a/cmake/modules/FindLCMS2.cmake
+++ b/cmake/modules/FindLCMS2.cmake
@@ -15,7 +15,7 @@
# LCMS2::LCMS2 - The LCMS Color Management library
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET)
+ pkg_check_modules(PC_LCMS2 lcms2 QUIET)
endif()
find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h
@@ -33,7 +33,7 @@ find_package_handle_standard_args(LCMS2
if(LCMS2_FOUND)
set(LCMS2_LIBRARIES ${LCMS2_LIBRARY})
set(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
- set(LCMS2_DEFINITIONS -DHAVE_LCMS2=1 -DCMS_NO_REGISTER_KEYWORD=1)
+ set(LCMS2_DEFINITIONS -DHAVE_LCMS2=1)
if(NOT TARGET LCMS2::LCMS2)
add_library(LCMS2::LCMS2 UNKNOWN IMPORTED)
diff --git a/cmake/platform/windows/defines.txt b/cmake/platform/windows/defines.txt
index 1a7609a27c..137a3d64ee 100644
--- a/cmake/platform/windows/defines.txt
+++ b/cmake/platform/windows/defines.txt
@@ -1 +1 @@
--DTARGET_WINDOWS -DTARGET_WINDOWS_DESKTOP -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_ \ No newline at end of file
+-DTARGET_WINDOWS -DTARGET_WINDOWS_DESKTOP -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS \ No newline at end of file
diff --git a/cmake/platform/windowsstore/defines.txt b/cmake/platform/windowsstore/defines.txt
index e962feb24d..09e1b082ef 100644
--- a/cmake/platform/windowsstore/defines.txt
+++ b/cmake/platform/windowsstore/defines.txt
@@ -1 +1 @@
--DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_ \ No newline at end of file
+-DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS \ No newline at end of file
diff --git a/cmake/scripts/android/ArchSetup.cmake b/cmake/scripts/android/ArchSetup.cmake
index 1e529de05d..888d0425dc 100644
--- a/cmake/scripts/android/ArchSetup.cmake
+++ b/cmake/scripts/android/ArchSetup.cmake
@@ -39,6 +39,7 @@ endif()
list(APPEND SYSTEM_DEFINES -DHAS_ZEROCONF)
set(ENABLE_X11 OFF CACHE BOOL "" FORCE)
+set(ENABLE_CLANGTIDY OFF CACHE BOOL "Enable clang-tidy support?" FORCE)
set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
set(ENABLE_MDNS OFF CACHE BOOL "" FORCE)
diff --git a/cmake/scripts/common/CompilerSettings.cmake b/cmake/scripts/common/CompilerSettings.cmake
index bb0af925ce..b4e7e89220 100644
--- a/cmake/scripts/common/CompilerSettings.cmake
+++ b/cmake/scripts/common/CompilerSettings.cmake
@@ -1,5 +1,7 @@
# Languages and global compiler settings
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake
index fba5252a9b..67d65b24bd 100644
--- a/cmake/scripts/common/ProjectMacros.cmake
+++ b/cmake/scripts/common/ProjectMacros.cmake
@@ -77,12 +77,12 @@ endfunction()
function(sca_add_tests)
find_program(CLANGCHECK_COMMAND clang-check)
- find_program(CPPCHECK_COMMAND cppcheck)
+ find_program(CPPCHECK_EXECUTABLE cppcheck)
if(CLANGCHECK_COMMAND AND CMAKE_EXPORT_COMPILE_COMMANDS)
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/linux/clang-check-test.sh.in
${CORE_BUILD_DIR}/clang-check-test.sh)
endif()
- if(CPPCHECK_COMMAND)
+ if(CPPCHECK_EXECUTABLE)
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/linux/cppcheck-test.sh.in
${CORE_BUILD_DIR}/cppcheck-test.sh)
set(CPPCHECK_INCLUDES)
@@ -99,9 +99,9 @@ function(sca_add_tests)
COMMAND ${CORE_BUILD_DIR}/clang-check-test.sh ${CLANGCHECK_COMMAND} ${src}
CONFIGURATIONS analyze clang-check)
endif()
- if(CPPCHECK_COMMAND)
+ if(CPPCHECK_EXECUTABLE)
add_test(NAME cppcheck+${name}
- COMMAND ${CORE_BUILD_DIR}/cppcheck-test.sh ${CPPCHECK_COMMAND} ${src} ${CPPCHECK_INCLUDES}
+ COMMAND ${CORE_BUILD_DIR}/cppcheck-test.sh ${CPPCHECK_EXECUTABLE} ${src} ${CPPCHECK_INCLUDES}
CONFIGURATIONS analyze cppcheck)
endif()
endif()
diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake
index 9473a4bb61..ad55a01ac8 100644
--- a/cmake/scripts/windowsstore/ArchSetup.cmake
+++ b/cmake/scripts/windowsstore/ArchSetup.cmake
@@ -79,6 +79,7 @@ list(APPEND SYSTEM_DEFINES -DHAS_WIN10_NETWORK)
# The /MP option enables /FS by default.
set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS} /EHsc /await")
+set(CMAKE_CXX_STANDARD 17)
# Google Test needs to use shared version of runtime libraries
set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt
index 64f1c9fc50..1988d5b5dc 100644
--- a/cmake/treedata/common/subdirs.txt
+++ b/cmake/treedata/common/subdirs.txt
@@ -33,6 +33,7 @@ xbmc/guilib guilib
xbmc/guilib/guiinfo guilib_guiinfo
xbmc/input input
xbmc/input/actions input/actions
+xbmc/input/button input/button
xbmc/input/joysticks input/joysticks
xbmc/input/joysticks/dialogs input/joysticks/dialogs
xbmc/input/joysticks/generic input/joysticks/generic