summaryrefslogtreecommitdiffstats
path: root/deps
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-11 13:10:52 +0500
committeruntodesu <kirill@untode.su>2025-09-11 13:10:52 +0500
commit96bd73ae020ecca1f94698744c77498a89ad19f7 (patch)
treedc0ee946138141e7a0327a7d3c566f4a37adff3f /deps
parent6dc5194895b6bd61d19bf5c95021471784084325 (diff)
downloadvoxelius-96bd73ae020ecca1f94698744c77498a89ad19f7.tar.bz2
voxelius-96bd73ae020ecca1f94698744c77498a89ad19f7.zip
Graft build scripts and buffer code from QFengine
Diffstat (limited to 'deps')
-rw-r--r--deps/CMakeLists.txt8
-rw-r--r--deps/glfw/CMakeLists.txt2
-rw-r--r--deps/imgui/CMakeLists.txt2
-rw-r--r--deps/thirdparty.py60
4 files changed, 70 insertions, 2 deletions
diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
index e5cc4a7..7d94219 100644
--- a/deps/CMakeLists.txt
+++ b/deps/CMakeLists.txt
@@ -14,3 +14,11 @@ add_subdirectory(salad)
add_subdirectory(spdlog)
add_subdirectory(stb)
add_subdirectory(thread_pool)
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
+add_custom_target(thirdparty_txt ALL
+ COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/thirdparty.py" "${CMAKE_CURRENT_LIST_DIR}"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/thirdparty.txt"
+ DEPENDS "${CMAKE_CURRENT_LIST_DIR}/thirdparty.py"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/thirdparty.txt" DESTINATION ".")
diff --git a/deps/glfw/CMakeLists.txt b/deps/glfw/CMakeLists.txt
index 24afd53..d982998 100644
--- a/deps/glfw/CMakeLists.txt
+++ b/deps/glfw/CMakeLists.txt
@@ -8,5 +8,5 @@ if(NOT glfw3_FOUND)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_Declare(glfw GIT_REPOSITORY https://github.com/glfw/glfw.git GIT_TAG 3.4)
FetchContent_MakeAvailable(glfw)
- add_library(glfw3 ALIAS glfw)
+ #add_library(glfw3 ALIAS glfw)
endif()
diff --git a/deps/imgui/CMakeLists.txt b/deps/imgui/CMakeLists.txt
index 8bb8142..b45e5ba 100644
--- a/deps/imgui/CMakeLists.txt
+++ b/deps/imgui/CMakeLists.txt
@@ -20,7 +20,7 @@ set_target_properties(imgui PROPERTIES FOLDER Dependencies)
add_library(imgui_glfw STATIC
"${CMAKE_CURRENT_LIST_DIR}/include/imgui_impl_glfw.h"
"${CMAKE_CURRENT_LIST_DIR}/src/imgui_impl_glfw.cpp")
-target_link_libraries(imgui_glfw PUBLIC glfw3 imgui)
+target_link_libraries(imgui_glfw PUBLIC glfw imgui)
set_target_properties(imgui_glfw PROPERTIES FOLDER Dependencies)
add_library(imgui_opengl3 STATIC
diff --git a/deps/thirdparty.py b/deps/thirdparty.py
new file mode 100644
index 0000000..7171bf4
--- /dev/null
+++ b/deps/thirdparty.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+import os
+
+# It is quite annoying to have to write all the dependency notices
+# by hand, so this script goes through the dependency list and generates
+# a file with all the licenses automatically during the build process
+
+def read_description_file(subdirectory):
+ description_filename = "DESCRIPTION"
+ description_extensions = [ "", ".txt", ".md", ".rst" ]
+ for extension in description_extensions:
+ fill_path = os.path.join(subdirectory, description_filename + extension)
+ if os.path.exists(fill_path):
+ with open(fill_path, 'r', encoding='utf-8') as file:
+ return file.read().rstrip().splitlines()[0]
+ return None
+
+def read_license_file(subdirectory):
+ license_filenames = [ "LICENSE", "COPYING", "NOTICE" ]
+ license_extensions = [ "", ".txt", ".md", ".rst" ]
+ for filename in license_filenames:
+ for extension in license_extensions:
+ fill_path = os.path.join(subdirectory, filename + extension)
+ if os.path.exists(fill_path):
+ with open(fill_path, 'r', encoding='utf-8') as file:
+ return file.read().rstrip()
+ return None
+
+def get_dependencies(directory):
+ dependencies = []
+ for subdirectory in os.listdir(directory):
+ subdirectory_path = os.path.join(directory, subdirectory)
+ if os.path.isdir(subdirectory_path):
+ license = read_license_file(subdirectory_path)
+ description = read_description_file(subdirectory_path)
+ if description and len(description) > 80:
+ description = description[:77] + "..."
+ if license:
+ dependencies.append((subdirectory, license, description))
+ return dependencies
+
+assert len(os.sys.argv) > 1, "Please provide the path to the dependencies directory."
+dependencies_dir = os.sys.argv[1]
+dependencies = get_dependencies(dependencies_dir)
+assert len(dependencies) > 0, "No licenses found in the dependencies directory."
+
+with open("thirdparty.txt", 'w', encoding='utf-8') as out_file:
+ out_file.write("QFengine uses third-party code for certain functions. All the\n")
+ out_file.write("license texts are included below using an automated script; this generated\n")
+ out_file.write("file is to be included in binary distributions of the project.\n\n")
+
+ for name, license, description in dependencies:
+ out_file.write(f"{'=' * 80}\n")
+ if description and len(description) > 0:
+ out_file.write(f"{name} - {description}\n")
+ else:
+ out_file.write(f"{name}\n")
+ out_file.write(f"{'=' * 80}\n")
+ out_file.write(f"{license}\n\n\n")