diff --git a/.gitignore b/.gitignore index 567609b..dd15e65 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ build/ +*.blif +*.dot +*.png +.cache +docs/ + +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f0f67ce --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 3.31.6) +project(BBDD_Manipulation_Package) + +# 1) A header-only target that exposes include/ +# Anything that links to this gets -I/include automatically. +add_library(project_headers INTERFACE) +target_include_directories(project_headers + INTERFACE + ${CMAKE_SOURCE_DIR}/include +) + +# Optional: set a default C++ standard for all targets made below +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# 2) Discover all example source files (top-level .cpp files in examples/) +# Use CONFIGURE_DEPENDS so 'cmake --build .' picks up new files after re-configure. +file(GLOB EXAMPLE_SOURCES + CONFIGURE_DEPENDS + ${CMAKE_SOURCE_DIR}/examples/*.cpp) + +# 3) Create an executable per example file and link include paths via project_headers +foreach(example_src IN LISTS EXAMPLE_SOURCES) + get_filename_component(example_name "${example_src}" NAME_WE) + add_executable(${example_name} "${example_src}") + + # Link the header-only interface to inherit include/ (and any future compile defs/opts) + target_link_libraries(${example_name} PRIVATE project_headers) + + # Optional: place example binaries into build/examples/ + set_target_properties(${example_name} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples" + ) +endforeach() + +############################################# Generate Doxygen Documentation +# Option to build docs +option(BUILD_DOC "Build API documentation with Doxygen" ON) + +if(BUILD_DOC) + find_package(Doxygen QUIET) + + if(NOT DOXYGEN_FOUND) + message(WARNING "Doxygen not found. Set BUILD_DOC=OFF or install Doxygen.") + else() + # Graphviz (dot) for diagrams — optional + find_program(DOT_EXE dot) + set(DOXYGEN_HAVE_DOT "NO") + if(DOT_EXE) + set(DOXYGEN_HAVE_DOT "YES") + endif() + + configure_file( + "${CMAKE_SOURCE_DIR}/Doxyfile.in" + "${CMAKE_BINARY_DIR}/Doxyfile" + @ONLY + ) + + # docs target + add_custom_target(docs + COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/Doxyfile" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMENT "Generating API documentation with Doxygen" + VERBATIM + ) + + # Optional: convenience target to clean generated docs + add_custom_target(docs-clean + COMMAND "${CMAKE_COMMAND}" -E rm -rf "${DOXYGEN_OUTPUT_DIR}" + COMMENT "Removing generated documentation in ${DOXYGEN_OUTPUT_DIR}" + VERBATIM + ) + endif() +endif() diff --git a/Doxyfile.in b/Doxyfile.in new file mode 100644 index 0000000..f66898f --- /dev/null +++ b/Doxyfile.in @@ -0,0 +1,38 @@ +# ---------- Project ---------- +PROJECT_NAME = "BBDD manipulation package" +OUTPUT_DIRECTORY = "../docs" +FULL_PATH_NAMES = NO +OPTIMIZE_OUTPUT_FOR_CPLUSPLUS = YES + +# ---------- Inputs ---------- +INPUT = "../include" +RECURSIVE = YES +FILE_PATTERNS = *.hpp + +# Parse Doxygen/Javadoc-style comments +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = YES +JAVADOC_AUTOBRIEF = YES + +# ---------- Warnings ---------- +WARN_IF_UNDOCUMENTED = YES +WARN_AS_ERROR = NO + +# ---------- HTML ---------- +GENERATE_HTML = YES +HTML_OUTPUT = html +GENERATE_TREEVIEW = YES + +# ---------- Diagrams (Graphviz) ---------- +HAVE_DOT = @DOXYGEN_HAVE_DOT@ +DOT_IMAGE_FORMAT = svg +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES + +# ---------- Misc ---------- +GENERATE_LATEX = NO +GENERATE_XML = NO + diff --git a/README.md b/README.md index 50cd417..44f2b7b 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,55 @@ # BBDD Manipulation package A C++ library for creating, manipulating, and analyzing **Biconditional Binary Decision Diagrams (BBDDs)**. It provides efficient data structures and algorithms for representing boolean functions in the form of BBDDs, with an intuitive API for integration into projects. --- ## 📂 Project Structure Below is an overview of the main files and directories: - `include/` - Public headers - `bbdd.hpp` - main functionality of merging and extending bbdds - `bbdd_node.hpp` - bbdd node definition, hashing function, dumping node, compare nodes - `bbdd_types.hpp` - bbdd cases, bbdd operations, and pointer sized - `chain_variable_ordering.hpp` - creating and manipulating chain variable ordering - `computed_table.hpp` - merge cache data structure - `extend_table.hpp` - extend cache data structure - `unique_table.hpp` - main storage structure with inserting and deleting functions - - `util.hpp` - converting cubes to boolean operation, progress bar - `examples/` - Usage demonstrations - - `example_basic.cpp` - TODO + - `full_adder.cpp` - example of creating the bbdd of a full adder and writing the design to a .dot and .blif file - `CMakeLists.txt` - Build configuration (CMake project setup) - `README.md` - This file - `LICENSE` - License file --- ## Getting Started TODO ### Installation requirements -TODO + - CMAKE version >= 3.31.6 + - c++ compiler (tested with g++ version 15.2.1 20250808) ### Build with CMake + +- Build examples + ```bash git clone https://phabricator.ict.tuwien.ac.at/source/SoC_BBDD_Library.git mkdir build && cd build cmake .. make ``` - -### Example - -TODO + - Build the docs +```bash +git clone https://phabricator.ict.tuwien.ac.at/source/SoC_BBDD_Library.git +mkdir build && cd build +cmake .. +make docs +```