examples for custom module SCsub

I needed to add multiple files and include paths and it took me a bit
of digging to figure out how to do it. Hopefully this will help the next guy.
This commit is contained in:
ssj71
2017-04-04 07:53:07 +02:00
committed by Rémi Verschelde
parent 4f9d2ba16f
commit 447b439db5
+20
View File
@@ -158,6 +158,26 @@ this module:
env.add_source_files(env.modules_sources,"*.cpp") # just add all cpp files to the build
With multiple sources, you can also add each file individually to a Python
string list:
.. code:: python
src_list = ["summator.cpp", "other.cpp", "etc.cpp"]
env.add_source_files(env.modules_sources, src_list)
This allows for powerful possibilities using Python to contruct the file list
using loops and logic statements. Look at some of the other modules that ship
with Godot by default for examples.
To add include directories for the compiler to look at you can append it to the
environment's paths:
.. code:: python
env.Append(CPPPATH="mylib/include") # this is a relative path
env.Append(CPPPATH="#myotherlib/include") # this is an 'absolute' path
If you want to add custom compiler flags when building your module, you need to clone
`env` first, so it won't add those flags to whole Godot build (which can cause errors).
Example `SCsub` with custom flags: