mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user