Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
project(
'quickjs-ng',
'c',
version: '0.10.1',
version: '0.11.0',
default_options: [
'c_std=gnu11,c11',
'warning_level=3',
'default_library=static',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the override work even if this is the default?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. However, the most use-cases I can think of (distributions, individuals) require shared libraries so hardcoding default_library=static seems like a bug to me.

Copy link
Author

@BalkanMadman BalkanMadman Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that the default for meson is default_library=shared, I don't really see a reason to override it in meson.build. Does your CI require it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's likely why it failed.

In addition our CMake setup defaults to static builds, so Meson should align to that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be okay with using meson defaults. cmake's default is more an accident of history that we inherit, I think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to build static libraries by default (in either CMake or meson)

In cmake it's controlled by a flag (-BUILD_SHARED_LIBS=ON or off), it's just that cmake defaults to static if not otherwise specified. Our CMakeListst.txt is agnostic as to whether it should produce static or shared libraries.

(Long-winded way of saying that whatever the cmake build does is not under discussion, it just is.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. The question is then does it make sense to build static libraries by default (in either CMake or meson)? I'd imagine most consumers of quickjs need shared libqjs.so rather than static libqjs.a.

I'd argue it's the opposite. Every tool I've seen out there installing JS engines like jsvu makes static builds.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, as far as I understand, tools installing JS engines mostly care about engine executables, not the provided lib. Obviously, the type of libqjs doesn't have influence on the executables.

For the consumers of the actual QuickJS-NG API, i.e. libqjs, it'd most likely be shared not static libraries they'd need.

In any case, that's not the hill to die on. I'm just arguing that, in my opinion, the consumers of your library API would prefer a shared lib, as with most other APIs out there.

The choice is up to you anyways.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry my bad. As long as building the executable statically links the library by default I don't think I care much about what the default for building a library is.

We haven't called a 1.0 yet so I think we have plenty of wiggle room to try things out.

Copy link
Author

@BalkanMadman BalkanMadman Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the shared library is built, then the executable is linked dynamically to it via executable(..., dependencies: qjs_dep).

For CI, the static (or shared) lib build can always be forced via the cmdline switch -Ddefault_library=(static|shared)

],
license: 'MIT',
license_files: 'LICENSE',
Expand Down
Loading