From 447b439db5ea1e9e4c0b22d53ba22a38d93f90c3 Mon Sep 17 00:00:00 2001 From: ssj71 Date: Thu, 23 Mar 2017 09:29:10 -0600 Subject: [PATCH] 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. --- development/cpp/custom_modules_in_cpp.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/development/cpp/custom_modules_in_cpp.rst b/development/cpp/custom_modules_in_cpp.rst index a279334ba..1a005afd8 100644 --- a/development/cpp/custom_modules_in_cpp.rst +++ b/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: