Commit Graph

59 Commits (ab01d43edeab52987e1581a272ddc718f2560b35)

Author SHA1 Message Date
Samuel Nicholas 2402a044eb Re-Structure cmake solution to be closer to the scons solution.
This is just a single step, re-arranging the code without actually changing its functionality.

new docs/cmake.md
moved the block of comments from the start of the CMakeLists.txt into the cmake.md file and converted content to markdown.

new cmake/godotcpp.cmake
Moved all exposed options into a new function godotcpp_options()
Moved configuration and generation code into godotcpp_generate()

To get all the options into the godotcpp_options() I changed the logic of GODOT_USE_HOT_RELOAD which I believe is a closer match to scons, that if the options is not set, and the build type is not release, then it defaults to ON.

I msvc builds require the default flags to be modified or it will throw errors. I have added the links to articles in the commit, but its about removing the runtime error checks /RTC1 from the CMAKE_CXX_FLAGS_DEBUG variable. This needs to happen before the files are included.
https://stackoverflow.com/questions/74426638/how-to-remove-rtc1-from-specific-target-or-file-in-cmake
https://discourse.cmake.org/t/how-do-i-remove-compile-options-from-target/5965

Renamed GodotCompilerWarnings.cmake to common_compiler_flags.cmake to match scons

Included files explicitly by path, as we dont need to append to the CMAKE_MODULES_PATH which effects the whole build tree.

This prevents consumers of the library from clobbering the names of the cmake include files and breaking the build.
2024-09-24 16:27:28 +09:30
Samuel Nicholas 390a9a5590 Updated all variable names to use GODOT_ prefix
changed cache type for api file and api dir to FILEPATH and PATH respectively.
Minor whitespace.
docstring parity
2024-09-14 09:04:01 +09:30
Samuel Nicholas 02bdc6665a Add GODOT_SYMBOL_VISIBILITY cache variable to match scons interface. 2024-09-14 07:47:29 +09:30
David Snopek aed9b5c7df
Merge pull request #1563 from APokorny/visibility-hidden
Add visibility-hidden to CMake build
2024-09-11 10:29:12 -05:00
ytnuf 05571971cc Add hot reload support when building with GCC and CMake 2024-08-26 19:54:55 +01:00
Andreas Pokorny d18fa929fb Add visibility-hidden
This should make all symbols that are not marked otherwise have hidden
visibility. There still may be exposed symbols if marked with respective
attributes.
2024-08-26 13:20:51 +02:00
David Snopek e3e8101e8c
Merge pull request #1330 from pimms/cmake-hot-reload
Add hot reload support to CMakeLists.txt
2024-08-07 15:53:35 -05:00
Thaddeus Crews e0d363aad8
Integrate `.pre-commit-config.yaml` 2024-06-24 15:43:55 -05:00
ytnuf 5c12bd2287 Change cmake_minimum_required to match actual requirements
This is because target_link_options was added in v3.13
So this wouldn't build with cmake v3.12

Likewise in CMAKE_CXX_STANDARD only supports value of 17 starting with
cmake v3.9
So the test wouldn't build properly with cmake v3.6
2024-03-22 13:55:34 +00:00
Joakim Stien 0a078d9ec9 PR comments — added doc, default 'ON' in Debug, 'OFF' in Release 2023-12-10 11:25:38 +01:00
Joakim Stien 31179ee47c Added hot reload support to CMakeLists.txt 2023-12-09 15:14:44 +01:00
Rémi Verschelde 41517eacb1
CMake: Remove hardcoded warnings list and forcing -Werror on library builds
The CMake buildsystem should be completely reviewed to properly match
what is done by SCons, instead of making its own arbitrary decisions on
how godot-cpp should be compiled.

Currently the SCons setup doesn't include warning options, so CMake
shouldn't either. Options similar to upstream Godot's SCons setup could
be added, and then replicated for CMake.
2023-12-01 10:45:07 +01:00
Rémi Verschelde 4fed88afcf
Merge pull request #1307 from LAK132/master
Fix file list issues when trying to build with meson via cmake
2023-11-24 12:35:29 +01:00
LAK132 39c139c814 Fix file list issues when trying to build with meson via cmake 2023-11-11 23:29:33 +10:30
Bytzo db884e9b1d
Prevent CMake from always including debug symbols 2023-10-25 23:57:13 -07:00
Rémi Verschelde bf1c03ab5f
SCons: Disable C++ exception handling by default
Counterpart to https://github.com/godotengine/godot/pull/80612.
2023-10-22 12:45:46 +02:00
bruvzg d1aeba771a
[MSVC] Force UTF-8 encoding. 2023-07-11 16:11:51 +03:00
Alex 7f94f90b01 Update CMakeLists.txt 2023-05-06 09:55:41 +03:00
Andy Maloney 2379034958 {cmake} Use STATIC and POSITION_INDEPENDENT_CODE
Instead of specifying flags manually, use CMake.
2023-02-07 10:24:25 -05:00
Rémi Verschelde 50e97de636
Merge pull request #1008 from asmaloney/cmake-compiler-warnings
{cmake} Use the same compiler warnings as godot
2023-02-07 14:00:04 +01:00
Andy Maloney d081b4bab6 {cmake} Use the same compiler warnings as godot 2023-02-04 11:18:19 -05:00
Andy Maloney 2a221300de {cmake} Combine target_include_directories
Makes all include directories consistent.

Turns GODOT_CPP_SYSTEM_HEADERS ON by default since that's what was already being done for ${GODOT_GDEXTENSION_DIR}.
2023-02-02 12:58:03 -05:00
Andy Maloney 1351710a18 {cmake} Add GODOT_CPP_SYSTEM_HEADERS option to mark includes as SYSTEM
From the cmake docs:

"This may have effects such as suppressing warnings or skipping the contained headers in dependency calculations (see compiler documentation). Additionally, system include directories are searched after normal include directories regardless of the order specified."

Addresses part of #999
2023-01-18 21:15:34 -05:00
Ricardo Buring 47140cdad0 Rename float=64 build option to precision=double
This makes the build system consistent with Godot again.
Also fix CMake build to define REAL_T_IS_DOUBLE when precision=double.
2023-01-09 23:22:03 +01:00
Rémi Verschelde bab247dcb6
Rename godot-headers to gdextension, move header to top folder
Changes the `<godot/gdextension_interface.h>` include to simply
`<gdextension_interface.h>`.

Refactor and better document the SCons and CMake logic around setting
the paths to the header and API JSON file.
2022-12-14 12:36:59 +01:00
Gilles Roudière c02e644679 Rename GDNative to GDExtension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension -> Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION -> EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:06:38 +01:00
Andy Maloney bb13b957de {cmake} Updates for target-based approach
- instead of setting globals which can effect other projects including this as a subdirectory, set them on the target if possible
- add "CONFIGURE_DEPENDS" to GLOBs to check for changes
- update required CMake version to 3.12 (still ancient - 2018) to support these
2022-12-04 17:37:38 -05:00
Fabio Alessandrelli 081d425277 [MSVC] Add NOMINMAX flag to scons and cmake.
Ensures user inclusion of windows.h do not define "min" and "max"
macros.
2022-09-12 13:12:55 +02:00
Joshua Cooper 165ad14b0f CMake: fix CMAKE_BUILD_TYPE and BITS check 2022-07-18 13:01:04 +02:00
Rémi Verschelde 9b4519280a CMake: Fixup build after #732 2022-07-18 12:58:50 +02:00
Rémi Verschelde 3c73d1a7a2
CMake: Don't use `-fPIC` on Windows (#732) 2022-07-18 11:55:30 +02:00
bruvzg e06d5cd414
Add double precision build support. 2022-05-04 15:56:35 +03:00
Pxl b7ade95edc
Update CMakeLists.txt
fix compile fail when windows with llvm+ninja
2022-03-26 13:09:25 +08:00
Rémi Verschelde 82bc102581 Sync `misc/` scripts and hooks with upstream Godot 2022-03-15 10:18:33 +01:00
Nicolás Carrasco df87396cf3 Merge branch 'master' of https://github.com/godotengine/godot-cpp into test_cmake_windows 2022-02-20 22:59:56 +01:00
Nicolás Carrasco f227a0179f Fix Test CMake project for Windows and parametrize paths 2022-01-26 20:12:05 +01:00
Ivorius 3475ad69b3
In CMakeLists, use the new FindPython3 instead of FindPython 2021-12-29 15:02:38 +01:00
O01eg c5fd3d00d2
Test CMake project with CI (#518) 2021-12-24 01:29:21 +01:00
Bradley Clemetson c608277bcf
Require at least python 3 2021-12-11 15:32:49 -08:00
Nickolai Korshunov 5336c7e97b synced windows compile definitions with scons configuration
df9164b9bd
2021-11-11 15:19:16 +03:00
Hennadii Chernyshchyk 2f92b4a37d
Rework debug flags for CMake
* Attach debug flags to the target and mark as `PUBLIC`. This will allow all
  projects that use bindings not to add the same defines manually.
* Use generator-expressions to support multiconfig generators (such as
  MSVC).
* Remove excplitic `NDEBUG` and `_DEBUG` flags, CMake handles it
  automatically.
2021-10-03 17:30:37 +03:00
Bastiaan Olij 68ebc9b2a8 Changed over to proper godot-headers 2021-09-27 23:08:12 +10:00
Hennadii Chernyshchyk 50774cf0fb Add alias 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk f24dcf4ff9 Specify project languages 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk 3b40a38c66 Remove Generating Bindings message
Bindings are generated using `generate_bindings` and the command contains the `COMMENT` parameter, which will display a message about the generation.
2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk 6daaeb6dba Do not override build path 2021-09-27 23:08:09 +10:00
Hennadii Chernyshchyk a904518075 Fix OUTPUT for add_custom_command 2021-09-27 23:08:09 +10:00
George Marques 8bcf32a619 Fix issues with method calls 2021-09-27 23:08:08 +10:00
George Marques e4ed48976a Replace bindgins to work with extensions 2021-09-27 23:08:08 +10:00
Hristo Stamenov c629200b93
Update `string(TOLOWER ...)` to take string versions of CMake variables (#561)
On some generators (MSVC) there is the issue that this line produces cause by the variable being expanded and not being surrounded by quotes.
2021-05-20 14:47:20 +02:00