- Create a new project:
- macOS > Framework & Library > Bundle
- Name: Max
- Bundle extension: mxo
- Add a new target:
- macOS > Framework & Library > Library
- Product name: Pd
- Framework: None (Plain C/C++ Library)
- Type: Dynamic
- Rename the project to
template~
:- Uncheck the targets from the project content items
- Close the project
- Reorganize the files in Finder following the next structure:
DAO-MaxMSP-Pd
├── _COMMON_
│ ├── ConfigMax.xcconfig
│ ├── ConfigPd.xcconfig
| └── Info.plist
├── _SDK_
│ ├── max-sdk (git submodule)
│ └── pure-data (git submodule)
└── template~
├── Products
│ ├── template.maxpat
│ └── template.pd
├── Source
│ ├── template~common.c
│ ├── template~common.h
│ ├── template~max.c
│ └── template~pd.c
└── Xcode
└── template~.xcodeproj
- Open the project
- Delete the folder Max in Xcode's project navigator
- Add a New Group without Folder named Config:
- Add the
ConfigMax.xcconfig
andConfigPd.xcconfig
files
- Add the
- Select the project info:
- Set the configuration targets for debug and release
- Select the Max target and delete the next build settings (to select the custom configuration):
- Installation Directory
- Skip Install
- Info.plist File
- Product Bundle Identifier
- Product name
- Select the Pd target and delete the next build settings (to select the custom configuration):
- Executable prefix
- Info.plist File
- Product name
- Add a scheme named All:
- Add both targets to its Build phase
- Manage schemes and check the Shared box in every scheme
- Edit the Max and Pd schemes and add the executables for debugging:
- For Max:
/Applications/Max.app
- For Pd:
/Applications/Pd.app/Contents/Resources/bin/pd
- For Max:
- Add a New Group without Folder named Source
- Add new source files and select the corresponding target membership for each file:
template~common.c
(Max)template~common.h
template~max.c
(Both)template~pd.c
(Pd)
- Add new source files and select the corresponding target membership for each file:
- Copy an existing project and paste it into a folder with the new name
- Open the Xcode project
- Rename the project (and the targets)
- Rename all the source files:
- Separator
~
for msp and_
for max objects
- Separator
- Search for all occurrences of the old name and replace them with the new name:
- Search for
oldname
replace withnewname
- If the new external is a max-only object:
- Search for
oldname~
replace withnewname
- In the Pd initialization routine name:
void name_tilde_setup(void)
, remove_tilde
- Search for
- Adjust indentation in the initialization of the class
- Search for
- Close the Xcode project and delete the
DerivedData
folder - Open the Xcode project and build and test the externals
- Create a Win32 Console application:
- Name it
template~.vcxproj
- DLL
- Empty project
- Name it
- Close the project
- Reorganize the file in Windows Explorer following the next structure:
DAO-MaxMSP-Pd
├── _COMMON_
│ ├── ConfigMax.props
│ └── ConfigPd.props
├── _SDK_
│ ├── max-sdk (git submodule)
│ └── pure-data (git submodule)
│ └── src/pd.lib (manually added from the installed application folder)
└── template~
├── Products
│ ├── template.maxpat
│ └── template.pd
├── Source
│ ├── template~common.c
│ ├── template~common.h
│ ├── template~max.c
│ └── template~pd.c
└── VisualStudio
├── template~.vcxproj
└── template~.vcxproj.user
- Open the project
- Open the Build Configuration Manager
- Rename the Project Configurations to
MaxDebug
andMaxRelease
- Create new configurations called
PdDebug
andPdRelease
based on the two existing ones - Open the Property Manager
- Add the existing property sheets to the configurations of Max and Pd
- Open the Project Properties:
- Select All Configurations and All Platforms
- Debugging > Command > $(APPLICATION)
- Add new C files
template~common.c
template~common.h
template~max.c
template~pd.c
- Exclude Max and Pd source files from build:
- Right-click on the file
template~max.c
and select Properties- Select All Platforms
- For Configurations
PdDebug
andPdRelease
, select Exclude From Build = Yes
- Right-click on the file
template~pd.c
and select Properties- Select All Platforms
- For Configurations
MaxDebug
andMaxRelease
, select Exclude From Build = Yes
- Right-click on the file
- Right-click on the project and select Unload Project
- Right-click on the project and select Edit target~.vcxproj
- Paste the next text before the tag
</Project>
:
<Target Name="AfterClean"> <Delete Files="$(PRODUCTS)\$(ProjectName).$(EXTENSION)" ContinueOnError="true" /> </Target>
- Close the text editor of the project
- Right-click on the project and select Reload Project
- Copy an existing project and paste it into a folder with the new name
- Rename the Visual Studio project and the source code files:
- Separator
~
for msp and_
for max objects
- Separator
- Open the project and the source code files with a text editor (not with Visual Studio)
- Search for all occurrences of the old name and replace them with the new name:
- Search for
oldname
replace withnewname
- If the new external is a max-only object:
- Search for
oldname~
replace withnewname_
- In the Pd initialization routine name:
void name_tilde_setup(void)
, remove_tilde
- Search for
- Adjust indentation in the initialization of the class
- Search for
- Open the Visual Studio project and build and test the externals
The makefile in the folder of each external detects the name of the external to build, so no action is needed to create a new project when copying an existing project as a template. The local makefile in each external's folder calls a global makefile located in the _COMMON_ folder. This global makefile is shared among all externals in the repository and defines the build targets. The makefile also detects the operating system and the right target is selected accordingly. The variable BBB=1
can be passed to cross-compile the externals for the BeagleBone Black + Bela Cape from a host operating system (cross-compilation was tested only on macOS using the Linaro toolchain).
Below is the folder structure that is assumed:
DAO-MaxMSP-Pd
├── _COMMON_
│ └── MakefilePd.mk (the global makefile)
├── _SDK_
│ └── pure-data (git submodule)
└── template~
├── Products
│ ├── _main.pd (used to run the Pd patch on the BBB+Bela)
│ ├── template.maxpat
│ └── template.pd
├── Source
│ ├── template~common.c
│ ├── template~common.h
│ ├── template~max.c
│ └── template~pd.c
└── Makefile
└── Makefile.mk (the local makefile)