Commit Graph

16 Commits

Author SHA1 Message Date
Bob Nystrom
0aaf3eca7b fix: reorder libuv link flags and remove silent @ prefix from link commands
Reorder -luv before -lpthread in LIB_UV_LINK to fix potential linker ordering issues on some systems, and remove the @ prefix from the bin/ and test/ link commands to allow verbose output during linking.
2015-08-16 16:16:26 +00:00
Bob Nystrom
4d175783d7 fix: move pthread flag from global CFLAGS to libuv link step for Linux builds
The -pthread compiler flag was removed from the global CFLAGS and instead
incorporated into a new LIB_UV_LINK variable that includes -lpthread alongside
the libuv library path. This change applies the pthread linking only to
executables that depend on libuv (the CLI binary and test binary), rather than
to all compilation units, preventing potential issues with modules or static
library builds that do not require threading support.
2015-08-16 16:07:41 +00:00
Bob Nystrom
85487d9d8c feat: enable pthread flag for gcc builds on non-macOS platforms
Add -pthread to CFLAGS in the Linux/Unix shared library build path
to ensure proper thread support when compiling with gcc, which does
not enable it by default unlike some other compilers.
2015-08-08 16:14:52 +00:00
Bob Nystrom
283c64d713 fix: bump _XOPEN_SOURCE to 600 for libuv compatibility on Linux
The previous value of 500 was insufficient for libuv's POSIX requirements,
causing compilation failures on Linux systems. Upgrading to 600 ensures
the necessary POSIX 2004 extensions are available, allowing libuv to
function correctly with the build system.
2015-08-08 16:06:40 +00:00
Bob Nystrom
fc745b43ed feat: add CLI_FLAGS variable with _XOPEN_SOURCE=500 and consolidate include paths for cli, module, and test targets 2015-08-08 15:57:57 +00:00
Bob Nystrom
0f4d3025b8 fix: adjust libuv build paths for Linux output directory and parameterize in Makefile 2015-08-08 14:40:27 +00:00
Bob Nystrom
810da1f0fc feat: add libuv event loop integration with timer module and CLI restructuring
Add a vertical slice of real libuv integration by introducing a "timer" CLI module with a Timer class and static sleep() method. This required significant infrastructure changes: setting up libuv event loop in the CLI, creating a new src/module directory for CLI modules, updating all build scripts (Makefile, wren.mk, Xcode project) to handle the new module compilation, and reorganizing CLI code by moving REPL logic from main.c to vm.c. The generate_builtins.py script was also updated to support copying Wren sources into the module directory.
2015-08-07 15:10:55 +00:00
Bob Nystrom
e24d9ef0c3 feat: integrate libuv as external dependency for CLI and add separate vm build target
Add a Python script to download and compile libuv v1.6.1, hook it into the Makefile so release and debug targets depend on the static library, and link libuv when building the CLI interpreter. Introduce a new "vm" target that builds only the VM library without requiring libuv. Update the Xcode project to link libuv.a into the executable.
2015-08-02 17:43:38 +00:00
Bob Nystrom
3901ab57e7 feat: add C API test infrastructure with foreign method binding support
Add a new test framework for exercising the Wren C embedding API directly from C code, including a Makefile target, test runner modifications, and the first API test case for boolean return values. The build system now compiles test sources from `test/api/` into a separate test executable, and the CLI's `createVM` and `runFile` functions accept an optional `WrenBindForeignMethodFn` callback to enable foreign method binding in tests. The test runner (`script/test.py`) is refactored to support both script and API test types, passing the test name instead of the full path for API tests. The initial `return_bool` test verifies that `wrenReturnBool` correctly returns `true` and `false` from foreign methods.
2015-05-24 16:23:30 +00:00
Bob Nystrom
80b24b50e8 refactor: split CFLAGS into C_WARNINGS and C_OPTIONS with pretty-printed build output
Split the monolithic CFLAGS variable into separate C_WARNINGS (warning flags) and C_OPTIONS (optimization, language, architecture flags) to improve maintainability. Added pretty-printed build commands using printf for cleaner terminal output during compilation and archiving.
2015-03-24 14:51:48 +00:00
Bob Nystrom
580f04be1a chore: remove redundant -Wsign-compare -Wtype-limits -Wuninitialized from CFLAGS in wren.mk
The build configuration in script/wren.mk had three redundant warning flags
(-Wsign-compare, -Wtype-limits, -Wuninitialized) that were already covered
by -Wextra. Also updated the TODO comment to explain why -Wno-unused-parameter
remains necessary due to heavy callback usage in Wren's codebase.
2015-03-23 05:17:29 +00:00
Peter Reijnders
0ddef2c17f chore: enable -Wextra compiler flag and suppress unused-parameter warnings
Enable the -Wextra compiler flag in the wren.mk build configuration, which was previously commented out with a TODO. To handle the new unused parameter warnings triggered by -Wextra (particularly for WrenVM* vm parameters in several functions), add -Wno-unused-parameter to suppress them. Also fix a declaration ordering issue in wren_vm.c where the 'static' keyword was placed after the return type in loadIntoCore, moving it to the correct position before the type specifier.
2015-02-28 12:52:48 +00:00
Bob Nystrom
18cf57d5f5 refactor: split source tree into vm/ and cli/ directories with updated build system
Separate Wren VM library sources from CLI tool sources by moving them into
src/vm/ and src/cli/ subdirectories respectively. Update the Makefile to use
separate wildcard patterns for each directory, generate distinct object file
paths under build/vm/ and build/cli/, and adjust include paths to src/include.
Also update the Xcode project file to reference the new file locations.
2015-03-14 22:00:50 +00:00
Bob Nystrom
3e37778acb fix: fallback to gcc when cc is missing on MinGW in wren.mk
The OS detection now uses `gcc -dumpmachine` directly instead of `$(CC)` to avoid failures when CC is not defined by MSYS. Additionally, when the OS is detected as mingw32, CC is explicitly set to gcc to work around missing cc executable on some MinGW versions.
2015-03-01 17:25:48 +00:00
Bob Nystrom
c9f0dcde66 fix: convert signed integer types to unsigned in core and value modules to eliminate -Wsign-compare warnings
- Change `int` to `uint32_t` for iterator indices in `map_iterate` and `string_iterate` to match capacity/length types
- Update `String.length` field type from `int` to `uint32_t` in `wren_utils.h`
- Modify `wrenStringCodePointAt` parameter type from `int` to `uint32_t` and remove redundant negative index assertion
- Convert loop variable in `markMap` from `int` to `uint32_t` to match `map->capacity` type
- Add `-Wsign-compare`, `-Wtype-limits`, and `-Wuninitialized` compiler flags to catch future mismatches
2015-02-25 05:56:33 +00:00
Bob Nystrom
2cdc57dda8 feat: restructure Makefile to delegate builds to script/wren.mk and output to bin/ and lib/ directories
The monolithic Makefile is replaced with a thin wrapper that invokes
script/wren.mk for each configuration. Build artifacts are now placed
in bin/ (executables) and lib/ (static/shared libraries) instead of
the project root. The .gitignore is updated accordingly, and the
getting-started documentation reflects the new output layout.
2015-02-22 18:19:23 +00:00