stdlib: relocate modules under library/
- examples/modules/ -> library/modules/ (top-level, no more symlink hacks in consumer projects) - compiler discovers stdlib via _NSGetExecutablePath / readlink /proc/self/exe; searches dev layout (../../library), install layout (../library), and alongside-binary fallback - SX_STDLIB_PATH env var overrides for tests / dev convenience - SX_DEBUG_STDLIB env var dumps the discovery results - build.zig installs library/ alongside the binary - Compilation gains stdlib_paths field threaded through resolveImports - 50 tests pass; consumer projects can now build from any cwd
This commit is contained in:
4
library/modules/testpkg/cwd_test.sx
Normal file
4
library/modules/testpkg/cwd_test.sx
Normal file
@@ -0,0 +1,4 @@
|
||||
// This file lives in modules/testpkg/ and imports std relative to its directory.
|
||||
#import "../std.sx";
|
||||
|
||||
cwd_greet :: () -> string { format("cwd-import-ok"); }
|
||||
1
library/modules/testpkg/greet.sx
Normal file
1
library/modules/testpkg/greet.sx
Normal file
@@ -0,0 +1 @@
|
||||
hello :: () -> string { "hello from testpkg"; }
|
||||
2
library/modules/testpkg/math.sx
Normal file
2
library/modules/testpkg/math.sx
Normal file
@@ -0,0 +1,2 @@
|
||||
add :: (a: s32, b: s32) -> s32 { a + b; }
|
||||
mul :: (a: s32, b: s32) -> s32 { a * b; }
|
||||
Reference in New Issue
Block a user