diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..c874703 --- /dev/null +++ b/.clang-format @@ -0,0 +1,91 @@ +# +# ChimeraTK clang-format definition. +# +# Use with clang-format-14. Please refer to https://apt.llvm.org/ for installation instructions on older Ubuntu versions. +# +--- +BasedOnStyle: LLVM +AccessModifierOffset: '-1' +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: 'false' +AlignConsecutiveDeclarations: 'false' +AlignEscapedNewlines: Right +AlignOperands: 'false' +AlignTrailingComments: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AllowShortBlocksOnASingleLine: 'false' +AllowShortCaseLabelsOnASingleLine: 'false' +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: 'true' +AllowShortLoopsOnASingleLine: 'true' +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'false' +AlwaysBreakTemplateDeclarations: 'true' +BinPackArguments: 'true' +BinPackParameters: 'true' +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BraceWrapping: + BeforeCatch: true + BeforeElse: true +BreakBeforeInheritanceComma: 'false' +BreakBeforeTernaryOperators: 'false' +BreakConstructorInitializers: BeforeColon +BreakStringLiterals: 'true' +ColumnLimit: '120' +CompactNamespaces: 'true' +ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' +ConstructorInitializerIndentWidth: '0' +ContinuationIndentWidth: '4' +Cpp11BracedListStyle: 'true' +DerivePointerAlignment: 'false' +DisableFormat: 'false' +ExperimentalAutoDetectBinPacking: 'false' +FixNamespaceComments: 'true' +IndentCaseLabels: 'true' +IndentPPDirectives: AfterHash +IndentWidth: '2' +IndentWrappedFunctionNames: 'true' +KeepEmptyLinesAtTheStartOfBlocks: 'false' +Language: Cpp +MaxEmptyLinesToKeep: '1' +NamespaceIndentation: All +PenaltyBreakBeforeFirstCallParameter: '1000' +PenaltyBreakComment: '10000' +PenaltyBreakFirstLessLess: '1000' +PenaltyBreakString: '10000' +PenaltyExcessCharacter: '700' +PenaltyReturnTypeOnItsOwnLine: '500' +PointerAlignment: Left +ReflowComments: 'true' +SortIncludes: 'CaseInsensitive' +IncludeBlocks: 'Regroup' +IncludeCategories: + - Regex: '^' + Priority: 6 + - Regex: '^<.*>' + Priority: 5 +SortUsingDeclarations: 'false' +SpaceAfterCStyleCast: 'false' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeParens: Never +SpaceInEmptyParentheses: 'false' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInContainerLiterals: 'true' +SpacesInParentheses: 'false' +SpacesInSquareBrackets: 'false' +Standard: Latest +UseTab: Never diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..548e71d --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,352 @@ +HeaderFilterRegex: '.*' +Checks: > + -*, + boost-use-to-string, + bugprone-argument-comment, + bugprone-assert-side-effect, + bugprone-bad-signal-to-kill-thread, + bugprone-bool-pointer-implicit-conversion, + bugprone-branch-clone, + bugprone-copy-constructor-init, + bugprone-dangling-handle, + bugprone-dynamic-static-initializers, + bugprone-exception-escape, + bugprone-fold-init-type, + bugprone-forward-declaration-namespace, + bugprone-forwarding-reference-overload, + bugprone-implicit-widening-of-multiplication-result, + bugprone-inaccurate-erase, + bugprone-incorrect-roundings, + bugprone-infinite-loop, + bugprone-integer-division, + bugprone-lambda-function-name, + bugprone-macro-parentheses, + bugprone-macro-repeated-side-effects, + bugprone-misplaced-operator-in-strlen-in-alloc, + bugprone-misplaced-pointer-arithmetic-in-alloc, + bugprone-misplaced-widening-cast, + bugprone-move-forwarding-reference, + bugprone-multiple-statement-macro, + bugprone-narrowing-conversions, + bugprone-no-escape, + bugprone-not-null-terminated-result, + bugprone-parent-virtual-call, + bugprone-posix-return, + bugprone-redundant-branch-condition, + bugprone-reserved-identifier, + bugprone-signal-handler, + bugprone-signed-char-misuse, + bugprone-sizeof-container, + bugprone-sizeof-expression, + bugprone-spuriously-wake-up-functions, + bugprone-string-constructor, + bugprone-string-integer-assignment, + bugprone-string-literal-with-embedded-nul, + bugprone-suspicious-enum-usage, + bugprone-suspicious-include, + bugprone-suspicious-memory-comparison, + bugprone-suspicious-memset-usage, + bugprone-suspicious-missing-comma, + bugprone-suspicious-realloc-usage, + bugprone-suspicious-semicolon, + bugprone-suspicious-string-compare, + bugprone-suspicious-stringview-data-usage, + bugprone-swapped-arguments, + bugprone-terminating-continue, + bugprone-throw-keyword-missing, + bugprone-too-small-loop-variable, + bugprone-undefined-memory-manipulation, + bugprone-undelegated-constructor, + bugprone-unhandled-exception-at-new, + bugprone-unhandled-self-assignment, + bugprone-unused-local-non-trivial-variable, + bugprone-unused-raii, + bugprone-unused-return-value, + bugprone-use-after-move, + bugprone-virtual-near-miss, + clang-analyzer-apiModeling.Errno, + clang-analyzer-apiModeling.TrustNonnull, + clang-analyzer-apiModeling.TrustReturnsNonnull, + clang-analyzer-apiModeling.google.GTest, + clang-analyzer-apiModeling.llvm.CastValue, + clang-analyzer-apiModeling.llvm.ReturnValue, + clang-analyzer-core.BitwiseShift, + clang-analyzer-core.CallAndMessage, + clang-analyzer-core.DivideZero, + clang-analyzer-core.DynamicTypePropagation, + clang-analyzer-core.FixedAddressDereference, + clang-analyzer-core.NonNullParamChecker, + clang-analyzer-core.NonnilStringConstants, + clang-analyzer-core.NullDereference, + clang-analyzer-core.NullPointerArithm, + clang-analyzer-core.StackAddressEscape, + clang-analyzer-core.UndefinedBinaryOperatorResult, + clang-analyzer-core.VLASize, + clang-analyzer-core.builtin.AssumeModeling, + clang-analyzer-core.builtin.BuiltinFunctions, + clang-analyzer-core.builtin.NoReturnFunctions, + clang-analyzer-core.uninitialized.ArraySubscript, + clang-analyzer-core.uninitialized.Assign, + clang-analyzer-core.uninitialized.Branch, + clang-analyzer-core.uninitialized.CapturedBlockVariable, + clang-analyzer-core.uninitialized.NewArraySize, + clang-analyzer-core.uninitialized.UndefReturn, + clang-analyzer-cplusplus.ArrayDelete, + clang-analyzer-cplusplus.InnerPointer, + clang-analyzer-cplusplus.Move, + clang-analyzer-cplusplus.NewDelete, + clang-analyzer-cplusplus.NewDeleteLeaks, + clang-analyzer-cplusplus.PlacementNew, + clang-analyzer-cplusplus.PureVirtualCall, + clang-analyzer-cplusplus.SelfAssignment, + clang-analyzer-cplusplus.SmartPtrModeling, + clang-analyzer-cplusplus.StringChecker, + clang-analyzer-deadcode.DeadStores, + clang-analyzer-fuchsia.HandleChecker, + clang-analyzer-nullability.NullPassedToNonnull, + clang-analyzer-nullability.NullReturnedFromNonnull, + clang-analyzer-nullability.NullableDereferenced, + clang-analyzer-nullability.NullablePassedToNonnull, + clang-analyzer-nullability.NullableReturnedFromNonnull, + clang-analyzer-optin.core.EnumCastOutOfRange, + clang-analyzer-optin.cplusplus.UninitializedObject, + clang-analyzer-optin.cplusplus.VirtualCall, + clang-analyzer-optin.mpi.MPI-Checker, + clang-analyzer-optin.osx.OSObjectCStyleCast, + clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, + clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker, + clang-analyzer-optin.performance.GCDAntipattern, + clang-analyzer-optin.performance.Padding, + clang-analyzer-optin.portability.UnixAPI, + clang-analyzer-optin.taint.GenericTaint, + clang-analyzer-optin.taint.TaintPropagation, + clang-analyzer-optin.taint.TaintedAlloc, + clang-analyzer-optin.taint.TaintedDiv, + clang-analyzer-osx.API, + clang-analyzer-osx.MIG, + clang-analyzer-osx.NumberObjectConversion, + clang-analyzer-osx.OSObjectRetainCount, + clang-analyzer-osx.ObjCProperty, + clang-analyzer-osx.SecKeychainAPI, + clang-analyzer-osx.cocoa.AtSync, + clang-analyzer-osx.cocoa.AutoreleaseWrite, + clang-analyzer-osx.cocoa.ClassRelease, + clang-analyzer-osx.cocoa.Dealloc, + clang-analyzer-osx.cocoa.IncompatibleMethodTypes, + clang-analyzer-osx.cocoa.Loops, + clang-analyzer-osx.cocoa.MissingSuperCall, + clang-analyzer-osx.cocoa.NSAutoreleasePool, + clang-analyzer-osx.cocoa.NSError, + clang-analyzer-osx.cocoa.NilArg, + clang-analyzer-osx.cocoa.NonNilReturnValue, + clang-analyzer-osx.cocoa.ObjCGenerics, + clang-analyzer-osx.cocoa.RetainCount, + clang-analyzer-osx.cocoa.RetainCountBase, + clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak, + clang-analyzer-osx.cocoa.SelfInit, + clang-analyzer-osx.cocoa.SuperDealloc, + clang-analyzer-osx.cocoa.UnusedIvars, + clang-analyzer-osx.cocoa.VariadicMethodTypes, + clang-analyzer-osx.coreFoundation.CFError, + clang-analyzer-osx.coreFoundation.CFNumber, + clang-analyzer-osx.coreFoundation.CFRetainRelease, + clang-analyzer-osx.coreFoundation.containers.OutOfBounds, + clang-analyzer-osx.coreFoundation.containers.PointerSizedValues, + clang-analyzer-security.ArrayBound, + clang-analyzer-security.FloatLoopCounter, + clang-analyzer-security.MmapWriteExec, + clang-analyzer-security.PointerSub, + clang-analyzer-security.PutenvStackArray, + clang-analyzer-security.SetgidSetuidOrder, + clang-analyzer-security.VAList, + clang-analyzer-security.cert.env.InvalidPtr, + clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, + clang-analyzer-security.insecureAPI.SecuritySyntaxChecker, + clang-analyzer-security.insecureAPI.UncheckedReturn, + clang-analyzer-security.insecureAPI.bcmp, + clang-analyzer-security.insecureAPI.bcopy, + clang-analyzer-security.insecureAPI.bzero, + clang-analyzer-security.insecureAPI.decodeValueOfObjCType, + clang-analyzer-security.insecureAPI.getpw, + clang-analyzer-security.insecureAPI.gets, + clang-analyzer-security.insecureAPI.mkstemp, + clang-analyzer-security.insecureAPI.mktemp, + clang-analyzer-security.insecureAPI.rand, + clang-analyzer-security.insecureAPI.strcpy, + clang-analyzer-security.insecureAPI.vfork, + clang-analyzer-unix.API, + clang-analyzer-unix.BlockInCriticalSection, + clang-analyzer-unix.Chroot, + clang-analyzer-unix.DynamicMemoryModeling, + clang-analyzer-unix.Errno, + clang-analyzer-unix.Malloc, + clang-analyzer-unix.MallocSizeof, + clang-analyzer-unix.MismatchedDeallocator, + clang-analyzer-unix.StdCLibraryFunctions, + clang-analyzer-unix.Stream, + clang-analyzer-unix.Vfork, + clang-analyzer-unix.cstring.BadSizeArg, + clang-analyzer-unix.cstring.CStringModeling, + clang-analyzer-unix.cstring.NotNullTerminated, + clang-analyzer-unix.cstring.NullArg, + clang-analyzer-webkit.NoUncountedMemberChecker, + clang-analyzer-webkit.RefCntblBaseVirtualDtor, + clang-analyzer-webkit.UncountedLambdaCapturesChecker, + clang-diagnostic-*, + cppcoreguidelines-interfaces-global-init, + cppcoreguidelines-narrowing-conversions, + cppcoreguidelines-no-malloc, + cppcoreguidelines-owning-memory, + cppcoreguidelines-pro-type-const-cast, + cppcoreguidelines-pro-type-cstyle-cast, + cppcoreguidelines-pro-type-member-init, + cppcoreguidelines-pro-type-reinterpret-cast, + cppcoreguidelines-pro-type-static-cast-downcast, + cppcoreguidelines-pro-type-union-access, + darwin-avoid-spinlock, + darwin-dispatch-once-nonstatic, + google-build-explicit-make-pair, + google-build-namespaces, + google-default-arguments, + google-explicit-constructor, + google-global-names-in-headers, + google-objc-avoid-nsobject-new, + google-objc-avoid-throwing-exception, + google-objc-function-naming, + google-objc-global-variable-declaration, + google-readability-avoid-underscore-in-googletest-name, + google-runtime-float, + google-runtime-int, + google-runtime-operator, + google-upgrade-googletest-case, + hicpp-exception-baseclass, + hicpp-multiway-paths-covered, + hicpp-no-assembler, + hicpp-signed-bitwise, + linuxkernel-must-check-errs, + llvm-namespace-comment, + llvm-prefer-isa-or-dyn-cast-in-conditionals, + llvm-prefer-register-over-unsigned, + llvm-prefer-static-over-anonymous-namespace, + llvm-twine-local, + misc-definitions-in-headers, + misc-include-cleaner, + misc-misplaced-const, + misc-new-delete-overloads, + misc-non-copyable-objects, + misc-redundant-expression, + misc-static-assert, + misc-throw-by-value-catch-by-reference, + misc-unconventional-assign-operator, + misc-uniqueptr-reset-release, + misc-unused-alias-decls, + misc-unused-parameters, + misc-unused-using-decls, + modernize-avoid-bind, + modernize-avoid-c-arrays, + modernize-concat-nested-namespaces, + modernize-deprecated-headers, + modernize-deprecated-ios-base-aliases, + modernize-loop-convert, + modernize-make-shared, + modernize-make-unique, + modernize-pass-by-value, + modernize-raw-string-literal, + modernize-redundant-void-arg, + modernize-replace-auto-ptr, + modernize-replace-disallow-copy-and-assign-macro, + modernize-replace-random-shuffle, + modernize-return-braced-init-list, + modernize-shrink-to-fit, + modernize-unary-static-assert, + modernize-use-auto, + modernize-use-bool-literals, + modernize-use-default-member-init, + modernize-use-emplace, + modernize-use-equals-default, + modernize-use-equals-delete, + modernize-use-nodiscard, + modernize-use-noexcept, + modernize-use-nullptr, + modernize-use-override, + modernize-use-ranges, + modernize-use-transparent-functors, + modernize-use-uncaught-exceptions, + modernize-use-using, + mpi-buffer-deref, + mpi-type-mismatch, + objc-assert-equals, + objc-avoid-nserror-init, + objc-dealloc-in-category, + objc-forbidden-subclassing, + objc-missing-hash, + objc-nsdate-formatter, + objc-nsinvocation-argument-lifetime, + objc-property-declaration, + objc-super-self, + openmp-exception-escape, + openmp-use-default-none, + performance-faster-string-find, + performance-for-range-copy, + performance-implicit-conversion-in-loop, + performance-inefficient-algorithm, + performance-inefficient-vector-operation, + performance-move-const-arg, + performance-move-constructor-init, + performance-no-automatic-move, + performance-noexcept-move-constructor, + performance-trivially-destructible, + performance-type-promotion-in-math-fn, + performance-unnecessary-copy-initialization, + performance-unnecessary-value-param, + portability-restrict-system-includes, + portability-simd-intrinsics, + portability-std-allocator-const, + readability-avoid-const-params-in-decls, + readability-braces-around-statements, + readability-const-return-type, + readability-container-size-empty, + readability-convert-member-functions-to-static, + readability-delete-null-pointer, + readability-else-after-return, + readability-function-size, + readability-identifier-naming, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-misleading-indentation, + readability-misplaced-array-index, + readability-non-const-parameter, + readability-qualified-auto, + readability-redundant-access-specifiers, + readability-redundant-casting, + readability-redundant-control-flow, + readability-redundant-declaration, + readability-redundant-function-ptr-dereference, + readability-redundant-inline-specifier, + readability-redundant-member-init, + readability-redundant-parentheses, + readability-redundant-preprocessor, + readability-redundant-smartptr-get, + readability-redundant-string-cstr, + readability-redundant-string-init, + readability-redundant-typename, + readability-simplify-boolean-expr, + readability-simplify-subscript-expr, + readability-static-accessed-through-instance, + readability-static-definition-in-anonymous-namespace, + readability-string-compare, + readability-uniqueptr-delete-release, + readability-uppercase-literal-suffix, + readability-use-anyofallof, + zircon-temporary-objects + +CheckOptions: + misc-include-cleaner.MissingIncludes: 'false' + misc-include-cleaner.IgnoreHeaders: 'boost/test/unit_test.hpp;' + readability-identifier-naming.ClassCase: 'CamelCase' + readability-identifier-naming.FunctionCase: 'camelBack' + readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE' + readability-identifier-naming.MemberCase: 'camelBack' + readability-identifier-naming.PrivateMemberPrefix: '_' + readability-identifier-naming.ProtectedMemberPrefix: '_' + readability-identifier-naming.PublicMemberPrefix: '' diff --git a/.gitignore b/.gitignore index 378eac2..6a838a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,34 @@ +###################### +# Section for 'ignore patterns' from the project-template +# +# !! Don't edit anything in this section to avoid merge conflics !! +###################### build +.project +.cproject +.pydevproject +.settings +.kdev4 +*.kdev4 +.vscode +CMakeLists.txt.user +*.code-workspace +.cache +#files ending with ~ are emacs backups +*~ +#files ending with .swp might show up when using vi +*.swp + +# ignore cmake presets file +CMakePresets.json +# ignore this files used with clangd +compile_commands.json + +###################### +# Project specific 'ignore patterns' +# +# Put you project specific ignores below. +# If they are generally useful consider adding them to the +# project-template and the merge them in. +###################### +doc/html/ \ No newline at end of file diff --git a/.jenkinsfile b/.jenkinsfile new file mode 100644 index 0000000..65c2e91 --- /dev/null +++ b/.jenkinsfile @@ -0,0 +1,2 @@ +@Library('ChimeraTK') _ +autojob(['ChimeraTK/DeviceAccess'], 'https://github.com/ChimeraTK/ControlSystemAdapter') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a2aa15..741c78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,119 +1,140 @@ -cmake_minimum_required(VERSION 2.8.0) - -project(ControlSystemAdapter) - -set(${PROJECT_NAME}_MAJOR_VERSION 00) -set(${PROJECT_NAME}_MINOR_VERSION 00) -set(${PROJECT_NAME}_PATCH_VERSION 00) -set(${PROJECT_NAME}_VERSION - ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}) -set(${PROJECT_NAME}_SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}) - -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -Wextra -Wshadow -#-Weffc++ -ansi -pedantic -Wuninitialized -std=c++11") -#skip -Weffc++ for the moment. It gives too many false positives -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -pedantic -Wuninitialized -std=c++11") - -#use -DCMAKE_BUILD_TYPE=Debug in your cmake command to turn on the coverage option -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 --coverage") - -#boost as such is required for shared pointers e.g. -FIND_PACKAGE(Boost REQUIRED) -include_directories(${Boost_INCLUDE_DIRS}) - -#boost chrono is needed for measuring time intervals. +cmake_minimum_required(VERSION 3.16) + +project(ChimeraTK-ControlSystemAdapter) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +set(${PROJECT_NAME}_MAJOR_VERSION 02) +set(${PROJECT_NAME}_MINOR_VERSION 13) +set(${PROJECT_NAME}_PATCH_VERSION 03) +include(cmake/set_version_numbers.cmake) + +include(cmake/set_default_build_to_release.cmake) +include(cmake/set_default_flags.cmake) +include(cmake/enable_code_coverage_report.cmake) +include(cmake/add_linter_target.cmake) + +include(cmake/format_options.cmake) + +# boost as such is required for shared pointers e.g. +FIND_PACKAGE(Boost 1.58 REQUIRED) + +# boost chrono is needed for measuring time intervals. FIND_PACKAGE(Boost REQUIRED COMPONENTS chrono) -#boost system is needed by boost::lockfree. +# boost system is needed by boost::lockfree. FIND_PACKAGE(Boost REQUIRED COMPONENTS system) -#boost thread is needed for synchronization and multi-threading +# boost thread is needed for synchronization and multi-threading FIND_PACKAGE(Boost REQUIRED COMPONENTS thread) -#the unit test component is optional -FIND_PACKAGE(Boost COMPONENTS unit_test_framework) -IF(Boost_UNIT_TEST_FRAMEWORK_FOUND) - set(TESTING_IS_ENABLED "true") +# boost system is needed by some tests +FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem) + +# the unit test component is optional +option(BUILD_TESTS "Build test programs" ON) + +IF(BUILD_TESTS) + FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework) ENABLE_TESTING() -ELSE(Boost_UNIT_TEST_FRAMEWORK_FOUND) - message("Boost unit_test_framework not found, disabling testing") -ENDIF(Boost_UNIT_TEST_FRAMEWORK_FOUND) +ENDIF() + +# do not remove runtime paths of the library when installing (helps for unsually located implicit dependencies) +SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -include_directories(${CMAKE_SOURCE_DIR}/include) +# DeviceAccess is needed due to the common interface classes +# no longer use add_dependency by directly find_package because we don't want pulled in options become PUBLIC +FIND_PACKAGE(ChimeraTK-DeviceAccess 03.18 REQUIRED) + +# libXML++ is used for parsing/writing XML files +FIND_PACKAGE(PkgConfig REQUIRED) +set(LIBXML++_VERSION "libxml++-2.6") +PKG_CHECK_MODULES(LibXML++ REQUIRED IMPORTED_TARGET ${LIBXML++_VERSION}) + +file(GLOB_RECURSE library_headers ${CMAKE_SOURCE_DIR}/include/ChimeraTK/*.h + ${CMAKE_SOURCE_DIR}/tests/include/ChimeraTK/ControlSystemAdapter/Testing/*.h) aux_source_directory(${CMAKE_SOURCE_DIR}/src library_sources) -#Create the executables for automated unit testing. -#Currently we assume that they are all tests contained in one file, so -#each file gives a new executable. This section has to be adapted if this should change. -if(TESTING_IS_ENABLED) - #include_directories(${CMAKE_SOURCE_DIR}/tests/include) +# Create the executables for automated unit testing. +# Currently we assume that they are all tests contained in one file, so +# each file gives a new executable. This section has to be adapted if this should change. +if(BUILD_TESTS) aux_source_directory(${CMAKE_SOURCE_DIR}/tests/src testSources) aux_source_directory(${CMAKE_SOURCE_DIR}/tests/auxsrc testAuxSources) - foreach( testSourceFile ${testSources}) - #NAME_WE means the base name without path and (longest) extension + + foreach(testSourceFile ${testSources}) + # NAME_WE means the base name without path and (longest) extension get_filename_component(executableName ${testSourceFile} NAME_WE) add_executable(${executableName} ${testSourceFile} ${testAuxSources}) - target_include_directories(${executableName} PRIVATE ${CMAKE_SOURCE_DIR}/tests/include) - #no target library yet - # Linking the boost libraries and using their included counterparts at the - # same time causes problems. - #target_link_libraries(${executableName} ${PROJECT_NAME} ${Boost_LIBRARIES}) - target_link_libraries(${executableName} ${PROJECT_NAME} ${Boost_CHRONO_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) + + # Includes inside the library are local includes, so we give the full path to the include directory + target_include_directories(${executableName} PRIVATE ${CMAKE_SOURCE_DIR}/include/ChimeraTK/ControlSystemAdapter) + target_include_directories(${executableName} PRIVATE ${CMAKE_SOURCE_DIR}/tests/include/ChimeraTK/ControlSystemAdapter/Testing) + + # The ReferenceTestApplication is written to work with the control system adapter as installed, so + # we add that path as system just for the tests. + target_include_directories(${executableName} SYSTEM BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/include) + target_link_libraries(${executableName} + + # most of the time we set dependencies for tests to PRIVATE; however since ReferenceTestApplication + # gets installed and is header-only, in this case we put PUBLIC + PUBLIC ${PROJECT_NAME} + + # not yet implicit from CSAdapter + PUBLIC Boost::filesystem pthread) add_test(${executableName} ${executableName}) - endforeach( testSourceFile ) - - #The make coverage command is only available in debug mode - IF(CMAKE_BUILD_TYPE STREQUAL "Debug") - configure_file(cmake/Makefile.coverage.in - ${PROJECT_BINARY_DIR}/Makefile.coverage @ONLY) - add_custom_target(coverage - make -f Makefile.coverage - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating test coverage documentation" VERBATIM - ) - ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") - -endif(TESTING_IS_ENABLED) - -add_library(${PROJECT_NAME} SHARED ${library_sources} ) -set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_SOVERSION}) -target_link_libraries(${PROJECT_NAME} ${Boost_CHRONO_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) - -#change the install prefix to the source directory in case the user has not specified a destination -#i. e. CMAKE_INSTALL_PREFIX is not set manually -IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - SET(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH "Install directory - prefix" FORCE) -ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - -#Install the library + endforeach(testSourceFile) + + FILE(COPY tests/changedType.persist DESTINATION ${PROJECT_BINARY_DIR}) + FILE(COPY tests/changedVectorSize.persist DESTINATION ${PROJECT_BINARY_DIR}) + FILE(COPY tests/renamedVariable.persist DESTINATION ${PROJECT_BINARY_DIR}) +endif() + +add_library(${PROJECT_NAME} SHARED ${library_sources} ${library_headers}) + +# Includes inside the library are local includes, so we give the full path to the include directory +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include/ChimeraTK/ControlSystemAdapter) +target_include_directories(${PROJECT_NAME} PUBLIC + "$" + + # relative to ${CMAKE_INSTALL_PREFIX} but don't explicitly mention it, to make result relocatable + "$") + +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_FULL_LIBRARY_VERSION} SOVERSION ${${PROJECT_NAME}_SOVERSION}) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::LibXML++) +target_link_libraries(${PROJECT_NAME} + PUBLIC + Boost::chrono Boost::system Boost::thread + ChimeraTK::ChimeraTK-DeviceAccess) + +# Install the library +# this defines architecture-dependent ${CMAKE_INSTALL_LIBDIR} +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -#all include files go into include/PROJECT_NAME -install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/${PROJECT_NAME} - FILES_MATCHING PATTERN "*.h" - PATTERN ".svn" EXCLUDE - PATTERN "${PROJECT_NAME}" EXCLUDE) - -#We additionally install the independent reference test application, it's header only -install(FILES ${CMAKE_SOURCE_DIR}/tests/include/IndependentTestCore.h DESTINATION include/${PROJECT_NAME}/testing) - -#Create the config files by filling the correct variables into the template (*.cmake.in). -#All variables @VARIABLE@ are replaced with the current values, but they have to be set first.... -#Only the reference header is needed. The other variables are for dependencies of this library, -#but there are none. -set(${PROJECT_NAME}_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include ${Boost_INCLUDE_DIRS}") -set(${PROJECT_NAME}_LIBRARIES "${PROJECT_NAME} ${Boost_CHRONO_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}") -set(${PROJECT_NAME}_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib ${Boost_LIBRARY_DIRS}") -set(${PROJECT_NAME}_CPPFLAGS "-std=c++11") -set(${PROJECT_NAME}_LDFLAGS "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib,--enable-new-dtags") -include(${CMAKE_SOURCE_DIR}/cmake/create_cmake_config_files.cmake) +# all include files go into include +install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include + FILES_MATCHING + PATTERN "ChimeraTK/*.h" + PATTERN "ChimeraTK/ControlSystemAdapter/*.h") + +# We additionally install the reference test application, it's header only +install(DIRECTORY ${CMAKE_SOURCE_DIR}/tests/include/ DESTINATION include + FILES_MATCHING + PATTERN "ChimeraTK/ControlSystemAdapter/Testing/*.h") +# we need the public dependencies so create_cmake_config_files can find them as implicit dependencies +list(APPEND ${PROJECT_NAME}_PUBLIC_DEPENDENCIES "Boost COMPONENTS system thread filesystem date_time chrono") +list(APPEND ${PROJECT_NAME}_PUBLIC_DEPENDENCIES "ChimeraTK-DeviceAccess") -## The instructions to create a debian package are loaded from a separate file -#include(${CMAKE_SOURCE_DIR}/cmake/prepare_debian_package.cmake) +# we support our cmake EXPORTS as imported targets +set(PROVIDES_EXPORTED_TARGETS 1) +include(${CMAKE_SOURCE_DIR}/cmake/create_cmake_config_files.cmake) +# # The instructions to create a debian package are loaded from a separate file +# include(${CMAKE_SOURCE_DIR}/cmake/prepare_debian_package.cmake) +include(${CMAKE_SOURCE_DIR}/cmake/enable_doxygen_documentation.cmake) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/COPYING.LESSER b/COPYING.LESSER new file mode 100644 index 0000000..0a04128 --- /dev/null +++ b/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/HowTo_project-template.md b/HowTo_project-template.md new file mode 100644 index 0000000..06a298a --- /dev/null +++ b/HowTo_project-template.md @@ -0,0 +1,41 @@ +This file descibes the intended way to use the template project. + +## Concept +The project template is merged via git. The idea is to have the whole +project-template repository merged into the project which uses it, incl. +all the history. Like this updates and improvements in the template +scripts can easily be propagated to all client projects by simply +merging the head of project template. + +## Instructions + +### Initial import and getting of the project template +In your local git repository, issue: + ``` + $ git fetch https://github.com/ChimeraTK/project-template.git + $ git merge FETCH_HEAD --allow-unrelated-histories +``` +To pull in an update of the project template, you can leave out the `--allow-unrelated-histories` flag. + +Note: you can access the files provided in the cmake directory from your +CMakeLists.txt after appending this location to your `CMAKE_MODULE_PATH` +variable + +### Updating/Improving the project template + + - Never write to the project template from one of the client projects! If + you have improvements or additions to the project template, check out + the project-template repository separately, make the modifications and + commit/push them. + + - Be careful not to break functionality for other project which are using + the template! + + - After the project template is updated you can merge the changes into + your project as described in the section above. (Getting updates of project template) + + - Note: For testing you might want to add your local repository of + project-template as a remote to your project, so you don't have to push + untested changes. Be careful that everything is pushed to github when + you are done in order not to lose consistency of the repositories. + diff --git a/This_project_uses_the_project-template.txt b/This_project_uses_the_project-template.txt new file mode 100644 index 0000000..ec7651f --- /dev/null +++ b/This_project_uses_the_project-template.txt @@ -0,0 +1,7 @@ +This project uses the ChimeraTK project-template. + +It contains some files (like this one) which should not be changed +inside the project. The files should be improved in a generic way in the +project-template and are afterwards merged into all projects which use the +project-template. Like this it is easier to improve the build scripts and +keep them consistent across projects. diff --git a/cmake/ConfigGenerator_configureThisHost.sh.in b/cmake/ConfigGenerator_configureThisHost.sh.in new file mode 100755 index 0000000..d8782a4 --- /dev/null +++ b/cmake/ConfigGenerator_configureThisHost.sh.in @@ -0,0 +1,16 @@ +#!/bin/bash + +## The purpose of this script is to call the correct version of the config +## generator for a particulat server config. The directory with the +## config generator version is put into a template by cmake, and this script +## is placed into the actual server config directory. + +server_type="$1" +if [[ -z ${server_type} ]]; then + echo "No server type given at command line." + exit 1 +fi + +export CFGDIR="$(dirname "$(which "$0")")" + +@ConfigGenerator_DIR@/config myself --type ${server_type} diff --git a/cmake/Doxyfile.in b/cmake/Doxyfile.in new file mode 100644 index 0000000..1b77afa --- /dev/null +++ b/cmake/Doxyfile.in @@ -0,0 +1,66 @@ +# Difference with default Doxyfile 1.9.8 +PROJECT_NAME = @PROJECT_NAME@ +PROJECT_NUMBER = @DOXYGEN_PROJECT_NUMBER@ +PROJECT_LOGO = @CMAKE_CURRENT_SOURCE_DIR@/doc/ChimeraTK_Logo_whitebg.png +OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doc +JAVADOC_AUTOBRIEF = YES +TAB_SIZE = 8 +BUILTIN_STL_SUPPORT = YES +EXTRACT_ALL = YES +CASE_SENSE_NAMES = NO +SORT_MEMBERS_CTORS_1ST = YES +QUIET = YES +INPUT = @CMAKE_CURRENT_SOURCE_DIR@ +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + */doc/*.md +RECURSIVE = YES +EXCLUDE_SYMBOLS = ChimeraTK::detail +EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_BINARY_DIR@/generated +IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@ +SOURCE_BROWSER = YES +HTML_COLORSTYLE_HUE = 202 +HTML_COLORSTYLE_SAT = 255 +HTML_COLORSTYLE_GAMMA = 100 +HTML_DYNAMIC_SECTIONS = YES +GENERATE_TREEVIEW = YES +MATHJAX_RELPATH = http://www.mathjax.org/mathjax +GENERATE_LATEX = NO +LATEX_CMD_NAME = latex +EXTERNAL_GROUPS = NO +EXTERNAL_PAGES = NO +TEMPLATE_RELATIONS = YES +DOT_IMAGE_FORMAT = svg +INTERACTIVE_SVG = YES +DOT_GRAPH_MAX_NODES = 200 +HAVE_DOT = YES diff --git a/cmake/FindMako.cmake b/cmake/FindMako.cmake new file mode 100644 index 0000000..c2a85da --- /dev/null +++ b/cmake/FindMako.cmake @@ -0,0 +1,84 @@ +# First check for python executable +if(NOT PYTHON_EXECUTABLE) + find_program(PYTHON_EXECUTABLE python) + if(NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "Please check for python before searching for mako") + endif() +endif() +# If mako was installed by this process previously, check that it is still there +if(MAKO_EXTERNAL_INSTALL) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} "-c \"import mako\"" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/python + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE MAKO_STILL_THERE + ) + if(MAKO_STILL_THERE) + return() + endif() +endif() +# If mako is not found ... +if(NOT FOUND_MAKO) + # Then look for it by importing it + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import mako" + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE FOUND_MAKO + ) + if(FOUND_MAKO EQUAL 0) + message(STATUS "[Mako] Found") + set(FOUND_MAKO TRUE CACHE INTERNAL "Found mako python package") + set(MAKO_EXTERNAL_INSTALL FALSE CACHE INTERNAL "Manual install of mako") + return() + endif() +else() + # If mako already found then continue + # We have checked that it was still there, if we installed it + return() +endif() + +message(STATUS "[Mako] Not found") +# Now try and install mako using pip +if(NOT PIP_EXECUTABLE) + find_program(PIP_EXECUTABLE pip) +endif() +if(NOT PIP_EXECUTABLE) + message(FATAL_ERROR "cannot install package without pip") +else() + message(STATUS "[pip] found: ${PIP_EXECUTABLE}") +endif() +# We install it in the build directory +execute_process( + COMMAND ${PIP_EXECUTABLE} install mako + --install-option=--install-purelib=${PROJECT_BINARY_DIR}/external/python + --install-option=--install-scripts=${PROJECT_BINARY_DIR}/external/python + --install-option=--prefix=${PROJECT_BINARY_DIR}/external/python + OUTPUT_VARIABLE PIP_OUTPUT + ERROR_VARIABLE PIP_ERROR + RESULT_VARIABLE PIP_INSTALLATION_WORKED +) +if(NOT PIP_INSTALLATION_WORKED EQUAL 0) + message(STATUS "${PIP_OUTPUT}") + message(STATUS "${PIP_ERROR}") + message(FATAL_ERROR "Could not install mako. Please see error message above") +else() + message(STATUS "[Mako] installed in ${PROJECT_BINARY_DIR}/external/python") +endif() + +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import mako" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/python + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE FOUND_MAKO +) +if(FOUND_MAKO EQUAL 0) + message(STATUS "[Mako] now available in build directory") + set(FOUND_MAKO TRUE CACHE INTERNAL "Found mako python package") + set(MAKO_EXTERNAL_INSTALL TRUE CACHE INTERNAL "Manual install of mako") + return() +else() + message(FATAL_ERROR "Could not install mako") +endif() diff --git a/cmake/FindPROJECT_NAME.cmake.in.in b/cmake/FindPROJECT_NAME.cmake.in.in deleted file mode 100644 index c3f6aa8..0000000 --- a/cmake/FindPROJECT_NAME.cmake.in.in +++ /dev/null @@ -1,27 +0,0 @@ -# -# cmake module for finding @PROJECT_NAME@ -# -# returns: -# @PROJECT_NAME@_FOUND : true or false, depending on whether the package was found -# @PROJECT_NAME@_VERSION : the package version -# @PROJECT_NAME@_INCLUDE_DIRS : path to the include directory -# @PROJECT_NAME@_LIBRARY_DIRS : path to the library directory -# @PROJECT_NAME@_LIBRARIES : the provided libraries -# -# @author Martin Killenberg, DESY -# - -# Since this file is already part of the installation to be found, the configuration can be hard-coded at -# installation time -set(@PROJECT_NAME@_VERSION @@PROJECT_NAME@_SOVERSION@) -set(@PROJECT_NAME@_INCLUDE_DIRS @@PROJECT_NAME@_INCLUDE_DIRS@) -set(@PROJECT_NAME@_LIBRARY_DIRS @@PROJECT_NAME@_LIBRARY_DIRS@) -set(@PROJECT_NAME@_LIBRARIES @@PROJECT_NAME@_LIBRARIES@) - -# Use a macro provided by CMake to check if all the listed arguments are valid and set @PROJECT_NAME@_FOUND accordingly. -# This is mainly important to check the version. -set(@PROJECT_NAME@_FOUND 0) -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(@PROJECT_NAME@ REQUIRED_VARS @PROJECT_NAME@_LIBRARIES @PROJECT_NAME@_INCLUDE_DIRS - VERSION_VAR @PROJECT_NAME@_VERSION ) - diff --git a/cmake/Makefile.coverage.in b/cmake/Makefile.coverage.in deleted file mode 100644 index 79b08d3..0000000 --- a/cmake/Makefile.coverage.in +++ /dev/null @@ -1,8 +0,0 @@ -coverage: - rm -f `find . -name "*\.gcda"` - make test - lcov --capture --directory . --output-file coverage_all.info - #lcov capture also includes external stuff like glibc, boost etc. - #only extract the reports for this project - lcov --extract coverage_all.info "@CMAKE_SOURCE_DIR@*" -o coverage.info - genhtml coverage.info --output-directory coverage_html diff --git a/cmake/Modules/FindConfigGenerator.cmake b/cmake/Modules/FindConfigGenerator.cmake new file mode 100644 index 0000000..dd15881 --- /dev/null +++ b/cmake/Modules/FindConfigGenerator.cmake @@ -0,0 +1,41 @@ +####################################################################################################################### +# +# cmake module for finding the config generator +# +# returns: +# ConfigGenerator_FOUND : true or false, depending on whether the package was found +# ConfigGenerator_VERSION : the package version +# ConfigGenerator_DIR : path to the include directory +# +# @author Martin Hierholzer, DESY +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +SET(ConfigGenerator_FOUND 0) + + +file(GLOB ConfigGenerator_SEARCH_PATHS ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_INSTALL_PREFIX}/share/ConfigGenerator*" "/usr/share/ConfigGenerator*") +FIND_PATH(ConfigGenerator_DIR + NAMES ConfigGeneratorConfigVersion.cmake + PATHS ${ConfigGenerator_SEARCH_PATHS} +) + +include(${ConfigGenerator_DIR}/ConfigGeneratorConfigVersion.cmake) +set(ConfigGenerator_VERSION ${PACKAGE_VERSION}) + +# use a macro provided by CMake to check if all the listed arguments are valid and set ConfigGenerator_FOUND accordingly +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ConfigGenerator REQUIRED_VARS ConfigGenerator_DIR VERSION_VAR ConfigGenerator_VERSION ) + diff --git a/cmake/Modules/FindDOOCS.cmake b/cmake/Modules/FindDOOCS.cmake new file mode 100644 index 0000000..443bd19 --- /dev/null +++ b/cmake/Modules/FindDOOCS.cmake @@ -0,0 +1,210 @@ +####################################################################################################################### +# +# cmake module for finding DOOCS +# +# By default, only the client API is included. If the component "server" is specified, also the +# server library will be used. If the component "zmq" is specified, the DOOCSdzmq library will be used as well. +# Currently support components: api, server, zmq, dapi, ddaq, daqreader, daqsndlib, timinglib +# +# returns: +# DOOCS_FOUND : true or false, depending on whether the package was found +# DOOCS_VERSION : the package version +# DOOCS_LIBRARIES : list of libraries to link against +# DOOCS_DIR : doocs library dir +# +# Also returns following for compatibility, however imported targets should be preferred for usage: +# DOOCS_INCLUDE_DIRS : path to the include directory +# DOOCS_LIBRARY_DIRS : path to the library directory +# DOOCS_CXX_FLAGS : Flags needed to be passed to the c++ compiler +# DOOCS_LINK_FLAGS : Flags needed to be passed to the linker +# +# For each component , an imported target DOOCS:: is returned. +# We support calling find_package(DOOCS COMPONENTS ) several times, for adding in different components . +# DOOCS_LIBRARIES will be updated to include all requested components as imported targets. +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +SET(DOOCS_FOUND 0) + +# if set, include the --no-as-needed linker flag which helps if inner dependencies between libs are not properly +# set inside the library binaries +set(DOOCS_noAsNeededFlag 1) + +# note, helper functions and variables should also be prefixed with DOOCS_, since everything is exported to +# project calling find_package(DOOCS) + +function (DOOCS_prependToPkgConfPath newPath) + if (NOT (":$ENV{PKG_CONFIG_PATH}:" MATCHES ":${newPath}:")) + set(ENV{PKG_CONFIG_PATH} ${newPath}:$ENV{PKG_CONFIG_PATH}) + endif() +endfunction() + +DOOCS_prependToPkgConfPath(/export/doocs/lib/pkgconfig) +if(DOOCS_DIR) + # prepend pkgconfig for user-set doocs dir; this makes sure system-installed DOOCS is overwritten + DOOCS_prependToPkgConfPath(${DOOCS_DIR}/x86_64-linux-gnu/pkgconfig) + DOOCS_prependToPkgConfPath(${DOOCS_DIR}/pkgconfig) +endif() +if (NOT DOOCS_FIND_QUIETLY) + message("FindDOOCS: Using PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}") +endif() + +# We add the always - required API component +if (NOT (";${DOOCS_FIND_COMPONENTS};" MATCHES ";api;")) + list(PREPEND DOOCS_FIND_COMPONENTS "api") +endif() + +function(expandDoocsComponentName longName shortName) + if (";${shortName};" MATCHES ";api;") + set(${longName} "doocs-doocsapi" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";zmq;") + set(${longName} "doocs-doocsdzmq" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";dapi;") + set(${longName} "doocs-doocsdapi" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";server;") + set(${longName} "doocs-serverlib" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";ddaq;") + set(${longName} "doocs-doocsddaq" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";daqreader;") + set(${longName} "doocs-daqreaderlib" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";daqsndlib;") + set(${longName} "doocs-daqsndlib" PARENT_SCOPE) + elseif (";${shortName};" MATCHES ";timinglib;") + set(${longName} "doocs-doocstiminglib" PARENT_SCOPE) + else() + set(${longName} "${shortName}" PARENT_SCOPE) + endif() +endfunction() + + +if(NOT PKG_CONFIG_FOUND) + include(CMakeFindDependencyMacro) + find_dependency(PkgConfig) +endif() +# thread libraries are required by DOOCS but seem not to be added through pkgconfig... +find_package(Threads REQUIRED) + +# We expect that find_package will be called more than once, with different components. +# Since imported targets cannot be replaced, the only clean solution is to define an imported component per pkgconfig component. +# pkg_check_modules can be called more than once, with different components. +# We define DOOCS_FIND_COMPONENTS_ALL to collect all asked-for components +foreach(component ${DOOCS_FIND_COMPONENTS}) + expandDoocsComponentName(componentLongName ${component}) + if (NOT ";${DOOCS_FIND_COMPONENTS_ALL};" MATCHES ";${componentLongName};") + list(APPEND DOOCS_FIND_COMPONENTS_ALL ${componentLongName}) + # IMPORTED_TARGET means also imported target PkgConfig::DOOCS will be defined. GLOBAL so we can alias. + pkg_check_modules(DOOCS_${component} REQUIRED IMPORTED_TARGET GLOBAL ${componentLongName}) + if (DOOCS_${component}_FOUND) + set(importedTarget PkgConfig::DOOCS_${component}) + if (NOT DOOCS_FIND_QUIETLY) + message(STATUS "FindDOOCS: imported target is ${importedTarget}. Defining alias DOOCS::${component}") + endif() + add_library(DOOCS::${component} ALIAS ${importedTarget}) + + set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} "DOOCS::${component}") + + if (${component} STREQUAL "api") + # add Threads lib only if not yet in + get_target_property(doocsLinkLibs ${importedTarget} INTERFACE_LINK_LIBRARIES) + if (NOT (";${doocsLinkLibs};" MATCHES ";Threads::Threads;")) + set_target_properties(${importedTarget} PROPERTIES INTERFACE_LINK_LIBRARIES "${doocsLinkLibs};Threads::Threads" ) + endif() + if(DOOCS_noAsNeededFlag) + get_target_property(doocsLinkFlags ${importedTarget} INTERFACE_LINK_OPTIONS) + string(REGEX REPLACE ".*-NOTFOUND" "" doocsLinkFlags "${doocsLinkFlags}") + set_target_properties(${importedTarget} PROPERTIES INTERFACE_LINK_OPTIONS "-Wl,--no-as-needed;${doocsLinkFlags}") + endif() + else() + # since we did some changes on DOOCS::api, add that as implicit dependency of the other components + # This makes sure projects not explicitly linking to DOOCS::api have the changes + get_target_property(doocsLinkLibs ${importedTarget} INTERFACE_LINK_LIBRARIES) + string(REGEX REPLACE ".*-NOTFOUND" "" doocsLinkLibs "${doocsLinkLibs}") + set_target_properties(${importedTarget} PROPERTIES INTERFACE_LINK_LIBRARIES "DOOCS::api;${doocsLinkLibs}") + endif() + + # strip the RPATH from the INTERFACE_LINK_OPTIONS of the imported target + # cmake will handle the RPATH properly itself when using imported targets. Adding the rpath linker flags + # explicitly will not only add the directories to the RPATH twice but also destroy the proper ordering, + # since the directories from the linker flags will be added first and e.g. the build directory will end up + # too late in the list. As a consequence, test executables might use the installed libraries instead of the + # library under test from the build directory - even for tests and libraries quite unrelated to DOOCS, as + # long as they have a DOOCS library as a (direct or indirect) dependency. + get_target_property(MY_LINK_OPTIONS ${importedTarget} INTERFACE_LINK_OPTIONS) + string(REGEX REPLACE "-Wl,-rpath,[^;]*" "" MY_LINK_OPTIONS "${MY_LINK_OPTIONS}") + string(REGEX REPLACE ";;" ";" MY_LINK_OPTIONS "${MY_LINK_OPTIONS}") + string(REGEX REPLACE "^;" "" MY_LINK_OPTIONS "${MY_LINK_OPTIONS}") + string(REGEX REPLACE ";$" "" MY_LINK_OPTIONS "${MY_LINK_OPTIONS}") + set_target_properties(${importedTarget} PROPERTIES INTERFACE_LINK_OPTIONS "${MY_LINK_OPTIONS}") + + # print some info about targets + get_target_property(doocsIncDirs ${importedTarget} INTERFACE_INCLUDE_DIRECTORIES) + message(VERBOSE " include dirs: ${doocsIncDirs}") + get_target_property(doocsCxxFlags ${importedTarget} INTERFACE_COMPILE_OPTIONS) + message(VERBOSE " compile options: ${doocsCxxFlags}") + get_target_property(doocsLinkFlags ${importedTarget} INTERFACE_LINK_OPTIONS) + message(VERBOSE " link options: ${doocsLinkFlags}") + get_target_property(doocsLinkLibs ${importedTarget} INTERFACE_LINK_LIBRARIES) + message(VERBOSE " link libs: ${doocsLinkLibs}") + get_target_property(doocsLinkDirs ${importedTarget} INTERFACE_LINK_DIRECTORIES) + message(VERBOSE " link dirs: ${doocsLinkDirs}") + + else() + message(FATAL_ERROR "DOOCS component ${component} not found!") + endif() + endif() +endforeach() +#message(DEBUG "complete list of searched components: ${DOOCS_FIND_COMPONENTS_ALL}") + +# append to list (arg) to space-separated list, only include not yet existing elements +macro(DOOCS_appendListToList list arg) + foreach(DOOCS_appendListToList_arg ${arg}) + string(FIND " ${${list}} " " ${DOOCS_appendListToList_arg} " DOOCS_appendListToList_pos) + if (${DOOCS_appendListToList_pos} EQUAL -1) + string(APPEND ${list} " ${DOOCS_appendListToList_arg}") + # strip leading spaces since they might cause problems + string(REGEX REPLACE "^[ \t]+" "" ${list} "${${list}}") + endif() + endforeach() +endmacro() + +# note, pkg_check_modules output variables _VERSION and _LIBDIR are different, +# depending on length of given module list! +set(DOOCS_DIR "${DOOCS_api_LIBDIR}") +set(DOOCS_VERSION "${DOOCS_api_VERSION}") + +set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + +# following lines are compatibiliy layer, required only if using project does not make use of imported targets +# here we should gather from all components +set(DOOCS_CFLAGS "") +set(DOOCS_LDFLAGS "") +if(DOOCS_noAsNeededFlag) + set(DOOCS_LDFLAGS "-Wl,--no-as-needed") +endif() +set(DOOCS_INCLUDE_DIRS "") +set(DOOCS_LIBRARY_DIRS "") +foreach(component api zmq server ddaq daqreader daqsndlib) + DOOCS_appendListToList(DOOCS_CFLAGS "${DOOCS_${component}_CFLAGS}") + DOOCS_appendListToList(DOOCS_LDFLAGS "${DOOCS_${component}_LDFLAGS}") + DOOCS_appendListToList(DOOCS_INCLUDE_DIRS "${DOOCS_${component}_INCLUDE_DIRS}") + DOOCS_appendListToList(DOOCS_LIBRARY_DIRS "${DOOCS_${component}_LIBRARY_DIRS}") +endforeach() +set(DOOCS_CXX_FLAGS ${DOOCS_CFLAGS}) +set(DOOCS_LINKER_FLAGS ${DOOCS_LDFLAGS}) +set(DOOCS_LINK_FLAGS ${DOOCS_LINKER_FLAGS}) + +# use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DOOCS REQUIRED_VARS DOOCS_DIR VERSION_VAR DOOCS_VERSION) diff --git a/cmake/Modules/FindFFTW.cmake b/cmake/Modules/FindFFTW.cmake new file mode 100644 index 0000000..8a88a21 --- /dev/null +++ b/cmake/Modules/FindFFTW.cmake @@ -0,0 +1,159 @@ +# - Find the FFTW library +# +# Usage: +# find_package(FFTW [REQUIRED] [QUIET] ) +# +# It sets the following variables: +# FFTW_FOUND ... true if fftw is found on the system +# FFTW_LIBRARIES ... full path to fftw library +# FFTW_INCLUDES ... fftw include directory +# +# The following variables will be checked by the function +# FFTW_USE_STATIC_LIBS ... if true, only static libraries are found +# FFTW_ROOT ... if set, the libraries are exclusively searched +# under this path +# FFTW_LIBRARY ... fftw library to use +# FFTW_INCLUDE_DIR ... fftw include directory +# + +#If environment variable FFTWDIR is specified, it has same effect as FFTW_ROOT +if( NOT FFTW_ROOT AND ENV{FFTWDIR} ) + set( FFTW_ROOT $ENV{FFTWDIR} ) +endif() + +# Check if we can use PkgConfig +find_package(PkgConfig) + +#Determine from PKG +if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT ) + pkg_check_modules( PKG_FFTW QUIET "fftw3" ) +endif() + +#Check whether to search static or dynamic libs +set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + +if( ${FFTW_USE_STATIC_LIBS} ) + set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ) +else() + set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} ) +endif() + +if( FFTW_ROOT ) + + #find libs + find_library( + FFTW_LIB + NAMES "fftw3" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_THREADS_LIB + NAMES "fftw3_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTWF_LIB + NAMES "fftw3f" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTWF_THREADS_LIB + NAMES "fftw3f_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTWL_LIB + NAMES "fftw3l" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTWL_THREADS_LIB + NAMES "fftw3l_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + #find includes + find_path( + FFTW_INCLUDES + NAMES "fftw3.h" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "include" + NO_DEFAULT_PATH + ) + +else() + + find_library( + FFTW_LIB + NAMES "fftw3" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_THREADS_LIB + NAMES "fftw3_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTWF_LIB + NAMES "fftw3f" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTWF_THREADS_LIB + NAMES "fftw3f_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTWL_LIB + NAMES "fftw3l" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTWL_THREADS_LIB + NAMES "fftw3l_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_path( + FFTW_INCLUDES + NAMES "fftw3.h" + PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR} + ) + +endif( FFTW_ROOT ) + +set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB}) + +if(FFTWL_LIB) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB}) +endif() + +set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFTW DEFAULT_MSG + FFTW_INCLUDES FFTW_LIBRARIES) + +mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB FFTW_THREADS_LIB FFTWF_THREADS_LIB FFTWL_THREADS_LIB) diff --git a/cmake/Modules/FindGccAtomic.cmake b/cmake/Modules/FindGccAtomic.cmake new file mode 100644 index 0000000..284f7be --- /dev/null +++ b/cmake/Modules/FindGccAtomic.cmake @@ -0,0 +1,24 @@ +# This scripts finds gcc's built-in atomic shared library (libatomic.so). +# It is required to link against this library on gcc when using 16 byte atomics, even when running on x86_64/amd64. + +FIND_LIBRARY(GccAtomic_LIBRARY NAMES atomic atomic.so.1 libatomic.so.1 + HINTS + $ENV{HOME}/local/lib64 + $ENV{HOME}/local/lib + /usr/local/lib64 + /usr/local/lib + /opt/local/lib64 + /opt/local/lib + /usr/lib64 + /usr/lib + /lib64 + /lib +) + +# we don't want to export the full path since this introduces problems with yocto cross-compilation +# so replace by simple lib name +if (GccAtomic_LIBRARY) + set(GccAtomic_LIBRARY "atomic") +endif() +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GccAtomic DEFAULT_MSG GccAtomic_LIBRARY) diff --git a/cmake/Modules/FindMako.cmake b/cmake/Modules/FindMako.cmake new file mode 100644 index 0000000..448a6a3 --- /dev/null +++ b/cmake/Modules/FindMako.cmake @@ -0,0 +1,93 @@ +# First check for python executable +if(Python_EXECUTABLE) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) +endif() + +if(Python3_EXECUTABLE) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) +endif() + + +if(NOT PYTHON_EXECUTABLE) + find_program(PYTHON_EXECUTABLE python) + if(NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "Please check for python before searching for mako") + endif() +endif() +# If mako was installed by this process previously, check that it is still there +if(MAKO_EXTERNAL_INSTALL) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} "-c \"import mako\"" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/python + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE MAKO_STILL_THERE + ) + if(MAKO_STILL_THERE) + return() + endif() +endif() +# If mako is not found ... +if(NOT FOUND_MAKO) + # Then look for it by importing it + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import mako" + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE FOUND_MAKO + ) + if(FOUND_MAKO EQUAL 0) + message(STATUS "[Mako] Found") + set(FOUND_MAKO TRUE CACHE INTERNAL "Found mako python package") + set(MAKO_EXTERNAL_INSTALL FALSE CACHE INTERNAL "Manual install of mako") + return() + endif() +else() + # If mako already found then continue + # We have checked that it was still there, if we installed it + return() +endif() + +message(STATUS "[Mako] Not found") +# Now try and install mako using pip +if(NOT PIP_EXECUTABLE) + find_program(PIP_EXECUTABLE pip) +endif() +if(NOT PIP_EXECUTABLE) + message(FATAL_ERROR "cannot install package without pip") +else() + message(STATUS "[pip] found: ${PIP_EXECUTABLE}") +endif() +# We install it in the build directory +execute_process( + COMMAND ${PIP_EXECUTABLE} install mako + --install-option=--install-purelib=${PROJECT_BINARY_DIR}/external/python + --install-option=--install-scripts=${PROJECT_BINARY_DIR}/external/python + --install-option=--prefix=${PROJECT_BINARY_DIR}/external/python + OUTPUT_VARIABLE PIP_OUTPUT + ERROR_VARIABLE PIP_ERROR + RESULT_VARIABLE PIP_INSTALLATION_WORKED +) +if(NOT PIP_INSTALLATION_WORKED EQUAL 0) + message(STATUS "${PIP_OUTPUT}") + message(STATUS "${PIP_ERROR}") + message(FATAL_ERROR "Could not install mako. Please see error message above") +else() + message(STATUS "[Mako] installed in ${PROJECT_BINARY_DIR}/external/python") +endif() + +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import mako" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/python + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE FOUND_MAKO +) +if(FOUND_MAKO EQUAL 0) + message(STATUS "[Mako] now available in build directory") + set(FOUND_MAKO TRUE CACHE INTERNAL "Found mako python package") + set(MAKO_EXTERNAL_INSTALL TRUE CACHE INTERNAL "Manual install of mako") + return() +else() + message(FATAL_ERROR "Could not install mako") +endif() diff --git a/cmake/Modules/FindPythonModule.cmake b/cmake/Modules/FindPythonModule.cmake new file mode 100644 index 0000000..744a269 --- /dev/null +++ b/cmake/Modules/FindPythonModule.cmake @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project +# SPDX-License-Identifier: LGPL-3.0-or-later + +# cmake module for checking the existence python modules +# Usage: find_package(PythonModule COMPONENTS module_a module_b) +# +# returns: +# PythonModule_FOUND : true if all listed components could be imported as a module +# PythonModule__FOUND: true if this particular module was found, false otherwise + +# First check for python executable if not provided +if(NOT Python_EXECUTABLE) + message(STATUS "PythonModule: No python executable found, looking for python 3.0 as baseline") + find_package(Python 3.0 REQUIRED COMPONENTS Interpreter) +endif() + +# Work-around so that we can use find_package_handle_standard_args to do the magic regarding components +set (_PythonModule_Run "yes") + +message(STATUS "Checking for requested python modules, using ${Python_EXECUTABLE}") +list(APPEND CMAKE_MESSAGE_INDENT " ") +foreach(python_module ${PythonModule_FIND_COMPONENTS}) + execute_process( + COMMAND ${Python_EXECUTABLE} -c "import ${python_module}" + ERROR_VARIABLE DUMMY + OUTPUT_VARIABLE DUMMY + RESULT_VARIABLE MODULE_RESULT) + if(MODULE_RESULT) + message("\"${python_module}\" could not be found") + else() + set(PythonModule_${python_module}_FOUND TRUE) + message("\"${python_module}\" seems to be available") + endif() +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PythonModule REQUIRED_VARS _PythonModule_Run HANDLE_COMPONENTS) diff --git a/cmake/Modules/FindlibYajl.cmake b/cmake/Modules/FindlibYajl.cmake new file mode 100644 index 0000000..fc10244 --- /dev/null +++ b/cmake/Modules/FindlibYajl.cmake @@ -0,0 +1,34 @@ +####################################################################################################################### +# +# cmake module for finding the yajl library +# +# returns: +# libYajl_FOUND : true or false, depending on whether the package was found +# libYajl_LIBRARY : path to the library +# @author Patrick Nonn, DESY +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +set(libYajl_FOUND 0) + +find_library(libYajl_LIBRARY + NAMES yajl yajl.so libyajl.so + PATHS /usr/lib /usr/lib32 /usr/lib64 /usr/local/lib + HINTS ${CMAKE_INSTALL_LIBDIR} +) + +# use a macro provided by CMake to check if all the listed arguments are valid and set Yajl_FOUND accordingly +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(libYajl REQUIRED_VARS libYajl_LIBRARY) diff --git a/cmake/Modules/Findreadline.cmake b/cmake/Modules/Findreadline.cmake new file mode 100644 index 0000000..8f432fc --- /dev/null +++ b/cmake/Modules/Findreadline.cmake @@ -0,0 +1,15 @@ +# Search for the path containing library's headers +find_path( readline_ROOT_DIR NAMES include/readline/readline.h ) + +# Search for include directory +find_path( readline_INCLUDE_DIR NAMES readline/readline.h + HINTS ${readline_ROOT_DIR}/include ) + +# Search for library +find_library( readline_LIBRARY NAMES readline + HINTS ${readline_ROOT_DIR}/lib ) + +# use a macro provided by CMake to check if all the listed arguments are valid and set readline_FOUND accordingly +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(readline DEFAULT_MSG readline_INCLUDE_DIR readline_LIBRARY ) + diff --git a/cmake/Modules/registerTests.cmake b/cmake/Modules/registerTests.cmake new file mode 100644 index 0000000..ec6c611 --- /dev/null +++ b/cmake/Modules/registerTests.cmake @@ -0,0 +1,131 @@ +include(CMakeParseArguments) +# +# usage: +# register_tests(SOURCES +# ${list_of_source_files} +# "test_src.cc" +# ${concatenated_string_of_source_files} +# NAMESPACE +# "test_namespace" +# LINK_LIBRARIES +# ${list_of_targets} +# INCLUDE_DIRECTORIES +# ${list_of_include_directories} +# COMPILE_OPTIONS +# ${list_of_compile_options} +# WORKING_DIRECTORY +# ${ctest_working_directory}) +# +# Function registers tests defined as a list of souce files. Test +# defined by file source_name.cc in the SOURCES list is registered under +# the name +# test_namespace.source_name +# +# If provided, test executables will use ${ctest_working_directory} +# as the working directory +# +# Provided list of dependent link targets and include directories are +# used as PRIVATE dependencies during compilation of test executable. +# +# Function implicitly adds a dependency on the boost unit test framework +# to each generated test executable. +function(register_tests) + find_package(Boost COMPONENTS unit_test_framework REQUIRED) + + list(APPEND single_parmeter_keywords NAMESPACE WORKING_DIRECTORY) + list(APPEND multi_parmeter_keywords SOURCES + LINK_LIBRARIES + INCLUDE_DIRECTORIES + COMPILE_OPTIONS) + cmake_parse_arguments("arg" "" "${single_parmeter_keywords}" + "${multi_parmeter_keywords}" "${ARGN}") + + + register_exe(SOURCES "${arg_SOURCES}" + NAMESPACE "${arg_NAMESPACE}" + WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}") + + get_test_targets(list_of_targets "${arg_SOURCES}") + + add_target_includes_private(TARGETS "${list_of_targets}" + LINK_LIBRARIES "${arg_INCLUDE_DIRECTORIES}" + "${Boost_INCLUDE_DIR}") + + add_target_link_libraries_private(TARGETS "${list_of_targets}" + LINK_LIBRARIES "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}" + "${arg_LINK_LIBRARIES}") + + add_target_compile_options_private(TARGETS "${list_of_targets}" + COMPILE_OPTIONS "${arg_COMPILE_OPTIONS}") + +endfunction() + +# +# Private functions: Do not use directly +###################################################################### +function(add_target_compile_options_private) + list(APPEND list_of_multivalue_keywords TARGETS COMPILE_OPTIONS) + cmake_parse_arguments("arg" "" "" "${list_of_multivalue_keywords}" "${ARGN}") + foreach( target IN LISTS arg_TARGETS) + target_compile_options(${target} + PRIVATE + ${arg_COMPILE_OPTIONS}) + endforeach() +endfunction() + + +function(add_target_includes_private) + + list(APPEND multi_value_keywords TARGETS LINK_LIBRARIES) + cmake_parse_arguments("arg" "" "" "${multi_value_keywords}" "${ARGN}") + foreach(target_name IN LISTS arg_TARGETS) + target_include_directories("${target_name}" + PRIVATE + "${arg_LINK_LIBRARIES}") + endforeach() +endfunction() + +###################################### +function(add_target_link_libraries_private) + list(APPEND multi_value_keywords TARGETS LINK_LIBRARIES) + cmake_parse_arguments("arg" "" "" "${multi_value_keywords}" "${ARGN}") + foreach(target_name IN LISTS arg_TARGETS) + target_link_libraries("${target_name}" + PRIVATE + "${arg_LINK_LIBRARIES}") + endforeach() +endfunction() + +###################################### +function(register_exe) + list(APPEND single_value_keywords NAMESPACE WORKING_DIRECTORY) + list(APPEND multi_value_keywords SOURCES) + + cmake_parse_arguments("arg" "" "${single_value_keywords}" + "${multi_value_keywords}" "${ARGN}") + foreach(source_name IN LISTS arg_SOURCES) + get_filename_component(target_name ${source_name} NAME_WE) + add_executable(${target_name} ${source_name}) + # Fixme: The thing below doesnt work for some reason + #add_test(NAME ${test_namespace}.${target_name} + # COMMAND ${target_name} + # WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests) + # + add_test(NAME + ${arg_NAMESPACE}.${target_name} + COMMAND + ${target_name} + WORKING_DIRECTORY + ${arg_WORKING_DIRECTORY}) + endforeach() +endfunction() + +###################################### +function(get_test_targets list_of_targets list_of_source_files ) + foreach(source_name IN LISTS list_of_source_files) + get_filename_component(target_name ${source_name} NAME_WE) + list(APPEND list_of_targets_ ${target_name}) + endforeach() + set(${list_of_targets} ${list_of_targets_} PARENT_SCOPE) +endfunction() +###################################################################### diff --git a/cmake/PROJECT_NAME-config.in.in b/cmake/PROJECT_NAME-config.in.in deleted file mode 100755 index c97e7c3..0000000 --- a/cmake/PROJECT_NAME-config.in.in +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -print_usage(){ - echo "usage: $0 [--cppflags] [--ldflags] [--version]" 1>&2 -} - -if [ $# -eq 0 ]; then - print_usage - exit 1 -fi - -#The variables are all prepared in CMAKE and also provided by -#Find@PROJECT_NAME@.cmake, so dependent applications can create consistent -#Makefiles. -while [ $# -gt 0 ]; do - case "$1" in - --cppflags) - OUTPUT="${OUTPUT}@@PROJECT_NAME@_CPPFLAGS_MAKEFILE@" - shift;; - --ldflags) - OUTPUT="${OUTPUT}@@PROJECT_NAME@_LDFLAGS_MAKEFILE@" - shift;; - --version) - OUTPUT="${OUTPUT}@@PROJECT_NAME@_SOVERSION@" - shift;; - *) - echo "invalid option: $1" 1>&2 - print_usage - exit 2;; - esac -done - -echo ${OUTPUT} diff --git a/cmake/PROJECT_NAME.pc.in.in b/cmake/PROJECT_NAME.pc.in.in new file mode 100644 index 0000000..b9ef4cf --- /dev/null +++ b/cmake/PROJECT_NAME.pc.in.in @@ -0,0 +1,5 @@ +Name: @PROJECT_NAME@ +Description: Config for @PROJECT_NAME@ +Version: @@PROJECT_NAME@_SOVERSION@ +Cflags: @@PROJECT_NAME@_CXX_FLAGS_MAKEFILE@ +Libs: @@PROJECT_NAME@_LINKER_FLAGS_MAKEFILE@ diff --git a/cmake/PROJECT_NAMEConfig.cmake.in.in b/cmake/PROJECT_NAMEConfig.cmake.in.in new file mode 100644 index 0000000..f12e79a --- /dev/null +++ b/cmake/PROJECT_NAMEConfig.cmake.in.in @@ -0,0 +1,89 @@ +####################################################################################################################### +# +# cmake module for finding @PROJECT_NAME@ +# +# returns: +# @PROJECT_NAME@_FOUND : true or false, depending on whether the package was found +# @PROJECT_NAME@_VERSION : the package version +# @PROJECT_NAME@_INCLUDE_DIRS : path to the include directory +# @PROJECT_NAME@_LIBRARY_DIRS : path to the library directory +# @PROJECT_NAME@_LIBRARIES : libraries the depending project needs to link against +# @PROJECT_NAME@_CXX_FLAGS : additional C++ compiler flags +# @PROJECT_NAME@_LINKER_FLAGS : additional linker flags +# +# Note for exporting project: +# If @PROJECT_NAME@ sets PROVIDES_EXPORTED_TARGETS, we also generate target EXPORTS. In this case the its CMakeLists.txt +# must also have +# install(TARGETS EXPORT ${PROJECT_NAME}Targets) +# before. The target will be named ChimeraTK::${PROJECT_NAME} . +# We keep above mentioned return variables for compatibility, but finally, when all projects use imported targets, +# all execept _FOUND and _VERSION will be superfluous. +# +# @author Martin Killenberg, DESY +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +# In case of packages with components, loading dependencies can cause trouble if required component list are differ. +# E.g. if Boost is required from the project, and also required from the dependency, but with less components, +# and the dependency is resolved later, then Boost_LIBRARIES content will be different than expected. +# To protect against this, save state and restore it later. +# Since imported targets are never unloaded, the loaded dependency should still work. +set(Boost_LIBRARIES_savedState_@PROJECT_NAME@ ${Boost_LIBRARIES}) + +# this code loads public dependencies +@@PROJECT_NAME@_PUBLIC_DEPENDENCIES_L@ +set(Boost_LIBRARIES ${Boost_LIBRARIES_savedState_@PROJECT_NAME@}) + +# Since this file is already part of the installation to be found, the configuration can be hard-coded at +# installation time +set(@PROJECT_NAME@_VERSION "@@PROJECT_NAME@_SOVERSION@") +set(@PROJECT_NAME@_PREFIX "@CMAKE_INSTALL_PREFIX@") + +# Use a macro provided by CMake to check if all the listed arguments are valid and set @PROJECT_NAME@_FOUND accordingly. +# This is mainly important to check the version. +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(@PROJECT_NAME@ REQUIRED_VARS @PROJECT_NAME@_PREFIX VERSION_VAR @PROJECT_NAME@_VERSION FOUND_VAR @PROJECT_NAME@_FOUND) + +# switch for exported target. We don't do this automatically, because the calling CMakeLists.txt +# first must be edited so that it properly defines PUBLIC set of compile and link options +if(@PROVIDES_EXPORTED_TARGETS@) + + @PACKAGE_INIT@ + + # include cmake's auto-generated exports file + include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + # this will set ${PROJECT_NAME}_FOUND if required components are missing + check_required_components(@PROJECT_NAME@) + +else() + if(@@PROJECT_NAME@_HAS_LIBRARY@) + # has true compiled library as output + # The library itself must be "searched" using the FIND_LIBRARY command in the known install directory, to set + # the variable properly + FIND_LIBRARY(@PROJECT_NAME@_LIBRARY @PROJECT_NAME@ + @CMAKE_INSTALL_PREFIX@/lib + NO_DEFAULT_PATH + ) + if(NOT @PROJECT_NAME@_LIBRARY) + set(@PROJECT_NAME@_FOUND FALSE) + message(SEND_ERROR "FIND_LIBRARY returned error: ${@PROJECT_NAME@_LIBRARY}") + else() + # prepend it to lib list + set(@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIBRARY} ${@PROJECT_NAME@_LIBRARIES}) + endif() + endif() +endif() + diff --git a/cmake/PROJECT_NAMEConfigVersion.cmake.in.in b/cmake/PROJECT_NAMEConfigVersion.cmake.in.in new file mode 100644 index 0000000..d449c1b --- /dev/null +++ b/cmake/PROJECT_NAMEConfigVersion.cmake.in.in @@ -0,0 +1,30 @@ +####################################################################################################################### +# +# cmake module for finding @PROJECT_NAME@ +# +# returns: +# PACKAGE_VERSION = full provided version string +# PACKAGE_VERSION_EXACT = true if version is exact match +# PACKAGE_VERSION_COMPATIBLE = true if version is compatible +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +set(PACKAGE_VERSION @@PROJECT_NAME@_SOVERSION@) +if(@@PROJECT_NAME@_SOVERSION@ VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE 1) + set(PACKAGE_VERSION_EXACT 1) +elseif(@@PROJECT_NAME@_SOVERSION@ VERSION_GREATER "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE 1) +endif() diff --git a/cmake/add_linter_target.cmake b/cmake/add_linter_target.cmake new file mode 100644 index 0000000..9d4352d --- /dev/null +++ b/cmake/add_linter_target.cmake @@ -0,0 +1,13 @@ +set(CTK_CLANG_TIDY_VERSION "22" CACHE STRING "Version of the clang-tidy binary to use") +set(CTK_ENABLE_TIDY_WHILE_BUILDING OFF CACHE BOOL "Whether to run clang-tidy on every compilation unit") +if (CTK_ENABLE_TIDY_WHILE_BUILDING) + set(CMAKE_CXX_CLANG_TIDY /usr/bin/clang-tidy-${CTK_CLANG_TIDY_VERSION};-config-file=${CMAKE_SOURCE_DIR}/.clang-tidy) + set(CMAKE_C_CLANG_TIDY /usr/bin/clang-tidy-${CTK_CLANG_TIDY_VERSION};-config-file=${CMAKE_SOURCE_DIR}/.clang-tidy) +endif() +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +add_custom_target(run-linter COMMAND run-clang-tidy-${CTK_CLANG_TIDY_VERSION} -p ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_target(fix-linter-stepwise COMMAND ${CMAKE_SOURCE_DIR}/cmake/fix-linter-for-all.py --tidy=clang-tidy-${CTK_CLANG_TIDY_VERSION} --apply-tool=clang-apply-replacements-${CTK_CLANG_TIDY_VERSION} --exclude="${CMAKE_BINARY_DIR}" ${CMAKE_BINARY_DIR}/compile_commands.json + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_target(fix-linter COMMAND run-clang-tidy-${CTK_CLANG_TIDY_VERSION} -fix -format -p ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + + diff --git a/cmake/check-coding-style.sh b/cmake/check-coding-style.sh new file mode 100755 index 0000000..6ac10e9 --- /dev/null +++ b/cmake/check-coding-style.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +ERRFILE=$(mktemp) +export ERRFILE +echo 0 > "${ERRFILE}" + +# This is necessary to get the two paths to match up, since we get a full path from cmake +mypath=$(pwd) +mypath=$(realpath "$mypath") +exclude_path=${1:-justignoreme} +exclude_pattern="$exclude_path/*" + +# check clang-format formatting +if which clang-format-19 > /dev/null; then + find "$mypath" \( -name \*.cc -o -name \*.cpp -o -name \*.h \) -not -path "$exclude_pattern" -exec clang-format-19 --output-replacements-xml \{\} \; | grep "^ /dev/null + if [ $? -ne 1 ]; then + echo 1 > "${ERRFILE}" + echo "Code formatting incorrect!" + fi +else + echo 77 > "${ERRFILE}" + echo "WARNING: clang-format-19 not found, code formatting not checked!" +fi + +# check copyright/licence file header comment +checkCopyrightComment() { + # First line must be SPDX-FileCopyrightText + if [[ "$(head -n1 "$1")" != '// SPDX-FileCopyrightText: '* ]]; then + echo 1 > "${ERRFILE}" + echo "File $1 does not start with SPDX-FileCopyrightText line." + fi + # Find the first non-FileCopyrightText line and check if it's License-Identifier + local found_license=0 + local found_pragma=0 + local found_copyright=0 + local check_pragma=0 + local line_num=0 + while IFS= read -r line; do + ((line_num++)) + if [[ $check_pragma -eq 0 && "$line" == '// SPDX-FileCopyrightText: '* ]]; then + found_copyright=1 + continue + elif [[ $check_pragma -eq 0 && "$line" == '// SPDX-License-Identifier: '* ]]; then + found_license=1 + if [[ "$1" != *.h ]]; then + break + else + check_pragma=1 + continue + fi + elif [ $check_pragma -eq 1 ]; then + if [ "$line" == '#pragma once' ]; then + found_pragma=1 + fi + break + else + # First non-FileCopyrightText line is not License-Identifier + echo "Unexpected line when testing SPDX comments and pragma statement. File $1 line $line_num: '$line'" + break + fi + done < "$1" + if [ $found_license -eq 0 ]; then + echo 1 > "${ERRFILE}" + echo "File $1 has no or an incorrect SPDX-License-Identifier comment." + fi + if [ $check_pragma -eq 1 ] && [ $found_pragma -eq 0 ]; then + echo 1 > "${ERRFILE}" + echo "Header $1 has wrong/is missing '#pragma once' after SPDX-License-Identifier comment." + fi + if [ $found_copyright -eq 0 ]; then + echo 1 > "${ERRFILE}" + echo "File $1 has no or an incorrect SPDX-FileCopyrightText comment." + fi +} +export -f checkCopyrightComment +find "$mypath" \( -name \*.cc -o -name \*.cpp -o -name \*.h \) -not -path "$exclude_pattern" -exec bash -c 'checkCopyrightComment "$1"' _ {} \; + +ERROR=`cat "${ERRFILE}"` +rm -f "${ERRFILE}" +exit ${ERROR} diff --git a/cmake/config_generator_project.cmake b/cmake/config_generator_project.cmake new file mode 100644 index 0000000..e73ef78 --- /dev/null +++ b/cmake/config_generator_project.cmake @@ -0,0 +1,50 @@ +# +# cmake include to be used for config generator based projects. +# +# Configuration packages for servers can have a very simple CMakeLists.txt like this: +# +# PROJECT(exampleserver-config NONE) +# cmake_minimum_required(VERSION 3.14) +# +# # Note: Always keep MAJOR_VERSION and MINOR_VERSION identical to the server version. Count only the patch separately. +# set(${PROJECT_NAME}_MAJOR_VERSION 01) +# set(${PROJECT_NAME}_MINOR_VERSION 00) +# set(${PROJECT_NAME}_PATCH_VERSION 00) +# include(cmake/set_version_numbers.cmake) +# +# include(cmake/config_generator_project.cmake) +# +cmake_minimum_required(VERSION 3.14) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +find_package(ConfigGenerator 03.00 REQUIRED) +list(APPEND CMAKE_MODULE_PATH ${ConfigGenerator_DIR}/shared) + + +set(DESTDIR share/ConfigGenerator-${PROJECT_NAME}-${${PROJECT_NAME}_MAJOR_VERSION}-${${PROJECT_NAME}_MINOR_VERSION}) + +# find all server type directories in our source directory and copy them to the build directory +file(GLOB hostlists RELATIVE ${PROJECT_SOURCE_DIR} */hostlist) +foreach(hostlist ${hostlists}) + string(REPLACE "/hostlist" "" servertype "${hostlist}") + # FOLLOW_SYMLINK_CHAIN is necessary to allow symlinks to git-submodules. This is used to create + # "derived" configurations which reuse some files from their base configuration (example: configs for + # different control systems) + file(COPY "${PROJECT_SOURCE_DIR}/${servertype}" DESTINATION "${PROJECT_BINARY_DIR}" FOLLOW_SYMLINK_CHAIN) + list(APPEND servertypes "${servertype}") +endforeach() + +# prepare a configure script which knows the version of config generator to call +configure_file(${PROJECT_SOURCE_DIR}/cmake/ConfigGenerator_configureThisHost.sh.in ${PROJECT_BINARY_DIR}/configureThisHost.sh @ONLY) + + +# install server types (scripts are installed by upstream config generator project) +foreach(servertype ${servertypes}) + install(DIRECTORY "${PROJECT_BINARY_DIR}/${servertype}/settings" DESTINATION "${DESTDIR}/${servertype}") + install(DIRECTORY "${PROJECT_BINARY_DIR}/${servertype}/templates" DESTINATION "${DESTDIR}/${servertype}" USE_SOURCE_PERMISSIONS) + file(GLOB thefiles LIST_DIRECTORIES no "${PROJECT_BINARY_DIR}/${servertype}/*") + install(FILES ${thefiles} DESTINATION "${DESTDIR}/${servertype}") +endforeach() + +install(PROGRAMS ${PROJECT_BINARY_DIR}/configureThisHost.sh DESTINATION "${DESTDIR}" ) diff --git a/cmake/create_cmake_config_files.cmake b/cmake/create_cmake_config_files.cmake index 7443799..8143f8f 100644 --- a/cmake/create_cmake_config_files.cmake +++ b/cmake/create_cmake_config_files.cmake @@ -1,58 +1,344 @@ -####################################################################################################################### +# ###################################################################################################################### # create_cmake_config_files.cmake # -# Create the Find${PROJECT_NAME}.cmake cmake macro and the ${PROJECT_NAME}-config shell script and installs them. +# Create the Find${PROJECT_NAME}.cmake cmake macro and the ${PROJECT_NAME}.pc package config and installs them. # # Expects the following input variables: -# ${PROJECT_NAME}_SOVERSION - version of the .so library file -# ${PROJECT_NAME}_INCLUDE_DIRS - list include directories needed when compiling against this project -# ${PROJECT_NAME}_LIBRARY_DIRS - list of library directories needed when linking against this project -# ${PROJECT_NAME}_LIBRARIES - list of libraries needed when linking against this project -# ${PROJECT_NAME}_CPPFLAGS - list of C++ compiler flags when compiling against this project -# ${PROJECT_NAME}_LDFLAGS - list of linker flags when linking against this project +# ${PROJECT_NAME}_SOVERSION - version of the .so library file (or just MAJOR.MINOR without the patch level) +# ${PROJECT_NAME}_MEXFLAGS - (optional) mex compiler flags # -####################################################################################################################### +# ###################################################################################################################### -# check that all config variables which have to be replaced are set -foreach(CONFIG_VARIABLE SOVERSION INCLUDE_DIRS LIBRARY_DIRS LIBRARIES CPPFLAGS LDFLAGS) - if(DEFINED ${${PROJECT_NAME}_${CONFIG_VARIABLE}} ) - message(FATAL_ERROR "${PROJECT_NAME}_${CONFIG_VARIABLE} not set in CMakeListst.txt") - endif() -endforeach() +# ###################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +# ###################################################################################################################### + +macro(handleGeneratorExprs var) + # Unfortunately, I do not see a solution for correct generator expression handling by cmake. So instead, do some simple replacements. + # $ defines path relative to install location. + string(REGEX REPLACE "\\$" "${CMAKE_INSTALL_PREFIX}/\\1" ${var} "${${var}}") + + # remove any other generator expression + string(REGEX REPLACE "\\$<.*>" "" ${var} "${${var}}") +endmacro() + +# append element-wise to (space-separated!) list, but only if not yet existing +# arg is allowed to be space-separated or ;-separated list +macro(appendToList list arg) + string(REPLACE " " ";" appendToList_args "${arg}") + + foreach(item ${appendToList_args}) + handleGeneratorExprs(item) + string(FIND " ${${list}} " " ${item} " appendToList_pos) + + if(${appendToList_pos} EQUAL -1) + string(APPEND ${list} " ${item}") + + # strip leading spaces since they might cause problems + string(REGEX REPLACE "^[ \t]+" "" ${list} "${${list}}") + endif() + endforeach() +endmacro() + +# prepend element-wise to (space-separated!) list, but only if not yet existing +# arg is allowed to be space-separated or ;-separated list +macro(prependToList list arg) + string(REPLACE " " ";" prependToList_args "${arg}") + + foreach(item ${prependToList_args}) + handleGeneratorExprs(item) + string(FIND " ${${list}} " " ${item} " prependToList_pos) + + if(${prependToList_pos} EQUAL -1) + string(PREPEND ${list} "${item} ") + + # strip trailing spaces since they might cause problems + string(REGEX REPLACE "[ \t]+$" "" ${list} "${${list}}") + endif() + endforeach() +endmacro() + +# this defines architecture-dependent ${CMAKE_INSTALL_LIBDIR} +include(GNUInstallDirs) + +include(cmake/get_imported_target_cxx_standard.cmake) + +# for lib, which might be lib File or linker flag or imported target, +# puts recursively resolved library list into ${linkLibs}, which will contain a library file list +# and recursively resolve link flags into ${linkFlags} +# Note, since some projects ignore libDirs, we put them also into linkFlags. +function(resolveImportedLib lib linkLibs linkFlags libDirs incDirs cxxFlags) + set(linkLibs1 "") + set(linkFlags1 "") + set(libDirs1 "") + set(incDirs1 "") + set(cxxFlags1 "") + + if(lib MATCHES "/") # library name contains slashes: link against the a file path name + appendToList(linkLibs1 "${lib}") + elseif(lib MATCHES "^[ \t]*-l") + # library name does not contain slashes but already the -l option: directly quote it + # although technically a linker flag, we put it to lib list because order matters sometimes + appendToList(linkLibs1 "${lib}") + elseif(lib MATCHES "::") # library name is an imported target - we need to resolve it for Makefiles + if(NOT TARGET ${lib}) + message(FATAL_ERROR "dependency ${lib} not available as target, maybe find_package was forgotten?") + endif() + + get_target_property(_libraryType ${lib} TYPE) + + # boost exports appear as UNKNOWN_LIBRARY but also have target location + if((${_libraryType} MATCHES SHARED_LIBRARY) OR(${_libraryType} MATCHES STATIC_LIBRARY) OR(${_libraryType} MATCHES UNKNOWN_LIBRARY)) + if(";${lib};" MATCHES ";.*::${PROJECT_NAME};") + # We cannot find target library location of this project via target properties at this point. + # Therefore, we simply assume that by convention, all our libs are installed into ${CMAKE_INSTALL_PREFIX}/lib. + # Exceptions are allowed if -L is already in linker flags + appendToList(linkFlags1 "-L${CMAKE_INSTALL_FULL_LIBDIR}") + appendToList(libDirs1 "${CMAKE_INSTALL_FULL_LIBDIR}") + appendToList(linkLibs1 "-l${PROJECT_NAME}") + else() + get_property(lib_loc TARGET ${lib} PROPERTY LOCATION) + + # message("imported target ${lib} is actual library. location=${lib_loc}") + appendToList(linkLibs1 "${lib_loc}") + endif() + endif() + + get_target_property(_linkLibs ${lib} INTERFACE_LINK_LIBRARIES) + + if(NOT "${_linkLibs}" MATCHES "-NOTFOUND") + message(VERBOSE "imported target ${lib} is interface, recursively go over its interface requirements ${_linkLibs}") + + foreach(_lib ${_linkLibs}) + if(${lib} STREQUAL ${_lib}) + message(FATAL_ERROR "self-reference in dependencies of ${_lib}! Aborting recursion.") + endif() + + resolveImportedLib(${_lib} linkLibs2 linkFlags2 libDirs2 incDirs2 cxxFlags2) + appendToList(linkLibs1 "${linkLibs2}") + appendToList(linkFlags1 "${linkFlags2}") + appendToList(libDirs1 "${libDirs2}") + appendToList(incDirs1 "${incDirs2}") + appendToList(cxxFlags1 "${cxxFlags2}") + endforeach() + endif() + + get_target_property(_incDirs ${lib} INTERFACE_INCLUDE_DIRECTORIES) + + if(_incDirs) + appendToList(incDirs1 "${_incDirs}") + endif() + + get_target_property(_cxxFlags ${lib} INTERFACE_COMPILE_OPTIONS) + + if(_cxxFlags) + appendToList(cxxFlags1 "${_cxxFlags}") + endif() -# create variables for standard makefiles -set(${PROJECT_NAME}_CPPFLAGS_MAKEFILE "${${PROJECT_NAME}_CPPFLAGS}") + get_target_property(_cxxFlags ${lib} INTERFACE_COMPILE_DEFINITIONS) + + if(_cxxFlags) + foreach(flag ${_cxxFlags}) + appendToList(cxxFlags1 "-D${flag}") + endforeach() + endif() + + get_imported_target_cxx_standard(${lib} _cxxStandardFlag) + appendToList(cxxFlags1 "${_cxxStandardFlag}") + + get_target_property(_linkFlags ${lib} INTERFACE_LINK_OPTIONS) + + if(_linkFlags) + appendToList(linkFlags1 "${_linkFlags}") + endif() + + get_target_property(_linkDirs ${lib} INTERFACE_LINK_DIRECTORES) + + if(_linkDirs) + foreach(flag ${_linkDirs}) + handleGeneratorExprs(flag) + appendToList(linkFlags1 "-L${flag}") + appendToList(libDirs1 "${flag}") + endforeach() + endif() + + else() + # link against library with -l option + handleGeneratorExprs(lib) + + # although technically a linker flag, we put it to lib list because for some linker flags, it is important + # that they come before libs + appendToList(linkLibs1 "-l${lib}") + endif() + + set(${linkLibs} "${linkLibs1}" PARENT_SCOPE) + set(${linkFlags} "${linkFlags1}" PARENT_SCOPE) + set(${libDirs} "${libDirs1}" PARENT_SCOPE) + set(${incDirs} "${incDirs1}" PARENT_SCOPE) + set(${cxxFlags} "${cxxFlags1}" PARENT_SCOPE) +endfunction() + +# if we already have cmake-exports for this project: +# sets the vars ${PROJECT_NAME}_INCLUDE_DIRS, ${PROJECT_NAME}_CXX_FLAGS, ${PROJECT_NAME}_LIBRARY_DIRS, +# ${PROJECT_NAME}_LINKER_FLAGS, and ${PROJECT_NAME}_LIBRARIES +# so that compatibility layer is provided automatically. +if(${PROVIDES_EXPORTED_TARGETS}) + # imported targets should be namespaced, so define namespaced alias + add_library(ChimeraTK::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + + resolveImportedLib(ChimeraTK::${PROJECT_NAME} linkLibs linkFlags libDirs incDirs cxxFlags) + + # printing results will help resolve problems with auto-generated compatibility layer + message(VERBOSE "explicitly provided compatibility layer,") + message(VERBOSE " old libset: ${${PROJECT_NAME}_LIBRARIES}") + message(VERBOSE " old linkflags: ${${PROJECT_NAME}_LINKER_FLAGS}") + message(VERBOSE " old cxxflags: ${${PROJECT_NAME}_CXX_FLAGS}") + message(VERBOSE " old incDirs: ${${PROJECT_NAME}_INCLUDE_DIRS}") + message(VERBOSE " old libDirs: ${${PROJECT_NAME}_LIBRARY_DIRS}") + set(${PROJECT_NAME}_INCLUDE_DIRS "${incDirs}") + set(${PROJECT_NAME}_LIBRARY_DIRS "${libDirs}") + set(${PROJECT_NAME}_LIBRARIES "${linkLibs}") + set(${PROJECT_NAME}_CXX_FLAGS "${cxxFlags}") + set(${PROJECT_NAME}_LINKER_FLAGS "${linkFlags}") + message(VERBOSE "will be overwritten by automatically generated compatibility layer from cmake-exports,") + message(VERBOSE " new libset: ${${PROJECT_NAME}_LIBRARIES}") + message(VERBOSE " new linkflags: ${${PROJECT_NAME}_LINKER_FLAGS}") + message(VERBOSE " new cxxflags: ${${PROJECT_NAME}_CXX_FLAGS}") + message(VERBOSE " new incDirs: ${${PROJECT_NAME}_INCLUDE_DIRS}") + message(VERBOSE " new libDirs: ${${PROJECT_NAME}_LIBRARY_DIRS}") +endif() + +# create variables for standard makefiles and pkgconfig +set(${PROJECT_NAME}_CXX_FLAGS_MAKEFILE "${${PROJECT_NAME}_CXX_FLAGS}") + +string(REPLACE " " ";" LIST "${${PROJECT_NAME}_INCLUDE_DIRS}") -string(REPLACE " " ";" LIST ${${PROJECT_NAME}_INCLUDE_DIRS}) foreach(INCLUDE_DIR ${LIST}) - set(${PROJECT_NAME}_CPPFLAGS_MAKEFILE "${${PROJECT_NAME}_CPPFLAGS_MAKEFILE} -I${INCLUDE_DIR}") + appendToList(${PROJECT_NAME}_CXX_FLAGS_MAKEFILE "-I${INCLUDE_DIR}") endforeach() -set(${PROJECT_NAME}_LDFLAGS_MAKEFILE "${${PROJECT_NAME}_LDFLAGS}") +# some old code still might call linker flags _LINK_FLAGS, also include that +appendToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINK_FLAGS}") + +string(REPLACE " " ";" LIST "${${PROJECT_NAME}_LIBRARY_DIRS}") -string(REPLACE " " ";" LIST ${${PROJECT_NAME}_LIBRARY_DIRS}) foreach(LIBRARY_DIR ${LIST}) - set(${PROJECT_NAME}_LDFLAGS_MAKEFILE "${${PROJECT_NAME}_LDFLAGS_MAKEFILE} -L${LIBRARY_DIR}") + appendToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "-L${LIBRARY_DIR}") endforeach() -string(REPLACE " " ";" LIST ${${PROJECT_NAME}_LIBRARIES}) -foreach(LIBRARY ${LIST}) - set(${PROJECT_NAME}_LDFLAGS_MAKEFILE "${${PROJECT_NAME}_LDFLAGS_MAKEFILE} -l${LIBRARY}") +if(${PROVIDES_EXPORTED_TARGETS}) + # libraries have already been resolved above, add them to linker flags + appendToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LIBRARIES}") +else() + # recursive resolution of linker flags is necessary, since dependencies could contain imported targets + string(REPLACE " " ";" LIST "${PROJECT_NAME} ${${PROJECT_NAME}_LIBRARIES}") + + foreach(LIBRARY ${LIST}) + resolveImportedLib(${LIBRARY} linkLibs linkFlags libDirs incDirs cxxFlags) + + appendToList(${PROJECT_NAME}_CXX_FLAGS_MAKEFILE "${cxxFlags}") + + string(REPLACE " " ";" LIST "${incDirs}") + + foreach(INCLUDE_DIR ${LIST}) + appendToList(${PROJECT_NAME}_CXX_FLAGS_MAKEFILE "-I${INCLUDE_DIR}") + endforeach() + + # for some linker flags, it is important that they come before the libs + prependToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${linkFlags}") + appendToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${linkLibs}") + string(REPLACE " " ";" LIST "${libDirs}") + + foreach(LIBRARY_DIR ${LIST}) + appendToList(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "-L${LIBRARY_DIR}") + endforeach() + endforeach() +endif() + +set(${PROJECT_NAME}_PUBLIC_DEPENDENCIES_L "") + +foreach(DEPENDENCY ${${PROJECT_NAME}_PUBLIC_DEPENDENCIES}) + # we only care about required dependencies: if some lib has an optional dependency and is built against it + # after it has been found, the dependency became mandatory for downstream libs. + # Note, keyword REQUIRED as not according to spec but it works... + string(APPEND ${PROJECT_NAME}_PUBLIC_DEPENDENCIES_L "find_package(${DEPENDENCY} REQUIRED)\n") endforeach() +if(TARGET ${PROJECT_NAME}) + # set _HAS_LIBRARY only if we have a true library, interface libraries (introduced for imported targets, + # e.g. header-only library) don't count. + get_target_property(targetLoc ${PROJECT_NAME} TYPE) + + if(NOT "INTERFACE_LIBRARY" MATCHES "${targetLoc}") + set(${PROJECT_NAME}_HAS_LIBRARY 1) + endif() +else() + set(${PROJECT_NAME}_HAS_LIBRARY 0) +endif() + # we have nested @-statements, so we have to parse twice: -# create the cmake Find package script -configure_file(cmake/FindPROJECT_NAME.cmake.in.in "${PROJECT_BINARY_DIR}/cmake/Find${PROJECT_NAME}.cmake.in") -configure_file(${PROJECT_BINARY_DIR}/cmake/Find${PROJECT_NAME}.cmake.in "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake") +# create the cmake find_package configuration file +set(PACKAGE_INIT "@PACKAGE_INIT@") # replacement handled later, so leave untouched here +cmake_policy(SET CMP0053 NEW) # less warnings about irrelevant stuff in comments +configure_file(cmake/PROJECT_NAMEConfig.cmake.in.in "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" @ONLY) + +if(${PROVIDES_EXPORTED_TARGETS}) +# we will configure later +else() + set(PACKAGE_INIT "") # required to avoid parse error + configure_file(${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY) +endif() + +configure_file(cmake/PROJECT_NAMEConfigVersion.cmake.in.in "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake.in" @ONLY) +configure_file(${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" @ONLY) + +# create the pkgconfig file +configure_file(cmake/PROJECT_NAME.pc.in.in "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}.pc.in" @ONLY) +configure_file(${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}.pc.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY) + +# install configuration file for pkgconfig +install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION share/pkgconfig COMPONENT dev) + +if(${PROVIDES_EXPORTED_TARGETS}) + # generate and install export file + install(EXPORT ${PROJECT_NAME}Targets + FILE ${PROJECT_NAME}Targets.cmake + NAMESPACE ChimeraTK:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + ) -# create the shell script for standard make files -configure_file(cmake/PROJECT_NAME-config.in.in "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.in") -configure_file(${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config") + include(CMakePackageConfigHelpers) -# install the script -install(FILES "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake" - DESTINATION share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules COMPONENT dev) + # create config file + # although @ONLY arg is not supported, this behaves in the same way. + configure_package_config_file("${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + ) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config DESTINATION bin COMPONENT dev) + # remove any previously installed share/cmake-xx/Modules/Find.cmake from this project since it does not harmonize with new Config + set(fileToRemove "share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules/Find${PROJECT_NAME}.cmake") + install(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${fileToRemove})") +else() + # install same cmake configuration file another time into the Modules cmake subdirectory for compatibility reasons + # We do this only if we did not move yet to exported target, since it does not harmonize + install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + DESTINATION share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules RENAME Find${PROJECT_NAME}.cmake COMPONENT dev) +endif() +# install cmake find_package configuration file +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + COMPONENT dev +) diff --git a/cmake/enable_code_coverage_report.cmake b/cmake/enable_code_coverage_report.cmake new file mode 100644 index 0000000..c64bf84 --- /dev/null +++ b/cmake/enable_code_coverage_report.cmake @@ -0,0 +1,48 @@ +####################################################################################################################### +# enable_code_coverage_report.cmake +# +# Enable possibility to generate a code coverage report when compiling in 'Debug' mode. +# Configure with the option -DCMAKE_BUILD_TYPE=Debug. +# It require working tests which can be called with 'make test'. The coverage is created +# over these tests. +# +# You need lcov installed to use the 'make coverage' command. +# +# This script appends to the variable CMAKE_CXX_FLAGS_DEBUG, +# and adds the target 'coverage', only available in 'Debug' mode. +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +# The make coverage command is only available in debug mode. Also +# factor in that cmake treats CMAKE_BUILD_TYPE string as case +# insensitive. + +option(ENABLE_COVERAGE_REPORT "Create coverage target to generate code coverage reports" ON) + +string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_uppercase) +IF(build_type_uppercase STREQUAL "DEBUG" AND ENABLE_COVERAGE_REPORT) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} --coverage") + configure_file(cmake/make_coverage.sh.in + ${PROJECT_BINARY_DIR}/make_coverage.sh @ONLY) + add_custom_target(coverage + ./make_coverage.sh + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating test coverage documentation" VERBATIM) + add_custom_target(clean-gcda + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND find -name "*.gcda" -exec rm {} \; + COMMENT "Removing old coverage files" VERBATIM) +ENDIF() diff --git a/cmake/enable_code_style_check.cmake b/cmake/enable_code_style_check.cmake new file mode 100644 index 0000000..80dda5a --- /dev/null +++ b/cmake/enable_code_style_check.cmake @@ -0,0 +1,25 @@ +####################################################################################################################### +# enable_code_style_check.cmake +# +# Enable automatic check of coding style as part of the tests. +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +enable_testing() +add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + +# coding style will return 77 if no clang-format-14 could be found AND none of the other tests fail +set_property(TEST coding_style PROPERTY SKIP_RETURN_CODE 77) diff --git a/cmake/enable_doxygen_documentation.cmake b/cmake/enable_doxygen_documentation.cmake new file mode 100644 index 0000000..f655b9b --- /dev/null +++ b/cmake/enable_doxygen_documentation.cmake @@ -0,0 +1,55 @@ +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +####################################################################################################################### +# Enable doxygen documentation, mainly (but not only for) for libraries +# +# Requirements: +# * A file 'cmake/Doxyfile.in' which is configured to generate output to ${CMAKE_BINARY_DIR}/doc/ +# +# Generates: +# * A target 'doc' +# * The target is automatically build unless -DSUPPRESS_AUTO_DOC_BUILD=true is given at configuration +# * The documentation is installed to share/doc/${PROJECT_NAME}-${${PROJECT_NAME}_SOVERSION} +# +# If generation of the documentation is off, 'make install' might not install documentation, or you install outdated documentation! +# +###################################################################################################################### + + +#use -DSUPPRESS_AUTO_DOC_BUILD=true to suppress to create the doc with every +#build. The 'make doc' target will still exist +if(SUPPRESS_AUTO_DOC_BUILD) + message("ATTENTION: Automatically building the documentation is disabled. 'make install' might not install documentation, or install outdated documentation! Re-enable by configuring cmake with '-DSUPPRESS_AUTO_DOC_BUILD=false'") + unset(DOC_DEPENDENCY) +else(SUPPRESS_AUTO_DOC_BUILD) + message("Automatically building the documentation is enabled. Disable by configuring cmake with '-DSUPPRESS_AUTO_DOC_BUILD=true'") + set(DOC_DEPENDENCY ALL) +endif(SUPPRESS_AUTO_DOC_BUILD) + +find_package(Doxygen) +if(DOXYGEN_FOUND) + # Add custom version variable for Doxygen since configure_file does not seem to be able to do double dereferencing for ${${PROJECT_NAME}_version} etc. + set(DOXYGEN_PROJECT_NUMBER ${${PROJECT_NAME}_VERSION}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + + add_custom_target(doc ${DOC_DEPENDENCY} + COMMAND ${CMAKE_COMMAND} -E env GS_OPTIONS=-dNOSAFER ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + #note the / after ${CMAKE_BINARY_DIR}/doc/. This causes the directory to be renamed to the destination, not copied into + #The optional allows make install to run even if documentation has not been build. + install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/ DESTINATION share/doc/${PROJECT_NAME}-${${PROJECT_NAME}_SOVERSION} + COMPONENT doc OPTIONAL) +else(DOXYGEN_FOUND) + message("Doxygen not found, documentation cannot be build.") +endif(DOXYGEN_FOUND) diff --git a/cmake/enable_latest_cxx_support.cmake b/cmake/enable_latest_cxx_support.cmake new file mode 100644 index 0000000..52b828c --- /dev/null +++ b/cmake/enable_latest_cxx_support.cmake @@ -0,0 +1,19 @@ +# ###################################################################################################################### +# enable_latest_cxx_support.cmake +# +# This file exists for historic/compatibility reasons only. Do not use it in new projects. The correct C++ standard +# will be propagated automatically from the base libraries and may be changed via target_compile_features if needed. +# +# ###################################################################################################################### + +# ###################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +# ###################################################################################################################### diff --git a/cmake/fix-linter-for-all.py b/cmake/fix-linter-for-all.py new file mode 100755 index 0000000..875f4bd --- /dev/null +++ b/cmake/fix-linter-for-all.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: LGPL-3.0-or-later +# SPDX-FileCopyRightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project + +import argparse +import json +import os +import re +import shutil +import subprocess +import sys +import tempfile + + +def make_absolute(file: str, path: str): + if os.path.isabs(file): + return file + return os.path.normpath(os.path.join(path, file)) + + +def main(): + parser = argparse.ArgumentParser(description="Runs clang-tidy over a compilation database and applies the fixes") + parser.add_argument("compile_db", metavar='PATH') + parser.add_argument("--tidy", help="Path to clang-tidy", default="clang-tidy-22") + parser.add_argument("--apply-tool", help='Path to clang-apply-replacements', default="clang-apply-replacements-14") + parser.add_argument("--git", help="Path to git", default="git") + parser.add_argument("--source", help="Path to top-level source folder", default=".") + parser.add_argument("--exclude", help="Regex of files to exclude", default=None) + + args = parser.parse_args() + + apply_version = subprocess.run([args.apply_tool, "--version"], capture_output=True, + encoding="latin1").stdout.strip() + + version_regex = re.compile(r"ersion\s*(\d+)\.(\d+)\.(\d+)") + match = version_regex.search(apply_version) + has_ignore_insert_conflict = int(match.group(1)) > 14 + + files = None + + try: + database = json.load(open(args.compile_db)) + files = set([make_absolute(entry['file'], entry['directory']) for entry in database]) + except FileNotFoundError: + print(f"Failed to open {args.compile_db}: Not found") + except json.decoder.JSONDecodeError: + print(f"Failed to open {args.compile_db}: Not valid json") + + if not files: + sys.exit(1) + + tmpdir = tempfile.mkdtemp() + source_folder = os.path.abspath(args.source) + + exclude_re = re.compile(args.exclude) if args.exclude else None + + for file in files: + if exclude_re and exclude_re.search(file): + continue + tidy = [args.tidy, "-header-filter=.*", "-export-fixes"] + (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir) + os.close(handle) + tidy.append(name) + tidy.append("-p=" + os.path.dirname(os.path.normpath(args.compile_db))) + tidy.append(file) + try: + print(f"Linting {file}...") + subprocess.run(tidy, check=True) + except subprocess.CalledProcessError: + print("Linting failed. Usually that means the previously applied fix has introduced a compiler error. Aborting.") + print("Most likely it converted a conversion operator to explicit") + sys.exit(1) + + fixer = [args.apply_tool, "--format", "--style=file", "--remove-change-desc-files"] + if has_ignore_insert_conflict: + fixer.append('--ignore-insert-conflict') + fixer.append(tmpdir) + if subprocess.call(fixer) == 0: + git_update = [args.git, 'add', '-u'] + subprocess.call(git_update) + git_commit = [args.git, 'commit', '-m', f'clang-tidy: {os.path.relpath(file, start=source_folder)}'] + subprocess.call(git_commit) + else: + print("Error applying fixes, not committing") + shutil.rmtree(tmpdir) + + +if __name__ == "__main__": + main() diff --git a/cmake/format_options.cmake b/cmake/format_options.cmake new file mode 100644 index 0000000..ed97831 --- /dev/null +++ b/cmake/format_options.cmake @@ -0,0 +1,8 @@ + +# function that reformat flags so they become compatible with target_compile_options, target_link_options etc. +function(formatOptionsAsArray outVar inVar) + string(REGEX REPLACE " +" ";" tmpVar "${inVar}") + string(REGEX REPLACE "^;+" "" tmpVar "${tmpVar}") + string(REGEX REPLACE ";+$" "" tmpVar "${tmpVar}") + set(${outVar} "${tmpVar}" PARENT_SCOPE) +endfunction() diff --git a/cmake/get_imported_target_cxx_standard.cmake b/cmake/get_imported_target_cxx_standard.cmake new file mode 100644 index 0000000..715a24d --- /dev/null +++ b/cmake/get_imported_target_cxx_standard.cmake @@ -0,0 +1,72 @@ +# ###################################################################################################################### +# get_imported_target_cxx_standard.cmake +# +# Define function to obtain the compiler flag for the C++ standard required by an imported target (defined via +# target_compile_features()), querying recursively the dependencies as well. If multiple standards are required by +# different dependencies, the greatest standard will be picked. +# +# Usage: +# +# get_imported_target_cxx_standard(MyImportedTarget NameOfVariableToPutFlagIn) +# +# ###################################################################################################################### + +# ###################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +# ###################################################################################################################### + +# Internal helper function +function(collect_compile_features_recursive target compile_features) + get_target_property(features ${target} INTERFACE_COMPILE_FEATURES) + + if(features) + foreach(f ${features}) + list(APPEND ${compile_features} ${f}) + endforeach() + endif() + + get_target_property(deps ${target} INTERFACE_LINK_LIBRARIES) + + foreach(dep ${deps}) + if(TARGET ${dep}) + collect_compile_features_recursive(${dep} ${compile_features}) + endif() + endforeach() + + set(${compile_features} ${${compile_features}} PARENT_SCOPE) +endfunction() + +# ###################################################################################################################### + +# Main function to be called by the user +function(get_imported_target_cxx_standard target required_standard_flag) + collect_compile_features_recursive(${target} my_compile_features) + + set(required_standard 0) + + foreach(feature ${my_compile_features}) + if(feature MATCHES "cxx_std_([0-9]+)") + if(CMAKE_MATCH_1 GREATER required_standard) + set(required_standard ${CMAKE_MATCH_1}) + endif() + endif() + endforeach() + + if(required_standard GREATER 0) + set(flag "-std=c++${required_standard}") + else() + set(flag "") + endif() + + set(${required_standard_flag} ${flag} PARENT_SCOPE) +endfunction() + +# ###################################################################################################################### diff --git a/cmake/make_coverage.sh.in b/cmake/make_coverage.sh.in new file mode 100755 index 0000000..5464236 --- /dev/null +++ b/cmake/make_coverage.sh.in @@ -0,0 +1,103 @@ +#!/bin/bash -e +####################################################################################################################### +# +# Shell script for generating a code coverage report. +# +# Parameter to be set inside the CMake project: +# EXCLUDE_FROM_COVERAGE (optional) Space separated list of directories in you source code which are excluded from the +# coverage report. +# +# CMAKE_SOURCE_DIR and PROJECT_BINARY_DIR are always automatically there. +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +TESTFILES=`find -name CTestTestfile.cmake` +if [ -z "${TESTFILES}" ]; then + echo "No tests found. Not generating any coverage report." + exit 0 +fi + +# +# Check whether Python tests are present +# +N_PYTHON=0 +for f in $TESTFILES; do + N_PYTHON=$(( N_PYTHON + `grep -E '^add_test\([^ ]* "/usr/bin/python3?" ' $f | wc -l` )) +done + +# +# Preparations for C++ coverage report +# +cmake --build . --target clean-gcda + +# +# Preparations for Python coverage report +# +if (( N_PYTHON > 0 )); then + cp CTestTestfile.cmake CTestTestfile-backup.cmake + sed -E 's_"/usr/bin/python(3)?"_"/usr/bin/python\1-coverage" "run" "-a"_' -i CTestTestfile.cmake + python3-coverage erase +fi + +# +# Execute tests and record coverage data +# +cmake --build . --target test + +# +# Check if C++ report has been generated +# +N_GCDA=`find -name *.gcda | wc -l` + +# +# Generate C++ coverage report, if files have been found +# +if (( N_GCDA > 0 )); then + lcov --capture --directory . --output-file coverage_all.info --ignore-errors gcov + + # lcov capture also includes external stuff like glibc, boost etc. + # only extract the reports for this project + lcov --extract coverage_all.info "@CMAKE_SOURCE_DIR@*" -o coverage_only_source_tree.info + + # Some parts of the source code might be excluded. Set EXCLUDE_FROM_COVERAGE to contain + # a list of directories to be excluded from the coverage report. + # Don't worry if this is empty. It just means there is nothing to exclude (the normal case). + for exclude_dir in @EXCLUDE_FROM_COVERAGE@; do + echo lcov --remove coverage_only_source_tree.info "@CMAKE_SOURCE_DIR@/${exclude_dir}*" -o tmp.info + lcov --remove coverage_only_source_tree.info "@CMAKE_SOURCE_DIR@/${exclude_dir}*" -o tmp.info + mv tmp.info coverage_only_source_tree.info + done + + # Some projects install the library and its headers for testing in the build directory + # and compile tests and examples against it. This leads to double + # counting and untested lines in the coverage report. That's why we + # exclude the build directory from the coverage report (needed if the + # build directory is in the source tree). + # Attention: If you make an 'in sorce build' the coverage report will + # be empty! + lcov --remove coverage_only_source_tree.info "@PROJECT_BINARY_DIR@/*" -o coverage.info + + # finally generate the html page + genhtml coverage.info --output-directory coverage_html +fi + +# +# Generate Python coverage report +# +if (( N_PYTHON > 0 )); then + python3-coverage html --omit='/usr/lib/*' -d coverage_python_html + python3-coverage xml --omit='/usr/lib/*' -o coverage_python.xml + mv CTestTestfile-backup.cmake CTestTestfile.cmake +fi diff --git a/cmake/make_debian_package.sh.in b/cmake/make_debian_package.sh.in new file mode 100755 index 0000000..b3ea221 --- /dev/null +++ b/cmake/make_debian_package.sh.in @@ -0,0 +1,70 @@ +#!/bin/bash + +# Shell script to generate a debian package from a particular tag (configured during the cmake configuration). + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +# This cmake.in file requires the following variables to be set: +# PACKAGE_BUILDVERSION_ENVIRONMENT_VARIABLE_NAME Environment variable which contains the build version. +# Must not contain any hyphens. +# PACKAGE_BASE_NAME This is the debian package name, not the project name (e.g. libraries must start with lib, +# all lover case, no underscore) +# PACKAGE_FULL_LIBRARY_VERSION The full version, incl. build version and patch version +# PACKAGE_GIT_URI The URI where to check out the source code +# PACKAGE_TAG_VERSION The tag for which the package is build +# PACKAGE_MESSAGE The message for the debian package log + +#Check that the @PACKAGE_BUILDVERSION_ENVIRONMENT_VARIABLE_NAME@ variable is set, otherwise reject creating a package +if [ -z "$@PACKAGE_BUILDVERSION_ENVIRONMENT_VARIABLE_NAME@" ]; then + echo Environment variable '@PACKAGE_BUILDVERSION_ENVIRONMENT_VARIABLE_NAME@' not set or empty. You need it to make a debian package! + exit 1 +fi + +#drop out of the script if anything goes wrong (e.g. non-existen git tag) +set -e + +#Create a working directory in order not to merge with the rest in the build directory +rm -rf debian_package +mkdir debian_package +cd debian_package + +#Check out the correct tag from the master git repository. +#The local directory name has to follow the debian convention +# lowecasepackagenname_package.ver.sion +#Note, we first clone and then checkout the tag because the old git version on +#Ubuntu12.4 does not support to do it in one go. +BUILD_DIR_NAME=@PACKAGE_BASE_NAME@_@PACKAGE_FULL_LIBRARY_VERSION@ +git clone @CMAKE_SOURCE_DIR@ ${BUILD_DIR_NAME} +( cd ${BUILD_DIR_NAME} &&\ + git checkout @PACKAGE_TAG_VERSION@ &&\ + rm -rf .git ) +#Debian convention: file has to end on .orig.tar.gz +tar -czf ${BUILD_DIR_NAME}.orig.tar.gz ${BUILD_DIR_NAME} + +#Copy the prepared debian packaging config files to the source code +#directroy +cp -r ../debian_from_template ${BUILD_DIR_NAME}/debian +cd ${BUILD_DIR_NAME} + +#The package versions for doocs / Ubuntu contain the codename of the distribution. Get it from the system. +CODENAME=`lsb_release -c | sed "{s/Codename:\s*//}"` + +#Before building the package we will update the changelog. This is easier from a shell script +#because debchange does the right format and the current date, user name and email automatically for us. +#Use the NAME and EMAIL environment variables to get correct values if needed (usually the email is +# user@host instead of first.last@institute, for instance killenb@mskpcx18571.desy.de instead of martin.killenberg@desy.de). +debchange --create --package @PACKAGE_BASE_NAME@ -v @PACKAGE_FULL_LIBRARY_VERSION@-${@PACKAGE_BUILDVERSION_ENVIRONMENT_VARIABLE_NAME@} --distribution ${CODENAME} @PACKAGE_MESSAGE@ + +#Now everything is prepared and we can actually build the package. +#If you have a gpg signature you can remove the -us and -uc flags and sign the package. +dpkg-buildpackage -rfakeroot -us -uc diff --git a/cmake/set_control_system_adapter.cmake b/cmake/set_control_system_adapter.cmake new file mode 100644 index 0000000..a5eae11 --- /dev/null +++ b/cmake/set_control_system_adapter.cmake @@ -0,0 +1,59 @@ +####################################################################################################################### +# set_control_system_adapter.cmake +# +# Set the ControlSystemAdapter for a ApplicationCore server +# +# Expects the following input variable: +# ADAPTER - String specifiing the adapter, either DOOCS, OPCUA or EPICSIOC +# +# This macro will add the selected adapter as a dependency and set the following variables: +# +# Adapter_LINK_FLAGS - Link flags provided by the adapter library +# Adapter_LIBRARIES - Libraries that are dependencies of the adapter +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +# Select control system adapter +if(ADAPTER STREQUAL "OPCUA") + message("Building against the OPC UA ControlSystemAdater") + find_package(ChimeraTK-ControlSystemAdapter-OPCUAAdapter 03.00 REQUIRED) + set_target_properties(ChimeraTK::ChimeraTK-ControlSystemAdapter-OPCUAAdapter PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-OPCUAAdapter) + set(ADAPTERS_MATCHING_BACKEND "ChimeraTK-DeviceAccess-OPC-UA-Backend") +elseif(ADAPTER STREQUAL "DOOCS") + message("Building against the DOOCS ControlSystemAdater") + find_package(ChimeraTK-ControlSystemAdapter-DoocsAdapter 01.08 REQUIRED) + set_target_properties(ChimeraTK::ChimeraTK-ControlSystemAdapter-DoocsAdapter PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-DoocsAdapter) + set(ADAPTERS_MATCHING_BACKEND "ChimeraTK-DeviceAccess-DoocsBackend") +elseif(ADAPTER STREQUAL "EPICSIOC") + message("Building against the EPICS IOC ControlSystemAdater") + find_package(ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter 02.01 REQUIRED) + set_target_properties(ChimeraTK::ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter) + set(ADAPTERS_MATCHING_BACKEND "ChimeraTK-DeviceAccess-EPICS-Backend") +elseif(ADAPTER STREQUAL "TANGO") + message("Building against the Tango ControlSystemAdater") + find_package(ChimeraTK-ControlSystemAdapter-TangoAdapter 01.00 REQUIRED) + set_target_properties(ChimeraTK::ChimeraTK-ControlSystemAdapter-TangoAdapter PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-TangoAdapter) + set(ADAPTERS_MATCHING_BACKEND "ChimeraTK-DeviceAccess-TangoBackend") +else() + message(FATAL_ERROR "Please select your ControlSystemAdapter to use by passing to the cmake command line:\n" + " -DADAPTER=DOOCS to build a DOOCS server\n" + " -DADAPTER=OPCUA to build an OPC UA server\n" + " -DADAPTER=EPICSIOC to build an EPICS IOC\n" + " -DADAPTER=TANGO to build a Tango device server") +endif() diff --git a/cmake/set_default_build_to_release.cmake b/cmake/set_default_build_to_release.cmake new file mode 100644 index 0000000..8d1fae2 --- /dev/null +++ b/cmake/set_default_build_to_release.cmake @@ -0,0 +1,23 @@ +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +####################################################################################################################### +# Set the build type to Release if none is specified +# Force it into Release if "None" is specified (needed to overrule dkpg_buildpackage) +###################################################################################################################### + +if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None") + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None") + diff --git a/cmake/set_default_flags.cmake b/cmake/set_default_flags.cmake new file mode 100644 index 0000000..ef88a19 --- /dev/null +++ b/cmake/set_default_flags.cmake @@ -0,0 +1,50 @@ +# ###################################################################################################################### +# set_default_flags.cmake +# +# Set default compiler flags for C++, including the flags for thelatest C++ standard (see +# enable_latest_cxx_support.cmake) +# +# It will also append ${PROJECT_NAME}_CXX_FLAGS to the CMAKE_CXX_FLAGS, so it is a good idea to set any project +# specific flags before calling this macro. +# +# ###################################################################################################################### + +# ###################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +# ###################################################################################################################### + +include(cmake/enable_latest_cxx_support.cmake) + +set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;asan;tsan") +# array-bounds and stringop-overflow warnings have many false positives in gcc 13.3 release builds (e.g. with +# nlohman/json) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${PROJECT_NAME}_CXX_FLAGS} -Wall -Wextra -Wshadow -pedantic -Wuninitialized -Wno-array-bounds") +if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-overflow") # doesn't exist for clang +endif() +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3 -g") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") +set(CMAKE_CXX_FLAGS_TSAN "${CMAKE_CXX_FLAGS} -g -O1 -fsanitize=thread -fno-inline") +set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS} -g -O0 -fsanitize=address -fsanitize=undefined -fsanitize=leak -fno-inline -fno-omit-frame-pointer") + +add_compile_definitions("$<$:_GLIBCXX_ASSERTIONS>") + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${PROJECT_NAME}_C_FLAGS} -Wall -Wextra -Wshadow -pedantic -Wuninitialized") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 -g") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0") +set(CMAKE_C_FLAGS_TSAN "${CMAKE_C_FLAGS} -g -O1 -fsanitize=thread -fno-inline") +set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS} -g -O0 -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=leak -fno-inline -fno-omit-frame-pointer") + +# Make sure any non-standard library path are added in library or executable targets. +# Since this in done only at install time, behavior of unit tests is not affected. +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) diff --git a/cmake/set_version_numbers.cmake b/cmake/set_version_numbers.cmake new file mode 100644 index 0000000..333afd4 --- /dev/null +++ b/cmake/set_version_numbers.cmake @@ -0,0 +1,46 @@ +####################################################################################################################### +# set_version_numbers.cmake +# +# Set the version numbers for a package in the format needed by other scripts of the project-template +# +# Expects the following input variables: +# ${PROJECT_NAME}_MAJOR_VERSION - major version number +# ${PROJECT_NAME}_MINOR_VERSION - minor version number +# ${PROJECT_NAME}_PATCH_VERSION - patch number +# +# Optional environment variables: +# $PROJECT_BUILDVERSION - additional build version number for the shared object version number (e.g. "xenial1") +# +####################################################################################################################### + +####################################################################################################################### +# +# IMPORTANT NOTE: +# +# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from +# there. Make sure to keep the file generic, since it will be used by other projects, too. +# +# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes +# into the project-template repository immediately. +# +####################################################################################################################### + +set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}) + +set(${PROJECT_NAME}_SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}) +set(${PROJECT_NAME}_BUILDVERSION $ENV{PROJECT_BUILDVERSION}) +if( ${PROJECT_NAME}_BUILDVERSION ) + set(${PROJECT_NAME}_SOVERSION "${${PROJECT_NAME}_SOVERSION}${${PROJECT_NAME}_BUILDVERSION}") +endif( ${PROJECT_NAME}_BUILDVERSION ) + +set(${PROJECT_NAME}_FULL_LIBRARY_VERSION ${${PROJECT_NAME}_SOVERSION}.${${PROJECT_NAME}_PATCH_VERSION}) + +# The following generates a cpp header file that can be used to access the CMAKE version info. +# The "VersionInfo.h" is available in the project's build directory and included in the build. + +string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_MAJOR_VERSION_INT ${${PROJECT_NAME}_MAJOR_VERSION}) +string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_MINOR_VERSION_INT ${${PROJECT_NAME}_MINOR_VERSION}) +string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_PATCH_VERSION_INT ${${PROJECT_NAME}_PATCH_VERSION}) + +configure_file(cmake/version_info_template.h.in "${PROJECT_BINARY_DIR}/generated/VersionInfo.h") +include_directories(${PROJECT_BINARY_DIR}/generated) diff --git a/cmake/version_info_template.h.in b/cmake/version_info_template.h.in new file mode 100644 index 0000000..5483e2e --- /dev/null +++ b/cmake/version_info_template.h.in @@ -0,0 +1,10 @@ +#pragma once + +namespace ChimeraTK::VersionInfo { + + const int major{${${PROJECT_NAME}_MAJOR_VERSION_INT}}; + const int minor{${${PROJECT_NAME}_MINOR_VERSION_INT}}; + const int applicationPatch{${${PROJECT_NAME}_PATCH_VERSION_INT}}; + + static constexpr const char * soVersion = "${${PROJECT_NAME}_SOVERSION}"; +} // namespace ChimeraTK::VersionInfo diff --git a/doc/ChimeraTK_Logo.pdf b/doc/ChimeraTK_Logo.pdf new file mode 100644 index 0000000..ee4f3f2 Binary files /dev/null and b/doc/ChimeraTK_Logo.pdf differ diff --git a/doc/ChimeraTK_Logo_whitebg.png b/doc/ChimeraTK_Logo_whitebg.png new file mode 100644 index 0000000..d7bf386 Binary files /dev/null and b/doc/ChimeraTK_Logo_whitebg.png differ diff --git a/doc/DESY_logo.png b/doc/DESY_logo.png index 1a68c33..5289ef1 100644 Binary files a/doc/DESY_logo.png and b/doc/DESY_logo.png differ diff --git a/doc/Doxyfile b/doc/Doxyfile deleted file mode 100644 index 4cd3115..0000000 --- a/doc/Doxyfile +++ /dev/null @@ -1,2471 +0,0 @@ -# Doxyfile 1.8.11 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "MTCA4U Control System Tools" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "Tools to facilitate the interfacing to control systems" - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = ./DESY_logo.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = ../src \ - ../include - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.for \ - *.vhd \ - *.vhdl - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /