Frank D. Martinez M 4 jaren geleden
bovenliggende
commit
1339c2cfb6
2 gewijzigde bestanden met toevoegingen van 32 en 20 verwijderingen
  1. 21 6
      3rdparty/bgfx-imgui/CMakeLists.txt
  2. 11 14
      CMakeLists.txt

+ 21 - 6
3rdparty/bgfx-imgui/CMakeLists.txt

@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.19)
 
 # --------------------------------------
-# Project
+# Project bgfx+imgui
 # --------------------------------------
 project(bgfx-imgui)
 
@@ -23,7 +23,6 @@ set(BGFX_IMGUI_PATCH
 )
 
 set(IMGUI_GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/dear-imgui)
-file(MAKE_DIRECTORY IMGUI_GENERATED_DIR)
 file(
     COPY 
         ${VANILLA_IMGUI_SOURCES} 
@@ -33,20 +32,36 @@ file(
         ${IMGUI_GENERATED_DIR}
 )
 
+file(GLOB_RECURSE IMGUI_GENERATED_SOURCES
+    ${IMGUI_GENERATED_DIR}/*
+)
+
+# --------------------------------------
+# Add bgfx examples/common copy because
+# these files are required. It is better
+# to maintain a local copy here because
+# there is no guarantee that anything in
+# examples actually work so this files
+# may require modifications for your own
+# environment.
+# --------------------------------------
 
 file(GLOB_RECURSE INTEGRATION_SOURCES
     ${CMAKE_CURRENT_LIST_DIR}/src/bgfx/*
 )
 
-file(GLOB_RECURSE IMGUI_GENERATED_SOURCES
-    ${IMGUI_GENERATED_DIR}/*
-)
+# --------------------------------------
+# Combine patched imgui with commons
+# --------------------------------------
 
 set(SOURCES
     ${IMGUI_GENERATED_SOURCES}
     ${INTEGRATION_SOURCES}
 )
 
+# --------------------------------------
+# Define the library
+# --------------------------------------
 add_library(${PROJECT_NAME} STATIC ${SOURCES})
 
 # --------------------------------------
@@ -62,7 +77,7 @@ target_include_directories(${PROJECT_NAME}
 # Link libraries
 # --------------------------------------
 target_link_libraries(${PROJECT_NAME} 
-    PRIVATE
+    PUBLIC
         bgfx
         bx
         bimg

+ 11 - 14
CMakeLists.txt

@@ -2,22 +2,23 @@ cmake_minimum_required(VERSION 3.19)
 
 # --------------------------------------
 # Project
+# Minimal bgfx+imgui project with cmake
 # --------------------------------------
 project(myapp)
 
-
 # --------------------------------------
-# bgfx
+# bgfx options
 # --------------------------------------
-set(BGFX_BUILD_TOOLS OFF CACHE BOOL "Build bgfx tools.")
-set(BGFX_BUILD_EXAMPLES OFF CACHE BOOL "Build bgfx examples.")
-set(BGFX_INSTALL OFF CACHE BOOL "Create installation target.")
-set(BGFX_INSTALL_EXAMPLES OFF CACHE BOOL "Install examples and their runtimes.")
-set(BGFX_CUSTOM_TARGETS OFF CACHE BOOL "Include convenience custom targets.")
-set(BGFX_AMALGAMATED OFF CACHE BOOL "Amalgamated bgfx build for faster compilation")
-set(BX_AMALGAMATED OFF CACHE BOOL "Amalgamated bx build for faster compilation")
-set(BGFX_CONFIG_DEBUG OFF CACHE BOOL "Enables debug configuration on all builds")
+set(BGFX_BUILD_TOOLS            OFF CACHE BOOL "Build bgfx tools.")
+set(BGFX_BUILD_EXAMPLES         OFF CACHE BOOL "Build bgfx examples.")
+set(BGFX_INSTALL                OFF CACHE BOOL "Create installation target.")
+set(BGFX_INSTALL_EXAMPLES       OFF CACHE BOOL "Install examples and their runtimes.")
+set(BGFX_CUSTOM_TARGETS         OFF CACHE BOOL "Include convenience custom targets.")
+set(BGFX_AMALGAMATED            OFF CACHE BOOL "Amalgamated bgfx build for faster compilation")
+set(BX_AMALGAMATED              OFF CACHE BOOL "Amalgamated bx build for faster compilation")
+set(BGFX_CONFIG_DEBUG           OFF CACHE BOOL "Enables debug configuration on all builds")
 set(BGFX_CONFIG_RENDERER_WEBGPU OFF CACHE BOOL "Enables the webgpu renderer")
+
 add_subdirectory(3rdparty/bgfx-cmake)
 add_subdirectory(3rdparty/bgfx-imgui)
 
@@ -47,8 +48,4 @@ target_include_directories(${PROJECT_NAME}
 target_link_libraries(${PROJECT_NAME} 
   PRIVATE
     bgfx-imgui
-    bgfx
-    bx
-    bimg
-    meshoptimizer
 )