-
Hi, Is it possible to add support for cross-compilation? For example, we can set |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You just need to use a different C compiler or CFLAGS. I do this with |
Beta Was this translation helpful? Give feedback.
-
A missing feature for cross-compilation is for nelua to know, at nelua compile-time, before the C compiler gets the result, what the target platform is. This would allow a program to use linux APIs when compiling to Linux, and Windows APIs when compiling to windows. An example of a library like that is https://github.com/treeform/puppy , which uses completely different underlying HTTP client libraries depending on the platform. As is, tests like Of course a workaround is to have the build system inject globals: ## if target.os == 'windows' then
print 'on windows'
## elseif target.os == 'linux' then
print 'on linux'
## else static_error('unsupported target') end Compiled as:
But without a convention, libraries like puppy aren't as convenient |
Beta Was this translation helpful? Give feedback.
You just need to use a different C compiler or CFLAGS. I do this with
nelua --cc=x86_64-w64-mingw32-gcc helloworld.nelua
for example to cross compile to Windows while on Linux andnelua --cc=emcc helloworld.nelua
to cross compile to WebAssembly. Usually any platform that supports C is supported.