-
Notifications
You must be signed in to change notification settings - Fork 6
Add thirdparty rendering deps as submodules #12
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -5,5 +5,6 @@ bits/ | |
| cmake-build-*/ | ||
| bin/ | ||
| build/ | ||
| graph/ | ||
|
|
||
| CMakeUserPresets.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [submodule "engine/native/thirdparty/bx"] | ||
| path = engine/native/thirdparty/bx | ||
| url = https://github.com/bkaradzic/bx | ||
| [submodule "engine/native/thirdparty/bimg"] | ||
| path = engine/native/thirdparty/bimg | ||
| url = https://github.com/bkaradzic/bimg | ||
| [submodule "engine/native/thirdparty/bgfx"] | ||
| path = engine/native/thirdparty/bgfx | ||
| url = https://github.com/bkaradzic/bgfx |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| include(Compiler) | ||
| include(Modules) | ||
|
|
||
| add_subdirectory(thirdparty) | ||
AR-DEV-1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| add_modules_library(core SHARED) | ||
| target_link_libraries(core PUBLIC definitions math) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| set(BGFX_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) | ||
| set(BGFX_BUILD_TOOLS OFF CACHE BOOL "" FORCE) | ||
| set(BGFX_INSTALL OFF CACHE BOOL "" FORCE) | ||
| set(CMAKE_CXX_SCAN_FOR_MODULES OFF) | ||
|
|
||
| set(BX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bx CACHE STRING "" FORCE) | ||
| set(BIMG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bimg CACHE STRING "" FORCE) | ||
| set(BGFX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bgfx CACHE STRING "" FORCE) | ||
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bx bx-build) | ||
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bimg bimg-build) | ||
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfx bgfx-build) | ||
|
|
||
| target_link_libraries(bgfx PUBLIC bx bimg) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||||||
| @PACKAGE_INIT@ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if(@BGFX_CMAKE_USER_SCRIPT_PRESENT@) | ||||||||||||||||||||||
| include("${CMAKE_CURRENT_LIST_DIR}/@BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME@") | ||||||||||||||||||||||
| endif() | ||||||||||||||||||||||
| include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") | ||||||||||||||||||||||
| get_target_property(BGFX_INCLUDE_PATH bgfx::bgfx INTERFACE_INCLUDE_DIRECTORIES) | ||||||||||||||||||||||
| list(GET BGFX_INCLUDE_PATH 0 BGFX_INCLUDE_PATH_1) # bgfx::bgfx exports include directory twice? | ||||||||||||||||||||||
| set(BGFX_SHADER_INCLUDE_PATH ${BGFX_INCLUDE_PATH_1}/bgfx) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # If cross compiling, we need a host-compatible version of shaderc to compile shaders | ||||||||||||||||||||||
| macro(_bgfx_crosscompile_use_host_tool TOOL_NAME) | ||||||||||||||||||||||
| if(NOT TARGET bgfx::${TOOL_NAME}) | ||||||||||||||||||||||
| find_program( | ||||||||||||||||||||||
| ${TOOL_NAME}_EXECUTABLE | ||||||||||||||||||||||
| NAMES bgfx-${TOOL_NAME} ${TOOL_NAME} | ||||||||||||||||||||||
| PATHS @BGFX_ADDITIONAL_TOOL_PATHS@ /usr/bin | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| add_executable(bgfx::${TOOL_NAME} IMPORTED) | ||||||||||||||||||||||
| set_target_properties(bgfx::${TOOL_NAME} PROPERTIES IMPORTED_LOCATION "${${TOOL_NAME}_EXECUTABLE}") | ||||||||||||||||||||||
|
Comment on lines
+13
to
+20
Contributor
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. 🧩 Analysis chain🏁 Script executed: # First, let's find and read the Config.cmake.in file to see the exact code
fd -t f "Config.cmake.in" engine/native/thirdparty/cmake/Repository: Redot-Engine/DraconicEngine Length of output: 117 🏁 Script executed: # Read the file to see the context around lines 13-20
cat -n engine/native/thirdparty/cmake/Config.cmake.in | head -40Repository: Redot-Engine/DraconicEngine Length of output: 1512 🏁 Script executed: # Find bgfxToolUtils.cmake to see how these targets are used
fd -t f "bgfxToolUtils.cmake" engine/native/Repository: Redot-Engine/DraconicEngine Length of output: 121 🏁 Script executed: # Search for references to the tool targets (geometryc, etc.) in bgfxToolUtils.cmake
rg -n "bgfx::" engine/native/thirdparty/cmake/bgfxToolUtils.cmake -A 2 -B 2Repository: Redot-Engine/DraconicEngine Length of output: 1498 Create host-tool targets only after When 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| endif() | ||||||||||||||||||||||
| endmacro() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _bgfx_crosscompile_use_host_tool(bin2c) | ||||||||||||||||||||||
| _bgfx_crosscompile_use_host_tool(texturec) | ||||||||||||||||||||||
| _bgfx_crosscompile_use_host_tool(shaderc) | ||||||||||||||||||||||
| _bgfx_crosscompile_use_host_tool(texturev) | ||||||||||||||||||||||
| _bgfx_crosscompile_use_host_tool(geometryv) | ||||||||||||||||||||||
|
Comment on lines
+24
to
+28
Contributor
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. 🧩 Analysis chain🏁 Script executed: cat -n engine/native/thirdparty/cmake/Config.cmake.in | sed -n '20,35p'Repository: Redot-Engine/DraconicEngine Length of output: 591 🏁 Script executed: rg "bgfx_compile_geometry" -A 10 -B 2Repository: Redot-Engine/DraconicEngine Length of output: 1909 🏁 Script executed: rg "geometryc|geometryv" --type cmakeRepository: Redot-Engine/DraconicEngine Length of output: 3380 Replace
Suggested fix _bgfx_crosscompile_use_host_tool(bin2c)
_bgfx_crosscompile_use_host_tool(texturec)
_bgfx_crosscompile_use_host_tool(shaderc)
_bgfx_crosscompile_use_host_tool(texturev)
-_bgfx_crosscompile_use_host_tool(geometryv)
+_bgfx_crosscompile_use_host_tool(geometryc)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| include("${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake") | ||||||||||||||||||||||
| check_required_components("@PROJECT_NAME@") | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # bgfx.cmake - bgfx building in cmake | ||
| # Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com> | ||
| # | ||
| # To the extent possible under law, the author(s) have dedicated all copyright | ||
| # and related and neighboring rights to this software to the public domain | ||
| # worldwide. This software is distributed without any warranty. | ||
| # | ||
| # You should have received a copy of the CC0 Public Domain Dedication along with | ||
| # this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
|
|
||
| # Ensure the directory exists | ||
| if(NOT IS_DIRECTORY ${BGFX_DIR}) | ||
| message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}") | ||
| return() | ||
| endif() | ||
|
|
||
| if(NOT DEAR_IMGUI_LIBRARIES) | ||
| file( | ||
| GLOB # | ||
| DEAR_IMGUI_SOURCES # | ||
| ${BGFX_DIR}/3rdparty/dear-imgui/*.cpp # | ||
| ${BGFX_DIR}/3rdparty/dear-imgui/*.h # | ||
| ${BGFX_DIR}/3rdparty/dear-imgui/*.inl # | ||
| ) | ||
| set(DEAR_IMGUI_INCLUDE_DIR ${BGFX_DIR}/3rdparty) | ||
| endif() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # bgfx.cmake - bgfx building in cmake | ||
| # Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com> | ||
| # | ||
| # To the extent possible under law, the author(s) have dedicated all copyright | ||
| # and related and neighboring rights to this software to the public domain | ||
| # worldwide. This software is distributed without any warranty. | ||
| # | ||
| # You should have received a copy of the CC0 Public Domain Dedication along with | ||
| # this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
|
|
||
| # Ensure the directory exists | ||
| if(NOT IS_DIRECTORY ${BGFX_DIR}) | ||
| message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}") | ||
| return() | ||
| endif() | ||
|
|
||
| set(FCPP_DIR ${BGFX_DIR}/3rdparty/fcpp) | ||
|
|
||
| file( | ||
| GLOB | ||
| FCPP_SOURCES | ||
| ${FCPP_DIR}/*.h | ||
| ${FCPP_DIR}/cpp1.c | ||
| ${FCPP_DIR}/cpp2.c | ||
| ${FCPP_DIR}/cpp3.c | ||
| ${FCPP_DIR}/cpp4.c | ||
| ${FCPP_DIR}/cpp5.c | ||
| ${FCPP_DIR}/cpp6.c | ||
| ${FCPP_DIR}/cpp6.c | ||
| ) | ||
|
|
||
| add_library(fcpp STATIC ${FCPP_SOURCES}) | ||
|
|
||
| target_compile_definitions( | ||
| fcpp | ||
| PRIVATE "NINCLUDE=64" # | ||
| "NWORK=65536" # | ||
| "NBUFF=65536" # | ||
| "OLD_PREPROCESSOR=0" # | ||
| # "MSG_PREFIX=\"Preprocessor: \"" # | ||
| ) | ||
|
|
||
| # Put in a "bgfx" folder in Visual Studio | ||
| set_target_properties(fcpp PROPERTIES FOLDER "bgfx") | ||
|
|
||
| target_include_directories(fcpp PUBLIC ${FCPP_DIR}) | ||
|
|
||
| if(MSVC) | ||
| target_compile_options( | ||
| fcpp | ||
| PRIVATE | ||
| "/wd4055" # warning C4055: 'type cast': from data pointer 'void *' to function pointer 'void (__cdecl *)(char *,void *)' | ||
| "/wd4244" # warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data | ||
| "/wd4701" # warning C4701: potentially uninitialized local variable 'lower' used | ||
| "/wd4706" # warning C4706: assignment within conditional expression | ||
| ) | ||
| else() | ||
| target_compile_options( | ||
| fcpp | ||
| PRIVATE -Wno-implicit-fallthrough # | ||
| -Wno-incompatible-pointer-types # | ||
| -Wno-parentheses-equality # | ||
| ) | ||
| endif() |
Uh oh!
There was an error while loading. Please reload this page.