From 1ebb6d9508ef919e4c1e81cb35ad70ee560b9906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20H=C3=A4rnqvist?= <ivarhar@outlook.com> Date: Tue, 7 Apr 2020 15:03:04 +0200 Subject: [PATCH] crlf -> lf for more files --- .clang-format | 300 ++++++++++++++++++++++++------------------------- .gitignore | 64 +++++------ .gitlab-ci.yml | 30 ++--- CMakeLists.txt | 156 ++++++++++++------------- LICENSE | 42 +++---- README.md | 238 +++++++++++++++++++-------------------- setup.py | 158 +++++++++++++------------- 7 files changed, 494 insertions(+), 494 deletions(-) diff --git a/.clang-format b/.clang-format index 44513788..7548f76b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,151 +1,151 @@ -AccessModifierOffset: -4 - -AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignConsecutiveMacros: true -AlignEscapedNewlines: DontAlign -AlignOperands: false -AlignTrailingComments: true - -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: Empty -AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Empty -AllowShortIfStatementsOnASingleLine: Never -AllowShortLambdasOnASingleLine: Inline -AllowShortLoopsOnASingleLine: false - -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: Yes - -BinPackArguments: false -BinPackParameters: true - -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false - SplitEmptyFunction: false - SplitEmptyRecord: false - SplitEmptyNamespace: true - -BreakBeforeBinaryOperators: None -BreakBeforeTernaryOperators: false -BreakConstructorInitializers: BeforeComma -BreakInheritanceList: BeforeComma -BreakStringLiterals: true - -ColumnLimit: 140 - -CommentPragmas: '' - -CompactNamespaces: false - -ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 4 - -ContinuationIndentWidth: 4 - -Cpp11BracedListStyle: true - -DerivePointerAlignment: false - -DisableFormat: false - -FixNamespaceComments: true - -ForEachMacros: - - Q_FOREACH - - BOOST_FOREACH - - FOREACH - - FOR_EACH - -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^<' - Priority: 2 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '(_test)?$' - -IndentCaseLabels: true -IndentGotoLabels: false -IndentPPDirectives: None -IndentWidth: 4 -IndentWrappedFunctionNames: false - -KeepEmptyLinesAtTheStartOfBlocks: false - -Language: Cpp - -MacroBlockBegin: '' -MacroBlockEnd: '' - -MaxEmptyLinesToKeep: 1 - -NamespaceIndentation: None -NamespaceMacros: - - NAMESPACE - -PenaltyBreakAssignment: 100 -PenaltyBreakBeforeFirstCallParameter: 10 -PenaltyBreakComment: 10 -PenaltyBreakFirstLessLess: 100 -PenaltyBreakString: 10 -PenaltyBreakTemplateDeclaration: 10000 -PenaltyExcessCharacter: 999999 -PenaltyReturnTypeOnItsOwnLine: 10000 - -PointerAlignment: Left - -ReflowComments: false - -SortIncludes: true -SortUsingDeclarations: true - -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInContainerLiterals: false -SpacesInParentheses: false -SpacesInSquareBrackets: false - -Standard: Cpp11 - -StatementMacros: - - Q_UNUSED - -TabWidth: 4 - -TypenameMacros: - - STACK_OF - - LIST - - LIST_ENTRY - +AccessModifierOffset: -4 + +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true +AlignEscapedNewlines: DontAlign +AlignOperands: false +AlignTrailingComments: true + +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: false + +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes + +BinPackArguments: false +BinPackParameters: true + +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: true + +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: false +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +BreakStringLiterals: true + +ColumnLimit: 140 + +CommentPragmas: '' + +CompactNamespaces: false + +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 + +ContinuationIndentWidth: 4 + +Cpp11BracedListStyle: true + +DerivePointerAlignment: false + +DisableFormat: false + +FixNamespaceComments: true + +ForEachMacros: + - Q_FOREACH + - BOOST_FOREACH + - FOREACH + - FOR_EACH + +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^<' + Priority: 2 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(_test)?$' + +IndentCaseLabels: true +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false + +KeepEmptyLinesAtTheStartOfBlocks: false + +Language: Cpp + +MacroBlockBegin: '' +MacroBlockEnd: '' + +MaxEmptyLinesToKeep: 1 + +NamespaceIndentation: None +NamespaceMacros: + - NAMESPACE + +PenaltyBreakAssignment: 100 +PenaltyBreakBeforeFirstCallParameter: 10 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 100 +PenaltyBreakString: 10 +PenaltyBreakTemplateDeclaration: 10000 +PenaltyExcessCharacter: 999999 +PenaltyReturnTypeOnItsOwnLine: 10000 + +PointerAlignment: Left + +ReflowComments: false + +SortIncludes: true +SortUsingDeclarations: true + +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false + +Standard: Cpp11 + +StatementMacros: + - Q_UNUSED + +TabWidth: 4 + +TypenameMacros: + - STACK_OF + - LIST + - LIST_ENTRY + UseTab: ForContinuationAndIndentation \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0bdf5476..3395e18a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,33 @@ -.vs/ -.vscode/ -build*/ -bin*/ -logs/ -dist/ -CMakeLists.txt.user* -*.autosave -*.creator -*.creator.user* -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* -*~ -.fuse_hudden* -.directory -.Trash-* -.nfs* -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db -$RECYCLE.BIN/ -*.stackdump -[Dd]esktop.ini -*.egg-info -__pycache__/ -env/ +.vs/ +.vscode/ +build*/ +bin*/ +logs/ +dist/ +CMakeLists.txt.user* +*.autosave +*.creator +*.creator.user* +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* +*~ +.fuse_hudden* +.directory +.Trash-* +.nfs* +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db +$RECYCLE.BIN/ +*.stackdump +[Dd]esktop.ini +*.egg-info +__pycache__/ +env/ venv/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 484c595f..3b2095bb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,16 +1,16 @@ -image: python:3.6 - -stages: - - test - -before_script: - - apt-get update --yes - - apt-get install --yes build-essential cmake libfmt-dev pybind11-dev - - pip3 install pytest pytest-cov - - pip3 install . - - pip3 show b_asic - -run tests: - stage: test - script: +image: python:3.6 + +stages: + - test + +before_script: + - apt-get update --yes + - apt-get install --yes build-essential cmake libfmt-dev pybind11-dev + - pip3 install pytest pytest-cov + - pip3 install . + - pip3 show b_asic + +run tests: + stage: test + script: - pytest test \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 652825e8..3471fb4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,79 +1,79 @@ -cmake_minimum_required(VERSION 3.8) - -project( - "B-ASIC" - VERSION 0.0.1 - DESCRIPTION "Better ASIC Toolbox for python3" - LANGUAGES C CXX -) - -find_package(fmt 5.2.1 REQUIRED) -find_package(pybind11 CONFIG REQUIRED) - -set(LIBRARY_NAME "b_asic") -set(TARGET_NAME "_${LIBRARY_NAME}") - -if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - include(GNUInstallDirs) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}") -endif() -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_PDB_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") - -pybind11_add_module( - "${TARGET_NAME}" - "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp" -) - -target_include_directories( - "${TARGET_NAME}" - PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/src" -) - -target_compile_features( - "${TARGET_NAME}" - PRIVATE - cxx_std_17 -) -target_compile_options( - "${TARGET_NAME}" - PRIVATE - $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>: - -W -Wall -Wextra -Werror -Wno-psabi - $<$<CONFIG:Debug>:-g> - $<$<NOT:$<CONFIG:Debug>>:-O3> - > - $<$<CXX_COMPILER_ID:MSVC>: - /W3 /WX /permissive- /utf-8 - $<$<CONFIG:Debug>:/Od> - $<$<NOT:$<CONFIG:Debug>>:/Ot> - > -) - -target_link_libraries( - "${TARGET_NAME}" - PRIVATE - fmt::fmt -) - -add_custom_target( - remove_old_python_dir ALL - COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" - COMMENT "Removing old python directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" -) -add_custom_target( - copy_python_dir ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_LIST_DIR}/${LIBRARY_NAME}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" - COMMENT "Copying python files to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" - DEPENDS "${TARGET_NAME}" remove_old_python_dir +cmake_minimum_required(VERSION 3.8) + +project( + "B-ASIC" + VERSION 0.0.1 + DESCRIPTION "Better ASIC Toolbox for python3" + LANGUAGES C CXX +) + +find_package(fmt 5.2.1 REQUIRED) +find_package(pybind11 CONFIG REQUIRED) + +set(LIBRARY_NAME "b_asic") +set(TARGET_NAME "_${LIBRARY_NAME}") + +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + include(GNUInstallDirs) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}") +endif() +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_PDB_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + +pybind11_add_module( + "${TARGET_NAME}" + "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp" +) + +target_include_directories( + "${TARGET_NAME}" + PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/src" +) + +target_compile_features( + "${TARGET_NAME}" + PRIVATE + cxx_std_17 +) +target_compile_options( + "${TARGET_NAME}" + PRIVATE + $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>: + -W -Wall -Wextra -Werror -Wno-psabi + $<$<CONFIG:Debug>:-g> + $<$<NOT:$<CONFIG:Debug>>:-O3> + > + $<$<CXX_COMPILER_ID:MSVC>: + /W3 /WX /permissive- /utf-8 + $<$<CONFIG:Debug>:/Od> + $<$<NOT:$<CONFIG:Debug>>:/Ot> + > +) + +target_link_libraries( + "${TARGET_NAME}" + PRIVATE + fmt::fmt +) + +add_custom_target( + remove_old_python_dir ALL + COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" + COMMENT "Removing old python directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" +) +add_custom_target( + copy_python_dir ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_LIST_DIR}/${LIBRARY_NAME}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" + COMMENT "Copying python files to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" + DEPENDS "${TARGET_NAME}" remove_old_python_dir ) \ No newline at end of file diff --git a/LICENSE b/LICENSE index acf4454a..669ce41e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2020 TDDD96 PUM4 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2020 TDDD96 PUM4 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 5fc71790..fd98f919 100644 --- a/README.md +++ b/README.md @@ -1,119 +1,119 @@ -<img src="logo.png" width="278" height="100"> - -# B-ASIC - Better ASIC Toolbox -B-ASIC is an ASIC toolbox for Python 3 that simplifies circuit design and optimization. - -## Development -How to build and debug the library during development. - -### Prerequisites -The following packages are required in order to build the library: -* cmake 3.8+ - * gcc 7+/clang 7+/msvc 16+ - * fmtlib 5.2.1+ - * pybind11 2.3.0+ -* python 3.6+ - * setuptools - * wheel - * pybind11 - * numpy - * pyside2/pyqt5 - -### Using CMake directly -How to build using CMake. - -#### Configuring -In `B-ASIC`: -``` -mkdir build -cd build -cmake .. -``` - -#### Building (Debug) -In `B-ASIC/build`: -``` -cmake --build . -``` -The output gets written to `B-ASIC/build/lib`. - -#### Building (Release) -In `B-ASIC/build`: -``` -cmake --build . --config Release -``` -The output gets written to `B-ASIC/build/lib`. - -### Using setuptools to create a package -How to create a package using setuptools that can be installed using pip. - -#### Setup (Binary distribution) -In `B-ASIC`: -``` -python3 setup.py bdist_wheel -``` -The output gets written to `B-ASIC/dist/b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl`. - -#### Setup (Source distribution) -In `B-ASIC`: -``` -python3 setup.py sdist -``` -The output gets written to `B-ASIC/dist/b-asic-<version>.tar.gz`. - -#### Installation (Binary distribution) -In `B-ASIC/dist`: -``` -pip install b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl -``` - -#### Installation (Source distribution) -In `B-ASIC/dist`: -``` -pip install b-asic-<version>.tar.gz -``` - -### Running tests -How to run the tests using pytest in a virtual environment. - -#### Linux/OS X -In `B-ASIC`: -``` -python3 -m venv env -source env/bin/activate -pip install . -pytest -``` - -#### Windows -In `B-ASIC` (as admin): -``` -python3 -m venv env -.\env\Scripts\activate.bat -pip install . -pytest -``` - -#### Test with coverage -``` -pytest --cov=b_asic --cov-report html test -``` - -## Usage -How to build and use the library as a user. - -### Installation -``` -pip install b_asic -``` - -### Importing -``` -python3 ->>> import b_asic as asic ->>> help(asic) -``` - -## License -B-ASIC is distributed under the MIT license. -See the included LICENSE file for more information. +<img src="logo.png" width="278" height="100"> + +# B-ASIC - Better ASIC Toolbox +B-ASIC is an ASIC toolbox for Python 3 that simplifies circuit design and optimization. + +## Development +How to build and debug the library during development. + +### Prerequisites +The following packages are required in order to build the library: +* cmake 3.8+ + * gcc 7+/clang 7+/msvc 16+ + * fmtlib 5.2.1+ + * pybind11 2.3.0+ +* python 3.6+ + * setuptools + * wheel + * pybind11 + * numpy + * pyside2/pyqt5 + +### Using CMake directly +How to build using CMake. + +#### Configuring +In `B-ASIC`: +``` +mkdir build +cd build +cmake .. +``` + +#### Building (Debug) +In `B-ASIC/build`: +``` +cmake --build . +``` +The output gets written to `B-ASIC/build/lib`. + +#### Building (Release) +In `B-ASIC/build`: +``` +cmake --build . --config Release +``` +The output gets written to `B-ASIC/build/lib`. + +### Using setuptools to create a package +How to create a package using setuptools that can be installed using pip. + +#### Setup (Binary distribution) +In `B-ASIC`: +``` +python3 setup.py bdist_wheel +``` +The output gets written to `B-ASIC/dist/b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl`. + +#### Setup (Source distribution) +In `B-ASIC`: +``` +python3 setup.py sdist +``` +The output gets written to `B-ASIC/dist/b-asic-<version>.tar.gz`. + +#### Installation (Binary distribution) +In `B-ASIC/dist`: +``` +pip install b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl +``` + +#### Installation (Source distribution) +In `B-ASIC/dist`: +``` +pip install b-asic-<version>.tar.gz +``` + +### Running tests +How to run the tests using pytest in a virtual environment. + +#### Linux/OS X +In `B-ASIC`: +``` +python3 -m venv env +source env/bin/activate +pip install . +pytest +``` + +#### Windows +In `B-ASIC` (as admin): +``` +python3 -m venv env +.\env\Scripts\activate.bat +pip install . +pytest +``` + +#### Test with coverage +``` +pytest --cov=b_asic --cov-report html test +``` + +## Usage +How to build and use the library as a user. + +### Installation +``` +pip install b_asic +``` + +### Importing +``` +python3 +>>> import b_asic as asic +>>> help(asic) +``` + +## License +B-ASIC is distributed under the MIT license. +See the included LICENSE file for more information. diff --git a/setup.py b/setup.py index b1212871..43d55d40 100644 --- a/setup.py +++ b/setup.py @@ -1,80 +1,80 @@ -import os -import sys -import shutil -import subprocess -import setuptools -from setuptools import Extension -from setuptools.command.build_ext import build_ext - -CMAKE_EXE = os.environ.get('CMAKE_EXE', shutil.which('cmake')) - -class CMakeExtension(Extension): - def __init__(self, name, sourcedir = ""): - super().__init__(name, sources=[]) - self.sourcedir = os.path.abspath(sourcedir) - -class CMakeBuild(build_ext): - def build_extension(self, ext): - if not isinstance(ext, CMakeExtension): - return super().build_extension(ext) - - if not CMAKE_EXE: - raise RuntimeError(f"Cannot build extension {ext.name}: CMake executable not found! Set the CMAKE_EXE environment variable or update your path.") - - cmake_build_type = "Debug" if self.debug else "Release" - cmake_output_dir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) - cmake_configure_argv = [ - CMAKE_EXE, ext.sourcedir, - "-DCMAKE_BUILD_TYPE=" + cmake_build_type, - "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + cmake_output_dir, - "-DPYTHON_EXECUTABLE=" + sys.executable, - ] - cmake_build_argv = [ - CMAKE_EXE, "--build", ".", - "--config", cmake_build_type - ] - - if not os.path.exists(self.build_temp): - os.makedirs(self.build_temp) - - env = os.environ.copy() - - print(f"=== Configuring {ext.name} ===") - print(f"Temp dir: {self.build_temp}") - print(f"Output dir: {cmake_output_dir}") - subprocess.check_call(cmake_configure_argv, cwd=self.build_temp, env=env) - - print(f"=== Building {ext.name} ===") - print(f"Temp dir: {self.build_temp}") - print(f"Output dir: {cmake_output_dir}") - print(f"Build type: {cmake_build_type}") - subprocess.check_call(cmake_build_argv, cwd=self.build_temp, env=env) - - print() - -setuptools.setup( - name = "b-asic", - version = "0.0.1", - author = "Adam Jakobsson, Angus Lothian, Arvid Westerlund, Felix Goding, Ivar Härnqvist, Jacob Wahlman, Kevin Scott, Rasmus Karlsson", - author_email = "adaja901@student.liu.se, anglo547@student.liu.se, arvwe160@student.liu.se, felgo673@student.liu.se, ivaha717@student.liu.se, jacwa448@student.liu.se, kevsc634@student.liu.se, raska119@student.liu.se", - description = "Better ASIC Toolbox", - long_description = open("README.md", "r").read(), - long_description_content_type = "text/markdown", - url = "https://gitlab.liu.se/PUM_TDDD96/B-ASIC", - license = "MIT", - classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires = ">=3.6", - install_requires = [ - "pybind11>=2.3.0", - "numpy", - "install_qt_binding" - ], - packages = ["b_asic"], - ext_modules = [CMakeExtension("b_asic")], - cmdclass = {"build_ext": CMakeBuild}, - zip_safe = False +import os +import sys +import shutil +import subprocess +import setuptools +from setuptools import Extension +from setuptools.command.build_ext import build_ext + +CMAKE_EXE = os.environ.get('CMAKE_EXE', shutil.which('cmake')) + +class CMakeExtension(Extension): + def __init__(self, name, sourcedir = ""): + super().__init__(name, sources=[]) + self.sourcedir = os.path.abspath(sourcedir) + +class CMakeBuild(build_ext): + def build_extension(self, ext): + if not isinstance(ext, CMakeExtension): + return super().build_extension(ext) + + if not CMAKE_EXE: + raise RuntimeError(f"Cannot build extension {ext.name}: CMake executable not found! Set the CMAKE_EXE environment variable or update your path.") + + cmake_build_type = "Debug" if self.debug else "Release" + cmake_output_dir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) + cmake_configure_argv = [ + CMAKE_EXE, ext.sourcedir, + "-DCMAKE_BUILD_TYPE=" + cmake_build_type, + "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + cmake_output_dir, + "-DPYTHON_EXECUTABLE=" + sys.executable, + ] + cmake_build_argv = [ + CMAKE_EXE, "--build", ".", + "--config", cmake_build_type + ] + + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) + + env = os.environ.copy() + + print(f"=== Configuring {ext.name} ===") + print(f"Temp dir: {self.build_temp}") + print(f"Output dir: {cmake_output_dir}") + subprocess.check_call(cmake_configure_argv, cwd=self.build_temp, env=env) + + print(f"=== Building {ext.name} ===") + print(f"Temp dir: {self.build_temp}") + print(f"Output dir: {cmake_output_dir}") + print(f"Build type: {cmake_build_type}") + subprocess.check_call(cmake_build_argv, cwd=self.build_temp, env=env) + + print() + +setuptools.setup( + name = "b-asic", + version = "0.0.1", + author = "Adam Jakobsson, Angus Lothian, Arvid Westerlund, Felix Goding, Ivar Härnqvist, Jacob Wahlman, Kevin Scott, Rasmus Karlsson", + author_email = "adaja901@student.liu.se, anglo547@student.liu.se, arvwe160@student.liu.se, felgo673@student.liu.se, ivaha717@student.liu.se, jacwa448@student.liu.se, kevsc634@student.liu.se, raska119@student.liu.se", + description = "Better ASIC Toolbox", + long_description = open("README.md", "r").read(), + long_description_content_type = "text/markdown", + url = "https://gitlab.liu.se/PUM_TDDD96/B-ASIC", + license = "MIT", + classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires = ">=3.6", + install_requires = [ + "pybind11>=2.3.0", + "numpy", + "install_qt_binding" + ], + packages = ["b_asic"], + ext_modules = [CMakeExtension("b_asic")], + cmdclass = {"build_ext": CMakeBuild}, + zip_safe = False ) \ No newline at end of file -- GitLab