
15 changed files with 282 additions and 70 deletions
@ -1,44 +1,96 @@ |
|||||
include Makefile.conf |
include Makefile.conf |
||||
|
|
||||
TARGET=synth_shed.so |
.PHONY: all install-pepacidgen gen compile compile-inplace dist dist-egg dist-whl install install-user \ |
||||
|
venv envtest install-test test develop docs clean clean-all clean-docs |
||||
|
|
||||
TARGET_MODULE_DYN=$(TARGET) |
all: install |
||||
TARGET_MODULE_STATIC=$(TARGET) |
|
||||
|
|
||||
CXX=clang |
# Install pEpACIDgen from this repo, not from pypi
|
||||
CXXFLAGS+=-std=c++11 -g |
install-pepacidgen: |
||||
|
pip3 install -r requirements.txt --find-links ../../../dist/ |
||||
|
|
||||
SRCS+=$(wildcard *.cc) |
# Build
|
||||
OBJS+=$(SRCS:.cc=.o) |
# =====
|
||||
|
gen: install-pepacidgen |
||||
|
$(MAKE) -C synth_shed gen |
||||
|
|
||||
CXXFLAGS+=$(INCLUDES) -I$(PREFIX)/include |
compile: gen |
||||
LDFLAGS_DYN+=-undefined dynamic_lookup $(LIBS_PATH) $(LIBS) |
python3 setup.py build_ext $(DEBUG_OPT) $(PREFIX_OPT) |
||||
LDFLAGS_STATIC+=-undefined dynamic_lookup |
|
||||
|
|
||||
$(info -----BUILD INFO----) |
compile-inplace: gen |
||||
$(info SRCS $(SRCS)) |
python3 setup.py build_ext $(DEBUG_OPT) $(PREFIX_OPT) --inplace |
||||
$(info OBJS $(OBJS)) |
|
||||
|
|
||||
.PHONY: all gen module_dyn module_static clean |
# Packaging
|
||||
|
# =========
|
||||
|
# create wheel and egg package in dist/
|
||||
|
dist: dist-whl dist-egg |
||||
|
|
||||
static: gen module_static |
# create wheel package in dist/
|
||||
|
dist-whl: compile |
||||
|
python3 setup.py bdist_wheel |
||||
|
|
||||
dyn: gen module_dyn |
# create egg package in dist/
|
||||
|
dist-egg: compile |
||||
|
python3 setup.py bdist_egg |
||||
|
|
||||
gen: |
|
||||
$(MAKE) -C gen |
|
||||
|
|
||||
module_dyn: $(TARGET_MODULE_DYN) |
# Installation
|
||||
|
# ============
|
||||
|
# installs the package system wide
|
||||
|
install: compile |
||||
|
pip3 install . |
||||
|
|
||||
$(TARGET_MODULE_DYN) : $(OBJS) |
# installs the package into your user home
|
||||
$(CXX) $(LDFLAGS_DYN) -o $@ $^ |
install-user: compile |
||||
|
pip3 install . --user |
||||
|
|
||||
module_static: $(TARGET_MODULE_STATIC) |
|
||||
|
|
||||
$(TARGET_MODULE_STATIC) : $(OBJS) $(LIBS_STATIC) |
# Envrionment
|
||||
$(CXX) $(LDFLAGS_STATIC) -o $@ $^ |
# ===========
|
||||
|
# Creates and activates a new venv that has the LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
|
||||
|
# already set for the prefix specified in local.conf
|
||||
|
# Only activates venv if already existing
|
||||
|
venv: |
||||
|
python3 -m venv $(VENV_DIR) |
||||
|
LD_LIBRARY_PATH=../../lib/lib_synth_shed/ \
|
||||
|
DYLD_LIBRARY_PATH=../../lib/lib_synth_shed/ \
|
||||
|
bash --rcfile $(VENV_DIR)/bin/activate |
||||
|
|
||||
|
# Tests if the current environment is able to load the pEp module
|
||||
|
envtest: |
||||
|
python3 -c 'import synth_shed' |
||||
|
|
||||
|
# Test
|
||||
|
# ====
|
||||
|
# Use these targets only in venv created with 'make venv'
|
||||
|
install-test: compile |
||||
|
pip3 install .[test] |
||||
|
|
||||
|
test: |
||||
|
pytest |
||||
|
|
||||
|
|
||||
|
# Development
|
||||
|
develop: compile |
||||
|
pip install -e . |
||||
|
|
||||
|
# Housekeeping
|
||||
|
# ============
|
||||
|
clean-all: clean |
||||
|
rm -rf $(VENV_DIR) |
||||
|
|
||||
clean: |
clean: |
||||
$(MAKE) -C gen clean |
rm -rf $(BUILD_DIR) |
||||
rm -f $(TARGET) |
rm -rf $(DIST_DIR) |
||||
rm -f $(OBJS) |
rm -rf $(PYTHON_ARTIFACTS) |
||||
|
rm -rf $(VERSION_FILE) |
||||
|
rm -rf $(BUILD_INPLACE) |
||||
|
|
||||
|
|
||||
|
# Makefile based build of C++ parts only
|
||||
|
# ======================================
|
||||
|
makefile-build: |
||||
|
$(MAKE) -C synth_shed/ |
||||
|
|
||||
|
makefile-clean: |
||||
|
$(MAKE) -C synth_shed/ clean |
||||
|
@ -1,23 +1,20 @@ |
|||||
# pyBind11
|
HERE:=$(dir $(lastword $(MAKEFILE_LIST))) |
||||
PREFIX=/Users/heck/local-default |
|
||||
|
|
||||
# YML2
|
# Constants
|
||||
YML2_PATH=$(HOME)/src/pepbase/default/yml2 |
BUILD_DIR = ./build |
||||
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS) |
DIST_DIR = ./dist |
||||
YML2_OPTS=--encoding=utf8 |
BUILD_INPLACE = ./src/synth_shed/syth_shed.cpython-38-darwin.so |
||||
|
PYTHON_ARTIFACTS += ./.eggs |
||||
|
PYTHON_ARTIFACTS += ./src/syth_shed.egg-info |
||||
|
PYTHON_ARTIFACTS += ./.pytest_cache |
||||
|
VENV_DIR = ./venv |
||||
|
|
||||
# pEpACIDgen
|
# Build config Defaults
|
||||
pEpACIDgen_ROOT=../../../../ |
PREFIX= |
||||
|
|
||||
# C Python headers
|
######### Overrides #########
|
||||
INCLUDES+=-I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 |
-include $(HERE)local.conf |
||||
|
|
||||
# example lib
|
ifneq ($(PREFIX),) |
||||
INCLUDES+=-I../../lib/lib_synth_shed |
PREFIX_OPT += --prefix=$(PREFIX) |
||||
|
endif |
||||
# static lib (.a)
|
|
||||
LIBS_STATIC+=../../lib/lib_synth_shed/libsynth_shed.a |
|
||||
|
|
||||
# dynamic lib (.so)
|
|
||||
LIBS+=-lsynth_shed |
|
||||
LIBS_PATH+=-L../../lib/lib_synth_shed/ |
|
||||
|
@ -1,19 +0,0 @@ |
|||||
include ../Makefile.conf |
|
||||
|
|
||||
YML2_FILE=py_module.yml2 |
|
||||
CC_FILE=py_module.cc |
|
||||
|
|
||||
.PHONY = yml cc |
|
||||
|
|
||||
all: yml cc |
|
||||
|
|
||||
yml: |
|
||||
$(pEpACIDgen_ROOT)/bin/pEp_acid_gen $(abspath config.json) |
|
||||
|
|
||||
cc : $(YML2_FILE) |
|
||||
$(YML2_PROC) -y $(pEpACIDgen_ROOT)/pEpACIDgen/gen_backend/gen_cc.ysl2 $(YML2_FILE) |
|
||||
|
|
||||
clean: |
|
||||
rm -f $(YML2_FILE) |
|
||||
rm -f $(CC_FILE) |
|
||||
|
|
@ -0,0 +1,16 @@ |
|||||
|
|
||||
|
[build-system] |
||||
|
# Preparing for PEP-517/PEP-518, but not in effect yet. |
||||
|
# These requires are not effective yet, setup.cfg is. |
||||
|
requires =[ |
||||
|
"setuptools >=39.2.0", |
||||
|
"wheel >= 0.35.1" ] |
||||
|
|
||||
|
build-backend = "setuptools.build_meta" |
||||
|
|
||||
|
[tool.pytest.ini_options] |
||||
|
minversion = "6.0" |
||||
|
addopts = "-rP" |
||||
|
testpaths = [ |
||||
|
"tests", |
||||
|
] |
@ -0,0 +1 @@ |
|||||
|
pEpACIDgen |
@ -0,0 +1,42 @@ |
|||||
|
[metadata] |
||||
|
name = synth_shed |
||||
|
url = https://pep.foundation |
||||
|
download_url = |
||||
|
ext_package = synth_shed |
||||
|
author = heck |
||||
|
author_email = heck@pep-project.org |
||||
|
maintainer = heck |
||||
|
maintainer_email = heck@pep.foundation |
||||
|
description = pEpACIDgen example extension module |
||||
|
long_description = file: README.md |
||||
|
keywords = pEpACIDgen |
||||
|
license = GNU Affero General Public License |
||||
|
license_files = LICENSE.txt |
||||
|
platforms = linux, macOs |
||||
|
classifiers = |
||||
|
Intended Audience :: Developers |
||||
|
Topic :: Utilities |
||||
|
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) |
||||
|
Natural Language :: English |
||||
|
Operating System :: OS Independent |
||||
|
Programming Language :: Python :: 3.6 |
||||
|
Programming Language :: Python :: 3.7 |
||||
|
Programming Language :: Python :: 3.8 |
||||
|
Development Status :: 3 - Alpha |
||||
|
|
||||
|
[options] |
||||
|
zip_safe = false |
||||
|
include_package_data = true |
||||
|
python_requires = >= 3.6 |
||||
|
test_suite = tests |
||||
|
install_requires = |
||||
|
# setup_requires is deprecated/redundant with pyproject.toml, but lets keep both ways around for now |
||||
|
setup_requires = |
||||
|
setuptools >=39.2.0 |
||||
|
wheel >= 0.35.1 |
||||
|
|
||||
|
[options.extras_require] |
||||
|
# To install these dependencies, run pip install .[test] |
||||
|
test = |
||||
|
pytest |
||||
|
|
@ -0,0 +1,26 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# This file is under GNU Affero General Public License 3.0 |
||||
|
# see LICENSE.txt |
||||
|
|
||||
|
from setuptools import setup, Extension |
||||
|
|
||||
|
# import pybind11.setup_helpers |
||||
|
|
||||
|
|
||||
|
ext_modules = [ |
||||
|
Extension( |
||||
|
"synth_shed", |
||||
|
["synth_shed/synth_shed.cc"], |
||||
|
include_dirs=['../../lib/lib_synth_shed', |
||||
|
'/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8', |
||||
|
'/Users/heck/src/adapter/pEpPythonAdapter-new/gen/examples/ext/synth_shed/venv/lib/python3.8/site-packages/pybind11/include'], |
||||
|
extra_compile_args=['-std=c++11'], |
||||
|
libraries=['synth_shed'], |
||||
|
library_dirs=['../../lib/lib_synth_shed/'] |
||||
|
) |
||||
|
] |
||||
|
|
||||
|
setup( |
||||
|
packages=['synth_shed'], |
||||
|
ext_modules=ext_modules |
||||
|
) |
@ -0,0 +1,46 @@ |
|||||
|
include Makefile.conf |
||||
|
|
||||
|
TARGET=synth_shed.so |
||||
|
|
||||
|
TARGET_MODULE_DYN=$(TARGET) |
||||
|
TARGET_MODULE_STATIC=$(TARGET) |
||||
|
|
||||
|
CXX=clang |
||||
|
CXXFLAGS+=-std=c++11 -g |
||||
|
|
||||
|
SRCS+=$(wildcard *.cc) |
||||
|
OBJS+=$(SRCS:.cc=.o) |
||||
|
|
||||
|
CXXFLAGS+=$(INCLUDES) |
||||
|
LDFLAGS_DYN+=-undefined dynamic_lookup $(LIBS_PATH) $(LIBS) |
||||
|
LDFLAGS_STATIC+=-undefined dynamic_lookup |
||||
|
|
||||
|
$(info -----BUILD INFO----) |
||||
|
$(info SRCS $(SRCS)) |
||||
|
$(info OBJS $(OBJS)) |
||||
|
|
||||
|
.PHONY: all gen module_dyn module_static clean |
||||
|
|
||||
|
all: static |
||||
|
|
||||
|
static: gen module_static |
||||
|
|
||||
|
dyn: gen module_dyn |
||||
|
|
||||
|
gen: |
||||
|
$(MAKE) -C gen |
||||
|
|
||||
|
module_dyn: $(TARGET_MODULE_DYN) |
||||
|
|
||||
|
$(TARGET_MODULE_DYN) : $(OBJS) |
||||
|
$(CXX) $(LDFLAGS_DYN) -o $@ $^ |
||||
|
|
||||
|
module_static: $(TARGET_MODULE_STATIC) |
||||
|
|
||||
|
$(TARGET_MODULE_STATIC) : $(OBJS) $(LIBS_STATIC) |
||||
|
$(CXX) $(LDFLAGS_STATIC) -o $@ $^ |
||||
|
|
||||
|
clean: |
||||
|
$(MAKE) -C gen clean |
||||
|
rm -f $(TARGET) |
||||
|
rm -f $(OBJS) |
@ -0,0 +1,12 @@ |
|||||
|
# pyBind11 and python headers
|
||||
|
INCLUDES+=$(shell pybind11-config --includes) |
||||
|
|
||||
|
# example lib
|
||||
|
INCLUDES+=-I../../../lib/lib_synth_shed |
||||
|
|
||||
|
# static lib (.a)
|
||||
|
LIBS_STATIC+=../../../lib/lib_synth_shed/libsynth_shed.a |
||||
|
|
||||
|
# dynamic lib (.so)
|
||||
|
LIBS+=-lsynth_shed |
||||
|
LIBS_PATH+=-L../../../lib/lib_synth_shed/ |
@ -0,0 +1,25 @@ |
|||||
|
include ../Makefile.conf |
||||
|
|
||||
|
YML2_FILE=py_module.yml2 |
||||
|
YSL2_FILE=$(shell pEp_acid_gen-config) |
||||
|
PYBIND11_FILE=py_module.pybind11 |
||||
|
|
||||
|
$(info -----SYNTH_SHED GEN----) |
||||
|
$(info YML2_FILE $(YML2_FILE)) |
||||
|
$(info YSL2_FILE $(YSL2_FILE)) |
||||
|
$(info CC_FILE $(PYBIND11_FILE)) |
||||
|
|
||||
|
.PHONY = yml pybind11 |
||||
|
|
||||
|
all: $(PYBIND11_FILE) |
||||
|
|
||||
|
$(YML2_FILE): config.json |
||||
|
pEp_acid_gen $^ |
||||
|
|
||||
|
$(PYBIND11_FILE) : $(YML2_FILE) |
||||
|
yml2proc --encoding=utf8 -y $(YSL2_FILE) $(YML2_FILE) |
||||
|
|
||||
|
clean: |
||||
|
rm -f $(YML2_FILE) |
||||
|
rm -f $(PYBIND11_FILE) |
||||
|
|
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"module_name": "synth_shed", |
"module_name": "synth_shed", |
||||
"header_filename": "../../../../examples/lib/lib_synth_shed/synth_shed.h", |
"header_filename": "../../../../../examples/lib/lib_synth_shed/synth_shed.h", |
||||
"libclang_path": "/opt/local/libexec/llvm-9.0/lib/libclang.dylib", |
"libclang_path": "/opt/local/libexec/llvm-9.0/lib/libclang.dylib", |
||||
"variables": [ |
"variables": [ |
||||
], |
], |
@ -0,0 +1,9 @@ |
|||||
|
#!/usr/bin/env python3 |
||||
|
# -*- coding: utf-8 -*- |
||||
|
# This file is under GNU Affero General Public License 3.0 |
||||
|
# see LICENSE.txt |
||||
|
|
||||
|
import synth_shed |
||||
|
|
||||
|
def test_synth_shed(): |
||||
|
synth_shed |
Loading…
Reference in new issue