2024-11-21 00:30:48 +00:00
|
|
|
cmake_minimum_required(VERSION 3.17)
|
|
|
|
|
|
|
|
#[=======================================================================[.rst:
|
|
|
|
|
|
|
|
CMake Version requirements
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
To enable use of the emscripten emsdk hack for pseudo shared library support
|
|
|
|
without polluting options for consumers we need to use the
|
|
|
|
CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE which was introduced in version 3.17
|
|
|
|
|
|
|
|
Scons Compatibility
|
|
|
|
-------------------
|
|
|
|
|
2024-11-26 09:14:37 +00:00
|
|
|
There is an understandable conflict between build systems as they define
|
|
|
|
similar concepts in different ways. When there isn't a 1:1 relationship,
|
|
|
|
compromises need to be made to resolve those differences.
|
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
As we are attempting to maintain feature parity, and ease of maintenance, these
|
2024-11-26 09:14:37 +00:00
|
|
|
CMake scripts are built to resemble the SCons build system wherever possible.
|
2024-09-12 04:11:18 +00:00
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
The file structure and file content are made to match, if not in content then
|
|
|
|
in spirit. The closer the two build systems look the easier they will be to
|
|
|
|
maintain.
|
2018-12-02 20:07:26 +00:00
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
Where the SCons additional scripts in the tools directory, The CMake scripts
|
|
|
|
are in the cmake directory.
|
2018-12-02 20:07:26 +00:00
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
For example, the tools/godotcpp.py is sourced into SCons, and the 'options'
|
|
|
|
function is run.
|
2022-12-03 21:43:00 +00:00
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
.. highlight:: python
|
|
|
|
|
|
|
|
cpp_tool = Tool("godotcpp", toolpath=["tools"])
|
|
|
|
cpp_tool.options(opts, env)
|
|
|
|
|
|
|
|
The CMake equivalent is below.
|
|
|
|
]=======================================================================]
|
|
|
|
|
|
|
|
include( cmake/godotcpp.cmake )
|
2024-09-18 22:41:03 +00:00
|
|
|
godotcpp_options()
|
2022-12-03 21:43:00 +00:00
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
#[[ Python is required for code generation ]]
|
|
|
|
find_package(Python3 3.4 REQUIRED) # pathlib should be present
|
|
|
|
|
|
|
|
# Define our project.
|
|
|
|
project( godot-cpp
|
|
|
|
VERSION 4.4
|
|
|
|
DESCRIPTION "C++ bindings for the Godot Engine's GDExtensions API."
|
|
|
|
HOMEPAGE_URL "https://github.com/godotengine/godot-cpp"
|
|
|
|
LANGUAGES CXX)
|
|
|
|
|
2024-09-18 22:41:03 +00:00
|
|
|
godotcpp_generate()
|
2024-11-21 00:30:48 +00:00
|
|
|
|
|
|
|
# Test Example
|
|
|
|
add_subdirectory( test )
|