0

For portability reasons, I'd like to compile lua from source when I compile my C++ code. I use lua to read input file.

If I understand correctly, lua's readme mentions that it's possible to do that through src/Makefile. I can't really read it that well. Has anyone figured out how to do it?

is it possible to have it in one command? gcc .... bonus: how to put it in cmake ?

lhf
  • 70,581
  • 9
  • 108
  • 149
kirill_igum
  • 3,953
  • 5
  • 47
  • 73

1 Answers1

0

Lua has a makefile that needs your target platform to build to so you will need to specify make [target platform].

But that is right in the beginning of the readme.

You could try to call the make command from inside your build process.

Cheers [UPDATE based on the comments]

If you use:

make a PLAT=[target platform]

on the command line in the src directory it will only build the liblua.a library for the target platform then you will just need to copy that file to wherever you need and link against it.

prmottajr
  • 1,816
  • 1
  • 13
  • 22
  • I should clarify. I'm not looking for a compilation of the whole lua together with interperter. I only need the part that links to the c++ code. and i want it to compile with the c++ code so that the whole program is portable and I know for sure that lua and my c++ code compiled with the same compiler. – kirill_igum Dec 11 '13 at 19:01
  • If you are not going to change Lua you could pre-compile it and provide it as a dynamic linked library for the platforms you intend to deploy. – prmottajr Dec 11 '13 at 20:03
  • that's what I don't want to do. I want to avoid having a dynamic library so that I can compile it all at once on different systems or using different compilers. – kirill_igum Dec 11 '13 at 21:33