From 7197ff316f8ee40c37e960a3af9c138311bc809d Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Mon, 16 Oct 2023 17:38:10 +0100 Subject: [PATCH 1/9] Update requirements with cmakelang --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 13e4db07c..f648e9f8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +cmakelang conan ninja -pre-commit \ No newline at end of file +pre-commit From b1e31742e2449c7acdd5c06c270f1929410c7a04 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Mon, 16 Oct 2023 17:58:58 +0100 Subject: [PATCH 2/9] Add pre-commit details to developer guide --- docs/development/developers-guide.md | 12 ++++++++++++ docs/development/pre-commit.md | 3 +++ docs/index.rst | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 docs/development/developers-guide.md create mode 100644 docs/development/pre-commit.md diff --git a/docs/development/developers-guide.md b/docs/development/developers-guide.md new file mode 100644 index 000000000..b0f17270c --- /dev/null +++ b/docs/development/developers-guide.md @@ -0,0 +1,12 @@ +# Developer Guide + +Welcome to the developers guide for the Morpheus Framework. This guide will detail how you, the developer can build and use the framework to extend existing functionality and use the framework to develop your own applications. + +# Overview + +The Morpheus Framework is written largely in C++, but does also support other language in places. For instance some of the other languages used are: +- CMake for build scripts +- Python for Conan +- Objective C/C++ for MacOs component such as the Metal rendering system. + +Morpheus has many libraries that it depends upon. Largely these dependencies are fetched via the Conan 2 package manager. In a few case where libraries are not packaged for Conan then a dependency may be fetched as a Git repo via CMake's FetchContent method. diff --git a/docs/development/pre-commit.md b/docs/development/pre-commit.md new file mode 100644 index 000000000..5e228cae5 --- /dev/null +++ b/docs/development/pre-commit.md @@ -0,0 +1,3 @@ +# Pre-commit + +The Morpheus Framework uses [pre-commit](https://pre-commit.com/) to install Git hooks which run on every commit. diff --git a/docs/index.rst b/docs/index.rst index a109d9794..30dea6c25 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,6 +17,12 @@ Morpheus is a modern C++23 based game engine. * :ref:`modindex` * :ref:`search` +.. toctree:: + :maxdepth: 3 + :caption: Development: + :name: librarytoc + + development/developers-guide .. toctree:: :maxdepth: 3 From 19afc503e07005c4a7178392fd8d131d93a633a3 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Mon, 16 Oct 2023 18:06:02 +0100 Subject: [PATCH 3/9] Default generated cmake format file --- .cmake-format.yaml | 245 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 .cmake-format.yaml diff --git a/.cmake-format.yaml b/.cmake-format.yaml new file mode 100644 index 000000000..b9cedc0c2 --- /dev/null +++ b/.cmake-format.yaml @@ -0,0 +1,245 @@ +_help_parse: Options affecting listfile parsing +parse: + _help_additional_commands: + - Specify structure for custom cmake functions + additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + HEADERS: '*' + SOURCES: '*' + DEPENDS: '*' + _help_override_spec: + - Override configurations per-command where available + override_spec: {} + _help_vartags: + - Specify variable tags. + vartags: [] + _help_proptags: + - Specify property tags. + proptags: [] +_help_format: Options affecting formatting. +format: + _help_disable: + - Disable formatting entirely, making cmake-format a no-op + disable: false + _help_line_width: + - How wide to allow formatted cmake files + line_width: 120 + _help_tab_size: + - How many spaces to tab for indent + tab_size: 4 + _help_use_tabchars: + - If true, lines are indented using tab characters (utf-8 + - 0x09) instead of space characters (utf-8 0x20). + - In cases where the layout would require a fractional tab + - character, the behavior of the fractional indentation is + - governed by + use_tabchars: false + _help_fractional_tab_policy: + - If is True, then the value of this variable + - indicates how fractional indentions are handled during + - whitespace replacement. If set to 'use-space', fractional + - indentation is left as spaces (utf-8 0x20). If set to + - '`round-up` fractional indentation is replaced with a single' + - tab character (utf-8 0x09) effectively shifting the column + - to the next tabstop + fractional_tab_policy: use-space + _help_max_subgroups_hwrap: + - If an argument group contains more than this many sub-groups + - (parg or kwarg groups) then force it to a vertical layout. + max_subgroups_hwrap: 2 + _help_max_pargs_hwrap: + - If a positional argument group contains more than this many + - arguments, then force it to a vertical layout. + max_pargs_hwrap: 6 + _help_max_rows_cmdline: + - If a cmdline positional group consumes more than this many + - lines without nesting, then invalidate the layout (and nest) + max_rows_cmdline: 2 + _help_separate_ctrl_name_with_space: + - If true, separate flow control names from their parentheses + - with a space + separate_ctrl_name_with_space: false + _help_separate_fn_name_with_space: + - If true, separate function names from parentheses with a + - space + separate_fn_name_with_space: false + _help_dangle_parens: + - If a statement is wrapped to more than one line, than dangle + - the closing parenthesis on its own line. + dangle_parens: false + _help_dangle_align: + - If the trailing parenthesis must be 'dangled' on its on + - 'line, then align it to this reference: `prefix`: the start' + - 'of the statement, `prefix-indent`: the start of the' + - 'statement, plus one indentation level, `child`: align to' + - the column of the arguments + dangle_align: prefix + _help_min_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is smaller than this amount, then force reject + - nested layouts. + min_prefix_chars: 4 + _help_max_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is larger than the tab width by more than this + - amount, then force reject un-nested layouts. + max_prefix_chars: 10 + _help_max_lines_hwrap: + - If a candidate layout is wrapped horizontally but it exceeds + - this many lines, then reject the layout. + max_lines_hwrap: 2 + _help_line_ending: + - What style line endings to use in the output. + line_ending: unix + _help_command_case: + - Format command names consistently as 'lower' or 'upper' case + command_case: canonical + _help_keyword_case: + - Format keywords consistently as 'lower' or 'upper' case + keyword_case: unchanged + _help_always_wrap: + - A list of command names which should always be wrapped + always_wrap: [] + _help_enable_sort: + - If true, the argument lists which are known to be sortable + - will be sorted lexicographicall + enable_sort: true + _help_autosort: + - If true, the parsers may infer whether or not an argument + - list is sortable (without annotation). + autosort: false + _help_require_valid_layout: + - By default, if cmake-format cannot successfully fit + - everything into the desired linewidth it will apply the + - last, most agressive attempt that it made. If this flag is + - True, however, cmake-format will print error, exit with non- + - zero status code, and write-out nothing + require_valid_layout: false + _help_layout_passes: + - A dictionary mapping layout nodes to a list of wrap + - decisions. See the documentation for more information. + layout_passes: {} +_help_markup: Options affecting comment reflow and formatting. +markup: + _help_bullet_char: + - What character to use for bulleted lists + bullet_char: '*' + _help_enum_char: + - What character to use as punctuation after numerals in an + - enumerated list + enum_char: . + _help_first_comment_is_literal: + - If comment markup is enabled, don't reflow the first comment + - block in each listfile. Use this to preserve formatting of + - your copyright/license statements. + first_comment_is_literal: false + _help_literal_comment_pattern: + - If comment markup is enabled, don't reflow any comment block + - which matches this (regex) pattern. Default is `None` + - (disabled). + literal_comment_pattern: null + _help_fence_pattern: + - Regular expression to match preformat fences in comments + - default= ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ + _help_ruler_pattern: + - Regular expression to match rulers in comments default= + - '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``' + ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ + _help_explicit_trailing_pattern: + - If a comment line matches starts with this pattern then it + - is explicitly a trailing comment for the preceeding + - argument. Default is '#<' + explicit_trailing_pattern: '#<' + _help_hashruler_min_length: + - If a comment line starts with at least this many consecutive + - hash characters, then don't lstrip() them off. This allows + - for lazy hash rulers where the first hash char is not + - separated by space + hashruler_min_length: 10 + _help_canonicalize_hashrulers: + - If true, then insert a space between the first hash char and + - remaining hash chars in a hash ruler, and normalize its + - length to fill the column + canonicalize_hashrulers: true + _help_enable_markup: + - enable comment markup parsing and reflow + enable_markup: true +_help_lint: Options affecting the linter +lint: + _help_disabled_codes: + - a list of lint codes to disable + disabled_codes: [] + _help_function_pattern: + - regular expression pattern describing valid function names + function_pattern: '[0-9a-z_]+' + _help_macro_pattern: + - regular expression pattern describing valid macro names + macro_pattern: '[0-9A-Z_]+' + _help_global_var_pattern: + - regular expression pattern describing valid names for + - variables with global (cache) scope + global_var_pattern: '[A-Z][0-9A-Z_]+' + _help_internal_var_pattern: + - regular expression pattern describing valid names for + - variables with global scope (but internal semantic) + internal_var_pattern: _[A-Z][0-9A-Z_]+ + _help_local_var_pattern: + - regular expression pattern describing valid names for + - variables with local scope + local_var_pattern: '[a-z][a-z0-9_]+' + _help_private_var_pattern: + - regular expression pattern describing valid names for + - privatedirectory variables + private_var_pattern: _[0-9a-z_]+ + _help_public_var_pattern: + - regular expression pattern describing valid names for public + - directory variables + public_var_pattern: '[A-Z][0-9A-Z_]+' + _help_argument_var_pattern: + - regular expression pattern describing valid names for + - function/macro arguments and loop variables. + argument_var_pattern: '[a-z][a-z0-9_]+' + _help_keyword_pattern: + - regular expression pattern describing valid names for + - keywords used in functions or macros + keyword_pattern: '[A-Z][0-9A-Z_]+' + _help_max_conditionals_custom_parser: + - In the heuristic for C0201, how many conditionals to match + - within a loop in before considering the loop a parser. + max_conditionals_custom_parser: 2 + _help_min_statement_spacing: + - Require at least this many newlines between statements + min_statement_spacing: 1 + _help_max_statement_spacing: + - Require no more than this many newlines between statements + max_statement_spacing: 2 + max_returns: 6 + max_branches: 12 + max_arguments: 5 + max_localvars: 15 + max_statements: 50 +_help_encode: Options affecting file encoding +encode: + _help_emit_byteorder_mark: + - If true, emit the unicode byte-order mark (BOM) at the start + - of the file + emit_byteorder_mark: false + _help_input_encoding: + - Specify the encoding of the input file. Defaults to utf-8 + input_encoding: utf-8 + _help_output_encoding: + - Specify the encoding of the output file. Defaults to utf-8. + - Note that cmake only claims to support utf-8 so be careful + - when using anything else + output_encoding: utf-8 +_help_misc: Miscellaneous configurations options. +misc: + _help_per_command: + - A dictionary containing any per-command configuration + - overrides. Currently only `command_case` is supported. + per_command: {} From 120bc29482ba22766627ab14cea417167b616e3d Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Mon, 16 Oct 2023 18:42:13 +0100 Subject: [PATCH 4/9] Add pre-commit badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4eae16ecf..cb9645dc2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/twon/morpheus/master/LICENSE.MIT) [![GitHub Issues](https://img.shields.io/github/issues/twon/morpheus.svg)](http://github.com/twon/morpheus/issues) [![codecov](https://codecov.io/gh/Twon/Morpheus/branch/main/graph/badge.svg?token=1JmtZA8soP)](https://codecov.io/gh/Twon/Morpheus) + [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) ![Coverage](https://codecov.io/gh/Twon/Morpheus/branch/main/graphs/sunburst.svg?token=1JmtZA8soP) From aa8650901d30cbc8722db11e984fd7e6bd3c2c5f Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Mon, 16 Oct 2023 21:46:07 +0100 Subject: [PATCH 5/9] Configure format settings --- .cmake-format.yaml | 197 ++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 101 deletions(-) diff --git a/.cmake-format.yaml b/.cmake-format.yaml index b9cedc0c2..dd607186d 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -3,14 +3,26 @@ parse: _help_additional_commands: - Specify structure for custom cmake functions additional_commands: - foo: + morpheus_add_library: flags: - - BAR - - BAZ + - INTERFACE kwargs: - HEADERS: '*' - SOURCES: '*' - DEPENDS: '*' + ALIAS: 1 + NAME: 1 + FOLDER: 1 + morpheus_add_testing_library: + flags: + - INTERFACE + kwargs: + ALIAS: 1 + NAME: 1 + FOLDER: 1 + morpheus_add_executable: + kwargs: + ALIAS: 1 + NAME: 1 + FOLDER: 1 + _help_override_spec: - Override configurations per-command where available override_spec: {} @@ -22,107 +34,90 @@ parse: proptags: [] _help_format: Options affecting formatting. format: - _help_disable: - - Disable formatting entirely, making cmake-format a no-op disable: false - _help_line_width: - - How wide to allow formatted cmake files line_width: 120 - _help_tab_size: - - How many spaces to tab for indent tab_size: 4 - _help_use_tabchars: - - If true, lines are indented using tab characters (utf-8 - - 0x09) instead of space characters (utf-8 0x20). - - In cases where the layout would require a fractional tab - - character, the behavior of the fractional indentation is - - governed by use_tabchars: false - _help_fractional_tab_policy: - - If is True, then the value of this variable - - indicates how fractional indentions are handled during - - whitespace replacement. If set to 'use-space', fractional - - indentation is left as spaces (utf-8 0x20). If set to - - '`round-up` fractional indentation is replaced with a single' - - tab character (utf-8 0x09) effectively shifting the column - - to the next tabstop - fractional_tab_policy: use-space - _help_max_subgroups_hwrap: - - If an argument group contains more than this many sub-groups - - (parg or kwarg groups) then force it to a vertical layout. +# _help_fractional_tab_policy: +# - If is True, then the value of this variable +# - indicates how fractional indentions are handled during +# - whitespace replacement. If set to 'use-space', fractional +# - indentation is left as spaces (utf-8 0x20). If set to +# - '`round-up` fractional indentation is replaced with a single' +# - tab character (utf-8 0x09) effectively shifting the column +# - to the next tabstop +# fractional_tab_policy: use-space +# _help_max_subgroups_hwrap: +# - If an argument group contains more than this many sub-groups +# - (parg or kwarg groups) then force it to a vertical layout. max_subgroups_hwrap: 2 - _help_max_pargs_hwrap: - - If a positional argument group contains more than this many - - arguments, then force it to a vertical layout. - max_pargs_hwrap: 6 - _help_max_rows_cmdline: - - If a cmdline positional group consumes more than this many - - lines without nesting, then invalidate the layout (and nest) - max_rows_cmdline: 2 - _help_separate_ctrl_name_with_space: - - If true, separate flow control names from their parentheses - - with a space - separate_ctrl_name_with_space: false - _help_separate_fn_name_with_space: - - If true, separate function names from parentheses with a - - space - separate_fn_name_with_space: false - _help_dangle_parens: - - If a statement is wrapped to more than one line, than dangle - - the closing parenthesis on its own line. - dangle_parens: false - _help_dangle_align: - - If the trailing parenthesis must be 'dangled' on its on - - 'line, then align it to this reference: `prefix`: the start' - - 'of the statement, `prefix-indent`: the start of the' - - 'statement, plus one indentation level, `child`: align to' - - the column of the arguments - dangle_align: prefix - _help_min_prefix_chars: - - If the statement spelling length (including space and - - parenthesis) is smaller than this amount, then force reject - - nested layouts. - min_prefix_chars: 4 - _help_max_prefix_chars: - - If the statement spelling length (including space and - - parenthesis) is larger than the tab width by more than this - - amount, then force reject un-nested layouts. - max_prefix_chars: 10 - _help_max_lines_hwrap: - - If a candidate layout is wrapped horizontally but it exceeds - - this many lines, then reject the layout. - max_lines_hwrap: 2 - _help_line_ending: - - What style line endings to use in the output. +# _help_max_pargs_hwrap: +# - If a positional argument group contains more than this many +# - arguments, then force it to a vertical layout. + max_pargs_hwrap: 2 +# _help_max_rows_cmdline: +# - If a cmdline positional group consumes more than this many +# - lines without nesting, then invalidate the layout (and nest) +# max_rows_cmdline: 2 +# _help_separate_ctrl_name_with_space: +# - If true, separate flow control names from their parentheses +# - with a space +# separate_ctrl_name_with_space: false +# _help_separate_fn_name_with_space: +# - If true, separate function names from parentheses with a +# - space +# separate_fn_name_with_space: false + dangle_parens: true +# _help_dangle_align: +# - If the trailing parenthesis must be 'dangled' on its on +# - 'line, then align it to this reference: `prefix`: the start' +# - 'of the statement, `prefix-indent`: the start of the' +# - 'statement, plus one indentation level, `child`: align to' +# - the column of the arguments +# dangle_align: prefix +# _help_min_prefix_chars: +# - If the statement spelling length (including space and +# - parenthesis) is smaller than this amount, then force reject +# - nested layouts. +# min_prefix_chars: 4 +# _help_max_prefix_chars: +# - If the statement spelling length (including space and +# - parenthesis) is larger than the tab width by more than this +# - amount, then force reject un-nested layouts. +# max_prefix_chars: 10 +# _help_max_lines_hwrap: +# - If a candidate layout is wrapped horizontally but it exceeds +# - this many lines, then reject the layout. +# max_lines_hwrap: 2 line_ending: unix - _help_command_case: - - Format command names consistently as 'lower' or 'upper' case - command_case: canonical - _help_keyword_case: - - Format keywords consistently as 'lower' or 'upper' case - keyword_case: unchanged - _help_always_wrap: - - A list of command names which should always be wrapped - always_wrap: [] - _help_enable_sort: - - If true, the argument lists which are known to be sortable - - will be sorted lexicographicall - enable_sort: true - _help_autosort: - - If true, the parsers may infer whether or not an argument - - list is sortable (without annotation). - autosort: false - _help_require_valid_layout: - - By default, if cmake-format cannot successfully fit - - everything into the desired linewidth it will apply the - - last, most agressive attempt that it made. If this flag is - - True, however, cmake-format will print error, exit with non- - - zero status code, and write-out nothing - require_valid_layout: false - _help_layout_passes: - - A dictionary mapping layout nodes to a list of wrap - - decisions. See the documentation for more information. - layout_passes: {} +# _help_command_case: +# - Format command names consistently as 'lower' or 'upper' case +# command_case: canonical +# _help_keyword_case: +# - Format keywords consistently as 'lower' or 'upper' case +# keyword_case: unchanged +# _help_always_wrap: +# - A list of command names which should always be wrapped +# always_wrap: [] +# _help_enable_sort: +# - If true, the argument lists which are known to be sortable +# - will be sorted lexicographicall +# enable_sort: true +# _help_autosort: +# - If true, the parsers may infer whether or not an argument +# - list is sortable (without annotation). +# autosort: false +# _help_require_valid_layout: +# - By default, if cmake-format cannot successfully fit +# - everything into the desired linewidth it will apply the +# - last, most agressive attempt that it made. If this flag is +# - True, however, cmake-format will print error, exit with non- +# - zero status code, and write-out nothing +# require_valid_layout: false +# _help_layout_passes: +# - A dictionary mapping layout nodes to a list of wrap +# - decisions. See the documentation for more information. +# layout_passes: {} _help_markup: Options affecting comment reflow and formatting. markup: _help_bullet_char: From bf2bed2acd7deb5794f9b71a530c0e8dbadfb496 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Tue, 17 Oct 2023 09:43:11 +0100 Subject: [PATCH 6/9] Testing out manual formatting --- .pre-commit-config.yaml | 8 ++++++++ libraries/core/CMakeLists.txt | 1 - requirements.txt | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b830ab23..a5d677e95 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,11 @@ repos: - id: forbid-submodules - id: requirements-txt-fixer - id: trailing-whitespace + +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + additional_dependencies: ["cmakelang[YAML]"] + - id: cmake-lint + additional_dependencies: ["cmakelang[YAML]"] diff --git a/libraries/core/CMakeLists.txt b/libraries/core/CMakeLists.txt index 46631a05a..3bed222c7 100644 --- a/libraries/core/CMakeLists.txt +++ b/libraries/core/CMakeLists.txt @@ -1,4 +1,3 @@ - add_subdirectory(mocking) add_subdirectory(src) add_subdirectory(testing) diff --git a/requirements.txt b/requirements.txt index f648e9f8c..4c87e391c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -cmakelang conan ninja pre-commit From 3c33a50940cbd29b5c1135147debff617d6115bf Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 22 Oct 2023 10:48:48 +0100 Subject: [PATCH 7/9] Format documentation module --- .cmake-format.yaml | 22 ++++++++-- .pre-commit-config.yaml | 4 +- cmake/documentation.cmake | 91 ++++++++++++++++++++++++++++++--------- 3 files changed, 91 insertions(+), 26 deletions(-) diff --git a/.cmake-format.yaml b/.cmake-format.yaml index dd607186d..983601024 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -3,6 +3,14 @@ parse: _help_additional_commands: - Specify structure for custom cmake functions additional_commands: + add_documentation: + kwargs: + PROJECT: 1 + PROJECT_NUMBER: 1 + OUTPUT_DIRECTORY: 1 + WORKING_DIRECTORY: 1 + INPUT_DIRECTORY: '*' + PUBLIC_HEADERS: '*' morpheus_add_library: flags: - INTERFACE @@ -22,7 +30,13 @@ parse: ALIAS: 1 NAME: 1 FOLDER: 1 - + virtualenv_create: + kwargs: + DESTINATION: 1 + REQUIREMENTS: 1 + WORKING_DIRECTORY: 1 + OUTPUT: '*' + EXTRA_ARGS: '*' _help_override_spec: - Override configurations per-command where available override_spec: {} @@ -46,15 +60,15 @@ format: # - '`round-up` fractional indentation is replaced with a single' # - tab character (utf-8 0x09) effectively shifting the column # - to the next tabstop -# fractional_tab_policy: use-space + fractional_tab_policy: use-space # _help_max_subgroups_hwrap: # - If an argument group contains more than this many sub-groups # - (parg or kwarg groups) then force it to a vertical layout. - max_subgroups_hwrap: 2 +# max_subgroups_hwrap: 2 # _help_max_pargs_hwrap: # - If a positional argument group contains more than this many # - arguments, then force it to a vertical layout. - max_pargs_hwrap: 2 +# max_pargs_hwrap: 6 # _help_max_rows_cmdline: # - If a cmdline positional group consumes more than this many # - lines without nesting, then invalidate the layout (and nest) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5d677e95..81e3f2d2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,5 +15,5 @@ repos: hooks: - id: cmake-format additional_dependencies: ["cmakelang[YAML]"] - - id: cmake-lint - additional_dependencies: ["cmakelang[YAML]"] +# - id: cmake-lint +# additional_dependencies: ["cmakelang[YAML]"] diff --git a/cmake/documentation.cmake b/cmake/documentation.cmake index 49b0dffaa..cd5999ef1 100644 --- a/cmake/documentation.cmake +++ b/cmake/documentation.cmake @@ -22,24 +22,75 @@ include(virtualenv) option(MORPHEUS_BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF) +#[=======================================================================[.rst: +cmake_to_doxyfile_string +------------------ +Overview +^^^^^^^^ + +Preps CMake strings for use with Doxyfile format. + +#]=======================================================================] macro(cmake_to_doxyfile_string string) - string (REPLACE ";" " " ${string} "${${string}}") + string(REPLACE ";" " " ${string} "${${string}}") endmacro() +#[=======================================================================[.rst: +add_documentation +------------------ + +Overview +^^^^^^^^ + +Add documentation will generate doxygen documenation from markup in the source code +before sending this to breath to generate Sphinx documenation from the markup + +.. code-block:: cmake + + add_documentation( + [PROJECT] + [PROJECT_NUMBER ] + [OUTPUT_DIRECTORY ] + [WORKING_DIRECTORY ] + [INPUT_DIRECTORY ] + [PUBLIC_HEADERS ] + ) + +A virtual environment is created for hosting the python dependencies required in order to +install breath, and sphinx dependencies in isolation. There is a sperate docuemtentation +requirements file storing dependencies for this virtual environment. + +Example +^^^^^^^ + +.. code-block:: cmake + + add_documentation( + PROJECT Morpheus + PROJECT_NUMBER ${MORPHEUS_VERSION} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + PUBLIC_HEADERS ${publicHeaders} + INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/examples + INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/libraries + OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/documentation + ) + +#]=======================================================================] function(add_documentation) set(options) set(oneValueArgs PROJECT PROJECT_NUMBER OUTPUT_DIRECTORY WORKING_DIRECTORY) set(multiValueArgs INPUT_DIRECTORY PUBLIC_HEADERS) cmake_parse_arguments(DOCUMENTATION "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (DOCUMENTATION_PROJECT) + # cmake-lint: disable=C0103 + if(DOCUMENTATION_PROJECT) set(DOXYGEN_PROJECT ${DOCUMENTATION_PROJECT}) endif() - if (DOCUMENTATION_PROJECT_NUMBER) + if(DOCUMENTATION_PROJECT_NUMBER) set(DOXYGEN_PROJECT_NUMBER ${DOCUMENTATION_PROJECT_NUMBER}) endif() - if (NOT DOCUMENTATION_INPUT_DIRECTORY) + if(NOT DOCUMENTATION_INPUT_DIRECTORY) set(DOXYGEN_INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}) else() foreach(input ${DOCUMENTATION_INPUT_DIRECTORY}) @@ -51,20 +102,22 @@ function(add_documentation) set(DOXYGEN_INPUT_DIRECTORY ${DOCUMENTATION_INPUT_DIRECTORY}) cmake_to_doxyfile_string(DOXYGEN_INPUT_DIRECTORY) endif() - if (NOT DOCUMENTATION_OUTPUT_DIRECTORY) + if(NOT DOCUMENTATION_OUTPUT_DIRECTORY) set(DOCUMENTATION_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/documentation) endif() - if (NOT DOCUMENTATION_WORKING_DIRECTORY) + if(NOT DOCUMENTATION_WORKING_DIRECTORY) message(FATAL_ERROR "WORKING_DIRECTORY parameter must be supplied") endif() find_package(Doxygen REQUIRED) - # If using Conan find modules to find an installed Doxygen then we lose doxygen_add_docs, - # so include the find module directly to access this method as a work around. + # If using Conan find modules to find an installed Doxygen then we lose doxygen_add_docs, so include the find module + # directly to access this method as a work around. include(${CMAKE_ROOT}/Modules/FindDoxygen.cmake) - list(APPEND DOXYGEN_EXCLUDE_PATTERNS + list( + APPEND + DOXYGEN_EXCLUDE_PATTERNS "*/.git/*" "*/CMakeFiles/*" "*/_CPack_Packages/*" @@ -95,7 +148,8 @@ function(add_documentation) COMMENT "Generating API documentation with Doxygen" ) - add_custom_target( Doxygen + add_custom_target( + Doxygen DEPENDS ${doxygenIndex} COMMENT "Checking if Doxygen XML re-generation is required" ) @@ -108,16 +162,15 @@ function(add_documentation) virtualenv_create( DESTINATION ${documentationVenv} REQUIREMENTS ${PROJECT_SOURCE_DIR}/cmake/requirements/documentation_requirements.txt - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - OUTPUT - ${documentationSphinx} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + OUTPUT ${documentationSphinx} ) set(sphinxOutput ${CMAKE_BINARY_DIR}/documentation/sphinx) - add_custom_target(Documentation - COMMAND ${documentationSphinx} "-Dbreathe_projects.morpheus=${doxygenXmlOutputDir}" - ${PROJECT_SOURCE_DIR}/docs ${DOCUMENTATION_OUTPUT_DIRECTORY}/sphinx + add_custom_target( + Documentation + COMMAND ${documentationSphinx} "-Dbreathe_projects.morpheus=${doxygenXmlOutputDir}" ${PROJECT_SOURCE_DIR}/docs + ${DOCUMENTATION_OUTPUT_DIRECTORY}/sphinx DEPENDS ${documentationSphinx} ${doxygenIndex} Doxygen WORKING_DIRECTORY ${DOCUMENTATION_WORKING_DIRECTORY} COMMENT "Generating documentation with Sphinx" @@ -128,7 +181,6 @@ function(add_documentation) endfunction() - if(MORPHEUS_BUILD_DOCUMENTATION) file(GLOB_RECURSE publicHeaders "${PROJECT_SOURCE_DIR}/libraries/*.hpp") add_documentation( @@ -136,8 +188,7 @@ if(MORPHEUS_BUILD_DOCUMENTATION) PROJECT_NUMBER ${MORPHEUS_VERSION} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} PUBLIC_HEADERS ${publicHeaders} - INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/examples - INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/libraries + INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/libraries OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/documentation ) endif() From 5e6ac99d69b506c69d9044215bed848c8baf3a4b Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 22 Oct 2023 11:04:38 +0100 Subject: [PATCH 8/9] Format cmake modules --- .cmake-format.yaml | 6 + cmake/compiler.cmake | 13 +- cmake/coverage.cmake | 166 ++++++++++------------- cmake/morpheus_add_executable.cmake | 30 ++-- cmake/morpheus_add_library.cmake | 4 +- cmake/morpheus_add_target.cmake | 46 +++---- cmake/morpheus_add_testing_library.cmake | 35 ++--- cmake/morpheus_add_tests.cmake | 42 +++--- cmake/sanitisers.cmake | 32 +++-- cmake/targets.cmake | 61 +++++---- cmake/third_party.cmake | 16 +-- cmake/virtualenv.cmake | 15 +- cmake/warnings.cmake | 14 +- 13 files changed, 226 insertions(+), 254 deletions(-) diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 983601024..ac090cbcc 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -30,6 +30,12 @@ parse: ALIAS: 1 NAME: 1 FOLDER: 1 + morpheus_add_target: + kwargs: + TYPE: 1 + ALIAS: 1 + NAME: 1 + FOLDER: 1 virtualenv_create: kwargs: DESTINATION: 1 diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 93323d714..985097da2 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -23,14 +23,9 @@ set(CMAKE_CXX_EXTENSIONS OFF) add_library(MorpheusConfig INTERFACE) add_library(morpheus::config ALIAS MorpheusConfig) -target_link_libraries(MorpheusConfig - INTERFACE - $<$:dl> -) +target_link_libraries(MorpheusConfig INTERFACE $<$:dl>) -target_compile_options(MorpheusConfig - INTERFACE - $<$:${MSVC_WARNINGS}> - $<$:${GCC_WARNINGS}> - $<$,$>:${CLANG_WARNINGS}> +target_compile_options( + MorpheusConfig INTERFACE $<$:${MSVC_WARNINGS}> $<$:${GCC_WARNINGS}> + $<$,$>:${CLANG_WARNINGS}> ) diff --git a/cmake/coverage.cmake b/cmake/coverage.cmake index 84b341de2..eea4547cb 100644 --- a/cmake/coverage.cmake +++ b/cmake/coverage.cmake @@ -23,20 +23,15 @@ include(CheckCXXCompilerFlag) option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF) - set(COVERAGE_SUPPORTED_FLAGS # gcc 8 onwards "-fprofile-arcs -fprofile-abs-path -ftest-coverage" - # gcc and clang "-fprofile-arcs -ftest-coverage" - # gcc and clang fallback "--coverage" ) - - #[=======================================================================[.rst: coverage_target_clean_intermediate_file ------------------ @@ -49,15 +44,15 @@ function(coverage_target_clean_intermediate_file) set(options QUIET) set(oneValueArgs TARGET_NAME RETURN_NOTE_FILES RETURN_DATA_FILES) set(multiValueArgs) - cmake_parse_arguments(COVERAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(COVERAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT COVERAGE_TARGET_NAME) + if(NOT COVERAGE_TARGET_NAME) message(FATAL_ERROR "TARGET_NAME parameter must be supplied") endif() targets_get_translation_units(TARGET ${COVERAGE_TARGET_NAME} RESULT targetSources) - foreach (file IN LISTS targetSources) + foreach(file IN LISTS targetSources) list(APPEND gcovNoteFiles "${file}.gcno") list(APPEND gcovDataFiles "${file}.gcda") endforeach() @@ -65,22 +60,26 @@ function(coverage_target_clean_intermediate_file) set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES "${gcovNoteFiles} ${gcovDataFiles}") if(COVERAGE_RETURN_NOTE_FILES) - set(${COVERAGE_RETURN_NOTE_FILES} "${gcovNoteFiles}" PARENT_SCOPE) + set(${COVERAGE_RETURN_NOTE_FILES} + "${gcovNoteFiles}" + PARENT_SCOPE + ) endif() if(COVERAGE_RETURN_DATA_FILES) - set(${COVERAGE_RETURN_DATA_FILES} "${gcovDataFiles}" PARENT_SCOPE) + set(${COVERAGE_RETURN_DATA_FILES} + "${gcovDataFiles}" + PARENT_SCOPE + ) endif() endfunction() - - function(enable_code_coverage) set(options QUIET VERBOSE) set(oneValueArgs) set(multiValueArgs) - cmake_parse_arguments(COVERAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(COVERAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) get_filename_component(COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH}) @@ -103,7 +102,7 @@ function(enable_code_coverage) message(SEND_ERROR "Unable to find c++filt, disable code coverage to continue") endif() - if (NOT COVERAGE_QUIET) + if(NOT COVERAGE_QUIET) message(STATUS "Found gcov: ${GCOV_BIN}") message(STATUS "Found lcov: ${LCOV_BIN}") message(STATUS "Found genhtml: ${GENHTML_BIN}") @@ -116,12 +115,8 @@ function(enable_code_coverage) virtualenv_create( DESTINATION ${COVERAGE_VENV} REQUIREMENTS ${PROJECT_SOURCE_DIR}/cmake/requirements/coverage_requirements.txt - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - OUTPUT - ${COVERAGE_FASTCOV_BIN} - ${COVERAGE_FASTCOV_TO_SONARQUBE_BIN} - ${COVERAGE_LCOV_TO_COBERTURA_BIN} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + OUTPUT ${COVERAGE_FASTCOV_BIN} ${COVERAGE_FASTCOV_TO_SONARQUBE_BIN} ${COVERAGE_LCOV_TO_COBERTURA_BIN} ) set(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coverage") @@ -131,22 +126,28 @@ function(enable_code_coverage) set(LCOV_REPORT_PATH "${COVERAGE_REPORT_DIR}/lcov.info") set(LCOV_HTML_PATH "${COVERAGE_REPORT_DIR}/html") - if (NOT TARGET CodeCoverage) + if(NOT TARGET CodeCoverage) add_library(CodeCoverage INTERFACE) add_library(coverage::coverage ALIAS CodeCoverage) - foreach (FLAGS ${COVERAGE_SUPPORTED_FLAGS}) + foreach(FLAGS ${COVERAGE_SUPPORTED_FLAGS}) set(CMAKE_REQUIRED_FLAGS "${FLAGS}") check_cxx_compiler_flag("${FLAGS}" COVERAGE_FLAGS_DETECTED) - if (COVERAGE_FLAGS_DETECTED) + if(COVERAGE_FLAGS_DETECTED) string(REPLACE " " ";" FLAGS "${FLAGS}") - set(COVERAGE_COMPILER_FLAGS "${FLAGS}" CACHE STRING "${CMAKE_CXX_COMPILER_ID} flags for code coverage.") + set(COVERAGE_COMPILER_FLAGS + "${FLAGS}" + CACHE STRING "${CMAKE_CXX_COMPILER_ID} flags for code coverage." + ) mark_as_advanced(COVERAGE_COMPILER_FLAGS) break() - else () - message(WARNING "Code coverage is not available for the currently enable compiler ${CMAKE_CXX_COMPILER_ID} via the compiler flags ${FLAGS}.") - endif () + else() + message( + WARNING + "Code coverage is not available for the currently enable compiler ${CMAKE_CXX_COMPILER_ID} via the compiler flags ${FLAGS}." + ) + endif() endforeach() target_compile_options(CodeCoverage INTERFACE ${COVERAGE_COMPILER_FLAGS}) @@ -154,12 +155,12 @@ function(enable_code_coverage) endif() targets_get_all(RESULT allTargets DIRECTORY ${PROJECT_SOURCE_DIR}) - if (COVERAGE_VERBOSE) + if(COVERAGE_VERBOSE) message(STATUS "Coverage: All project targets: ${allTargets}") endif() targets_filter_for_sources(RESULT targetsWithSource TARGETS ${allTargets}) - if (COVERAGE_VERBOSE) + if(COVERAGE_VERBOSE) message(STATUS "Coverage: Targets with sources: ${targetsWithSource}}") endif() @@ -173,14 +174,16 @@ function(enable_code_coverage) set(translationUnit "${translationUnitDir}/${translationUnitFile}") set(objectFile "${translationUnit}.o") - add_custom_command(OUTPUT "${translationUnit}.gcno" - COMMAND ${CMAKE_COMMAND} -E touch "${translationUnit}.gcno" + add_custom_command( + OUTPUT "${translationUnit}.gcno" + COMMAND ${CMAKE_COMMAND} -E touch "${translationUnit}.gcno" DEPENDS "${objectFile}" - ) - add_custom_command(OUTPUT ${gcdaFile} - COMMAND ${CMAKE_COMMAND} -E touch "${gcdaFile}" + ) + add_custom_command( + OUTPUT ${gcdaFile} + COMMAND ${CMAKE_COMMAND} -E touch "${gcdaFile}" DEPENDS "${translationUnit}.gcno" - ) + ) endforeach() add_custom_target(${target}-gcda-init DEPENDS ${outputGCovDataFile}) @@ -191,35 +194,26 @@ function(enable_code_coverage) list(REMOVE_DUPLICATES allGcovDataFiles) file(MAKE_DIRECTORY ${COVERAGE_REPORT_DIR}) - add_custom_target(coverage-clean + add_custom_target( + coverage-clean COMMAND - ${COVERAGE_FASTCOV_BIN} - --gcov ${GCOV_BIN} - #--exclude ${CMAKE_CURRENT_BINARY_DIR} - --include ${PROJECT_SOURCE_DIR} - --zerocounters - DEPENDS - ${COVERAGE_FASTCOV_BIN} - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - COMMENT - "Recursively delete all gcda files" + ${COVERAGE_FASTCOV_BIN} --gcov ${GCOV_BIN} + # --exclude ${CMAKE_CURRENT_BINARY_DIR} + --include ${PROJECT_SOURCE_DIR} --zerocounters + DEPENDS ${COVERAGE_FASTCOV_BIN} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Recursively delete all gcda files" ) - add_custom_target(coverage-fastcov + add_custom_target( + coverage-fastcov COMMAND - ${COVERAGE_FASTCOV_BIN} - --gcov ${GCOV_BIN} - #--exclude ${CMAKE_CURRENT_BINARY_DIR} - --include ${PROJECT_SOURCE_DIR} - -o ${COVERAGE_REPORT_PATH} - DEPENDS - ${COVERAGE_FASTCOV_BIN} - ${gcdaInitTargets} - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - COMMENT - "Distributed proccessing of coverage data collection and report generation" + ${COVERAGE_FASTCOV_BIN} --gcov ${GCOV_BIN} + # --exclude ${CMAKE_CURRENT_BINARY_DIR} + --include ${PROJECT_SOURCE_DIR} -o ${COVERAGE_REPORT_PATH} + DEPENDS ${COVERAGE_FASTCOV_BIN} ${gcdaInitTargets} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Distributed proccessing of coverage data collection and report generation" ) add_custom_target(coverage) @@ -228,27 +222,16 @@ function(enable_code_coverage) add_custom_command( OUTPUT ${LCOV_REPORT_PATH} COMMAND - ${COVERAGE_FASTCOV_BIN} - --gcov ${GCOV_BIN} - #--exclude ${CMAKE_CURRENT_BINARY_DIR} - --include ${PROJECT_SOURCE_DIR} - --lcov - --verbose - -o ${LCOV_REPORT_PATH} - DEPENDS - ${COVERAGE_FASTCOV_BIN} - ${LCOV_BIN} - ${allGcovDataFiles} - # Missing source file (*.cpp and *.gcda) dependencies. - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - COMMENT - "Distributed proccessing of coverage data collection and lcov report generation" + ${COVERAGE_FASTCOV_BIN} --gcov ${GCOV_BIN} + # --exclude ${CMAKE_CURRENT_BINARY_DIR} + --include ${PROJECT_SOURCE_DIR} --lcov --verbose -o ${LCOV_REPORT_PATH} + DEPENDS ${COVERAGE_FASTCOV_BIN} ${LCOV_BIN} ${allGcovDataFiles} + # Missing source file (*.cpp and *.gcda) dependencies. + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Distributed proccessing of coverage data collection and lcov report generation" ) - add_custom_target(coverage-lcov-info - DEPENDS ${LCOV_REPORT_PATH} - ) + add_custom_target(coverage-lcov-info DEPENDS ${LCOV_REPORT_PATH}) add_custom_command( OUTPUT ${LCOV_HTML_PATH}/index.html @@ -258,30 +241,19 @@ function(enable_code_coverage) COMMENT "Generating lcov html report" ) - add_custom_target(coverage-lcov - DEPENDS ${LCOV_HTML_PATH}/index.html - ) + add_custom_target(coverage-lcov DEPENDS ${LCOV_HTML_PATH}/index.html) add_dependencies(coverage-lcov coverage-lcov-info) add_custom_command( OUTPUT ${COBERTURA_REPORT_PATH} - COMMAND - ${COVERAGE_LCOV_TO_COBERTURA_BIN} ${LCOV_REPORT_PATH} - --base-dir ${PROJECT_SOURCE_DIR} - --output ${COBERTURA_REPORT_PATH} - --demangle - DEPENDS - ${LCOV_REPORT_PATH} - ${COVERAGE_LCOV_TO_COBERTURA_BIN} - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR} - COMMENT - "Generate Cobertura XML report from LCov report" + COMMAND ${COVERAGE_LCOV_TO_COBERTURA_BIN} ${LCOV_REPORT_PATH} --base-dir ${PROJECT_SOURCE_DIR} --output + ${COBERTURA_REPORT_PATH} --demangle + DEPENDS ${LCOV_REPORT_PATH} ${COVERAGE_LCOV_TO_COBERTURA_BIN} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generate Cobertura XML report from LCov report" ) - add_custom_target(coverage-cobertura - DEPENDS ${COBERTURA_REPORT_PATH} - ) + add_custom_target(coverage-cobertura DEPENDS ${COBERTURA_REPORT_PATH}) endfunction() diff --git a/cmake/morpheus_add_executable.cmake b/cmake/morpheus_add_executable.cmake index 98aabf1c1..6910f7d3c 100644 --- a/cmake/morpheus_add_executable.cmake +++ b/cmake/morpheus_add_executable.cmake @@ -51,31 +51,29 @@ function(morpheus_add_executable) set(oneValueArgs NAME ALIAS FOLDER) set(multiValueArgs) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT MORPHEUS_NAME) + if(NOT MORPHEUS_NAME) message(FATAL_ERROR "NAME parameter must be supplied") endif() add_executable(${MORPHEUS_NAME}) - if (MORPHEUS_ALIAS) + if(MORPHEUS_ALIAS) add_executable(${MORPHEUS_ALIAS} ALIAS ${MORPHEUS_NAME}) endif() - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + set_target_properties( + ${MORPHEUS_NAME} + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) - if (MORPHEUS_FOLDER) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - FOLDER ${MORPHEUS_FOLDER} - ) + if(MORPHEUS_FOLDER) + set_target_properties(${MORPHEUS_NAME} PROPERTIES FOLDER ${MORPHEUS_FOLDER}) endif() - install(TARGETS ${MORPHEUS_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + install( + TARGETS ${MORPHEUS_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endfunction() diff --git a/cmake/morpheus_add_library.cmake b/cmake/morpheus_add_library.cmake index 4d840fd9e..02e9b5292 100644 --- a/cmake/morpheus_add_library.cmake +++ b/cmake/morpheus_add_library.cmake @@ -54,10 +54,10 @@ function(morpheus_add_library) set(oneValueArgs NAME ALIAS FOLDER) set(multiValueArgs) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT MORPHEUS_NAME) + if(NOT MORPHEUS_NAME) message(FATAL_ERROR "NAME parameter must be supplied") endif() - if (NOT MORPHEUS_ALIAS) + if(NOT MORPHEUS_ALIAS) message(FATAL_ERROR "ALIAS parameter must be supplied") endif() diff --git a/cmake/morpheus_add_target.cmake b/cmake/morpheus_add_target.cmake index 8393f8f8b..ee2bc5ad1 100644 --- a/cmake/morpheus_add_target.cmake +++ b/cmake/morpheus_add_target.cmake @@ -17,7 +17,6 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR include_guard(GLOBAL) - #[=======================================================================[.rst: morpheus_add_target ------------------ @@ -62,7 +61,7 @@ function(morpheus_add_target) set(multiValueArgs) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT MORPHEUS_TYPE) + if(NOT MORPHEUS_TYPE) message(FATAL_ERROR "TYPE parameter must be supplied") else() set(VALID_TARGET_TYPES library executable) @@ -71,23 +70,23 @@ function(morpheus_add_target) message(FATAL_ERROR "TYPE must be one of <${VALID_TARGET_TYPES}>") endif() endif() - if (NOT MORPHEUS_NAME) + if(NOT MORPHEUS_NAME) message(FATAL_ERROR "NAME parameter must be supplied") endif() - if (NOT MORPHEUS_ALIAS AND MORPHEUS_TYPE STREQUAL library) + if(NOT MORPHEUS_ALIAS AND MORPHEUS_TYPE STREQUAL library) message(FATAL_ERROR "ALIAS parameter must be supplied for library targets") endif() - if (NOT MORPHEUS_INFERFACE AND NOT MORPHEUS_TYPE STREQUAL library) + if(NOT MORPHEUS_INFERFACE AND NOT MORPHEUS_TYPE STREQUAL library) message(FATAL_ERROR "INFERFACE parameter can only be used with library targets") endif() - if (MORPHEUS_TYPE STREQUAL executable) + if(MORPHEUS_TYPE STREQUAL executable) add_executable(${MORPHEUS_NAME}) - if (MORPHEUS_ALIAS) + if(MORPHEUS_ALIAS) add_executable(${MORPHEUS_ALIAS} ALIAS ${MORPHEUS_NAME}) endif() else() - if (NOT MORPHEUS_INFERFACE) + if(NOT MORPHEUS_INFERFACE) add_library(${MORPHEUS_NAME}) else() add_library(${MORPHEUS_NAME} INTERFACE) @@ -95,10 +94,7 @@ function(morpheus_add_target) add_library(${MORPHEUS_ALIAS} ALIAS ${MORPHEUS_NAME}) endif() - morpheus_add_target_properties( - NAME ${MORPHEUS_NAME} - FOLDER ${MORPHEUS_FOLDER} - ) + morpheus_add_target_properties(NAME ${MORPHEUS_NAME} FOLDER ${MORPHEUS_FOLDER}) endfunction() #[=======================================================================[.rst: @@ -132,23 +128,21 @@ function(morpheus_add_target_properties) set(multiValueArgs) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + set_target_properties( + ${MORPHEUS_NAME} + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) - if (MORPHEUS_FOLDER) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - FOLDER ${MORPHEUS_FOLDER} - ) + if(MORPHEUS_FOLDER) + set_target_properties(${MORPHEUS_NAME} PROPERTIES FOLDER ${MORPHEUS_FOLDER}) endif() - install(TARGETS ${MORPHEUS_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + install( + TARGETS ${MORPHEUS_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endfunction() diff --git a/cmake/morpheus_add_testing_library.cmake b/cmake/morpheus_add_testing_library.cmake index d7d90ddd3..c026c2643 100644 --- a/cmake/morpheus_add_testing_library.cmake +++ b/cmake/morpheus_add_testing_library.cmake @@ -56,43 +56,32 @@ function(morpheus_add_testing_library) set(oneValueArgs NAME ALIAS FOLDER) set(multiValueArgs) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT MORPHEUS_NAME) + if(NOT MORPHEUS_NAME) message(FATAL_ERROR "NAME parameter must be supplied") endif() - if (NOT MORPHEUS_ALIAS) + if(NOT MORPHEUS_ALIAS) message(FATAL_ERROR "ALIAS parameter must be supplied") endif() - if (NOT MORPHEUS_INFERFACE) + if(NOT MORPHEUS_INFERFACE) add_library(${MORPHEUS_NAME}) - target_link_libraries(${MORPHEUS_NAME} - PUBLIC - Catch2::Catch2 - GTest::gmock - ) + target_link_libraries(${MORPHEUS_NAME} PUBLIC Catch2::Catch2 GTest::gmock) else() add_library(${MORPHEUS_NAME} INTERFACE) - target_link_libraries(${MORPHEUS_NAME} - INTERFACE - Catch2::Catch2 - GTest::gmock - ) + target_link_libraries(${MORPHEUS_NAME} INTERFACE Catch2::Catch2 GTest::gmock) endif() add_library(${MORPHEUS_ALIAS} ALIAS ${MORPHEUS_NAME}) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + set_target_properties( + ${MORPHEUS_NAME} + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) - if (MORPHEUS_FOLDER) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - FOLDER ${MORPHEUS_FOLDER} - ) + if(MORPHEUS_FOLDER) + set_target_properties(${MORPHEUS_NAME} PROPERTIES FOLDER ${MORPHEUS_FOLDER}) endif() endfunction() diff --git a/cmake/morpheus_add_tests.cmake b/cmake/morpheus_add_tests.cmake index 96c428f32..751892185 100644 --- a/cmake/morpheus_add_tests.cmake +++ b/cmake/morpheus_add_tests.cmake @@ -58,48 +58,42 @@ function(morpheus_add_tests) set(oneValueArgs NAME ALIAS FOLDER) set(multiValueArgs LABELS) cmake_parse_arguments(MORPHEUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT MORPHEUS_NAME) + if(NOT MORPHEUS_NAME) message(FATAL_ERROR "NAME parameter must be supplied") endif() add_executable(${MORPHEUS_NAME}) - if (MORPHEUS_ALIAS) + if(MORPHEUS_ALIAS) add_executable(${MORPHEUS_ALIAS} ALIAS ${MORPHEUS_NAME}) endif() - #find_package(Catch2 3 REQUIRED HINTS ${Catch2_DIR}) - target_link_libraries(${MORPHEUS_NAME} - PRIVATE - Catch2::Catch2 - morpheus::core::testing - ) + # find_package(Catch2 3 REQUIRED HINTS ${Catch2_DIR}) + target_link_libraries(${MORPHEUS_NAME} PRIVATE Catch2::Catch2 morpheus::core::testing) - configure_file(${PROJECT_SOURCE_DIR}/libraries/core/testing/morpheus/catch2/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp @ONLY) - target_sources(${MORPHEUS_NAME} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/main.cpp + configure_file( + ${PROJECT_SOURCE_DIR}/libraries/core/testing/morpheus/catch2/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp + @ONLY ) + target_sources(${MORPHEUS_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/main.cpp) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + set_target_properties( + ${MORPHEUS_NAME} + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) add_test( NAME ${MORPHEUS_NAME} COMMAND ${MORPHEUS_NAME} - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ) - if (MORPHEUS_FOLDER) - set_target_properties(${MORPHEUS_NAME} - PROPERTIES - FOLDER ${MORPHEUS_FOLDER} - ) + if(MORPHEUS_FOLDER) + set_target_properties(${MORPHEUS_NAME} PROPERTIES FOLDER ${MORPHEUS_FOLDER}) endif() - if (MORPHEUS_LABELS) + if(MORPHEUS_LABELS) set_property(TEST ${MORPHEUS_NAME} PROPERTY LABELS ${MORPHEUS_LABELS}) endif() diff --git a/cmake/sanitisers.cmake b/cmake/sanitisers.cmake index 7d3e06968..38bc68d28 100644 --- a/cmake/sanitisers.cmake +++ b/cmake/sanitisers.cmake @@ -24,24 +24,38 @@ option(ENABLE_MEMORY_SANITIZER "Enable MemorySanitizer for sanitized targets." O option(ENABLE_THREAD_SANITIZER "Enable ThreadSanitizer for sanitized targets." OFF) option(ENABLE_UNDEFINED_BEHAVIOUR_SANITIZER "Enable UndefineBehaviourSanitizer for sanitized targets." OFF) -if(NOT (ENABLE_ADDRESS_SANITIZER OR ENABLE_MEMORY_SANITIZER OR ENABLE_THREAD_SANITIZER OR ENABLE_UNDEFINED_BEHAVIOUR_SANITIZER)) +if(NOT + (ENABLE_ADDRESS_SANITIZER + OR ENABLE_MEMORY_SANITIZER + OR ENABLE_THREAD_SANITIZER + OR ENABLE_UNDEFINED_BEHAVIOUR_SANITIZER) +) return() endif() -FetchContent_Declare( - sanitizers - GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake -) +FetchContent_Declare(sanitizers GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake) FetchContent_GetProperties(sanitizers) if(NOT sanitizers_POPULATED) FetchContent_Populate(sanitizers) list(APPEND CMAKE_MODULE_PATH ${sanitizers_SOURCE_DIR}/cmake) endif() -set(SANITIZE_ADDRESS ${ENABLE_ADDRESS_SANITIZER} CACHE BOOL "Enable AddressSanitizer for sanitized targets." FORCE) -set(SANITIZE_MEMORY ${ENABLE_MEMORY_SANITIZER} CACHE BOOL "Enable MemorySanitizer for sanitized targets." FORCE) -set(SANITIZE_THREAD ${ENABLE_THREAD_SANITIZER} CACHE BOOL "Enable ThreadSanitizer for sanitized targets." FORCE) -set(SANITIZE_UNDEFINED ${ENABLE_UNDEFINED_BEHAVIOUR_SANITIZER} CACHE BOOL "Enable UndefinedBehaviorSanitizer for sanitized targets." FORCE) +set(SANITIZE_ADDRESS + ${ENABLE_ADDRESS_SANITIZER} + CACHE BOOL "Enable AddressSanitizer for sanitized targets." FORCE +) +set(SANITIZE_MEMORY + ${ENABLE_MEMORY_SANITIZER} + CACHE BOOL "Enable MemorySanitizer for sanitized targets." FORCE +) +set(SANITIZE_THREAD + ${ENABLE_THREAD_SANITIZER} + CACHE BOOL "Enable ThreadSanitizer for sanitized targets." FORCE +) +set(SANITIZE_UNDEFINED + ${ENABLE_UNDEFINED_BEHAVIOUR_SANITIZER} + CACHE BOOL "Enable UndefinedBehaviorSanitizer for sanitized targets." FORCE +) find_package(Sanitizers) targets_get_all(RESULT allTargets DIRECTORY ${PROJECT_SOURCE_DIR}) diff --git a/cmake/targets.cmake b/cmake/targets.cmake index 417ff696b..8312c5fe6 100644 --- a/cmake/targets.cmake +++ b/cmake/targets.cmake @@ -32,22 +32,29 @@ function(targets_get_all) set(options) set(oneValueArgs RESULT DIRECTORY) set(multiValueArgs) - cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT ARGS_RESULT) + if(NOT ARGS_RESULT) message(FATAL_ERROR "RESULT parameter must be supplied") endif() - if (NOT ARGS_DIRECTORY) + if(NOT ARGS_DIRECTORY) message(FATAL_ERROR "DIRECTORY parameter must be supplied") endif() - get_property(subdirs DIRECTORY ${ARGS_DIRECTORY} PROPERTY SUBDIRECTORIES) + get_property( + subdirs + DIRECTORY ${ARGS_DIRECTORY} + PROPERTY SUBDIRECTORIES + ) foreach(subdir IN LISTS subdirs) targets_get_all(RESULT subTargets DIRECTORY ${subdir}) endforeach() get_directory_property(allTargets DIRECTORY ${ARGS_DIRECTORY} BUILDSYSTEM_TARGETS) - set(${ARGS_RESULT} ${subTargets} ${allTargets} PARENT_SCOPE) + set(${ARGS_RESULT} + ${subTargets} ${allTargets} + PARENT_SCOPE + ) endfunction() #[=======================================================================[.rst: @@ -65,34 +72,36 @@ function(targets_filter_for_sources) set(options) set(oneValueArgs RESULT) set(multiValueArgs TARGETS) - cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT ARGS_TARGETS) + if(NOT ARGS_TARGETS) message(FATAL_ERROR "TARGETS parameter must be supplied") endif() - if (NOT ARGS_RESULT) + if(NOT ARGS_RESULT) message(FATAL_ERROR "RESULT parameter must be supplied") endif() foreach(target IN LISTS ARGS_TARGETS) get_target_property(targetSource ${target} SOURCES) - if (NOT targetSource) + if(NOT targetSource) continue() endif() # Interface targets can propagate sources in cmake 3.19 onward but not compile directly get_target_property(targetType ${target} TYPE) - if (targetType STREQUAL "INTERFACE_LIBRARY") + if(targetType STREQUAL "INTERFACE_LIBRARY") continue() endif() list(APPEND targets ${target}) endforeach() - set(${ARGS_RESULT} ${${ARGS_RESULT}} ${targets} PARENT_SCOPE) + set(${ARGS_RESULT} + ${${ARGS_RESULT}} ${targets} + PARENT_SCOPE + ) endfunction() - #[=======================================================================[.rst: targets_get_translation_units ------------------ @@ -116,18 +125,19 @@ function(targets_get_translation_units) set(options) set(oneValueArgs TARGET RESULT) set(multiValueArgs) - cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT ARGS_TARGET) + if(NOT ARGS_TARGET) message(FATAL_ERROR "TARGET parameter must be supplied") endif() - if (NOT ARGS_RESULT) + if(NOT ARGS_RESULT) message(FATAL_ERROR "RESULT parameter must be supplied") endif() get_target_property(targetSource ${ARGS_TARGET} SOURCES) - # CMAKE_CXX_SOURCE_FILE_EXTENSIONS defined in: https://github.com/Kitware/CMake/blob/master/Modules/CMakeCXXCompiler.cmake.in + # CMAKE_CXX_SOURCE_FILE_EXTENSIONS defined in: + # https://github.com/Kitware/CMake/blob/master/Modules/CMakeCXXCompiler.cmake.in foreach(cppExt IN LISTS CMAKE_CXX_SOURCE_FILE_EXTENSIONS) # Filter on a copy of the oringal source list set(filteredTargetSource "${targetSource}") @@ -144,11 +154,13 @@ function(targets_get_translation_units) list(APPEND targetTranslationUnitLocations ${translationUnitLocation}) endforeach() - set(${ARGS_RESULT} ${targetTranslationUnitLocations} PARENT_SCOPE) + set(${ARGS_RESULT} + ${targetTranslationUnitLocations} + PARENT_SCOPE + ) endfunction() - #[=======================================================================[.rst: targets_relative_path_of_source ------------------ @@ -157,16 +169,16 @@ Overview ^^^^^^^^ #]=======================================================================] -function (targets_relative_path_of_source) +function(targets_relative_path_of_source) set(options) set(oneValueArgs TARGET_NAME RESULT SOURCE_FILE) set(multiValueArgs) - cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT ARGS_TARGET_NAME) + if(NOT ARGS_TARGET_NAME) message(FATAL_ERROR "TARGET_NAME parameter must be supplied") endif() - if (NOT ARGS_RESULT) + if(NOT ARGS_RESULT) message(FATAL_ERROR "RESULT parameter must be supplied") endif() @@ -183,5 +195,8 @@ function (targets_relative_path_of_source) # get the right path for file string(REPLACE ".." "__" PATH "${file}") - set(${ARGS_RESULT} "${PATH}" PARENT_SCOPE) + set(${ARGS_RESULT} + "${PATH}" + PARENT_SCOPE + ) endfunction() diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 2effb0bef..510f516f4 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -2,11 +2,10 @@ include_guard(GLOBAL) include(FetchContent) -#if(MORPHEUS_ENABLE_TESTS) - find_package(Catch2 3 REQUIRED) - find_package(GTest REQUIRED) - #find_package(rapidcheck REQUIRED) -#endif(MORPHEUS_ENABLE_TESTS) +# if(MORPHEUS_ENABLE_TESTS) +find_package(Catch2 3 REQUIRED) +find_package(GTest REQUIRED) +# find_package(rapidcheck REQUIRED) endif(MORPHEUS_ENABLE_TESTS) find_package(Boost REQUIRED) find_package(ctre REQUIRED) @@ -19,13 +18,14 @@ if(WIN32) find_package(wil REQUIRED) endif(WIN32) -if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") +if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") find_package(date REQUIRED) -endif (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") +endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") #[[FetchContent_Declare( libunifex GIT_REPOSITORY git@github.com:facebookexperimental/libunifex.git GIT_TAG main ) -FetchContent_MakeAvailable(libunifex)]]# +FetchContent_MakeAvailable(libunifex)]] +# diff --git a/cmake/virtualenv.cmake b/cmake/virtualenv.cmake index c1f1eea83..e3233f41d 100644 --- a/cmake/virtualenv.cmake +++ b/cmake/virtualenv.cmake @@ -67,21 +67,21 @@ function(virtualenv_create) set(oneValueArgs DESTINATION REQUIREMENTS WORKING_DIRECTORY) set(multiValueArgs OUTPUT EXTRA_ARGS) - cmake_parse_arguments(PYTHON_VENV "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(PYTHON_VENV "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT PYTHON_VENV_DESTINATION) + if(NOT PYTHON_VENV_DESTINATION) message(FATAL_ERROR "DESTINATION parameter must be supplied") endif() - if (NOT PYTHON_VENV_REQUIREMENTS) + if(NOT PYTHON_VENV_REQUIREMENTS) message(FATAL_ERROR "REQUIREMENTS parameter must be supplied") endif() - if (NOT PYTHON_VENV_WORKING_DIRECTORY) + if(NOT PYTHON_VENV_WORKING_DIRECTORY) message(FATAL_ERROR "WORKING_DIRECTORY parameter must be supplied") endif() - if (NOT EXISTS ${PYTHON_VENV_REQUIREMENTS}) + if(NOT EXISTS ${PYTHON_VENV_REQUIREMENTS}) message(FATAL_ERROR "REQUIREMENTS must exist, invalid path: ${PYTHON_VENV_REQUIREMENTS}") endif() @@ -91,10 +91,9 @@ function(virtualenv_create) OUTPUT ${PYTHON_VENV_INTERPRETER} COMMAND ${Python3_EXECUTABLE} -m venv ${PYTHON_VENV_DESTINATION} COMMAND ${PYTHON_VENV_INTERPRETER} -m pip install --upgrade pip - COMMAND ${PYTHON_VENV_INTERPRETER} -m pip install -r ${PYTHON_VENV_REQUIREMENTS} + COMMAND ${PYTHON_VENV_INTERPRETER} -m pip install -r ${PYTHON_VENV_REQUIREMENTS} WORKING_DIRECTORY ${PYTHON_VENV_WORKING_DIRECTORY} - OUTPUT ${PYTHON_VENV_OUTPUT} - ${PYTHON_VENV_EXTRA_ARGS} + OUTPUT ${PYTHON_VENV_OUTPUT} ${PYTHON_VENV_EXTRA_ARGS} ) endfunction() diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake index bfadd9f8c..45d87288c 100644 --- a/cmake/warnings.cmake +++ b/cmake/warnings.cmake @@ -17,9 +17,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR include_guard(GLOBAL) -set(MSVC_WARNINGS - /permissive- # standards conformance. - /W4 # Level 1, 2, 3 and 4 warnings. +set(MSVC_WARNINGS /permissive- # standards conformance. + /W4 # Level 1, 2, 3 and 4 warnings. ) set(GCC_CLANG_COMPATIBLE_WARNINGS @@ -34,11 +33,8 @@ set(GCC_CLANG_COMPATIBLE_WARNINGS -Wshadow # Warning of a variabled shadows the declation of one from the parent context. ) -set(GCC_WARNINGS - ${GCC_CLANG_COMPATIBLE_WARNINGS} -) +set(GCC_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS}) -set(CLANG_WARNINGS - ${GCC_CLANG_COMPATIBLE_WARNINGS} - -Wextra-semi-stmt # warn about empty expression statements, for example extra ; like this: puts("string");; +set(CLANG_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS} -Wextra-semi-stmt # warn about empty expression statements, for + # example extra ; like this: puts("string");; ) From d0c9c6697d03aae98e52d989ac8c3977fb05f9b6 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 22 Oct 2023 12:04:35 +0100 Subject: [PATCH 9/9] Further formatting --- .cmake-format.yaml | 20 ++----- examples/gfx/CMakeLists.txt | 2 +- examples/gfx/render_triangle/CMakeLists.txt | 13 +---- libraries/application/src/CMakeLists.txt | 25 +++----- .../src/morpheus/application/CMakeLists.txt | 11 ++-- .../morpheus/application/po/CMakeLists.txt | 15 ++--- .../po/adapters/boost/CMakeLists.txt | 6 +- .../po/adapters/std/CMakeLists.txt | 6 +- libraries/application/tests/CMakeLists.txt | 16 +---- libraries/application/tests/po/CMakeLists.txt | 6 +- .../tests/po/adapters/boost/CMakeLists.txt | 5 +- .../tests/po/adapters/std/CMakeLists.txt | 6 +- libraries/core/src/CMakeLists.txt | 58 +++++++------------ .../core/src/morpheus/core/CMakeLists.txt | 15 ++--- .../src/morpheus/core/base/CMakeLists.txt | 40 ++++++------- .../morpheus/core/concurrency/CMakeLists.txt | 5 +- .../morpheus/core/conformance/CMakeLists.txt | 31 ++++------ .../morpheus/core/conversion/CMakeLists.txt | 5 +- .../morpheus/core/functional/CMakeLists.txt | 6 +- .../src/morpheus/core/memory/CMakeLists.txt | 8 +-- .../core/serialisation/CMakeLists.txt | 40 ++++++------- 21 files changed, 107 insertions(+), 232 deletions(-) diff --git a/.cmake-format.yaml b/.cmake-format.yaml index ac090cbcc..e4f5bca3e 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -58,31 +58,23 @@ format: line_width: 120 tab_size: 4 use_tabchars: false -# _help_fractional_tab_policy: -# - If is True, then the value of this variable -# - indicates how fractional indentions are handled during -# - whitespace replacement. If set to 'use-space', fractional -# - indentation is left as spaces (utf-8 0x20). If set to -# - '`round-up` fractional indentation is replaced with a single' -# - tab character (utf-8 0x09) effectively shifting the column -# - to the next tabstop fractional_tab_policy: use-space # _help_max_subgroups_hwrap: # - If an argument group contains more than this many sub-groups # - (parg or kwarg groups) then force it to a vertical layout. -# max_subgroups_hwrap: 2 +# max_subgroups_hwrap: 1 # _help_max_pargs_hwrap: # - If a positional argument group contains more than this many # - arguments, then force it to a vertical layout. -# max_pargs_hwrap: 6 +# max_pargs_hwrap: 1 # _help_max_rows_cmdline: # - If a cmdline positional group consumes more than this many # - lines without nesting, then invalidate the layout (and nest) -# max_rows_cmdline: 2 + max_rows_cmdline: 2 # _help_separate_ctrl_name_with_space: # - If true, separate flow control names from their parentheses # - with a space -# separate_ctrl_name_with_space: false + separate_ctrl_name_with_space: false # _help_separate_fn_name_with_space: # - If true, separate function names from parentheses with a # - space @@ -122,11 +114,11 @@ format: # _help_enable_sort: # - If true, the argument lists which are known to be sortable # - will be sorted lexicographicall -# enable_sort: true + enable_sort: true # _help_autosort: # - If true, the parsers may infer whether or not an argument # - list is sortable (without annotation). -# autosort: false + autosort: true # _help_require_valid_layout: # - By default, if cmake-format cannot successfully fit # - everything into the desired linewidth it will apply the diff --git a/examples/gfx/CMakeLists.txt b/examples/gfx/CMakeLists.txt index 5132dab67..4962309b6 100644 --- a/examples/gfx/CMakeLists.txt +++ b/examples/gfx/CMakeLists.txt @@ -1,5 +1,5 @@ if(WIN32) -add_subdirectory(render_triangle) + add_subdirectory(render_triangle) endif(WIN32) diff --git a/examples/gfx/render_triangle/CMakeLists.txt b/examples/gfx/render_triangle/CMakeLists.txt index 629ba15d6..f81638c8c 100644 --- a/examples/gfx/render_triangle/CMakeLists.txt +++ b/examples/gfx/render_triangle/CMakeLists.txt @@ -1,14 +1,5 @@ add_executable(RenderTriangle main.cpp) -target_link_libraries(RenderTriangle - PRIVATE - morpheus::application - morpheus::gfx::platform - morpheus::gfx::gl4 -) +target_link_libraries(RenderTriangle PRIVATE morpheus::application morpheus::gfx::platform morpheus::gfx::gl4) -set_target_properties(RenderTriangle - PROPERTIES - FOLDER Examples/Gfx - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin -) +set_target_properties(RenderTriangle PROPERTIES FOLDER Examples/Gfx RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/libraries/application/src/CMakeLists.txt b/libraries/application/src/CMakeLists.txt index 25e61c65f..24225db87 100644 --- a/libraries/application/src/CMakeLists.txt +++ b/libraries/application/src/CMakeLists.txt @@ -4,27 +4,16 @@ morpheus_add_library( FOLDER "Libraries/Application" ) -target_include_directories(MorpheusApplication - PUBLIC - $ - $ +target_include_directories( + MorpheusApplication PUBLIC $ + $ ) -#target_include_directories(MorpheusApplication -# PUBLIC -# $ -# $ -# $ -#) +# target_include_directories(MorpheusApplication PUBLIC $ +# $ $ ) -target_link_libraries(MorpheusApplication - PUBLIC - morpheus::core -) +target_link_libraries(MorpheusApplication PUBLIC morpheus::core) -set_target_properties(MorpheusApplication - PROPERTIES - WINDOWS_EXPORT_ALL_SYMBOLS TRUE -) +set_target_properties(MorpheusApplication PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) add_subdirectory(morpheus/application) diff --git a/libraries/application/src/morpheus/application/CMakeLists.txt b/libraries/application/src/morpheus/application/CMakeLists.txt index cc6904de5..c67c95eec 100644 --- a/libraries/application/src/morpheus/application/CMakeLists.txt +++ b/libraries/application/src/morpheus/application/CMakeLists.txt @@ -1,10 +1,7 @@ -target_sources(MorpheusApplication - PUBLIC - application.hpp - try_catch.hpp - version.hpp - PRIVATE - application.cpp +target_sources( + MorpheusApplication + PUBLIC application.hpp try_catch.hpp version.hpp + PRIVATE application.cpp ) add_subdirectory(po) diff --git a/libraries/application/src/morpheus/application/po/CMakeLists.txt b/libraries/application/src/morpheus/application/po/CMakeLists.txt index cdf01c0aa..b6087dd42 100644 --- a/libraries/application/src/morpheus/application/po/CMakeLists.txt +++ b/libraries/application/src/morpheus/application/po/CMakeLists.txt @@ -1,12 +1,7 @@ -target_sources(MorpheusApplication - PUBLIC - config.hpp - options.hpp - PRIVATE - config.cpp +target_sources( + MorpheusApplication + PUBLIC config.hpp options.hpp + PRIVATE config.cpp ) -target_link_libraries(MorpheusApplication - PUBLIC - Boost::program_options -) +target_link_libraries(MorpheusApplication PUBLIC Boost::program_options) diff --git a/libraries/application/src/morpheus/application/po/adapters/boost/CMakeLists.txt b/libraries/application/src/morpheus/application/po/adapters/boost/CMakeLists.txt index db92fd081..4aeab4d68 100644 --- a/libraries/application/src/morpheus/application/po/adapters/boost/CMakeLists.txt +++ b/libraries/application/src/morpheus/application/po/adapters/boost/CMakeLists.txt @@ -1,5 +1 @@ -target_sources(MorpheusApplication - PUBLIC - asio.hpp - log.hpp -) +target_sources(MorpheusApplication PUBLIC asio.hpp log.hpp) diff --git a/libraries/application/src/morpheus/application/po/adapters/std/CMakeLists.txt b/libraries/application/src/morpheus/application/po/adapters/std/CMakeLists.txt index ecc7aeccb..d0a06016d 100644 --- a/libraries/application/src/morpheus/application/po/adapters/std/CMakeLists.txt +++ b/libraries/application/src/morpheus/application/po/adapters/std/CMakeLists.txt @@ -1,5 +1 @@ -target_sources(MorpheusApplication - PUBLIC - chrono.hpp - filesystem.hpp -) +target_sources(MorpheusApplication PUBLIC chrono.hpp filesystem.hpp) diff --git a/libraries/application/tests/CMakeLists.txt b/libraries/application/tests/CMakeLists.txt index 847b1bb33..cc90514d4 100644 --- a/libraries/application/tests/CMakeLists.txt +++ b/libraries/application/tests/CMakeLists.txt @@ -1,17 +1,7 @@ -morpheus_add_tests( - NAME MorpheusApplicationTests - FOLDER "Libraries/Application" -) +morpheus_add_tests(NAME MorpheusApplicationTests FOLDER "Libraries/Application") -target_sources(MorpheusApplicationTests - PRIVATE - application.tests.cpp -) +target_sources(MorpheusApplicationTests PRIVATE application.tests.cpp) -target_link_libraries(MorpheusApplicationTests - PRIVATE - MorpheusCore - morpheus::application -) +target_link_libraries(MorpheusApplicationTests PRIVATE MorpheusCore morpheus::application) add_subdirectory(po) diff --git a/libraries/application/tests/po/CMakeLists.txt b/libraries/application/tests/po/CMakeLists.txt index 3c8c0ddbe..56b16b9da 100644 --- a/libraries/application/tests/po/CMakeLists.txt +++ b/libraries/application/tests/po/CMakeLists.txt @@ -1,7 +1,3 @@ -target_sources(MorpheusApplicationTests - PRIVATE - config.tests.cpp - options.tests.cpp -) +target_sources(MorpheusApplicationTests PRIVATE config.tests.cpp options.tests.cpp) add_subdirectory(adapters) diff --git a/libraries/application/tests/po/adapters/boost/CMakeLists.txt b/libraries/application/tests/po/adapters/boost/CMakeLists.txt index fe223bdce..f493e2754 100644 --- a/libraries/application/tests/po/adapters/boost/CMakeLists.txt +++ b/libraries/application/tests/po/adapters/boost/CMakeLists.txt @@ -1,4 +1 @@ -target_sources(MorpheusApplicationTests - PRIVATE - log.tests.cpp -) +target_sources(MorpheusApplicationTests PRIVATE log.tests.cpp) diff --git a/libraries/application/tests/po/adapters/std/CMakeLists.txt b/libraries/application/tests/po/adapters/std/CMakeLists.txt index 96cf44640..9f0b5f832 100644 --- a/libraries/application/tests/po/adapters/std/CMakeLists.txt +++ b/libraries/application/tests/po/adapters/std/CMakeLists.txt @@ -1,5 +1 @@ -target_sources(MorpheusApplicationTests - PRIVATE - chrono.tests.cpp - filesystem.tests.cpp -) +target_sources(MorpheusApplicationTests PRIVATE chrono.tests.cpp filesystem.tests.cpp) diff --git a/libraries/core/src/CMakeLists.txt b/libraries/core/src/CMakeLists.txt index 608f8189a..2cfe49189 100644 --- a/libraries/core/src/CMakeLists.txt +++ b/libraries/core/src/CMakeLists.txt @@ -4,34 +4,20 @@ morpheus_add_library( FOLDER "Libraries/Core" ) -target_include_directories(MorpheusCore - PUBLIC - $ - $ - $ +target_include_directories( + MorpheusCore PUBLIC $ $ + $ ) -target_link_libraries(MorpheusCore - PUBLIC - morpheus::config - Boost::headers - Boost::log - ctre::ctre - magic_enum::magic_enum -) +target_link_libraries(MorpheusCore PUBLIC morpheus::config Boost::headers Boost::log ctre::ctre magic_enum::magic_enum) add_subdirectory(morpheus/core) -#target_compile_definitions(MorpheusCore -# PUBLIC -# MORPHEUS_SHARED_BUILD=1 -# MORPHEUS_DLL_EXPORTS=1 -#) +# target_compile_definitions(MorpheusCore PUBLIC MORPHEUS_SHARED_BUILD=1 MORPHEUS_DLL_EXPORTS=1 ) -target_compile_options(MorpheusCore - PRIVATE -# -enable-hosted-libstdcxx - $<$:/wd4251> # class 'foo' needs to have dll-interface to be used by clients of class 'bar' +target_compile_options( + MorpheusCore PRIVATE $<$:/wd4251> # class 'foo' needs to have dll-interface to be used by + # clients of class 'bar' ) get_target_property(SOURCES_FILES MorpheusCore SOURCES) source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${SOURCES_FILES}) @@ -40,25 +26,21 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) include(GenerateExportHeader) generate_export_header(MorpheusCore) -configure_file(${CMAKE_CURRENT_BINARY_DIR}/morpheuscore_export.h ${CMAKE_CURRENT_BINARY_DIR}/morpheus/core/morpheuscore_export.h COPYONLY) - -install(TARGETS MorpheusCore - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/core +configure_file( + ${CMAKE_CURRENT_BINARY_DIR}/morpheuscore_export.h ${CMAKE_CURRENT_BINARY_DIR}/morpheus/core/morpheuscore_export.h + COPYONLY ) +install(TARGETS MorpheusCore PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/core) + # Hierarchically copy headers to the install dir -install ( - DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR}/morpheus/core - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/morpheus/core - FILES_MATCHING PATTERN - "*.hpp" +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/morpheus/core + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/morpheus/core + FILES_MATCHING + PATTERN "*.hpp" ) -install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/morpheus/core/morpheuscore_export.h - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/morpheus/core/ +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/morpheus/core/morpheuscore_export.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/morpheus/core/ ) diff --git a/libraries/core/src/morpheus/core/CMakeLists.txt b/libraries/core/src/morpheus/core/CMakeLists.txt index 12f4a7ceb..d0044f0d2 100644 --- a/libraries/core/src/morpheus/core/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/CMakeLists.txt @@ -1,14 +1,7 @@ -target_sources(MorpheusCore - PUBLIC - cpu.hpp - game/game.hpp - world/world_model.hpp - visualisation/visualisation.hpp - PRIVATE - cpu.cpp - game/game.cpp - world/world_model.cpp - visualisation/visualisation.cpp +target_sources( + MorpheusCore + PUBLIC cpu.hpp game/game.hpp world/world_model.hpp visualisation/visualisation.hpp + PRIVATE cpu.cpp game/game.cpp world/world_model.cpp visualisation/visualisation.cpp ) add_subdirectory(base) diff --git a/libraries/core/src/morpheus/core/base/CMakeLists.txt b/libraries/core/src/morpheus/core/base/CMakeLists.txt index 7d995d211..ee72db78d 100644 --- a/libraries/core/src/morpheus/core/base/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/base/CMakeLists.txt @@ -1,25 +1,19 @@ -target_sources(MorpheusCore - PUBLIC - architecture.hpp - assert.hpp - assert_handler.hpp - cold.hpp - compiler.hpp - debugging.hpp - exceptions.hpp - platform.hpp - prerequisites.hpp - sanitizers.hpp - scoped_action.hpp - unreachable.hpp - verify.hpp - PRIVATE - assert_handler.cpp - debugging.cpp - exceptions.cpp +target_sources( + MorpheusCore + PUBLIC architecture.hpp + assert.hpp + assert_handler.hpp + cold.hpp + compiler.hpp + debugging.hpp + exceptions.hpp + platform.hpp + prerequisites.hpp + sanitizers.hpp + scoped_action.hpp + unreachable.hpp + verify.hpp + PRIVATE assert_handler.cpp debugging.cpp exceptions.cpp ) -target_link_libraries(MorpheusCore - PRIVATE - Boost::unit_test_framework -) +target_link_libraries(MorpheusCore PRIVATE Boost::unit_test_framework) diff --git a/libraries/core/src/morpheus/core/concurrency/CMakeLists.txt b/libraries/core/src/morpheus/core/concurrency/CMakeLists.txt index 57a5cb3f4..30d3712ce 100644 --- a/libraries/core/src/morpheus/core/concurrency/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/concurrency/CMakeLists.txt @@ -1,4 +1 @@ -target_sources(MorpheusCore - PUBLIC - generator.hpp -) +target_sources(MorpheusCore PUBLIC generator.hpp) diff --git a/libraries/core/src/morpheus/core/conformance/CMakeLists.txt b/libraries/core/src/morpheus/core/conformance/CMakeLists.txt index 291f91678..f3444e6f3 100644 --- a/libraries/core/src/morpheus/core/conformance/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/conformance/CMakeLists.txt @@ -1,27 +1,20 @@ -target_sources(MorpheusCore - PUBLIC - date.hpp - format.hpp - print.hpp - ranges.hpp - source_location.hpp - version.hpp -) +target_sources(MorpheusCore PUBLIC date.hpp format.hpp print.hpp ranges.hpp source_location.hpp version.hpp) find_package(fmt REQUIRED) find_package(tl-expected REQUIRED) find_package(range-v3 REQUIRED) -target_link_libraries(MorpheusCore - PUBLIC - $<$>:date::date> # Only Visual Studio 19.26 onwards has a complete implementation: https://en.cppreference.com/w/cpp/compiler_support - $<$>:date::date-tz> - fmt::fmt - range-v3::range-v3 - tl::expected +target_link_libraries( + MorpheusCore + PUBLIC $<$>:date::date> # Only Visual Studio 19.26 onwards has a complete + # implementation: + # https://en.cppreference.com/w/cpp/compiler_support + $<$>:date::date-tz> + fmt::fmt + range-v3::range-v3 + tl::expected ) -target_compile_definitions(MorpheusCore - PUBLIC - $<$:_GNU_SOURCE=1> # Boost stacktrace requires this for MacOS. +target_compile_definitions( + MorpheusCore PUBLIC $<$:_GNU_SOURCE=1> # Boost stacktrace requires this for MacOS. ) diff --git a/libraries/core/src/morpheus/core/conversion/CMakeLists.txt b/libraries/core/src/morpheus/core/conversion/CMakeLists.txt index fadf53b6d..2d45fd8b5 100644 --- a/libraries/core/src/morpheus/core/conversion/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/conversion/CMakeLists.txt @@ -1,6 +1,3 @@ add_subdirectory(adapters) -target_sources(MorpheusCore - PUBLIC - string.hpp -) +target_sources(MorpheusCore PUBLIC string.hpp) diff --git a/libraries/core/src/morpheus/core/functional/CMakeLists.txt b/libraries/core/src/morpheus/core/functional/CMakeLists.txt index 60a3a78e0..0c4e076c9 100644 --- a/libraries/core/src/morpheus/core/functional/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/functional/CMakeLists.txt @@ -1,5 +1 @@ -target_sources(MorpheusCore - PUBLIC - function_ref.hpp - overload.hpp -) +target_sources(MorpheusCore PUBLIC function_ref.hpp overload.hpp) diff --git a/libraries/core/src/morpheus/core/memory/CMakeLists.txt b/libraries/core/src/morpheus/core/memory/CMakeLists.txt index 3c04c77f1..147d86ff2 100644 --- a/libraries/core/src/morpheus/core/memory/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/memory/CMakeLists.txt @@ -1,9 +1,3 @@ -target_sources(MorpheusCore - PUBLIC - copier_traits.hpp - default_copy.hpp - indirect_value.hpp - polymorphic_value.hpp -) +target_sources(MorpheusCore PUBLIC copier_traits.hpp default_copy.hpp indirect_value.hpp polymorphic_value.hpp) add_subdirectory(concepts) diff --git a/libraries/core/src/morpheus/core/serialisation/CMakeLists.txt b/libraries/core/src/morpheus/core/serialisation/CMakeLists.txt index 6f8061d3b..af044ec43 100644 --- a/libraries/core/src/morpheus/core/serialisation/CMakeLists.txt +++ b/libraries/core/src/morpheus/core/serialisation/CMakeLists.txt @@ -1,28 +1,22 @@ -target_sources(MorpheusCore - PUBLIC - binary_reader.hpp - binary_writer.hpp - exceptions.hpp - fundamentals.hpp - json_reader.hpp - json_writer.hpp - read_serialiser.hpp - read_serialiser_decl.hpp - serialise.hpp - serialisers.hpp - text_writer.hpp - write_serialiser.hpp - write_serialiser_decl.hpp - PRIVATE - exceptions.cpp - json_reader.cpp - json_writer.cpp +target_sources( + MorpheusCore + PUBLIC binary_reader.hpp + binary_writer.hpp + exceptions.hpp + fundamentals.hpp + json_reader.hpp + json_writer.hpp + read_serialiser.hpp + read_serialiser_decl.hpp + serialise.hpp + serialisers.hpp + text_writer.hpp + write_serialiser.hpp + write_serialiser_decl.hpp + PRIVATE exceptions.cpp json_reader.cpp json_writer.cpp ) -target_link_libraries(MorpheusCore - PUBLIC - rapidjson -) +target_link_libraries(MorpheusCore PUBLIC rapidjson) add_subdirectory(adapters) add_subdirectory(concepts)