xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.87k stars 776 forks source link

Improve Vala support #5302

Closed al1-ce closed 2 months ago

al1-ce commented 2 months ago

When compiling multiple files valac fails to find symbols (i.e SomeClass from a.vala using in b.vala), changed build to process all source files at once

waruqi commented 2 months ago

Did you test other examples.

e.g. https://github.com/xmake-io/xmake/tree/dev/tests/projects/vala/staticlib

it does not work.

and others. https://github.com/xmake-io/xmake/tree/dev/tests/projects/vala

al1-ce commented 2 months ago

Checking rn

al1-ce commented 2 months ago

Strange, vala/lua test doesn't compile even with upstream rule file...

al1-ce commented 2 months ago

Implemented requested changes, all tests passing except for lua, but lua fails because of xmake (and maybe arch linux, it has headers who knows where) coz gcc fails to find lua includes from -Llua flag

Also fixed vala.vapidir and vala.flags not being applied and fixed vala.vapifile and vala.header locations being incorrect

al1-ce commented 2 months ago

Couldn't get valac build to run only when needed, but everything else should be correct now

waruqi commented 2 months ago

But incremental compilation still doesn't work.

bash-5.2$ xmake
[ 20%]: compiling.vala src/mymath.vala
[ 70%]: compiling.vala src/main.vala
[100%]: build ok, spent 0.588s

bash-5.2$ xmake
[ 20%]: compiling.vala src/mymath.vala
[ 70%]: compiling.vala src/main.vala
[100%]: build ok, spent 0.571s
al1-ce commented 2 months ago

Oh, I think I'm starting to understand how batchcmds work, not completely though... Hard to figure out, not that much documentation about it, except for examples which do not explain anything

waruqi commented 2 months ago

Oh, I think I'm starting to understand how batchcmds work, not completely though... Hard to figure out, not that much documentation about it, except for examples which do not explain anything

https://xmake.io/#/manual/custom_rule?id=custom-batch-compile-script-process-one-source-file-at-a-time

al1-ce commented 2 months ago

https://xmake.io/#/manual/custom_rule?id=custom-batch-compile-script-process-one-source-file-at-a-time

Again, shows how, but now why. Maybe worth adding some explaining comments to it?

Anyway, thanks for taking time to review and merge my PR