LUA – How to build a custom tool from the Premake build script?

I use protocol buffers for data serialization in my C application. I want to add a call to the protoc code generator in my premake build script (to ensure that the generated class The latest state, and avoid storing the generated source under version control).

Even their FAQ has questions and answers about this, but the answer is very incomplete for me. Have the ability to call any The lua function is great, but where exactly do I make a call? I need to run the protoc compiler before building the application or unit tests.

You can of course start from Premake The script calls external code. But please remember: Premake script is used to generate build files: Makefile, C project, etc. Run the Premake script before building the project.

If you want this preprocessing in the actual Run outside of the build file (not by make, VC, Code::Blocks, etc.), then this is easy. Lua’s os.execute will execute the command line.

The Premake script is still a Lua script. All Premake commands are just Lua calls to functions defined by Premake. Premake executes scripts and then uses the data in them to generate build files. So all your Lua codes are run during the execution of the script. The position of this command in the script is irrelevant Important; no matter where it is, it will be executed before the build file is generated.

I use protocol buffers for data serialization in my C application. I want to My premake build script adds the call of the protoc code generator (so as to ensure the latest state of the generated classes and avoid storing the generated source under version control).

Even their FAQ There are also questions and answers, but the answer is very incomplete for me. It is good to be able to call any lua function, but where exactly do I make a call? I need to run the protoc compiler before building applications or unit tests.

Of course you can call external code from Premake script. But remember: Premake script Used to generate build files: Makefile, C projects, etc. Run the Premake script before building the project.

If you want this preprocessing to run outside of the actual build file (not by make, VC , Code::Blocks, etc.), then this is easy. Lua’s os.execute will execute the command line.

Premake scripts are still Lua scripts. All Premake commands are just Lua calls to functions defined by Premake Premake executes the scripts and then uses the data in them to generate build files. So all your Lua code runs during the execution of the script. It doesn’t matter where you put this command in the script; no matter where it is, it will be generating the build Execute before the file.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3209 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.