|
| 1 | +# Example usage: |
| 2 | +# jam -j$(nproc) - build using all cpu cores |
| 3 | +# jam clean - remove all build files |
| 4 | +# |
| 5 | +# Documentation for jam can be found at /boot/system/documentation/packages/jam |
| 6 | +# * Jamfile.html provides a good reference for those writing Jamfiles. |
| 7 | +# * Jambase.html documents the built-in rules. |
| 8 | +# * Jam.html documents syntax and the jam command usage. |
| 9 | + |
| 10 | +## Utility rules |
| 11 | +# Maybe these should be built-in to Jambase. |
| 12 | + |
| 13 | +# To create a shared library from some object files... |
| 14 | +rule SharedLibraryFromObjects |
| 15 | +{ |
| 16 | +# Compile as if creating an executable |
| 17 | +MainFromObjects $(<) : $(>) ; |
| 18 | +# But build with the -shared flag when linking |
| 19 | +LINKFLAGS on $(<) = [ on $(<) return $(LINKFLAGS) ] -shared ; |
| 20 | +} |
| 21 | + |
| 22 | +# To create a shared library from some code files... |
| 23 | +rule SharedLibrary |
| 24 | +{ |
| 25 | +# Compile the input files into .o files |
| 26 | +Objects $(>) ; |
| 27 | +# Then turn those .o files into a single .so file |
| 28 | +SharedLibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ; |
| 29 | +# Remove .o file after .so is made |
| 30 | +RmTemps $(<) : $(>:S=$(SUFOBJ)) ; |
| 31 | +} |
| 32 | + |
| 33 | +# To create a soft link, run the following command in the terminal. |
| 34 | +# This replaces the built-in SoftLink action. |
| 35 | +actions SoftLink |
| 36 | +{ |
| 37 | +$(RM) $(<) && $(LN) -sr $(>) $(<) |
| 38 | +} |
| 39 | + |
| 40 | +## Main build file |
| 41 | + |
| 42 | +# Where to search for .cpp files |
| 43 | +SEARCH_SOURCE += bindings/interface bindings/app api ; |
| 44 | + |
| 45 | +# Where to look for header files |
| 46 | +SubDirHdrs /system/lib/python3.9/vendor-packages/pybind11/include/ ; |
| 47 | +SubDirHdrs /system/develop/headers/python3.9/ ; |
| 48 | + |
| 49 | +# Additional C++ flags to use when compiling |
| 50 | +SubDirC++Flags -std=c++14 -pipe -fPIC ; |
| 51 | + |
| 52 | +# Flags to use when linking |
| 53 | +LINKLIBS = -lbe ; |
| 54 | + |
| 55 | +# Where to put the generated build files |
| 56 | +LOCATE_TARGET = bin/x86_64 ; # TODO: hardcoded arch |
| 57 | + |
| 58 | +# The source files that we want to compile: |
| 59 | +local sourceFiles = |
| 60 | +# AppKit |
| 61 | +AppDefs.cpp |
| 62 | +Application.cpp |
| 63 | +Clipboard.cpp |
| 64 | +Cursor.cpp |
| 65 | +Handler.cpp |
| 66 | +Invoker.cpp |
| 67 | +Key.cpp |
| 68 | +KeyStore.cpp |
| 69 | +Looper.cpp |
| 70 | +Message.cpp |
| 71 | +MessageFilter.cpp |
| 72 | +MessageQueue.cpp |
| 73 | +MessageRunner.cpp |
| 74 | +Messenger.cpp |
| 75 | +Notification.cpp |
| 76 | +PropertyInfo.cpp |
| 77 | +Roster.cpp |
| 78 | + |
| 79 | +# InterfaceKit |
| 80 | +Button.cpp |
| 81 | +Control.cpp |
| 82 | +Rect.cpp |
| 83 | +StringView.cpp |
| 84 | +TextControl.cpp |
| 85 | +View.cpp |
| 86 | +Window.cpp |
| 87 | +Font.cpp ; |
| 88 | + |
| 89 | +# The shared library Be.so can be built from the sourceFiles |
| 90 | +SharedLibrary Be.so : $(sourceFiles) ; |
| 91 | + |
| 92 | +# Create all the symlinks to Be.so |
| 93 | +for sourceFile in $(sourceFiles) { |
| 94 | +# replace sourceFile's suffix (aka file extension) with .so |
| 95 | +libFile = $(sourceFile:S=.so) ; |
| 96 | + |
| 97 | +# $(libFile) can be made by symlinking to Be.so |
| 98 | +SoftLink $(LOCATE_TARGET)/$(libFile) : Be.so ; |
| 99 | +} |