How to run a python script as pre-build step?

Comments

3 comments

  • Avatar
    Axel Wachtler

    So I can resolve my post with the following remarks:

    Python needs to be in the System-Path

    • for Windows it needs to be set explicitely,
    • on Linux it is most probably already there

    Run the script in the Pre-Compile-Command with:

    python$(HostEXE) $(ProjectDir)/Tools/myscript.py <more args w/ macros beeing expanded>

    This works fine on Linux and Windows.

    0
    Comment actions Permalink
  • Avatar
    Axel Wachtler

    Next question: since pre-compile is executed before each source file, that is going to be compiled, is there something like a user defined prebuild execution step? That means that I'm looking for a step, that is executed "once", e.g the Makefile syntax would look like:

    my_generated_file.h: my_input_file.json
    python Tool/myscript.py $< $@

     

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    The command doesn't need to be applied to all source files, it can be set on just one file. There is an example of something similar at https://rowley.zendesk.com/hc/en-us/community/posts/205387253--get-the-current-Subversion-version-number-

    0
    Comment actions Permalink

Please sign in to leave a comment.