summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/CodeCoverage.cmake33
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateTokenNames.cmake37
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateVersionHeader.cmake39
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw32.cmake19
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw64.cmake19
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/uninstall.cmake27
6 files changed, 174 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/CodeCoverage.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/CodeCoverage.cmake
new file mode 100644
index 00000000..670c5144
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/CodeCoverage.cmake
@@ -0,0 +1,33 @@
+#
+# Code Coverage
+#
+
+if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
+ message( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
+endif ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
+
+if ( NOT DEFINED CODECOV_OUTPUTFILE )
+ set( CODECOV_OUTPUTFILE cmake_coverage.output )
+endif ( NOT DEFINED CODECOV_OUTPUTFILE )
+
+if ( NOT DEFINED CODECOV_HTMLOUTPUTDIR )
+ set( CODECOV_HTMLOUTPUTDIR coverage_results )
+endif ( NOT DEFINED CODECOV_HTMLOUTPUTDIR )
+
+if ( CMAKE_COMPILER_IS_GNUCXX )
+ find_program( CODECOV_LCOV lcov )
+ find_program( CODECOV_GENHTML genhtml )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -W -Wshadow \
+ -Wunused-variable -Wunused-parameter -Wunused-function -Wunused \
+ -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings \
+ -fprofile-arcs -ftest-coverage" )
+ link_libraries( gcov )
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage" )
+ add_custom_target( coverage_init ALL ${CODECOV_LCOV} --base-directory ${PROJECT_SOURCE_DIR}/src
+ --directory ${CMAKE_BINARY_DIR} --output-file ${CODECOV_OUTPUTFILE} --no-external --capture --initial
+ DEPENDS ${CODECOVERAGE_DEPENDS})
+ add_custom_target( coverage ${CODECOV_LCOV} --base-directory ${PROJECT_SOURCE_DIR}/src
+ --directory ${CMAKE_BINARY_DIR} --output-file ${CODECOV_OUTPUTFILE} --no-external --capture)
+ add_custom_target( coverage_html ${CODECOV_GENHTML} -o ${CODECOV_HTMLOUTPUTDIR} ${CODECOV_OUTPUTFILE}
+ DEPENDS coverage )
+endif ( CMAKE_COMPILER_IS_GNUCXX )
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateTokenNames.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateTokenNames.cmake
new file mode 100644
index 00000000..02a6241a
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateTokenNames.cmake
@@ -0,0 +1,37 @@
+#
+# Generate token_names.h from token_enum.h
+#
+# This script is meant to be executed with `cmake -P` from a custom command,
+# and expects the variables `src_file` and `dst_file` to be set.
+#
+
+function(generate_token_names src_file dst_file)
+ set(tokens "")
+
+ file(READ "${src_file}" token_lines)
+ string(REGEX REPLACE ";|\\[|\\]" " " token_lines "${token_lines}")
+ string(REPLACE "\n" ";" token_lines "${token_lines}")
+
+ foreach(token_line ${token_lines})
+ if(${token_line} MATCHES "^[ \t]*CT_([A-Z0-9_]+),.*$")
+ list(APPEND tokens " \"${CMAKE_MATCH_1}\",\n")
+ endif()
+ endforeach()
+
+ file(WRITE "${dst_file}"
+ "/*\n"
+ " * Generated by CMake\n"
+ " */\n"
+ "#ifndef TOKEN_NAMES_H_INCLUDED\n"
+ "#define TOKEN_NAMES_H_INCLUDED\n"
+ "\n"
+ "const char *token_names[] =\n"
+ "{\n"
+ ${tokens}
+ "};\n"
+ "\n"
+ "#endif /* TOKEN_NAMES_H_INCLUDED */\n"
+ )
+endfunction()
+
+generate_token_names("${src_file}" "${dst_file}")
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateVersionHeader.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateVersionHeader.cmake
new file mode 100644
index 00000000..3d6d376b
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/GenerateVersionHeader.cmake
@@ -0,0 +1,39 @@
+#
+# Generate uncrustify_version.h from uncrustify_version.h.in
+#
+# This script is meant to be executed with `cmake -P` from a custom target,
+# and expects the variables `PYTHON_EXECUTABLE`, `SOURCE_DIR`, `INPUT`,
+# `OUTPUT` and `UNCRUSTIFY_VERSION` to be set.
+#
+
+
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${SOURCE_DIR}/scripts/make_version.py
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ RESULT_VARIABLE make_version_error
+ OUTPUT_VARIABLE make_version_output
+)
+
+if (make_version_error)
+ # It's normal for make_version.py to fail when building from a tarball, so we
+ # want to avoid anything that looks too much like a scary error. Thus, report
+ # the error in an innocuous-looking fashion.
+ #
+ # If make_version.py is failing unexpectedly and needs to be debugged,
+ # uncomment the next few lines.
+ # string(STRIP "${make_version_output}" make_version_output)
+ # message(STATUS
+ # "scripts/make_version.py exited with code ${make_version_error}: "
+ # "${make_version_output}")
+
+ message(STATUS
+ "Unable to determine version from source tree; "
+ "fallback version '${UNCRUSTIFY_VERSION}' will be used")
+ message(STATUS
+ "(This is normal if you are building from a zip / tarball)")
+else()
+ string(STRIP ${make_version_output} UNCRUSTIFY_VERSION)
+ message(STATUS "Version: '${UNCRUSTIFY_VERSION}'")
+endif()
+
+configure_file("${INPUT}" "${OUTPUT}" @ONLY)
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw32.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw32.cmake
new file mode 100644
index 00000000..c220975c
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw32.cmake
@@ -0,0 +1,19 @@
+#
+# Toolchain file for cross-compiling from Linux to Win32 using MinGW
+#
+
+set(CMAKE_SYSTEM_NAME Windows)
+
+if(NOT COMPILER_PREFIX)
+ if(EXISTS /usr/i586-mingw32msvc)
+ # mingw
+ set(COMPILER_PREFIX "i586-mingw32msvc")
+ else()
+ # default to mingw-w64
+ set(COMPILER_PREFIX "i686-w64-mingw32")
+ endif()
+endif()
+
+find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
+find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
+find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw64.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw64.cmake
new file mode 100644
index 00000000..bc1a666e
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/Toolchain-mingw64.cmake
@@ -0,0 +1,19 @@
+#
+# Toolchain file for cross-compiling from Linux to Win64 using MinGW
+#
+
+set(CMAKE_SYSTEM_NAME Windows)
+
+if(NOT COMPILER_PREFIX)
+ if(EXISTS /usr/amd64-mingw32msvc-gcc)
+ # mingw
+ set(COMPILER_PREFIX "amd64-mingw32msvc-gcc")
+ else()
+ # default to mingw-w64
+ set(COMPILER_PREFIX "x86_64-w64-mingw32")
+ endif()
+endif()
+
+find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
+find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
+find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/uninstall.cmake b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/uninstall.cmake
new file mode 100644
index 00000000..b9618a29
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/cmake/uninstall.cmake
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.0.2)
+
+set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
+
+if(NOT EXISTS ${MANIFEST})
+ message(FATAL_ERROR "Cannot find install manifest: ${MANIFEST}")
+endif()
+
+file(STRINGS ${MANIFEST} files)
+foreach(file ${files})
+ if(EXISTS ${file} OR IS_SYMLINK ${file})
+ message(STATUS "Removing: ${file}")
+
+ execute_process(COMMAND rm -f ${file}
+ RESULT_VARIABLE result
+ OUTPUT_QUIET
+ ERROR_VARIABLE stderr
+ ERROR_STRIP_TRAILING_WHITESPACE
+ )
+
+ if(NOT ${result} EQUAL 0)
+ message(FATAL_ERROR "${stderr}")
+ endif()
+ else()
+ message(STATUS "Does-not-exist: ${file}")
+ endif()
+endforeach(file)