diff options
author | QuentinCaffeino <sergey95zu@gmail.com> | 2018-02-25 16:25:42 +0100 |
---|---|---|
committer | QuentinCaffeino <sergey95zu@gmail.com> | 2018-02-25 16:25:42 +0100 |
commit | 43f57c7f80a3014fa8d9491420ca33ff93968625 (patch) | |
tree | 334231203f09d75cf7c582bc9969ebca37c4b335 /README.md | |
parent | 38cfd627f394862bf09ce9c44bc270f3b230ad98 (diff) | |
download | redot-cpp-43f57c7f80a3014fa8d9491420ca33ff93968625.tar.gz |
Bindings are generated by default; Replaced generate with regenerate flag; Updated readme
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 57 |
1 files changed, 24 insertions, 33 deletions
@@ -1,54 +1,45 @@ -# cpp_bindings +# godot-cpp C++ bindings for the Godot script API # Creating a GDNative library (Linux) Create a directory named `SimpleLibrary` with subdirectories `lib, src` -Getting latest `cpp_bindings` and `godot_headers` +Getting latest `godot-cpp` and `godot_headers` ``` -$ cd SimpleLibrary -$ git clone https://github.com/GodotNativeTools/cpp_bindings +$ git clone https://github.com/GodotNativeTools/godot-cpp $ git clone https://github.com/GodotNativeTools/godot_headers ``` -right now our directory structure should look like this +right now our directory structure should look like this: ``` -[SimpleLibrary] - ├── cpp_bindings/ - ├── godot_headers/ - ├── lib/ - └── src/ +godot-cpp +godot_headers +SimpleLibrary +├── lib/ +└── src/ ``` Now to generate cpp bindings ``` -$ cd cpp_bindings -``` - -Edit `SConstruct` file and assign your godot executable path at line:7 `godot_bin_path = "../godot_fork/bin/"`, - -Building cpp_bindings -``` -$ scons godotbinpath="../godot_fork/bin/godot_binary" headers="../godot_headers/" p=linux generate_bindings=yes +$ cd godot-cpp +$ scons godotbinpath="../godot_fork/bin/godot_binary" p=linux +$ cd .. ``` resulting libraries will be placed under `bin/` and the generated headers will be placed under `include/*` **Note:** -> `generate_bindings=yes` is used to generate C++ bindings (`godot_api.json` - Godot API) +> `regenerate_bindings=yes` is used to force regenerating C++ bindings (`godot_api.json` - Godot API) + > Include `use_llvm=yes` for using clang++ -Copy binding libraries into the `SimpleLibrary/lib` folder -``` -$ cd .. -$ cp cpp_bindings/bin/libgodot_cpp_bindings.a lib/ -``` + And our directory structure will be ``` -[SimpleLibrary] - ├── cpp_bindings/ - ├── godot_headers/ - ├── lib/ - │ └──libgodot_cpp_bindings.a - └── src/ +godot-cpp +└── bin/libgodot-cpp.a +godot_headers +SimpleLibrary +├── lib/ +└── src/ ``` # Creating simple class @@ -115,9 +106,9 @@ extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) # Compiling ``` -$ cd .. -$ clang -fPIC -o src/init.os -c src/init.cpp -g -O3 -std=c++14 -Icpp_bindings/include -Igodot_headers -$ clang -o lib/libtest.so -shared src/init.os -Llib -lgodot_cpp_bindings +$ cd SimpleLibrary +$ clang -fPIC -o src/init.os -c src/init.cpp -g -O3 -std=c++14 -I../godot-cpp/include -Igodot_headers +$ clang -o lib/libtest.so -shared src/init.os -L../godot-cpp/lib -lgodot-cpp ``` This creates the file `libtest.so` in your `SimpleLibrary/lib` directory. For windows you need to find out what compiler flags need to be used. |