55 Commits

Author SHA1 Message Date
David Snopek
fe68c22c3e Generate GDExtension interface header and loader from JSON 2025-12-18 12:09:41 -06:00
David Snopek
ee2a174746 Merge pull request #1880 from guillaumeriousat/make-noexcept-flag-private
CMake: Make -fno-exceptions private
2025-11-30 06:05:14 -06:00
David Snopek
f47a4d5400 Merge pull request #1869 from enetheru/issue-1830
CMake: Fix missing -sUSE_PTHREADS=1 in web build
2025-11-26 05:05:24 -06:00
Guillaume Riou
7d114d8d28 make -fno-exceptions private 2025-11-12 15:17:23 -05:00
David Snopek
d033e8abea On Linux default use_static_cpp to disabled 2025-11-01 08:31:46 -05:00
Samuel Nicholas
42b03da2b1 CMake: Fix missing -sUSE_PTHREADS=1 in web build
- add -sUSE_PTHREADS=1 to link flags
- add =1 to sSIDE_MODULE=1 in compile flags to match scons.
2025-10-20 08:25:55 +10:30
Lukas Tenbrink
c7873e1355 Migrate cmake docs to the godot docs. 2025-10-05 11:10:29 +02:00
David Snopek
449e37fa21 Merge pull request #1814 from enetheru/suffix.fix
CMake: Remove starting `.` from GODOTCPP_SUFFIX
2025-08-21 08:45:26 -05:00
Pāvels Nadtočajevs
8646cd31b5 Sync Android SDK and NDK versions with the engine. 2025-08-06 22:48:13 +03:00
Samuel Nicholas
b64b941adf CMake: Add GODOTCPP_SUFFIX_GENEX variable
This is the same as GODOTCPP_SUFFIX but without the leading '.'
GODOTCPP_SUFFIX is  then based on the above.
2025-07-11 11:30:34 +09:30
David Snopek
86e32cef4a Merge pull request #1786 from marcmarmir/CMake-message-improvement
Fix: Add STATUS to CMake message commands missing them
2025-06-10 07:02:37 -05:00
marcin.mirski
0c2e66e414 Improve CMAKE_BUILD_PARALLEL_LEVEL message 2025-06-05 11:48:03 -07:00
marcin.mirski
8eac097c37 Fix: Add STATUS to CMake message commands missing them 2025-06-04 16:54:45 -07:00
Dyllan Cole
4824aa41e8 Fix incorrect binding_generator_generate_bindings variable names 2025-05-31 19:23:50 -04:00
Samuel Nicholas
b195a51c6c Match #1758 build option changes
d634a5f8c4 (diff-e2225522e55739f1533a3ce9eee58324ac9c192c8ba30065067964347d22fdacL471)
2025-04-17 08:46:58 +09:30
Samuel Nicholas
b6c0251296 CMake: Update CI
- Duplicated the ci.yml into ci-scons.yml and ci-cmake.yml
- Replaced some manual shell commands to detect changes with  tj-actions/changed-files@v45
- Conditionally run the CI depending on what files change.
- Add ios toolchain from leetal/ios-cmake
- Added a cmake-minimum of 3.10 to silence errors from ios toolchain
2025-04-05 13:31:52 +10:30
David Snopek
c2d688bae6 Merge pull request #1747 from unvermuthet/linux-use-static-cpp
Implement `use_static_cpp` flag for Linux
2025-04-02 12:59:04 -05:00
unvermuthet
b0f41909e0 Implement use_static_cpp flag for Linux 2025-04-01 22:35:40 +02:00
Pāvels Nadtočajevs
d239da3221 [macOS] Remove unnecessary Cocoa reference. 2025-03-28 08:45:43 +02:00
David Snopek
67ca2fbbad Merge pull request #1740 from enetheru/privatise
CMake: public/private flags
2025-03-14 09:20:46 -05:00
Samuel Nicholas
5eb16d0c5b CMake: public/private flags
Made all warnings private.
Warning as error private
Consistency in  generator expressions
2025-03-14 11:11:15 +10:30
Samuel Nicholas
f83f364144 CMake: XCode dependency chain fixes - remastered
When attempting to generate XCode projects it would fail due to the target dependency chain not meeting expectations.

This PR, adds the required dependency infomation so that the XCode generator works.
2025-03-14 10:10:33 +10:30
David Snopek
9f02db1eb8 Merge pull request #1733 from enetheru/single_target_test
CMake: Revert to single cmake target
2025-03-13 11:42:15 -05:00
Samuel Nicholas
89abe15268 CMake: Target as configuration option
Add GODOTCPP_TARGET configuration option
Remove loop to generate the godot-cpp.<target> CMake Targets

Rename test bindings target
Update documentation
2025-03-12 08:58:59 +10:30
ytnuf
43690cb60b Remove unnecessary forced -fno-exceptions for web builds
The SCons build doesn't do this, so neither should CMake
Excpetions are already handled by DISABLE_EXCEPTIONS option
2025-03-10 13:33:56 +00:00
David Snopek
a3f89217df Merge pull request #1723 from enetheru/comments
CMake: Comment Cleanup
2025-03-06 08:21:53 -06:00
Samuel Nicholas
8b33e73353 CMake: default target when godot-cpp is top level
People seem to want to build godot-cpp without any arguments, not even specifying a target.

We have to detect if we are top level though because it conflicts with being consumed.
2025-03-07 00:04:36 +10:30
Samuel Nicholas
671e309cfa Updating commenting to be consistent 2025-03-06 23:57:02 +10:30
Samuel Nicholas
2f6d7f2dad add gersemi to pre-commit hooks for CMake formatting like black 2025-03-04 13:58:39 +10:30
Samuel Nicholas
d0dd282d73 CMake: Rename all GODOT_ to GODOTCPP_
This is for discussion primarily at this stage.
2025-03-01 10:50:55 +10:30
Samuel Nicholas
e7f07dab87 CMake: Add generate_bindings custom target
I was working on something today and wanted to just generate the bindings separately to compilation.

This PR adds a custom target to do just that.
2025-02-26 23:02:59 +10:30
Samuel Nicholas
23c24073f4 CMake: Create destination folder for doc_source.cpp generation
When compiling using 'MinGW Makefiles' the folders aren't created automatically.
2025-02-18 07:11:53 +10:30
David Snopek
79f9bc9600 Merge pull request #1708 from enetheru/arch_confusion
CMake: Fix unknown architecture and simplify OSX_ARCHITECTURES
2025-02-17 11:04:34 -06:00
David Snopek
3f54a86554 Merge pull request #1707 from enetheru/cmake_module
CMake: GodotCPPModule.cmake
2025-02-17 11:04:25 -06:00
Samuel Nicholas
18a926e836 CMake: Fix for #1699 msvc runtime selection issues
Previously I eschewed the use of CMAKE_MSVC_RUNTIME_LIBRARY in favour of setting the flags using target_compile_options so that they would propagate to consumers.

However, it has been raised that a dependency( independent to godot-cpp ) that doesn't set any runtime flags, which relies purely on the CMAKE_MSVC_RUNTIME_LIBRARY variable will very likely not have the correct msvc runtime flags set.

Where MSVC documentation states "All modules passed to a given invocation of the linker must have been compiled with the same runtime library compiler option (/MD, /MT, /LD)."

It was also mentioned that message type WARNING is not ideal for notifying consumers.

So I have updated the cmake code to use CMAKE_MSVC_RUNTIME_LIBRARY  over target-compile_options. And set it as a CACHE STRING variable so that it can be overridden if desired. We still message consumers, but as a NOTICE.
2025-02-15 18:28:12 +10:30
Samuel Nicholas
35469fd839 Turn python_callouts.cmake into GodotCPPModule.cmake
Move the find_package for python into it.
Recommend adding godot-cpp/cmake to CMAKE_MODULE_PATH and using include( GodotCPPModule ) to use functions.
Add target_doc_sources function to simplify the addition of documentation to a binary.
2025-02-15 09:04:12 +10:30
Samuel Nicholas
9d9099adcd Simplified architecture naming to reduce confusion 2025-02-09 18:08:53 +10:30
Samuel Nicholas
91f81f51e1 CMake: Implement 'threads' Option
Add the GODOT_THREADS option and related supporting code
Includes naming cleanups
2025-02-04 09:08:35 +10:30
Samuel Nicholas
9ce7a71cbf CMake: Fix #1690 - DEBUG_FEATURES generator expression
As described in issue #1690 the expression needs to depend on TARGET_ALIAS not TARGET_NAME.

This was introduced when I was solving the naming conflict issues and I missed this usage.
2025-01-23 14:36:48 +10:30
Samuel Nicholas
8814ac51ac CMake: Support for XML documentation
Add new function generate_doc_source to python_callouts.cmake
Update Test extension to use generate_doc_source function and include generated file in the build.

Cleanup:
Fix godotcpp.py imports after rebase
Pre-Commit hook sorted python imports in doc_source_generator.py
- replace ${CMAKE_CURRENT_SOURCE_DIR} with ${godot-cpp_SOURCE_DIR} when referencing current working directory and script locations when invoking python scripts.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2025-01-13 08:28:42 +10:30
Samuel Nicholas
ae198fe860 CMake: Support using build_profile.json
Add python_callouts.py to hold functions which call python utilities
- generate trimmed API
- generate file list
- generate bindings

if GODOT_BUILD_PROFILE is specified, a trimmed API file is created in the CMAKE_CURRENT_BINARY_DIR and used as the source for binding generation

Simplify Code Generation Variables
- use generator expressions
- use math for bits
- simplify if statements
2025-01-11 12:22:22 +10:30
Samuel Nicholas
6f7293cef4 Alleviate CMake target name clashes, visibility, and grouping.
Simplify <platform>_generate cmake function signature, as TARGET_ALIAS and TARGET_NAME are still in scope and do not need to be passed.
Add USE_FOLDERS, and FOLDER properties to group targets in VS and XCode
Guard test target with GODOT_ENABLE_TESTING
Generate all three variants in the form godot-cpp.test.<target> to remove the -DTEST_TARGET option clutter.
Update the docs/cmake.rst with information about the testing target
Update the Github CI
2024-12-29 09:54:55 +10:30
Samuel Nicholas
ef9778a392 CMake: Enable using clang-cl on windows
detect clang with MSVC frontend using CMAKE_CXX_COMPILER_FRONTEND_VARIANT
2024-12-09 11:58:40 +10:30
Samuel Nicholas
542ab19a21 CMake: Handle GODOT_DEV_BUILD flag correctly
.dev is added to output artifacts
Warn users for specifying dev_build and Release build config
Update documentation with deviations to SCons
Update debug_symbols handling, its rolled into build config
Cleanup helper variables and comments
2024-12-07 09:50:59 +10:30
David Snopek
163189fba9 Merge pull request #1660 from enetheru/exclude_typo
CMake: Replace empty ${EXCLUDE} variable with EXCLUDE_FROM_ALL
2024-12-06 16:08:27 -06:00
Samuel Nicholas
9df3a66a88 Replace empty EXCLUDE variable with EXCLUDE_FROM_ALL
This was a mistake left over from the modernise PR
2024-12-05 09:16:11 +10:30
Samuel Nicholas
732df06a81 CMake: Fix selection of MSVC Runtime compile flags
My last attempt at solving this was not correct. I have left lots of comments in the source detailing the issue as it will effect consumers.
2024-12-05 09:15:40 +10:30
David Snopek
af4eaa76d7 Merge pull request #1649 from enetheru/fix-backward-break
CMake: fix break for build prior to modernisation PR
2024-11-28 06:58:57 -06:00
Samuel Nicholas
b7dbd26d8f Align MSVC runtime (MD[d], MT) options to engine #1647
Engine has an option to link to MDd debug_crt
add flag to SCons options
Add flag to CMAKE options
2024-11-28 13:46:41 +10:30
Samuel Nicholas
597055d13c CMake: re-add the godot::cpp alias pointing to template_debug
So that builds that relied on the alias already wont break.
2024-11-26 19:42:33 +10:30