project('cell', ['c', 'cpp'], version: '0.9.3', meson_version: '>=1.4', default_options : [ 'cpp_std=c++11', 'default_library=static']) libtype = get_option('default_library') link = [] src = [] add_project_arguments( '-Wno-incompatible-pointer-types', '-Wno-missing-braces', '-Wno-strict-prototypes', '-Wno-unused-function', '-Wno-int-conversion', language: 'c' ) add_project_arguments('-Wno-narrowing', language: 'cpp') deps = [] if host_machine.system() == 'darwin' add_project_arguments('-x', 'objective-c', language: 'c') fworks = [ 'CoreFoundation', 'CFNetwork', ] foreach fkit : fworks deps += dependency('appleframeworks', modules: fkit) endforeach endif if host_machine.system() == 'playdate' add_project_arguments('-DTARGET_PLAYDATE', language: 'c') endif link_args = link sources = [] src += [ # core 'qjs_blob.c', 'monocypher.c', 'cell.c', 'wildmatch.c', 'qjs_actor.c', 'qjs_wota.c', 'miniz.c', 'quickjs.c', 'libregexp.c', 'libunicode.c', 'cutils.c', 'dtoa.c' ] src += ['scheduler.c'] scripts = [ 'internal/nota.c', 'debug/js.c', 'qop.c', 'wildstar.c', 'fit.c', 'crypto.c', 'internal/text.c', 'utf8.c', 'internal/kim.c', 'time.c', 'internal/nota.c', 'debug/debug.c', 'internal/os.c', 'fd.c', 'net/http.c', 'net/enet.c', 'wildstar.c', 'archive/miniz.c', 'internal/json.c', ] foreach file: scripts sources += files(file) endforeach srceng = 'source' includes = [srceng, 'internal', 'debug', 'net', 'archive', 'math'] foreach file : src full_path = join_paths(srceng, file) sources += files(full_path) endforeach includers = [] foreach inc : includes includers += include_directories(inc) endforeach if host_machine.system() == 'windows' exe_ext = '.exe' link += '-Wl,--export-all-symbols' else exe_ext = '' link += '-Wl,-export_dynamic' endif cell_so = shared_library( 'cell_runtime', sources, include_directories: includers, dependencies: deps, install : true, ) # Determine RPATH based on OS # MacOS uses @loader_path, Linux uses $ORIGIN # We include both the current directory (for build) and ../lib (for install) rpath_dirs = [] if host_machine.system() == 'darwin' rpath_dirs += ['@loader_path', '@loader_path/../lib'] elif host_machine.system() == 'linux' rpath_dirs += ['$ORIGIN', '$ORIGIN/../lib'] endif # Create main executable linked against the cell library cell_exe = executable('cell', 'source/main.c', dependencies: deps, include_directories: includers, link_with: cell_so, link_args: link, build_rpath: ':'.join(rpath_dirs), install: true ) # Install headers for building dynamic libraries using Cell install_headers('source/cell.h') install_headers('source/quickjs.h') install_headers('source/wota.h')