-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDExtension build prototype #294
base: master
Are you sure you want to change the base?
Changes from 26 commits
ef2a4c2
49ee950
9c91e24
6d138a0
53f2703
0899c8b
86ec8ef
e59be0a
7bc1090
6f6ce3d
5e8a0b5
12b5988
8e363b2
5e7f6d6
26c9570
29cae46
ba00d9a
d10e044
9277bbe
463fe6e
1f52957
58961ee
e6d3298
50e257f
3e4a34a
f1eaa18
081e842
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ out/ | |
.vs/ | ||
build/ | ||
.vscode/ | ||
.cache | ||
.cache | ||
.clang-format |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,16 +122,16 @@ if(NOT OSP_USE_SYSTEM_SDL) | |
SET(SDL_VIRTUAL_JOYSTICK ON CACHE BOOL "" FORCE) | ||
|
||
SET(LIBSAMPLERATE ON CACHE BOOL "" FORCE) | ||
SET(LIBSAMPLERATE_SHARED ON CACHE BOOL "" FORCE) | ||
SET(LIBSAMPLERATE_SHARED OFF CACHE BOOL "" FORCE) | ||
|
||
SET(SDL_EVENTS ON CACHE BOOL "" FORCE) | ||
SET(SDL_THREADS ON CACHE BOOL "" FORCE) | ||
|
||
# This assumes you want to have SDL as a static library. If not, set SDL_STATIC | ||
# to OFF instead. | ||
SET(SDL_DLOPEN ON CACHE BOOL "" FORCE) | ||
SET(SDL_SHARED ON CACHE BOOL "" FORCE) | ||
SET(SDL_STATIC OFF CACHE BOOL "" FORCE) | ||
SET(SDL_DLOPEN OFF CACHE BOOL "" FORCE) | ||
SET(SDL_SHARED OFF CACHE BOOL "" FORCE) | ||
SET(SDL_STATIC ON CACHE BOOL "" FORCE) | ||
|
||
SET(SDL2_DISABLE_SDL2MAIN ON CACHE BOOL "" FORCE) | ||
SET(SDL2_DISABLE_INSTALL ON CACHE BOOL "" FORCE) | ||
|
@@ -186,31 +186,23 @@ SET(MAGNUM_WITH_DEBUGTOOLS OFF CACHE BOOL "" FORCE) | |
SET(MAGNUM_WITH_MESHTOOLS ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SCENEGRAPH OFF CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SCENETOOLS OFF CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SHADERS ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SHADERTOOLS OFF CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_TEXT OFF CACHE BOOL "" FORCE) | ||
|
||
IF (OSP_BUILD_TESTAPP) | ||
SET(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_SHADERS ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_GL ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_TARGET_GL ON CACHE BOOL "" FORCE) | ||
ENDIF() | ||
|
||
ADD_SUBDIRECTORY(magnum EXCLUDE_FROM_ALL) | ||
|
||
SET(MAGNUM_WITH_TINYGLTFIMPORTER ON CACHE BOOL "" FORCE) | ||
SET(MAGNUM_WITH_STBIMAGEIMPORTER ON CACHE BOOL "" FORCE) | ||
ADD_SUBDIRECTORY(magnum-plugins EXCLUDE_FROM_ALL) | ||
|
||
SET(NEWTON_BUILD_SANDBOX_DEMOS OFF CACHE BOOL "" FORCE) | ||
SET(NEWTON_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) | ||
SET(NEWTON_USE_PLUGIN_DLL OFF CACHE BOOL "" FORCE) | ||
SET(NEWTON_WITH_AVX_PLUGIN OFF CACHE BOOL "" FORCE) | ||
SET(NEWTON_WITH_REFERENCE_GPU_PLUGIN OFF CACHE BOOL "" FORCE) | ||
ADD_SUBDIRECTORY(newton-dynamics/newton-3.14/ EXCLUDE_FROM_ALL) | ||
|
||
# Newton sets CMAKE_ARCHIVE_OUTPUT_DIRECTORY and CMAKE_LIBRARY_OUTPUT_DIRECTORY | ||
# for UNIX, so manually set each target to our desired location | ||
SET_TARGET_PROPERTIES(dAnimation dContainers dCustomJoints dMath dModel dNewton dScene dVehicle dgCore dgPhysics newton PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" | ||
) | ||
|
||
ADD_SUBDIRECTORY(entt EXCLUDE_FROM_ALL) | ||
|
||
# toml11 3.8.0 added a check for this global variable, which they should not have. | ||
|
@@ -222,32 +214,44 @@ ADD_SUBDIRECTORY(toml11 EXCLUDE_FROM_ALL) | |
SET(SPDLOG_ENABLE_PCH ON CACHE BOOL "" FORCE) | ||
# Not yet supported by github runners | ||
# SET(SPDLOG_USE_STD_FORMAT ON CACHE BOOL "" FORCE) | ||
SET(SPDLOG_BUILD_PIC ON CACHE BOOL "" FORCE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate on this? I don't mind it, but i'm curious to know your reasons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly, I had a link error due to positionning in spdlog, I saw there was a flag, I enabled it, it fixed the error. |
||
ADD_SUBDIRECTORY(spdlog EXCLUDE_FROM_ALL) | ||
ADD_SUBDIRECTORY(longeronpp EXCLUDE_FROM_ALL) | ||
|
||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
ADD_SUBDIRECTORY(googletest EXCLUDE_FROM_ALL) | ||
|
||
SET(FT_DISABLE_ZLIB ON CACHE BOOL "" FORCE) | ||
SET(FT_DISABLE_BZIP2 ON CACHE BOOL "" FORCE) | ||
SET(FT_DISABLE_PNG ON CACHE BOOL "" FORCE) | ||
SET(FT_DISABLE_HARFBUZZ ON CACHE BOOL "" FORCE) | ||
SET(FT_DISABLE_BROTLI ON CACHE BOOL "" FORCE) | ||
SET(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE) | ||
SET(SKIP_INSTALL_LIBRARIES ON CACHE BOOL "" FORCE) | ||
SET(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) | ||
ADD_SUBDIRECTORY(freetype EXCLUDE_FROM_ALL) | ||
|
||
INSTALL(TARGETS freetype | ||
EXPORT RmlUiTargets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
# SET(FT_DISABLE_ZLIB ON CACHE BOOL "" FORCE) | ||
# SET(FT_DISABLE_BZIP2 ON CACHE BOOL "" FORCE) | ||
# SET(FT_DISABLE_PNG ON CACHE BOOL "" FORCE) | ||
# SET(FT_DISABLE_HARFBUZZ ON CACHE BOOL "" FORCE) | ||
# SET(FT_DISABLE_BROTLI ON CACHE BOOL "" FORCE) | ||
# SET(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE) | ||
# SET(SKIP_INSTALL_LIBRARIES ON CACHE BOOL "" FORCE) | ||
# SET(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) | ||
# ADD_SUBDIRECTORY(freetype EXCLUDE_FROM_ALL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if i recall correctly, we only need freetype for RmlUi. So if we're going to go full steam on godot, then we can just drop RmlUi and freetype. but in general, best not to leave commented out code in the source files. |
||
|
||
# INSTALL(TARGETS freetype | ||
# EXPORT RmlUiTargets | ||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
# ) | ||
|
||
SET(RML_SKIP_INSTALL ON CACHE BOOL "" FORCE) | ||
SET(CUSTOM_CONFIGURATION ON CACHE BOOL "" FORCE) | ||
#ADD_SUBDIRECTORY(RmlUi EXCLUDE_FROM_ALL) | ||
SET(ENABLE_ALL_WARNINGS OFF CACHE BOOL "" FORCE) | ||
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh lovely, Jolt doesn't namespace it's options? Rather selfish of them. |
||
ADD_SUBDIRECTORY(JoltPhysics/Build EXCLUDE_FROM_ALL) | ||
set_property(TARGET Jolt PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
|
||
SET( GODOT_CPP_SYSTEM_HEADERS ON CACHE BOOL "" FORCE ) | ||
|
||
ADD_SUBDIRECTORY( godot-cpp EXCLUDE_FROM_ALL) | ||
|
||
SET_TARGET_PROPERTIES( godot-cpp | ||
PROPERTIES | ||
CXX_VISIBILITY_PRESET hidden # visibility needs to be the same as the main library | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,11 @@ IF(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT CMAKE_SYSTEM_VERSION) | |
SET(CMAKE_SYSTEM_VERSION "10.0.18362.0" CACHE INTERNAL "" FORCE) | ||
ENDIF() | ||
|
||
#build universally on macOS | ||
if ( APPLE ) | ||
set( CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" ) | ||
endif() | ||
|
||
# Set project name | ||
PROJECT(OSP-MAGNUM CXX) | ||
|
||
|
@@ -56,6 +61,8 @@ OPTION(OSP_ENABLE_COMPILER_WARNINGS "Build with the majority of compiler warning | |
OPTION(OSP_ENABLE_IWYU "Build with warnings from IWYU turned on" OFF) | ||
OPTION(OSP_ENABLE_CLANG_TIDY "Build with warnings from clang-tidy turned on" OFF) | ||
OPTION(OSP_USE_SYSTEM_SDL "Build with SDL that you provide if turned on, compiles SDL if turned off. Off by default" OFF) | ||
OPTION(OSP_BUILD_TESTAPP "Build OSP TestApp with Magnum, OpenGL, and SDL2" ON) | ||
OPTION(OSP_BUILD_GDEXTENSION "Build OSP GDExtension" OFF) | ||
|
||
# If the environment has these set, pull them into proper variables. | ||
SET(CLANG_COMPILE_FLAGS ${CLANG_COMPILE_FLAGS}) | ||
|
@@ -138,6 +145,7 @@ IF(MSVC) | |
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>) | ||
# Force dynamic runtime library to be in debug mode in debug mode. | ||
add_compile_options($<$<CONFIG:Debug>:$<$<CXX_COMPILER_ID:MSVC>:/MDd>>) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is already supposed to be the behavior that cmake has by default. https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure this is something for the Jolt PR, it was what was causing the windows compile error in debug mode in the CI. Adding that line fixed it. Maybe something in Jolt breaks it somehow ... If that's the case, it might be better to upstream a fix in the long term. |
||
add_compile_options($<$<CONFIG:Release>:$<$<CXX_COMPILER_ID:MSVC>:/MD>>) | ||
# Don't generate a blah.manifest file for each build target. | ||
add_link_options(LINKER:/MANIFEST:NO) | ||
ELSEIF(UNIX) | ||
|
@@ -163,4 +171,3 @@ ADD_SUBDIRECTORY(test) | |
# Set OSP as default startup project in Visual Studio | ||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT osp-magnum) | ||
# Set execution directory of osp-magnum so that we don't have to copy the files | ||
set_property(TARGET osp-magnum PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably specify a branch (latest LTS? so 4.2 right now), the README for https://github.com/godotengine/godot-cpp?tab=readme-ov-file#versioning indicates tracking master is not a good idea unless you are building Godot from source to match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fully up to date on how the
.gitmodules
file works so maybe a new feature was added since i last looked, but as far as I understand, there isn't a way to explicitly indicate a branch in this file, and you have to instead rely on specifying the exact commit you want to refer to.If they've added "Give me the latest in branch X" support, or "Give me whatever tag Y points to" support, i'd be happy to hear about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll put the commit number, I'm pretty sure it's specified in the releases.