Forráskód Böngészése

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.
ssj71 8 éve
szülő
commit
447b439db5
1 módosított fájl, 20 hozzáadás és 0 törlés
  1. 20 0
      development/cpp/custom_modules_in_cpp.rst

+ 20 - 0
development/cpp/custom_modules_in_cpp.rst

@@ -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: