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

Python3 & CMake build + Thread caused bug fix #21

Open
wants to merge 161 commits into
base: python3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
16517a2
Makefile.pdlibbuilder version 0.0.0
katjav Jun 25, 2015
9c7e501
changed some comments
katjav Jun 25, 2015
3906a92
corrected futile typo in comment
katjav Jun 25, 2015
9e1fa90
added vim modeline for syntax highlighting
katjav Jun 25, 2015
b43f7ad
another try at syntax highlighting modeline
katjav Jun 25, 2015
84ae43e
Added reference to helloworld project in README.md.
katjav Jul 6, 2015
0a7d057
use $(metafile) in version expansion
umlaeute Oct 28, 2015
d2fa193
Merge pull request #3 from umlaeute/patch-1
katjav Oct 29, 2015
9015ba7
fix expansion of variable lib.version in cflags during compilation
katjav Oct 31, 2015
974b617
bump version to 0.0.1
katjav Oct 31, 2015
164d294
Evaluate optional per-system multiline defines
katjav Dec 4, 2015
589d7fc
Use CPPFLAGS, CFLAGS and LDFLAGS to override/add build flags
katjav Dec 5, 2015
0595e44
Improve methods for searching Pd include paths.
katjav Dec 6, 2015
15832b5
Small fix: add LDFLAGS to shared.ldflags too.
katjav Dec 6, 2015
ed37e6b
Bumped to version 0.0.2.
katjav Dec 6, 2015
e08bab9
Updated README.md to include reference to xeq.
katjav Dec 6, 2015
c428456
Introduce pre and post targets.
katjav Dec 8, 2015
a5678ac
bump version 0.0.2 > 0.1.0 for added feature (targets pre / post)
katjav Dec 8, 2015
abeb4de
Remove cruft from .PHONY:
katjav Dec 8, 2015
8cba158
Remove cruft from a variable definition
katjav Dec 8, 2015
3946ea5
Merge branch 'eval-system-specific-defines', update version to 0.2.0
katjav Dec 19, 2015
c6fe183
Document CPPFLAGS, CFLAGS, LDFLAGS
katjav Dec 21, 2015
c887569
Replaced outdated link to cyclone repository in README.md
katjav Dec 22, 2015
98f3582
Merge branch 'command-line-build-flags', bump version to 0.2.1
katjav Dec 27, 2015
d94538e
Remove target 'pre' from Makefile.pdlibbuilder
katjav Mar 26, 2016
c989c8e
Bump to version 0.2.2 after removal of 'pre' target
katjav Mar 26, 2016
eb614fd
Disable dep. checking for fat builds on OSX <= 10.5. Version 0.2.3
katjav Mar 29, 2016
1d7bb5e
Fix regression bug that disabled all dependency checking
katjav Jun 25, 2016
b1a4c9b
Print Makefile.pdlibbuilder version
katjav Jun 25, 2016
f06e550
Fix dependency checking for object files in other directories
katjav Jun 26, 2016
49a0b2f
allow installed files to contain weirdo characters
umlaeute Jun 28, 2016
9fd1795
Do not pass architecture flags for dependency checking
katjav Sep 20, 2016
2832db3
Remove old dependency-check workaround for OSX <= 10.5
katjav Sep 20, 2016
5c9fed1
updated cyclone link
danomatika Sep 30, 2016
dc9a8df
re-added cyclone link & added contextual info
danomatika Oct 2, 2016
a6a89dc
Scrap all default include / bin paths except vanilla's
katjav Oct 4, 2016
4815915
Add more projects that use pd-lib-builder in README.md
katjav Oct 5, 2016
7b5e359
Merge branch 'install-dollarfiles'
katjav Oct 5, 2016
a7d3098
Respect flag '-mmacosx-version-min=*' from lib makefile
katjav Oct 9, 2016
5b920b1
Set version to 0.2.8 after merging 'install-dollarfiles'
katjav Oct 9, 2016
41e9743
Introduce variable 'PD_PATH', bump version to 0.3.0
katjav Oct 9, 2016
a0c87be
Defer expansion of $(pdbinpath) to correctly find pd.dll (bugfix)
katjav Oct 13, 2016
b0dab72
Introduce variables PDDIR, PDINCLUDEDIR, PDBINDIR, PDLIBDIR
katjav Oct 13, 2016
cf04da9
Rewrite variable descriptions after introduction of 'PDDIR' & Co.
katjav Oct 14, 2016
ff9b40c
Merge branch 'configurable-minimum-osxversion'
katjav Oct 26, 2016
48c4127
Bump version to 0.4.1 after merging 'configurable-minimum-osxversion'
katjav Oct 26, 2016
4c680bf
Add 'path' and 'documentation' sections in README.md
katjav Oct 26, 2016
006d957
Add CHANGELOG.txt to the project
katjav Oct 28, 2016
058ba82
Add section 'versioning' in README.md
katjav Oct 28, 2016
2e13d8f
Fix bug where incorrect message about m_pd.h is given
katjav Oct 30, 2016
426b38b
Replace flags '-fpic' with '-fPIC'
katjav Nov 2, 2016
6120db1
Update CHANGELOG.txt
katjav Nov 2, 2016
cdd3b43
removed trailing whitespace
umlaeute Nov 22, 2016
cb839ed
note (within the pd-lib-builder Makefile) how to update the file.
umlaeute Nov 22, 2016
2c14110
Use variable 'system' when evaluating 'for{Linux,Darwin,Windows}
katjav Nov 22, 2016
872c34b
Update CHANGELOG.txt for v0.4.4
katjav Nov 22, 2016
fcf20d1
Fixed Python signal script. Max help file still incorrect
grrrr Apr 20, 2017
88fc77a
Change to python2.7 by default
grrrr May 9, 2017
4be3e99
Swap OS and machine detection so OS comes first
katjav Jan 20, 2018
fa3c2ca
Introduce variable 'target.arch'
katjav Jan 20, 2018
ef21a16
Introduce architecture dependent settings for Windows
katjav Jan 20, 2018
37d2353
Leave out architecture 'ia64'
katjav Jan 21, 2018
f83d429
Introduce remainder architecture category for Windows
katjav Jan 21, 2018
867ad5e
Introduce general remainder architecture category
katjav Jan 21, 2018
231e344
Use variables 'build.arch' and 'target.arch' consistently
katjav Jan 21, 2018
e4d42f2
Assume system is "Windows" when uname says "MSYS"
katjav Jan 21, 2018
77ff876
Fix conditional checks broken in commits e4d42f2 and f83d429
katjav Jan 21, 2018
13796bf
Add option '-msse3' for Windows on x86_64 architecture
katjav Jan 21, 2018
a01ee16
Revert 'uname --machine' to 'uname -m' (bug fix OSX)
katjav Jan 22, 2018
215bf3e
Merge branch 'target-arch-mingw'
katjav Jan 23, 2018
80d7dc0
Bump version to 0.5.0, ready for Windows 64 bit
katjav Jan 23, 2018
1361dd3
Remove unuseful variable 'PD_PATH'
katjav Jan 24, 2018
7740128
Fix priority for user path variables 'PDDIR' & Co.
katjav Jan 24, 2018
1bcf78f
Define default paths for 32 bit build on 64 bit Windows
katjav Jan 26, 2018
f3887bb
Update Windows search path documentation in makefile
katjav Jan 27, 2018
9240b64
Evaluate 'PDBINDIR' before ld flags
katjav Jan 27, 2018
fe45bcb
Avoid ls errors when default paths for Pd on Windows do not exist
katjav Jan 28, 2018
3e974fd
Update makefile comments related to paths
katjav Jan 31, 2018
a1ad2e9
Merge branch 'windows-paths'
katjav Jan 31, 2018
f1b0e3c
Add linker option '-static-libgcc' for C++ code on Windows
katjav Feb 1, 2018
0493d4a
Started a small tips&tricks page
umlaeute Oct 3, 2016
b2ce500
sections and TODOs
umlaeute Oct 3, 2016
07c5e78
document `git subtree`
umlaeute Feb 7, 2018
e9a67fd
use ~~ for strikethrough
umlaeute Feb 7, 2018
e90da16
Moved git-submodule down the page
umlaeute Feb 7, 2018
fa7f798
drop "pd-lib-builder" from headings when there's only general advise
umlaeute Feb 7, 2018
7e47b98
how to build double/W64/double+W64 externals
umlaeute Feb 7, 2018
b715b0e
sed -e's| sed | set |'
umlaeute Feb 7, 2018
1b9f3d8
Do wildcard-search for MSYS when checking Windows platform
umlaeute Feb 7, 2018
44a32fd
fixed small typo
umlaeute Feb 7, 2018
6bfaba6
Introduce target 'install-strip' in the battle against Mingw-w64 bloat
katjav Feb 18, 2018
f334dd4
Revert "Introduce target 'install-strip' in the battle against Mingw-…
katjav Mar 12, 2018
397b72e
Strip when 'stripflags' is defined (default for Windows only)
katjav Mar 12, 2018
5b4f636
Document 'STRIP' variable
katjav Mar 15, 2018
b19fe37
Bump version to 0.5.1 for several Windows fixes
katjav Mar 15, 2018
9dd4f36
Removed trailing whitespace
umlaeute May 30, 2018
ece8e6b
Fix omission of flag for minimum OSX version
katjav Aug 1, 2018
1137cca
Specify minimum OSX version 10.6 instead of 10.5
katjav Mar 20, 2019
7764061
support conda python
ahihi Aug 7, 2019
21e3b32
add conda lib dir to rpath
ahihi Aug 8, 2019
ac328cd
add dummy StdOut_Flush() method to make absl logging happy
ahihi Aug 14, 2019
1f7e520
call Py_SetProgramName() when building for conda env
ahihi Aug 16, 2019
8308d8a
don't include <Python/Python.h> when using conda
ahihi Aug 27, 2019
0c800aa
more conda fixing
ahihi Aug 27, 2019
6d47a22
Fixed argument type
grrrr Nov 24, 2019
1dc4219
Detect target platform consistently with $(CC) -dumpmachine
katjav Dec 15, 2019
a140d21
Terminate if target triplet remained empty
katjav Dec 15, 2019
e13255d
Test target arch more consistently on Windows
katjav Dec 15, 2019
53caa9c
Change test to see whether -fcheck-new must be used on Darwin
katjav Dec 15, 2019
2cfb271
For Darwin do not build fat binaries by default
katjav Dec 15, 2019
69e2002
Reorganize definition of -mmacosx-version-min
katjav Dec 15, 2019
65e9fc7
For Darwin build fat binaries when extension=d_fat
katjav Dec 15, 2019
262143b
Introduce optional user variable 'PLATFORM' for cross compilation
katjav Dec 15, 2019
f2a5b66
Add target 'dumpmachine' for verification purposes
katjav Dec 15, 2019
0993535
Add description of variable 'PLATFORM'and target 'dumpmachine'
katjav Dec 20, 2019
6dd1880
Merge branch target-detection
katjav Dec 21, 2019
db2bcdd
Update version to 0.6.0 after merging 'target-detection'
katjav Dec 21, 2019
8a27ffc
Update CHANGELOG.txt for version 0.6.0
katjav Dec 21, 2019
2d3b7f4
Update section about cross-compiling in tips-tricks.md
katjav Dec 21, 2019
d187d47
Update README.txt, mainly to list more projects
katjav Dec 22, 2019
7d70890
const str
Mar 5, 2020
14022b2
Add 'pd-lib-builder/' from commit '03c0b3fbc180d6896bafbc68b53743cbab…
Mar 5, 2020
8c92c66
Use pd-lib-builder for compilation
Mar 5, 2020
5488e40
Fix float type
grrrr Mar 5, 2020
1884683
Merge branch 'master' of https://github.com/grrrr/py
ahihi Mar 9, 2020
df8fa8f
Merge branch 'master' into python3
ahihi Mar 9, 2020
c0b374e
python 3 compatibility fixes
ahihi Mar 10, 2020
99abb6a
support pymalloc python build
ahihi Mar 10, 2020
379ab50
reorganize module defs & fix builtins import
ahihi Mar 10, 2020
34c529e
fix module init
ahihi Mar 10, 2020
22e9601
fix python 2 build
ahihi Mar 10, 2020
4ec81db
more python 3 fixing... simple-1.pd now works
ahihi Mar 17, 2020
6e8ea82
python 3 - simple-2.pd now working
ahihi Mar 17, 2020
4408d3d
fix script.py for python 3, fix simple.py docstring
ahihi Mar 17, 2020
a32b6db
more python 3 compat work on example scripts
ahihi Mar 17, 2020
daa5543
first shot at pybuffer in py3. still buggy...
ahihi Mar 23, 2020
e3dfb2e
handle Pd array memory layout using strides
ahihi Mar 30, 2020
ec04393
fix numpy buffer format
ahihi Mar 30, 2020
e6782e7
port sig.py to python3 and fix dsp buffer handling
ahihi Mar 31, 2020
aaaf6c1
port sendrecv.py to python3
ahihi Mar 31, 2020
e8a95d7
untabify simple.py
ahihi Mar 31, 2020
36416a5
define pyext class using PyTypeObject
ahihi Apr 6, 2020
f0a6ee1
string.swapcase is gone in py3, use capwords as example instead
ahihi Apr 7, 2020
a6e7a76
compat fixes to examples
ahihi Apr 7, 2020
27020c4
cleanup
ahihi Apr 7, 2020
5a2bca7
cleanup
ahihi Apr 7, 2020
2737539
unbreak python 2
ahihi Apr 7, 2020
cc2ad77
add _canvas_dir attribute
ahihi Sep 7, 2020
0e35ed1
fix(?) "pyext." behavior
ahihi Sep 7, 2020
630fcdb
make conda build work on linux
ahihi Nov 10, 2020
bc0708f
fix some uninitialized memory bugs found by valgrind
ahihi Nov 30, 2020
5a8994e
build py/pyext for python3 with cmake
grybouilli Jun 29, 2023
6f4c52b
some other numpy deprecated macros
grybouilli Jul 5, 2023
be1bd98
enable python 3 & multithreaded flext
grybouilli Jul 6, 2023
8c02920
Solved hang on close with threaded build of py/pyext
grybouilli Jul 12, 2023
2d5708e
several improvements to CMake build system:
fferri Jul 11, 2023
f8a6307
README for py/pyext with python 3
grybouilli Jul 12, 2023
5d7ed56
ingoring notes for now
grybouilli Jul 17, 2023
b49ad2e
adapt to new flext install
grybouilli Aug 3, 2023
cbcd597
added support for pd instance
grybouilli Aug 9, 2023
41b58a2
made boolean atomic for thread safety
grybouilli Aug 9, 2023
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@
*.app
config.txt
.DS_Store

# CMake build folder
*-build
*__pycache__*

notes*
124 changes: 124 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
cmake_minimum_required(VERSION 3.24)
project(py VERSION 0.1.0 LANGUAGES C CXX)

include(CMakePrintHelpers)

# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)

find_package(Python3 REQUIRED COMPONENTS Interpreter Development NumPy)

if(VERBOSE)
cmake_print_variables(Python3_INCLUDE_DIRS)
cmake_print_variables(Python3_NumPy_INCLUDE_DIRS)
endif()

# TODO: make a FindPd.cmake find module to address the following PD_* items:
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c "import platform; print('.pd_' + platform.system().lower())"
OUTPUT_VARIABLE PD_EXTERNAL_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(VERBOSE)
cmake_print_variables(PD_EXTERNAL_SUFFIX)
endif()

set(PD_EXTERNALS_PATH "~/Documents/Pd/externals" CACHE PATH "Pd externals path")

if(UNIX AND NOT APPLE)
set(PD_SOURCE_PATH_DEFAULT /usr/local/pd/src)
elseif(UNIX AND APPLE)
set(PD_SOURCE_PATH_DEFAULT /Applications/Pd-0.54-0.app/Contents/Resources/src)
elseif(WIN32)
set(PD_SOURCE_PATH_DEFAULT c:/pd/src)
endif()

set(PD_SOURCE_PATH ${PD_SOURCE_PATH_DEFAULT} CACHE PATH "Pd src path")
set(PD_INSTANCE OFF CACHE BOOL "Builds with PDINSTANCE defined")

set(STRIP_TARGET OFF CACHE BOOL "Strip unneeded symbols from compiled library (saves some disk space)")

set(FLEXT_SOURCE_PATH /usr/local/include/flext CACHE PATH "Flext source path")
set(FLEXT_BUILD_TYPE SHARED CACHE STRING "Flext build type")
set_property(CACHE FLEXT_BUILD_TYPE PROPERTY STRINGS "SINGLE" "SHARED" "MULTI")

add_library(objects OBJECT
source/bound.cpp
source/clmeth.cpp
source/main.cpp
source/modmeth.cpp
source/py.cpp
source/pyargs.cpp
source/pyatom.cpp
source/pybase.cpp
source/pybuffer.cpp
source/pybundle.cpp
source/pycompat.cpp
source/pydsp.cpp
source/pyext.cpp
source/pymeth.cpp
source/pysymbol.cpp
source/register.cpp)

target_compile_definitions(objects PRIVATE PD)
target_compile_definitions(objects PRIVATE FLEXT_INLINE)
target_compile_definitions(objects PRIVATE FLEXT_ATTRIBUTES=1)

if(FLEXT_BUILD_TYPE STREQUAL MULTI)
target_compile_definitions(objects PRIVATE FLEXT_THREADS)
elseif(FLEXT_BUILD_TYPE STREQUAL SHARED)
target_compile_definitions(objects PRIVATE FLEXT_SHARED)
endif()

if(${PD_INSTANCE})
target_compile_definitions(objects PRIVATE PDINSTANCE)
target_compile_definitions(objects PRIVATE PDTHREAD)
endif()

if(UNIX)
target_compile_definitions(objects PRIVATE UNIX)
endif()

target_compile_options(objects PRIVATE -O3 -Wl,--trace -fPIC -fcheck-new -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -ffast-math -funroll-loops -fomit-frame-pointer)
target_include_directories(objects PRIVATE ${PD_SOURCE_PATH})
target_include_directories(objects PRIVATE ${FLEXT_SOURCE_PATH})
target_link_libraries(objects PRIVATE Python3::Python Python3::NumPy)

# ---------------------------------------------- #
# BUILDING PD EXTERNAL PY/PYEXT
add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:objects>)
target_compile_options(${PROJECT_NAME} PRIVATE -rdynamic -shared -fPIC -Wl,-rpath,"\$ORIGIN",--enable-new-dtags)
target_link_libraries(${PROJECT_NAME}
PRIVATE -lc
PRIVATE -lm
PRIVATE -lstdc++
)
target_link_libraries(${PROJECT_NAME} PRIVATE Python3::Python Python3::NumPy)

if(FLEXT_BUILD_TYPE STREQUAL MULTI)
target_compile_definitions(${PROJECT_NAME} PRIVATE FLEXT_THREADS)
elseif(FLEXT_BUILD_TYPE STREQUAL SHARED)
target_compile_definitions(${PROJECT_NAME} PRIVATE FLEXT_SHARED)
endif()
if(${PD_INSTANCE})
target_compile_definitions(${PROJECT_NAME} PRIVATE PDINSTANCE)
target_compile_definitions(${PROJECT_NAME} PRIVATE PDTHREAD)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX "${PD_EXTERNAL_SUFFIX}")

if(STRIP_TARGET)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND strip --strip-unneeded ${CMAKE_BINARY_DIR}/${PROJECT_NAME}${PD_EXTERNAL_SUFFIX}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Stripping file..."
)
endif()

# install to Pd externals directory (run `cmake --install <build-dir>` to install)
if(NOT ${PD_INSTANCE})
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}${PD_EXTERNAL_SUFFIX} DESTINATION ${PD_EXTERNALS_PATH}/${PROJECT_NAME})
else()
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}${PD_EXTERNAL_SUFFIX} DESTINATION ${PD_EXTERNALS_PATH}instance/${PROJECT_NAME})
endif()
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
NAME=py
cflags=-DFLEXT_INLINE -DFLEXT_ATTRIBUTES=1

# source files
$(NAME).class.sources = $(wildcard source/*.cpp)

# help files
datafiles = $(wildcard pd/*.pd scripts/*.py)

# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
PDLIBBUILDER_DIR=./pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# py/pyext for Python 3

## Credits

### py/pyext - python script objects for PD and Max/MSP

Copyright (c)2002-2020 Thomas Grill ([email protected])

For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.

Donations for further development of the package are highly appreciated.
Visit https://www.paypal.com/xclick/business=gr%40grrrr.org&item_name=pyext&no_note=1&tax=0&currency_code=EUR

More info in the previous `readme.txt`.
## Installation

### Pre-requisite
* A python3 environment;
* An installation of [flext](https://github.com/grrrr/flext/);
* cmake ;
* ninja (optional).
### Build with cmake

Thanks to the work of @fferri, the `CMakeLists.txt` has been largely purified.
The library can be build with wathever python3 environment ; to build with a conda environment for example, first activate that environment before running the following commands:
```bash
mkdir cmake-build
cd cmake-build
cmake .. \
-GNinja \ # optional, builds faster
-DFLEXT_BUILD_TYPE=[SINGLE | MULTI | SHARED] # SINGLE is default
```

The variable `FLEXT_BUILD_TYPE` allows the user to choose which version of flext to use for the build. `MULTI` and `SHARED` enable thread usage.

### Build with pd-lib-builder

See `readme.txt`.
## Pd configuration & usage

### Configuration

You should create a folder to hold your python scripts - we'll call it the pd script folder; ideally, place it alongside the folder that natively contains the pd externals (for example at `~/Documents/Pd/externals`).

* Open puredata and go to `File > Preferences > Edit Preferences` (*might be something along the lines of `Paths` for older pd versions*);
* Add the script folder to your search path.

If you want to work with scripts that are located somewhere else on your machine, you can create a link to that file in the pd script folder. That way, you can modify your file in place and the changes will be taken into account in puredata without having to move your file over and over again.

### Usage

There are plenty examples of patches the `pd` folder of this repo. Try them out !
10 changes: 9 additions & 1 deletion build/config-lnx.def
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# what is the base prefix of the Python installation?
ifdef PY_CONDA_ROOT
PYTHONPREFIX=$(PY_CONDA_ROOT)
else
PYTHONPREFIX=/usr
endif

# which Python version do you want to compile against?
PYTHONVERSION=2.4
PY_MAJOR_VERSION=3
PY_MINOR_VERSION=7

# uncomment if numpy/numarray/numeric support should be compiled in
# for info see http://numeric.scipy.org
Expand All @@ -15,3 +20,6 @@ PY_USE_GIL=1

# use inofficial (pure data) functionality
# PY_USE_INOFFICIAL=1

# use python with pymalloc (look for "pythonX.Ym" files)
PY_USE_PYMALLOC=1
18 changes: 12 additions & 6 deletions build/config-mac.def
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# set PY_DEFAULT=0 if you manually installed Python on your system
# (overriding the one that came with OS X by default)
PY_DEFAULT=1
# which kind of Python installation to use
# system - macOS system default
# local - local installation
# conda - conda environment; specify the environment root dir using the
# PY_CONDA_ROOT environment variable
PY_KIND=conda

#########################################################################

Expand All @@ -10,16 +13,16 @@ PY_DEFAULT=1
# Mac OSX 10.5 -> default Python version (major.minor) = 2.5
# Mac OSX 10.6 -> default Python version (major.minor) = 2.6

PY_MAJOR_VERSION=2
PY_MINOR_VERSION=6
PY_MAJOR_VERSION=3
PY_MINOR_VERSION=7

#########################################################################

# uncomment if numpy/numarray/numeric support should be compiled in
# for info see http://numeric.scipy.org
# numarray and numeric are outdated

# PY_NUMPY=1
PY_NUMPY=1
# PY_NUMARRAY=1
# PY_NUMERIC=1

Expand All @@ -30,3 +33,6 @@ PY_USE_GIL=1

# use inofficial (pure data) functionality
# PY_USE_INOFFICIAL=1

# use python with pymalloc (look for "pythonX.Ym" files)
PY_USE_PYMALLOC=1
15 changes: 15 additions & 0 deletions build/gnumake-lnx-gcc.inc
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
ifdef PY_USE_PYMALLOC
PYTHONVERSION=$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m
else
PYTHONVERSION=$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
endif

DEFS += -DPY_EXPORTS

INCPATH += -I$(PYTHONPREFIX)/include/python$(PYTHONVERSION)

ifdef PY_CONDA_ROOT
LIBPATH += -L$(PY_CONDA_ROOT)/lib
LDFLAGS += -Wl,-R$(PY_CONDA_ROOT)/lib
DEFS += -DPY_INTERPRETER=$(PY_CONDA_ROOT)/bin/python
endif

LIBS += -lpython$(PYTHONVERSION)

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif
ifdef PY_NUMPY
DEFS += -DPY_NUMPY
INCPATH += -I$(PYTHONPREFIX)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif
ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
Expand Down
69 changes: 53 additions & 16 deletions build/gnumake-mac-gcc.inc
Original file line number Diff line number Diff line change
@@ -1,42 +1,79 @@
DEFS += -DPY_EXPORTS

ifdef PY_NUMPY
DEFS += -DPY_NUMPY
endif

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif

ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
endif

ifdef PY_USE_GIL
DEFS += -DPY_USE_GIL
endif

ifdef PY_USE_INOFFICIAL
DEFS += -DPY_USE_INOFFICIAL
endif

ifeq ($(PY_KIND),conda)

ifndef PY_CONDA_ROOT
$(error PY_CONDA_ROOT is undefined)
endif

DEFS += -DPY_INTERPRETER=$(PY_CONDA_ROOT)/bin/python
INCPATH += -I$(PY_CONDA_ROOT)/include
ifdef PY_USE_PYMALLOC
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m.dylib
else
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION).dylib
endif
LDFLAGS += -rpath $(PY_CONDA_ROOT)/lib

ifdef PY_NUMPY
INCPATH += -I$(PY_CONDA_ROOT)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif

else

DEFS += -DPY_USE_FRAMEWORK

# don't use -framework Python, since this will stick to the default system version

_LOCAL_FRAMEWORK := /Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_SYSTEM_FRAMEWORK := /System/Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_LOCAL_LIBRARY := /Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_SYSTEM_LIBRARY := /System/Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)

DEFS += -DPY_EXPORTS
#INCPATH += -F/Library/Frameworks -framework Python
INCPATH += -F/Library/Frameworks -framework Python

ifeq ($(PY_DEFAULT),1)
ifeq ($(PY_KIND),system)
LIBS += $(_SYSTEM_FRAMEWORK)/Python
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Headers
else
LIBS += $(_LOCAL_FRAMEWORK)/Python
INCPATH += -I$(_LOCAL_FRAMEWORK)/Headers
endif

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif
ifdef PY_NUMPY
DEFS += -DPY_NUMPY
INCPATH += -I$(_LOCAL_LIBRARY)/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
ifeq ($(PY_DEFAULT),1)

ifeq ($(PY_KIND),system)
INCPATH += -I$(_SYSTEM_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Extras/lib/python/numpy/core/include
else
INCPATH += -I$(_LOCAL_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif
endif
ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
endif

ifdef PY_USE_GIL
DEFS += -DPY_USE_GIL
endif

ifdef PY_USE_INOFFICIAL
DEFS += -DPY_USE_INOFFICIAL
endif
#DEBUG = 1
#DFLAGS += -DFLEXT_DEBUG
2 changes: 1 addition & 1 deletion maxmsp/py.maxhelp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
, {
"box" : {
"maxclass" : "message",
"text" : "gain 0.5",
"text" : "set gain 0.5",
"fontsize" : 12.0,
"numinlets" : 2,
"patching_rect" : [ 100.77256, 1262.583496, 53.0, 18.0 ],
Expand Down
Loading