Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Code format and linting config update #389

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FormatStyle: file

Checks: |
clang-diagnostic-*,
clang-analyzer-*,
boost-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-unchecked-optional-access,
clang-analyzer-*,
-clang-analyzer-core.NullDereference,
clang-diagnostic-*,
cppcoreguidelines-*,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-special-member-functions,
Expand All @@ -28,6 +28,7 @@ Checks: |
-readability-identifier-length,
-readability-magic-numbers,
-readability-function-cognitive-complexity

CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
Expand Down
4 changes: 4 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
format:
line_width: 100
keyword_case: "upper"
autosort: true
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{py,pyi}]
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[{*.{cmake,cmake.in},CMakeLists.txt}]
max_line_length = 100
1 change: 0 additions & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
*.profraw

# Translations
*.mo
Expand All @@ -73,6 +74,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/api/

# PyBuilder
.pybuilder/
Expand Down Expand Up @@ -136,7 +138,7 @@ _skbuild/

# Any build dirs in the tests
test/**/build/
/src/mqt/ddsim/_version.py
/src/mqt/**/_version.py

# Common editor files
*~
Expand Down Expand Up @@ -169,3 +171,6 @@ Thumbs.db
/docs/**/build
.vs
out/build

node_modules/
wheelhouse/
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.19...3.28)
project(
mqt-ddsim
LANGUAGES CXX
DESCRIPTION
"MQT DDSIM - A quantum circuit simulator based on decision diagrams")
DESCRIPTION "MQT DDSIM - A quantum circuit simulator based on decision diagrams")

option(BUILD_MQT_DDSIM_TESTS "Also build tests for the MQT DDSIM project" ON)
option(BUILD_MQT_DDSIM_BINDINGS "Build the MQT DDSIM Python bindings" OFF)
Expand All @@ -25,9 +24,7 @@ if(BUILD_MQT_DDSIM_BINDINGS)
CACHE STRING "Prefer Brew/Conda to Apple framework Python")
set(Python_ARTIFACTS_INTERACTIVE
ON
CACHE
BOOL
"Prevent multiple searches for Python and instead cache the results.")
CACHE BOOL "Prevent multiple searches for Python and instead cache the results.")

# top-level call to find Python
find_package(
Expand Down
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Chair for Design Automation, Technical University of Munich
Copyright (c) 2024 Chair for Design Automation, Technical University of Munich

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 6 additions & 15 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,9 @@ if(BUILD_MQT_DDSIM_TESTS)
set(GTEST_VERSION
1.14.0
CACHE STRING "Google Test version")
set(GTEST_URL
https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.tar.gz
)
set(GTEST_URL https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.tar.gz)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(googletest URL ${GTEST_URL} FIND_PACKAGE_ARGS
${GTEST_VERSION} NAMES GTest)
FetchContent_Declare(googletest URL ${GTEST_URL} FIND_PACKAGE_ARGS ${GTEST_VERSION} NAMES GTest)
list(APPEND FETCH_PACKAGES googletest)
else()
find_package(googletest ${GTEST_VERSION} QUIET NAMES GTest)
Expand All @@ -81,9 +78,7 @@ set(TF_BUILD_PROFILER
set(TF_VERSION
3.6.0
CACHE STRING "Taskflow version")
set(TF_URL
https://github.com/taskflow/taskflow/archive/refs/tags/v${TF_VERSION}.tar.gz
)
set(TF_URL https://github.com/taskflow/taskflow/archive/refs/tags/v${TF_VERSION}.tar.gz)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(taskflow URL ${TF_URL} FIND_PACKAGE_ARGS)
list(APPEND FETCH_PACKAGES taskflow)
Expand All @@ -105,12 +100,9 @@ if(BUILD_MQT_DDSIM_CLI)
set(CXXOPTS_VERSION
3.1.1
CACHE STRING "cxxopts version")
set(CXXOPTS_URL
https://github.com/jarro2783/cxxopts/archive/refs/tags/v${CXXOPTS_VERSION}.tar.gz
)
set(CXXOPTS_URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v${CXXOPTS_VERSION}.tar.gz)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(cxxopts URL ${CXXOPTS_URL} FIND_PACKAGE_ARGS
${CXXOPTS_VERSION})
FetchContent_Declare(cxxopts URL ${CXXOPTS_URL} FIND_PACKAGE_ARGS ${CXXOPTS_VERSION})
list(APPEND FETCH_PACKAGES cxxopts)
else()
find_package(cxxopts ${CXXOPTS_VERSION} QUIET)
Expand All @@ -132,8 +124,7 @@ if(BUILD_MQT_DDSIM_BINDINGS)
else()
find_package(pybind11_json QUIET)
if(NOT pybind11_json_FOUND)
FetchContent_Declare(
pybind11_json GIT_REPOSITORY https://github.com/pybind/pybind11_json)
FetchContent_Declare(pybind11_json GIT_REPOSITORY https://github.com/pybind/pybind11_json)
list(APPEND FETCH_PACKAGES pybind11_json)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{ name = "Stefan Hillmich", email = "stefan.hillmich@scch.at" },
]
keywords = ["MQT", "quantum-computing", "design-automation", "quantum-circuit-sim", "simulation"]
license = { file = "LICENSE" }
license = { file = "LICENSE.md" }

classifiers = [
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
Expand Down
13 changes: 5 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@ add_library(
PathSimulator.cpp)

# set include directories
target_include_directories(
${MQT_DDSIM_TARGET_NAME}
PUBLIC $<BUILD_INTERFACE:${MQT_DDSIM_INCLUDE_BUILD_DIR}>)
target_include_directories(${MQT_DDSIM_TARGET_NAME}
PUBLIC $<BUILD_INTERFACE:${MQT_DDSIM_INCLUDE_BUILD_DIR}>)

# link to the MQT::Core and Taskflow libraries
target_link_libraries(${MQT_DDSIM_TARGET_NAME} PUBLIC MQT::CoreDD Taskflow)
target_link_libraries(${MQT_DDSIM_TARGET_NAME} PRIVATE MQT::ProjectWarnings
MQT::ProjectOptions)
target_link_libraries(${MQT_DDSIM_TARGET_NAME} PRIVATE MQT::ProjectWarnings MQT::ProjectOptions)

# the following sets the SYSTEM flag for the include dirs of the taskflow libs
set_target_properties(
Taskflow PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:Taskflow,INTERFACE_INCLUDE_DIRECTORIES>)
set_target_properties(Taskflow PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:Taskflow,INTERFACE_INCLUDE_DIRECTORIES>)

# add MQT alias
add_library(MQT::DDSim ALIAS ${MQT_DDSIM_TARGET_NAME})
Expand Down
5 changes: 2 additions & 3 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ pybind11_add_module(
OPT_SIZE
# Source code goes here
bindings.cpp)
target_link_libraries(
pyddsim PRIVATE MQT::DDSim MQT::ProjectOptions MQT::ProjectWarnings
MQT::CorePython pybind11_json)
target_link_libraries(pyddsim PRIVATE MQT::DDSim MQT::ProjectOptions MQT::ProjectWarnings
MQT::CorePython pybind11_json)

# Install directive for scikit-build-core
install(
Expand Down
16 changes: 6 additions & 10 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ package_add_test(
add_custom_command(
TARGET mqt-ddsim-test
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E create_symlink
$<TARGET_FILE_DIR:mqt-ddsim-test>/mqt-ddsim-test
${CMAKE_BINARY_DIR}/mqt-ddsim-test
COMMAND
${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/circuits
$<TARGET_FILE_DIR:mqt-ddsim-test>/circuits
COMMAND
${CMAKE_COMMAND} -E create_symlink
$<TARGET_FILE_DIR:mqt-ddsim-test>/circuits ${CMAKE_BINARY_DIR}/circuits
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_DIR:mqt-ddsim-test>/mqt-ddsim-test
${CMAKE_BINARY_DIR}/mqt-ddsim-test
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/circuits
$<TARGET_FILE_DIR:mqt-ddsim-test>/circuits
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_DIR:mqt-ddsim-test>/circuits
${CMAKE_BINARY_DIR}/circuits
COMMENT "Copying circuits and creating symlinks for mqt-ddsim-test"
VERBATIM)
Loading