Skip to content

DKUtil

Started as a helper header for personal projects, improved on demand with more and more features.

platform: Windows
standard: c++20

Usage Requirement

Dependencies

All dependencies will be handled by vcpkg & CMake.

Installation

ps
git clone https://github.com/gottyduke/DKUtil.git
ps
git submodule add https://github.com/gottyduke/DKUtil.git extern/DKUtil
git submodule update --init --recursive -f
git submodule update --remote -f

Environment

Adding path to DKUtil to environment variable DKUtilPath can help with consuming the library.

PluginTemplate

If this is your first time using DKUtil and starting a fresh plugin project, consider using PluginTemplate and skip DKUtil setup process.

Consume in Projects

CMake

Add to your target project's CMakeLists.txt:

CMake
add_subdirectory("Path/To/DKUtil" DKUtil)
CMake
# dependency macros
macro(find_dependency_path DEPENDENCY FILE)
	# searches extern for dependencies and if not checks the environment variable
	if(NOT ${DEPENDENCY} STREQUAL "")
		# Check extern
		message(
			STATUS
			"Searching for ${DEPENDENCY} using file ${FILE}"
		)
		find_path("${DEPENDENCY}Path"
			${FILE}
			PATHS "extern/${DEPENDENCY}"
		)

		if("${${DEPENDENCY}Path}" STREQUAL "${DEPENDENCY}Path-NOTFOUND")
			# Check path
			message(
				STATUS
				"Getting environment for ${DEPENDENCY}Path: $ENV{${DEPENDENCY}Path}"
			)
			set("${DEPENDENCY}Path" "$ENV{${DEPENDENCY}Path}")
		endif()

		message(
			STATUS
			"Found ${DEPENDENCY} in ${${DEPENDENCY}Path}; adding"
		)
		add_subdirectory("${${DEPENDENCY}Path}" ${DEPENDENCY})
	endif()
endmacro()

# find DKUtil with environment DKUtilPath or "extern/DKUtil"
find_dependency_path(DKUtil include/DKUtil/Logger.hpp)

VCPKG Port

Planned, low priority due to no demand

Released under the MIT License