Godot Version
4.61
I did the godotcon2024 tutorial for creating a gd extension. This was easy enough.
Now I want to start playing with using a third party lib as part of an extension. The third party library requires cmake to build. Adding this in the cmake file for the extension was simple enough.
Edit:
Turns out cmake wasn’t working properly either as soon as I tried to use the library I ended up with errors, multiple times it prints x is
only available with ‘-std=c++20’ or ‘-std=gnu++20’Before adding the code to the extension I had did a poc and the folder layout was the same as it is now, with same cmake commands and it builds fine. Any suggestions? Yes I did add this to my CMakeLists.txt:
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED YES)
Figured out why this happening somewhere the following flag is set:
-std=gnu++17does anyone know where I can change this flag?
Further Edit:
Figured out how to set the flag to use c++ 20, addingset_property(TARGET ${LIBNAME} PROPERTY CXX_STANDARD 20)to CMakeLists.txt seems to have worked. But now I have a new error and need to find a different flag. The library uses iostreams which require exceptions to be enabled, and I can’t find where any of the flags are set, to enable exceptions. If I set the flags in the extension’s CMakeLists.txt the settings are overidden when the cmake file for godot-cpp is called. I see in the cmake file for godot-cpp that there are two calls to methodscompiler_detection()adngodotcpp_generateand I assume this is where my compiler flags are being overridden, any ideas?
However I want to make the build process agnostic and have already setup the necessary build targets for running scons and launching the extension. In order to set up scons I was checking out:
However I notice it is extremely out of date, and much of what it refers to does not mesh with the current template, and the summator example is very different then the one presented in the tutorial. At the top of the pages there is a link saying check this page in the stable branch for additions and corrections but the page is unavailable.
So I have two questions, what do I have to add to SConstruct to use cmake to build the third party lib or build it itself, and then include it as a link target. The src folder for the library is in the top level (lsp-framework) in the screenshot.
Second question is, does anyone have any links to more up to date documentation for creating gdextensions?
