Skip to content

Commit

Permalink
Cython binding! + better build system
Browse files Browse the repository at this point in the history
  • Loading branch information
st1vms committed Apr 21, 2023
1 parent eb92813 commit d870abc
Show file tree
Hide file tree
Showing 14 changed files with 32,296 additions and 19 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ set(HEADER_FILES

add_library(dynamic-bits SHARED ${SOURCES} ${HEADER_FILES})

add_executable(test test.c)
target_link_libraries(test PUBLIC dynamic-bits m)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
Expand All @@ -30,6 +27,10 @@ set_target_properties(${PROJECT_NAME}
PUBLIC_HEADER "${HEADER_FILES}"
)

if (UNIX)
set(CMAKE_INSTALL_PREFIX "/usr")
endif (UNIX)

install(TARGETS dynamic-bits
CONFIGURATIONS Release
LIBRARY DESTINATION lib
Expand Down
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<a href="https://www.buymeacoffee.com/st1vms"><img src="https://img.buymeacoffee.com/button-api/?text=1 Pizza Margherita&emoji=🍕&slug=st1vms&button_colour=0fa913&font_colour=ffffff&font_family=Bree&outline_colour=ffffff&coffee_colour=FFDD00" /></a>
# dynamic-bits


## Table of content

- [Overview](#overview)
- [Linux Installation](#linux-installation)
- [Building on Linux (Cmake)](#building-on-linux-cmake)
- [Installing on Linux (Cmake)](#installing-on-linux-cmake)
- [Android Installation](#manual-android-installation)
- [Uninstalling](#uninstalling)
- [Usage](#usage)
Expand All @@ -26,6 +27,7 @@ Programmers must register their packets in the table before any de/serialization

# Linux-Installation

## Requirements
## Requirements

- [cmake](https://cmake.org/install/) is required in order to build this library.
Expand All @@ -45,25 +47,17 @@ It is drastically important to tweak this value in order to optimize space requi
*PacketTableByteSize = 255 * (MAX_PACKET_FIELDS) bytes*
## Building-On-Linux-CMake
## Installing-On-Linux-CMake
After configuration is done, open a terminal inside the repository directory, make a build folder and generate build files using cmake.
After configuration is done, open a terminal inside the repository directory, and execute these commands.
```
cd ./dynamic-bits
mkdir build
cd build
cmake .. && cmake --build .
chmod u+x ./build.sh
./build.sh && sudo make install -C build/
```
Inside the build folder you will find the generated shared library.
To install the library on Linux run these two commands inside build folder...
```
sudo make install
sudo ldconfig /usr/local/lib
```
The library will be already installed on your system...
# Manual-Android-Installation
Expand Down
5 changes: 4 additions & 1 deletion binds/Android/JDBits/jdbits/src/main/cpp/include/dpacket.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#ifndef __DPACKET_H

const unsigned int PACKET_TABLE_SIZE = (1<<8)-1;
#define PACKET_TABLE_SIZE ((1<<8)-1)

// Max number of fields x packet
#define MAX_PACKET_FIELDS 20

// The result packet table,
// will occupy 255*(MAX_PACKET_FIELDS) bytes

// The result packet table,
// will occupy 255*(MAX_PACKET_FIELDS) bytes

#include <dtypes.h>

#ifdef __cplusplus
Expand Down
160 changes: 160 additions & 0 deletions binds/python/pydbits/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Empty file.
Loading

0 comments on commit d870abc

Please sign in to comment.