mirror of
https://github.com/mpusz/mp-units.git
synced 2025-06-25 01:01:33 +02:00
check: run pre-commit on all files
This commit is contained in:
@ -21,9 +21,7 @@
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(mp-units-dev
|
||||
LANGUAGES CXX
|
||||
)
|
||||
project(mp-units-dev LANGUAGES CXX)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
@ -50,8 +48,7 @@ if(${projectPrefix}IWYU)
|
||||
include(include-what-you-use)
|
||||
enable_iwyu(
|
||||
MAPPING_FILE "${PROJECT_SOURCE_DIR}/.mp-units.imp"
|
||||
NO_FORWARD_DECLARATIONS
|
||||
QUOTED_INCLUDES_FIRST
|
||||
NO_FORWARD_DECLARATIONS QUOTED_INCLUDES_FIRST
|
||||
MAX_LINE_LENGTH 120
|
||||
NO_COMMENTS
|
||||
)
|
||||
|
@ -1,11 +1,7 @@
|
||||
# Look for an executable called sphinx-build
|
||||
find_program(SPHINX_EXECUTABLE
|
||||
NAMES sphinx-build
|
||||
DOC "Path to sphinx-build executable")
|
||||
find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Path to sphinx-build executable")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# Handle standard arguments to find_package like REQUIRED and QUIET
|
||||
find_package_handle_standard_args(Sphinx
|
||||
"Failed to find sphinx-build executable"
|
||||
SPHINX_EXECUTABLE)
|
||||
find_package_handle_standard_args(Sphinx "Failed to find sphinx-build executable" SPHINX_EXECUTABLE)
|
||||
|
@ -134,7 +134,7 @@ function(enable_ccache)
|
||||
endif()
|
||||
|
||||
if("${_ccache_version}" VERSION_LESS 3.3.0)
|
||||
list(APPEND _ccacheEnv CCACHE_CPP2=1) # avoids spurious warnings with some compilers for ccache older than 3.3
|
||||
list(APPEND _ccacheEnv CCACHE_CPP2=1) # avoids spurious warnings with some compilers for ccache older than 3.3
|
||||
endif()
|
||||
|
||||
if(_enable_ccache_MODE STREQUAL DIRECT_DEPEND)
|
||||
@ -188,25 +188,18 @@ function(enable_ccache)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja|Makefiles")
|
||||
foreach(_lang IN ITEMS C CXX OBJC OBJCXX CUDA)
|
||||
set(CMAKE_${_lang}_COMPILER_LAUNCHER
|
||||
${CMAKE_COMMAND} -E env
|
||||
${_ccacheEnv} ${CCACHE_PATH}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
set(CMAKE_${_lang}_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env ${_ccacheEnv} ${CCACHE_PATH} PARENT_SCOPE)
|
||||
endforeach()
|
||||
elseif(CMAKE_GENERATOR STREQUAL Xcode)
|
||||
# Each of the Xcode project variables allow specifying only a single value, but the ccache command line needs to have multiple options.
|
||||
# A separate launch script needs to be written out and the project variables pointed at them.
|
||||
foreach(_lang IN ITEMS C CXX)
|
||||
set(launch${_lang} ${CMAKE_BINARY_DIR}/launch-${_lang})
|
||||
file(WRITE ${launch${_lang}} "#!/bin/bash\n\n")
|
||||
foreach(keyVal IN LISTS _ccacheEnv)
|
||||
file(APPEND ${launch${_lang}} "export ${keyVal}\n")
|
||||
endforeach()
|
||||
file(APPEND ${launch${_lang}}
|
||||
"exec \"${CCACHE_PROGRAM}\" "
|
||||
"\"${CMAKE_${_lang}_COMPILER}\" \"$@\"\n"
|
||||
)
|
||||
set(launch${_lang} ${CMAKE_BINARY_DIR}/launch-${_lang})
|
||||
file(WRITE ${launch${_lang}} "#!/bin/bash\n\n")
|
||||
foreach(keyVal IN LISTS _ccacheEnv)
|
||||
file(APPEND ${launch${_lang}} "export ${keyVal}\n")
|
||||
endforeach()
|
||||
file(APPEND ${launch${_lang}} "exec \"${CCACHE_PROGRAM}\" " "\"${CMAKE_${_lang}_COMPILER}\" \"$@\"\n")
|
||||
execute_process(COMMAND chmod a+rx ${launch${_lang}})
|
||||
endforeach()
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC ${launchC} PARENT_SCOPE)
|
||||
|
@ -22,7 +22,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
find_package(Doxygen MODULE REQUIRED) # TODO Switch to CONFIG when Conan will start supporting imported executables in CMakeDeps
|
||||
find_package(Doxygen MODULE REQUIRED
|
||||
)# TODO Switch to CONFIG when Conan will start supporting imported executables in CMakeDeps
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
#
|
||||
@ -80,16 +81,14 @@ function(add_documentation targetName)
|
||||
set(_doxygenIndexFile "${DOXYGEN_OUTPUT_DIR}/xml/index.xml")
|
||||
|
||||
# Only regenerate Doxygen when the Doxyfile or given dependencies change
|
||||
add_custom_command(OUTPUT "${_doxygenIndexFile}"
|
||||
add_custom_command(
|
||||
OUTPUT "${_doxygenIndexFile}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}
|
||||
COMMAND Doxygen::doxygen ARGS "${_doxyfile}"
|
||||
MAIN_DEPENDENCY "${_doxyfileIn}"
|
||||
DEPENDS
|
||||
"${_doxyfile}"
|
||||
"${_args_CODE_DEPENDS}"
|
||||
DEPENDS "${_doxyfile}" "${_args_CODE_DEPENDS}"
|
||||
COMMENT "Generating doxygen XML metadata"
|
||||
USES_TERMINAL
|
||||
VERBATIM
|
||||
USES_TERMINAL VERBATIM
|
||||
)
|
||||
|
||||
set(_sphinx_docs_dir "${CMAKE_CURRENT_BINARY_DIR}/sphinx")
|
||||
@ -99,16 +98,16 @@ function(add_documentation targetName)
|
||||
# - Doxygen has rerun
|
||||
# - Our doc files have been updated
|
||||
# - The Sphinx config has been updated
|
||||
add_custom_command(OUTPUT "${_sphinx_index_file}"
|
||||
COMMAND "${SPHINX_EXECUTABLE}" ARGS -b html -j auto "-Dbreathe_projects.${_args_BREATHE_PROJECT}=${DOXYGEN_OUTPUT_DIR}/xml" "${_args_DOCS_SOURCE_DIR}" "${_sphinx_docs_dir}"
|
||||
add_custom_command(
|
||||
OUTPUT "${_sphinx_index_file}"
|
||||
COMMAND "${SPHINX_EXECUTABLE}" ARGS -b html -j auto
|
||||
"-Dbreathe_projects.${_args_BREATHE_PROJECT}=${DOXYGEN_OUTPUT_DIR}/xml" "${_args_DOCS_SOURCE_DIR}"
|
||||
"${_sphinx_docs_dir}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
MAIN_DEPENDENCY "${_args_DOCS_SOURCE_DIR}/conf.py"
|
||||
DEPENDS
|
||||
"${_doxygenIndexFile}"
|
||||
"${_args_DOCS_DEPENDS}"
|
||||
DEPENDS "${_doxygenIndexFile}" "${_args_DOCS_DEPENDS}"
|
||||
COMMENT "Generating documentation with Sphinx"
|
||||
USES_TERMINAL
|
||||
VERBATIM
|
||||
USES_TERMINAL VERBATIM
|
||||
)
|
||||
|
||||
# Custom target
|
||||
@ -118,7 +117,7 @@ function(add_documentation targetName)
|
||||
add_custom_target(${targetName} ${_all} DEPENDS "${_sphinx_index_file}")
|
||||
|
||||
if(_args_INSTALL_DIR)
|
||||
# Add an install step to install the docs
|
||||
install(DIRECTORY ${_sphinx_docs_dir} TYPE DOC)
|
||||
# Add an install step to install the docs
|
||||
install(DIRECTORY ${_sphinx_docs_dir} TYPE DOC)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -48,7 +48,17 @@ macro(_enable_iwyu_failed log_postfix)
|
||||
endmacro()
|
||||
|
||||
macro(_process_iwyu_arguments offset log_postfix)
|
||||
set(_options QUIET REQUIRED NO_DEFAULT_MAPPINGS PCH_IN_CODE TRANSITIVE_INCLUDES_ONLY NO_COMMENTS NO_FORWARD_DECLARATIONS CXX17_NAMESPACES QUOTED_INCLUDES_FIRST)
|
||||
set(_options
|
||||
QUIET
|
||||
REQUIRED
|
||||
NO_DEFAULT_MAPPINGS
|
||||
PCH_IN_CODE
|
||||
TRANSITIVE_INCLUDES_ONLY
|
||||
NO_COMMENTS
|
||||
NO_FORWARD_DECLARATIONS
|
||||
CXX17_NAMESPACES
|
||||
QUOTED_INCLUDES_FIRST
|
||||
)
|
||||
set(_one_value_args PROGRAM MAPPING_FILE MAX_LINE_LENGTH)
|
||||
set(_multi_value_args KEEP)
|
||||
cmake_parse_arguments(PARSE_ARGV ${offset} _enable_iwyu "${_options}" "${_one_value_args}" "${_multi_value_args}")
|
||||
@ -160,7 +170,5 @@ endfunction()
|
||||
#
|
||||
function(enable_target_iwyu target)
|
||||
_process_iwyu_arguments(1 " for '${target}'")
|
||||
set_target_properties(${target} PROPERTIES
|
||||
CXX_INCLUDE_WHAT_YOU_USE "${_iwyu_path};${_iwyu_args}"
|
||||
)
|
||||
set_target_properties(${target} PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${_iwyu_path};${_iwyu_args}")
|
||||
endfunction()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,9 +23,11 @@
|
||||
cmake_minimum_required(VERSION 3.4)
|
||||
|
||||
function(ensure_entry_point)
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
message(FATAL_ERROR "'${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt' is meant to be used only "
|
||||
"as a CMake entry point and should not be included from other CMake files. "
|
||||
"Include '${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt' directly instead.")
|
||||
endif()
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
message(FATAL_ERROR
|
||||
"'${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt' is meant to be used only "
|
||||
"as a CMake entry point and should not be included from other CMake files. "
|
||||
"Include '${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt' directly instead."
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -70,9 +70,7 @@ macro(_set_flags)
|
||||
-Wformat=2 # warn on security issues around functions that format output (ie printf)
|
||||
)
|
||||
|
||||
set(CLANG_WARNINGS
|
||||
${GCC_COMMON_WARNINGS}
|
||||
)
|
||||
set(CLANG_WARNINGS ${GCC_COMMON_WARNINGS})
|
||||
|
||||
set(GCC_WARNINGS
|
||||
${GCC_COMMON_WARNINGS}
|
||||
|
@ -44,17 +44,13 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/_static/img/downcast_1.png"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/_static/img/downcast_2.png"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/_static/img/units.svg"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/design.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/design/directories.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/design/downcasting.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/design/quantity.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/design/quantity_kind.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics/avg_speed.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics/box_example.rst"
|
||||
@ -66,17 +62,13 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics/hello_units.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics/total_energy.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/basics/unknown_dimension.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_representation.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_representation/linear_algebra.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_representation/measurement.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_systems.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_systems/custom_systems.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_utilities.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_utilities/conversion_factor.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter/example_1.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter/example_2.rst"
|
||||
@ -87,9 +79,7 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter/example_7.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter/example_8.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/kalman_filter/kalman.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/faq.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/arithmetics.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/basic_concepts.rst"
|
||||
@ -101,18 +91,16 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/quantity_points.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/text_output.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/units.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/genindex.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/glossary.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/index.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/introduction.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/quick_start.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/concepts.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/customization_points.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/downcasting.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/core/functions.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/core/functions.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/metafunctions.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/types.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/types/dimensions.rst"
|
||||
@ -128,26 +116,20 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/types/utilities/basic_fixed_string.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/types/utilities/basic_symbol_text.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/core/types/utilities/ratio.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/math.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/math.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/random.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/angle.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/dimensionless.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/unknown.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000/binary_prefixes.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000/modulation_rate.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000/storage_capacity.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000/traffic_intensity.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/iec80000/transfer_rate.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/acceleration.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/constants.rst"
|
||||
@ -159,7 +141,6 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/speed.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/time.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/units.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_cgs.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/length.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/acceleration.rst"
|
||||
@ -172,9 +153,7 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/pressure.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/speed.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/time.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/dimensions_and_concepts.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_fps.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/length.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/acceleration.rst"
|
||||
@ -189,19 +168,15 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/speed.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/time.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/volume.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_iau.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/iau/length.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_imperial.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/imperial/length.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_international.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/area.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/length.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/speed.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/volume.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/absorbed_dose.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/acceleration.rst"
|
||||
@ -245,15 +220,11 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/time.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/voltage.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/volume.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_typographic.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/typographic/length.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_uscs.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/uscs/length.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/references.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases/custom_representation_types.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases/extensions.rst"
|
||||
@ -262,14 +233,14 @@ set(unitsSphinxDocs
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases/linear_algebra.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases/natural_units.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/use_cases/unknown_dimensions.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/usage.rst"
|
||||
)
|
||||
|
||||
include(documentation)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_documentation(documentation ALL
|
||||
add_documentation(
|
||||
documentation ALL
|
||||
BREATHE_PROJECT mp-units
|
||||
CODE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src"
|
||||
INSTALL_DIR ${CMAKE_INSTALL_DOCDIR}
|
||||
@ -277,6 +248,7 @@ add_documentation(documentation ALL
|
||||
DOCS_DEPENDS ${unitsSphinxDocs}
|
||||
)
|
||||
|
||||
add_custom_command(TARGET documentation POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/_static/img/*.svg ${CMAKE_CURRENT_BINARY_DIR}/sphinx/_images
|
||||
add_custom_command(
|
||||
TARGET documentation POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/_static/img/*.svg
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sphinx/_images
|
||||
)
|
||||
|
@ -28,16 +28,23 @@ cmake_minimum_required(VERSION 3.2)
|
||||
function(add_example target)
|
||||
add_executable(${target}-aliases ${target}.cpp)
|
||||
target_link_libraries(${target}-aliases PRIVATE ${ARGN})
|
||||
target_compile_definitions(${target}-aliases PRIVATE
|
||||
${projectPrefix}NO_LITERALS
|
||||
${projectPrefix}NO_REFERENCES
|
||||
)
|
||||
target_compile_definitions(${target}-aliases PRIVATE ${projectPrefix}NO_LITERALS ${projectPrefix}NO_REFERENCES)
|
||||
endfunction()
|
||||
|
||||
add_example(avg_speed mp-units::core-io mp-units::si mp-units::si-cgs mp-units::si-international)
|
||||
add_example(box_example mp-units::core-fmt mp-units::si)
|
||||
add_example(capacitor_time_curve mp-units::core-io mp-units::si)
|
||||
add_example(clcpp_response mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-iau mp-units::si-imperial mp-units::si-international mp-units::si-typographic mp-units::si-uscs)
|
||||
add_example(
|
||||
clcpp_response
|
||||
mp-units::core-fmt
|
||||
mp-units::core-io
|
||||
mp-units::si
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
)
|
||||
add_example(experimental_angle mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
add_example(foot_pound_second mp-units::core-fmt mp-units::si-fps)
|
||||
add_example(measurement mp-units::core-io mp-units::si)
|
||||
@ -46,9 +53,8 @@ add_example(unknown_dimension mp-units::core-io mp-units::si)
|
||||
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
add_example(glide_computer_example mp-units::core-fmt mp-units::si-international glide_computer)
|
||||
target_compile_definitions(glide_computer_example-aliases PRIVATE
|
||||
${projectPrefix}NO_LITERALS
|
||||
${projectPrefix}NO_REFERENCES
|
||||
target_compile_definitions(
|
||||
glide_computer_example-aliases PRIVATE ${projectPrefix}NO_LITERALS ${projectPrefix}NO_REFERENCES
|
||||
)
|
||||
|
||||
find_package(wg21_linear_algebra CONFIG REQUIRED)
|
||||
|
@ -22,12 +22,6 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
add_library(glide_computer STATIC
|
||||
geographic.cpp include/geographic.h
|
||||
glide_computer.cpp include/glide_computer.h
|
||||
)
|
||||
target_link_libraries(glide_computer
|
||||
PRIVATE mp-units::core-fmt
|
||||
PUBLIC mp-units::si
|
||||
)
|
||||
add_library(glide_computer STATIC geographic.cpp include/geographic.h glide_computer.cpp include/glide_computer.h)
|
||||
target_link_libraries(glide_computer PRIVATE mp-units::core-fmt PUBLIC mp-units::si)
|
||||
target_include_directories(glide_computer PUBLIC include)
|
||||
|
@ -28,10 +28,7 @@ cmake_minimum_required(VERSION 3.2)
|
||||
function(add_example target)
|
||||
add_executable(${target} ${target}.cpp)
|
||||
target_link_libraries(${target} PRIVATE ${ARGN})
|
||||
target_compile_definitions(${target} PRIVATE
|
||||
${projectPrefix}NO_LITERALS
|
||||
${projectPrefix}NO_ALIASES
|
||||
)
|
||||
target_compile_definitions(${target} PRIVATE ${projectPrefix}NO_LITERALS ${projectPrefix}NO_ALIASES)
|
||||
endfunction()
|
||||
|
||||
add_example(kalman_filter-example_1 mp-units::core-fmt mp-units::si)
|
||||
|
@ -28,16 +28,23 @@ cmake_minimum_required(VERSION 3.2)
|
||||
function(add_example target)
|
||||
add_executable(${target}-literals ${target}.cpp)
|
||||
target_link_libraries(${target}-literals PRIVATE ${ARGN})
|
||||
target_compile_definitions(${target}-literals PRIVATE
|
||||
${projectPrefix}NO_REFERENCES
|
||||
${projectPrefix}NO_ALIASES
|
||||
)
|
||||
target_compile_definitions(${target}-literals PRIVATE ${projectPrefix}NO_REFERENCES ${projectPrefix}NO_ALIASES)
|
||||
endfunction()
|
||||
|
||||
add_example(avg_speed mp-units::core-io mp-units::si mp-units::si-cgs mp-units::si-international)
|
||||
add_example(box_example mp-units::core-fmt mp-units::si)
|
||||
add_example(capacitor_time_curve mp-units::core-io mp-units::si)
|
||||
add_example(clcpp_response mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-iau mp-units::si-imperial mp-units::si-international mp-units::si-typographic mp-units::si-uscs)
|
||||
add_example(
|
||||
clcpp_response
|
||||
mp-units::core-fmt
|
||||
mp-units::core-io
|
||||
mp-units::si
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
)
|
||||
add_example(experimental_angle mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
add_example(foot_pound_second mp-units::core-fmt mp-units::si-fps)
|
||||
add_example(total_energy mp-units::core-io mp-units::si mp-units::isq-natural)
|
||||
@ -45,9 +52,8 @@ add_example(unknown_dimension mp-units::core-io mp-units::si)
|
||||
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
add_example(glide_computer_example mp-units::core-fmt mp-units::si-international glide_computer)
|
||||
target_compile_definitions(glide_computer_example-literals PRIVATE
|
||||
${projectPrefix}NO_REFERENCES
|
||||
${projectPrefix}NO_ALIASES
|
||||
target_compile_definitions(
|
||||
glide_computer_example-literals PRIVATE ${projectPrefix}NO_REFERENCES ${projectPrefix}NO_ALIASES
|
||||
)
|
||||
|
||||
find_package(wg21_linear_algebra CONFIG REQUIRED)
|
||||
|
@ -28,16 +28,23 @@ cmake_minimum_required(VERSION 3.2)
|
||||
function(add_example target)
|
||||
add_executable(${target}-references ${target}.cpp)
|
||||
target_link_libraries(${target}-references PRIVATE ${ARGN})
|
||||
target_compile_definitions(${target}-references PRIVATE
|
||||
${projectPrefix}NO_LITERALS
|
||||
${projectPrefix}NO_ALIASES
|
||||
)
|
||||
target_compile_definitions(${target}-references PRIVATE ${projectPrefix}NO_LITERALS ${projectPrefix}NO_ALIASES)
|
||||
endfunction()
|
||||
|
||||
add_example(avg_speed mp-units::core-io mp-units::si mp-units::si-cgs mp-units::si-international)
|
||||
add_example(box_example mp-units::core-fmt mp-units::si)
|
||||
add_example(capacitor_time_curve mp-units::core-io mp-units::si)
|
||||
add_example(clcpp_response mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-iau mp-units::si-imperial mp-units::si-international mp-units::si-typographic mp-units::si-uscs)
|
||||
add_example(
|
||||
clcpp_response
|
||||
mp-units::core-fmt
|
||||
mp-units::core-io
|
||||
mp-units::si
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
)
|
||||
add_example(experimental_angle mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
add_example(foot_pound_second mp-units::core-fmt mp-units::si-fps)
|
||||
add_example(total_energy mp-units::core-io mp-units::si mp-units::isq-natural)
|
||||
@ -45,9 +52,8 @@ add_example(unknown_dimension mp-units::core-io mp-units::si)
|
||||
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
add_example(glide_computer_example mp-units::core-fmt mp-units::si-international glide_computer)
|
||||
target_compile_definitions(glide_computer_example-references PRIVATE
|
||||
${projectPrefix}NO_LITERALS
|
||||
${projectPrefix}NO_ALIASES
|
||||
target_compile_definitions(
|
||||
glide_computer_example-references PRIVATE ${projectPrefix}NO_LITERALS ${projectPrefix}NO_ALIASES
|
||||
)
|
||||
|
||||
find_package(wg21_linear_algebra CONFIG REQUIRED)
|
||||
|
@ -21,10 +21,7 @@
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(mp-units
|
||||
VERSION 0.8.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
project(mp-units VERSION 0.8.0 LANGUAGES CXX)
|
||||
|
||||
set(projectPrefix UNITS_)
|
||||
|
||||
@ -47,12 +44,7 @@ add_subdirectory(systems)
|
||||
|
||||
# project-wide wrapper
|
||||
add_library(mp-units INTERFACE)
|
||||
target_link_libraries(mp-units INTERFACE
|
||||
mp-units::core
|
||||
mp-units::core-io
|
||||
mp-units::core-fmt
|
||||
mp-units::systems
|
||||
)
|
||||
target_link_libraries(mp-units INTERFACE mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems)
|
||||
add_library(mp-units::mp-units ALIAS mp-units)
|
||||
install(TARGETS mp-units EXPORT mp-unitsTargets)
|
||||
|
||||
@ -63,11 +55,8 @@ include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(mp-unitsConfigVersion.cmake COMPATIBILITY SameMajorVersion)
|
||||
|
||||
# installation
|
||||
install(EXPORT mp-unitsTargets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mp-units
|
||||
NAMESPACE mp-units::
|
||||
)
|
||||
install(EXPORT mp-unitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mp-units NAMESPACE mp-units::)
|
||||
|
||||
install(FILES mp-unitsConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/mp-unitsConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mp-units
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mp-units
|
||||
)
|
||||
|
@ -28,9 +28,9 @@ cmake_minimum_required(VERSION 3.15)
|
||||
function(add_units_module name)
|
||||
add_library(mp-units-${name} INTERFACE)
|
||||
target_link_libraries(mp-units-${name} INTERFACE ${ARGN})
|
||||
target_include_directories(mp-units-${name} ${unitsAsSystem} INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
target_include_directories(
|
||||
mp-units-${name} ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
set_target_properties(mp-units-${name} PROPERTIES EXPORT_NAME ${name})
|
||||
add_library(mp-units::${name} ALIAS mp-units-${name})
|
||||
|
@ -29,6 +29,6 @@ add_units_module(core-fmt mp-units::core)
|
||||
target_compile_definitions(mp-units-core-fmt INTERFACE ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>)
|
||||
|
||||
if(${projectPrefix}USE_LIBFMT)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
target_link_libraries(mp-units-core-fmt INTERFACE fmt::fmt)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
target_link_libraries(mp-units-core-fmt INTERFACE fmt::fmt)
|
||||
endif()
|
||||
|
@ -36,12 +36,10 @@ check_libcxx_in_use(${projectPrefix}LIBCXX)
|
||||
# core library definition
|
||||
add_library(mp-units-core INTERFACE)
|
||||
target_compile_features(mp-units-core INTERFACE cxx_std_20)
|
||||
target_link_libraries(mp-units-core INTERFACE
|
||||
gsl::gsl-lite
|
||||
)
|
||||
target_include_directories(mp-units-core ${unitsAsSystem} INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
target_link_libraries(mp-units-core INTERFACE gsl::gsl-lite)
|
||||
target_include_directories(
|
||||
mp-units-core ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
@ -50,8 +48,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_link_libraries(mp-units-core INTERFACE range-v3::range-v3)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(mp-units-core INTERFACE
|
||||
/utf-8 # Specifies both the source character set and the execution character set as UTF-8
|
||||
target_compile_options(
|
||||
mp-units-core
|
||||
INTERFACE /utf-8 # Specifies both the source character set and the execution character set as UTF-8
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -59,7 +58,9 @@ if(DEFINED ${projectPrefix}DOWNCAST_MODE)
|
||||
set(downcast_mode_options OFF ON AUTO)
|
||||
list(FIND downcast_mode_options "${${projectPrefix}DOWNCAST_MODE}" downcast_mode)
|
||||
if(downcast_mode EQUAL -1)
|
||||
message(FATAL_ERROR "'${projectPrefix}DOWNCAST_MODE' should be one of ${downcast_mode_options} ('${${projectPrefix}DOWNCAST_MODE}' received)")
|
||||
message(FATAL_ERROR
|
||||
"'${projectPrefix}DOWNCAST_MODE' should be one of ${downcast_mode_options} ('${${projectPrefix}DOWNCAST_MODE}' received)"
|
||||
)
|
||||
else()
|
||||
message(STATUS "${projectPrefix}DOWNCAST_MODE: ${${projectPrefix}DOWNCAST_MODE}")
|
||||
target_compile_definitions(mp-units-core INTERFACE ${projectPrefix}DOWNCAST_MODE=${downcast_mode})
|
||||
|
@ -38,19 +38,21 @@ add_subdirectory(si-uscs)
|
||||
|
||||
# wrapper for all the systems
|
||||
add_library(mp-units-systems INTERFACE)
|
||||
target_link_libraries(mp-units-systems INTERFACE
|
||||
mp-units::isq
|
||||
mp-units::isq-iec80000
|
||||
mp-units::isq-natural
|
||||
mp-units::si
|
||||
mp-units::si-cgs
|
||||
mp-units::si-fps
|
||||
mp-units::si-hep
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
target_link_libraries(
|
||||
mp-units-systems
|
||||
INTERFACE
|
||||
mp-units::isq
|
||||
mp-units::isq-iec80000
|
||||
mp-units::isq-natural
|
||||
mp-units::si
|
||||
mp-units::si-cgs
|
||||
mp-units::si-fps
|
||||
mp-units::si-hep
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
)
|
||||
add_library(mp-units::systems ALIAS mp-units-systems)
|
||||
set_target_properties(mp-units-systems PROPERTIES EXPORT_NAME systems)
|
||||
|
@ -25,17 +25,10 @@ cmake_minimum_required(VERSION 3.12)
|
||||
function(add_metabench_test target name erb_path range)
|
||||
metabench_add_dataset(${target} "${erb_path}" "${range}" NAME "${name}")
|
||||
target_compile_features(${target} PUBLIC cxx_std_20)
|
||||
target_link_libraries(${target}
|
||||
PUBLIC
|
||||
range-v3::range-v3>
|
||||
)
|
||||
target_compile_options(${target}
|
||||
PUBLIC
|
||||
-fconcepts
|
||||
)
|
||||
target_link_libraries(${target} PUBLIC range-v3::range-v3>)
|
||||
target_compile_options(${target} PUBLIC -fconcepts)
|
||||
endfunction()
|
||||
|
||||
|
||||
include(metabench)
|
||||
if(NOT METABENCH_DIR)
|
||||
return()
|
||||
|
@ -22,34 +22,44 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
add_metabench_test(metabench.data.list.type_list.concepts_all "all concepts" type_list_concepts_all.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
add_metabench_test(metabench.data.list.type_list.concepts_iface "concepts in interface" type_list_concepts_iface.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
add_metabench_test(metabench.data.list.type_list.concepts_no "no concepts" type_list_concepts_no.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
metabench_add_chart(metabench.chart.list.concepts
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.concepts_all "all concepts" type_list_concepts_all.cpp.erb "[3, 6, 9, 12, 15]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.concepts_iface "concepts in interface" type_list_concepts_iface.cpp.erb
|
||||
"[3, 6, 9, 12, 15]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.concepts_no "no concepts" type_list_concepts_no.cpp.erb "[3, 6, 9, 12, 15]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.list.concepts
|
||||
TITLE "Sorting a list of size N"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.list.type_list.concepts_all
|
||||
metabench.data.list.type_list.concepts_iface
|
||||
metabench.data.list.type_list.concepts_no
|
||||
DATASETS metabench.data.list.type_list.concepts_all metabench.data.list.type_list.concepts_iface
|
||||
metabench.data.list.type_list.concepts_no
|
||||
)
|
||||
|
||||
add_metabench_test(metabench.data.list.type_list.conditional_std "std::conditional" type_list_conditional_std.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
add_metabench_test(metabench.data.list.type_list.conditional_alias "alias conditional" type_list_conditional_alias.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
add_metabench_test(metabench.data.list.type_list.conditional_alias_hard "alias conditional hard" type_list_conditional_alias_hard.cpp.erb "[3, 6, 9, 12, 15]")
|
||||
metabench_add_chart(metabench.chart.list.conditional
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.conditional_std "std::conditional" type_list_conditional_std.cpp.erb
|
||||
"[3, 6, 9, 12, 15]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.conditional_alias "alias conditional" type_list_conditional_alias.cpp.erb
|
||||
"[3, 6, 9, 12, 15]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.list.type_list.conditional_alias_hard "alias conditional hard"
|
||||
type_list_conditional_alias_hard.cpp.erb "[3, 6, 9, 12, 15]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.list.conditional
|
||||
TITLE "Sorting a list of size N"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.list.type_list.conditional_std
|
||||
metabench.data.list.type_list.conditional_alias
|
||||
metabench.data.list.type_list.conditional_alias_hard
|
||||
DATASETS metabench.data.list.type_list.conditional_std metabench.data.list.type_list.conditional_alias
|
||||
metabench.data.list.type_list.conditional_alias_hard
|
||||
)
|
||||
|
||||
add_custom_target(metabench.chart.list
|
||||
DEPENDS
|
||||
metabench.chart.list.concepts
|
||||
metabench.chart.list.conditional
|
||||
)
|
||||
add_custom_target(metabench.chart.list DEPENDS metabench.chart.list.concepts metabench.chart.list.conditional)
|
||||
|
||||
add_dependencies(metabench metabench.chart.list)
|
||||
|
@ -23,15 +23,18 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
add_metabench_test(metabench.data.make_dimension.no_concepts "no concepts" no_concepts.cpp.erb "[1, 2, 3, 4, 6, 8, 10]")
|
||||
add_metabench_test(metabench.data.make_dimension.concepts_iface "concepts iface" concepts_iface.cpp.erb "[1, 2, 3, 4, 6, 8, 10]")
|
||||
add_metabench_test(metabench.data.make_dimension.concepts_all "concepts all" concepts_all.cpp.erb "[1, 2, 3, 4, 6, 8, 10]")
|
||||
metabench_add_chart(metabench.chart.make_dimension
|
||||
add_metabench_test(
|
||||
metabench.data.make_dimension.concepts_iface "concepts iface" concepts_iface.cpp.erb "[1, 2, 3, 4, 6, 8, 10]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.make_dimension.concepts_all "concepts all" concepts_all.cpp.erb "[1, 2, 3, 4, 6, 8, 10]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.make_dimension
|
||||
TITLE "100 x make_dimension"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.make_dimension.no_concepts
|
||||
metabench.data.make_dimension.concepts_iface
|
||||
metabench.data.make_dimension.concepts_all
|
||||
DATASETS metabench.data.make_dimension.no_concepts metabench.data.make_dimension.concepts_iface
|
||||
metabench.data.make_dimension.concepts_all
|
||||
)
|
||||
|
||||
add_dependencies(metabench metabench.chart.make_dimension)
|
||||
|
@ -22,52 +22,65 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
add_metabench_test(metabench.data.ratio.create.std_ratio "std::ratio" create_std_ratio.cpp.erb "[1000, 2500, 5000, 7500, 10000]")
|
||||
add_metabench_test(metabench.data.ratio.create.ratio_type_constexpr "ratio with constexpr" create_ratio_type_constexpr.cpp.erb "[1000, 2500, 5000, 7500, 10000]")
|
||||
metabench_add_chart(metabench.chart.ratio.create
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.create.std_ratio "std::ratio" create_std_ratio.cpp.erb "[1000, 2500, 5000, 7500, 10000]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.create.ratio_type_constexpr "ratio with constexpr" create_ratio_type_constexpr.cpp.erb
|
||||
"[1000, 2500, 5000, 7500, 10000]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.ratio.create
|
||||
TITLE "Creation of 2*N ratios"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.ratio.create.std_ratio
|
||||
metabench.data.ratio.create.ratio_type_constexpr
|
||||
DATASETS metabench.data.ratio.create.std_ratio metabench.data.ratio.create.ratio_type_constexpr
|
||||
)
|
||||
|
||||
add_metabench_test(metabench.data.ratio.multiply_divide.std_ratio "std::ratio" multiply_divide_std_ratio.cpp.erb "[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]")
|
||||
add_metabench_test(metabench.data.ratio.multiply_divide.ratio_type_constexpr "ratio constexpr" multiply_divide_ratio_type_constexpr.cpp.erb "[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]")
|
||||
metabench_add_chart(metabench.chart.ratio.multiply_divide
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.multiply_divide.std_ratio "std::ratio" multiply_divide_std_ratio.cpp.erb
|
||||
"[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.multiply_divide.ratio_type_constexpr "ratio constexpr"
|
||||
multiply_divide_ratio_type_constexpr.cpp.erb "[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.ratio.multiply_divide
|
||||
TITLE "N ratio multiply + divide operations"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.ratio.multiply_divide.std_ratio
|
||||
metabench.data.ratio.multiply_divide.ratio_type_constexpr
|
||||
DATASETS metabench.data.ratio.multiply_divide.std_ratio metabench.data.ratio.multiply_divide.ratio_type_constexpr
|
||||
)
|
||||
|
||||
add_metabench_test(metabench.data.ratio.common_ratio.std_ratio "std::ratio" common_ratio_std_ratio.cpp.erb "[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]")
|
||||
add_metabench_test(metabench.data.ratio.common_ratio.ratio_type_constexpr "ratio constexpr" common_ratio_ratio_type_constexpr.cpp.erb "[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]")
|
||||
metabench_add_chart(metabench.chart.ratio.common_ratio
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.common_ratio.std_ratio "std::ratio" common_ratio_std_ratio.cpp.erb
|
||||
"[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]"
|
||||
)
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.common_ratio.ratio_type_constexpr "ratio constexpr" common_ratio_ratio_type_constexpr.cpp.erb
|
||||
"[10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.ratio.common_ratio
|
||||
TITLE "N common_ratio operations"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.ratio.common_ratio.std_ratio
|
||||
metabench.data.ratio.common_ratio.ratio_type_constexpr
|
||||
DATASETS metabench.data.ratio.common_ratio.std_ratio metabench.data.ratio.common_ratio.ratio_type_constexpr
|
||||
)
|
||||
|
||||
add_metabench_test(metabench.data.ratio.all.std_ratio "std::ratio" all_std_ratio.cpp.erb "[10, 50, 100, 500, 1000]")
|
||||
add_metabench_test(metabench.data.ratio.all.ratio_type_constexpr "ratio with constexpr" all_ratio_type_constexpr.cpp.erb "[10, 50, 100, 500, 1000]")
|
||||
metabench_add_chart(metabench.chart.ratio.all
|
||||
add_metabench_test(
|
||||
metabench.data.ratio.all.ratio_type_constexpr "ratio with constexpr" all_ratio_type_constexpr.cpp.erb
|
||||
"[10, 50, 100, 500, 1000]"
|
||||
)
|
||||
metabench_add_chart(
|
||||
metabench.chart.ratio.all
|
||||
TITLE "N x all ratio operations"
|
||||
SUBTITLE "(lower is better)"
|
||||
DATASETS
|
||||
metabench.data.ratio.all.std_ratio
|
||||
metabench.data.ratio.all.ratio_type_constexpr
|
||||
DATASETS metabench.data.ratio.all.std_ratio metabench.data.ratio.all.ratio_type_constexpr
|
||||
)
|
||||
|
||||
add_custom_target(metabench.chart.ratio
|
||||
DEPENDS
|
||||
metabench.chart.ratio.create
|
||||
metabench.chart.ratio.multiply_divide
|
||||
metabench.chart.ratio.common_ratio
|
||||
metabench.chart.ratio.all
|
||||
add_custom_target(
|
||||
metabench.chart.ratio DEPENDS metabench.chart.ratio.create metabench.chart.ratio.multiply_divide
|
||||
metabench.chart.ratio.common_ratio metabench.chart.ratio.all
|
||||
)
|
||||
|
||||
add_dependencies(metabench metabench.chart.ratio)
|
||||
|
@ -24,22 +24,15 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
find_package(Catch2 CONFIG REQUIRED)
|
||||
|
||||
add_executable(unit_tests_runtime
|
||||
catch_main.cpp
|
||||
math_test.cpp
|
||||
magnitude_test.cpp
|
||||
fmt_test.cpp
|
||||
fmt_units_test.cpp
|
||||
distribution_test.cpp
|
||||
)
|
||||
target_link_libraries(unit_tests_runtime PRIVATE
|
||||
mp-units::mp-units
|
||||
Catch2::Catch2
|
||||
add_executable(
|
||||
unit_tests_runtime catch_main.cpp math_test.cpp magnitude_test.cpp fmt_test.cpp fmt_units_test.cpp
|
||||
distribution_test.cpp
|
||||
)
|
||||
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(unit_tests_runtime PRIVATE
|
||||
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
target_compile_options(
|
||||
unit_tests_runtime PRIVATE /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -22,23 +22,17 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
add_library(unit_tests_static_truncating
|
||||
quantity_test.cpp
|
||||
)
|
||||
add_library(unit_tests_static_truncating quantity_test.cpp)
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
target_sources(unit_tests_static_truncating PRIVATE
|
||||
quantity_kind_test.cpp
|
||||
quantity_point_kind_test.cpp
|
||||
)
|
||||
target_sources(unit_tests_static_truncating PRIVATE quantity_kind_test.cpp quantity_point_kind_test.cpp)
|
||||
endif()
|
||||
target_link_libraries(unit_tests_static_truncating PRIVATE
|
||||
mp-units::mp-units
|
||||
)
|
||||
target_compile_options(unit_tests_static_truncating PRIVATE
|
||||
$<IF:$<CXX_COMPILER_ID:MSVC>,/wd4242 /wd4244,-Wno-conversion>
|
||||
target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::mp-units)
|
||||
target_compile_options(
|
||||
unit_tests_static_truncating PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/wd4242 /wd4244,-Wno-conversion>
|
||||
)
|
||||
|
||||
add_library(unit_tests_static
|
||||
add_library(
|
||||
unit_tests_static
|
||||
cgs_test.cpp
|
||||
chrono_test.cpp
|
||||
concepts_test.cpp
|
||||
@ -66,13 +60,7 @@ add_library(unit_tests_static
|
||||
)
|
||||
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
target_sources(unit_tests_static PRIVATE
|
||||
custom_rep_test_min_impl.cpp
|
||||
quantity_point_test.cpp
|
||||
)
|
||||
target_sources(unit_tests_static PRIVATE custom_rep_test_min_impl.cpp quantity_point_test.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(unit_tests_static PRIVATE
|
||||
unit_tests_static_truncating
|
||||
mp-units::mp-units
|
||||
)
|
||||
target_link_libraries(unit_tests_static PRIVATE unit_tests_static_truncating mp-units::mp-units)
|
||||
|
@ -21,9 +21,7 @@
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package
|
||||
LANGUAGES CXX
|
||||
)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(mp-units CONFIG REQUIRED)
|
||||
|
||||
|
Reference in New Issue
Block a user