Compare commits

..

2 Commits

Author SHA1 Message Date
97d03733a4 Changes to dependencies to make it easier for any one build the project without any huge setup
Reviewed-on: jeslaspravin/Cranberry-Private#2
2025-12-25 22:41:25 +01:00
Jeslas Pravin
ace51acb72 Changes to dependencies to make it easier to build
ccffcde3 Enable dependencies between reflected targets
a9f04fb3 Unify dependencies into single manifest based source
e8af4793 Update screenshots and readme
2025-12-25 22:39:39 +01:00
20 changed files with 367 additions and 192 deletions

6
.gitignore vendored
View File

@@ -44,11 +44,11 @@ bld/
[Tt]emp/ [Tt]emp/
[Tt]mp/ [Tt]mp/
# External dependencies # Dependencies
[Tt]hirdParties/* [Tt]hirdParties/*
[Ee]xternal/* [Dd]ependencies/*
![Tt]hirdParties/CMakeLists.txt ![Tt]hirdParties/CMakeLists.txt
![Ee]xternal/CMakeLists.txt ![Dd]ependencies/CMakeLists.txt
# Visual Studio 2015/2017 cache/options directory # Visual Studio 2015/2017 cache/options directory
.vs/ .vs/

View File

@@ -1 +1,12 @@
@jeslaspravin # Documentations
Docs/* @jeslaspravin
# External and Dependencies
Dependencies/* @jeslaspravin
Licenses/* @jeslaspravin
# Project scripts
Scripts/* @jeslaspravin
# All Sources
Sources/* @jeslaspravin

97
Dependencies/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,97 @@
cmake_minimum_required( VERSION 3.26 )
set( deps_manifest_url "https://drive.jeslaspravin.com/seafhttp/f/563b857bc80b4ed8babd/?op=view" )
set( deps_version "0.1" )
set( deps_path ${CMAKE_CURRENT_LIST_DIR} )
set( deps_setup_status_file ${deps_path}/DepsSetupSuccess.txt )
set( deps_download_dir "${deps_path}/${deps_version}" )
# Downloading the manifest
message( STATUS "Downloading dependencies manifest..." )
set( deps_manifest_file ${deps_download_dir}/manifest.json )
file( DOWNLOAD "${deps_manifest_url}" "${deps_manifest_file}"
STATUS download_status
LOG download_log
)
list( GET download_status 0 status_code )
if( NOT ${status_code} EQUAL 0 )
list( GET download_status 1 status_msg )
message( FATAL_ERROR "Status code ${status_code} Error grabbing manifest file: ${status_msg}\nLOG ${download_log}" )
endif()
# Download the manifest ends
# Find version entry in manifest. Refer Docs\DependenciesManifest.schema.json
file( READ ${deps_manifest_file} deps_cfg )
string( JSON deps_cfg GET ${deps_cfg} "deps" )
string( JSON deps_versions_count LENGTH ${deps_cfg} )
math( EXPR deps_versions_count "${deps_versions_count} - 1" ) # Foreach Range stop is inclusive so subtract 1
foreach( i RANGE ${deps_versions_count} )
string( JSON found_version GET ${deps_cfg} ${i} "version" )
if( ${deps_version} VERSION_EQUAL ${found_version} )
set( dep_sel_idx ${i} )
endif()
endforeach( i RANGE ${deps_versions_count} )
if( NOT DEFINED dep_sel_idx )
message( FATAL_ERROR "Failed to find the expected version ${deps_version}" )
endif()
message( STATUS "Found version ${deps_version} at index ${dep_sel_idx}" )
# Find version entry in manifest ends
# Download the binaries
string( JSON deps_files GET ${deps_cfg} ${dep_sel_idx} "files" )
string( JSON deps_files_count LENGTH ${deps_files} )
math( EXPR deps_files_count "${deps_files_count} - 1" ) # Foreach Range stop is inclusive so subtract 1
foreach( i RANGE ${deps_files_count} )
string( JSON deps_file GET ${deps_files} ${i} )
string( JSON deps_archive_url GET ${deps_file} "downloadUrl" )
string( JSON deps_archive_hash GET ${deps_file} "hash" )
string( JSON deps_archive_hash_algo GET ${deps_file} "hashAlgo" )
string( JSON deps_archive_name GET ${deps_file} "name" )
set( deps_archive_file "${deps_download_dir}/${deps_archive_name}.zip" )
message( STATUS "Downloading ${deps_archive_name}... \nFrom: ${deps_archive_url}\nTo ${deps_archive_file}..." )
file( DOWNLOAD "${deps_archive_url}" "${deps_archive_file}"
SHOW_PROGRESS
STATUS download_status
LOG download_log
EXPECTED_HASH "${deps_archive_hash_algo}=${deps_archive_hash}"
)
list( GET download_status 0 status_code )
if( NOT ${status_code} EQUAL 0 )
list( GET download_status 1 status_msg )
message( FATAL_ERROR " Status code ${status_code} Error: ${status_msg}\nLOG ${download_log} " )
endif()
message( STATUS "Success: Download ${deps_archive_name} finished!" )
set( deps_archive_folder "${deps_path}/${deps_archive_name}" )
file( REMOVE_RECURSE ${deps_archive_folder} )
message( STATUS "Extracting to ${deps_archive_folder}..." )
file( MAKE_DIRECTORY "${deps_archive_folder}" )
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xf "${deps_archive_file}"
WORKING_DIRECTORY "${deps_archive_folder}"
RESULT_VARIABLE exit_code
COMMAND_ERROR_IS_FATAL ANY
)
if( NOT ${exit_code} EQUAL 0 )
message( FATAL_ERROR "Failed to extract ${deps_archive_file}!" )
endif()
message( STATUS "SUCCESS: Extraction of ${deps_archive_file} completed!" )
endforeach( i RANGE ${deps_files_count} )
file( WRITE ${deps_setup_status_file} "${deps_version}" )

View File

@@ -1,6 +1,6 @@
# Best Practises # Best Practices
This document describes some of the best practises to follow when writing C++ code. This document describes some of the best practices to follow when writing C++ code.
## Cosmetic and Formatting ## Cosmetic and Formatting
@@ -14,8 +14,8 @@ This document describes some of the best practises to follow when writing C++ co
## C++ Code ## C++ Code
- Always be const correct - Always be const correct
- Do not use fundamental types that are less or equal to 64bit size as reference unneccesarily. - Do not use fundamental types that are less or equal to 64bit size as reference unnecessarily.
- Do not use noexcept unneccasarily. Check code gen functions might not get inlined. - Do not use noexcept unnecessarily. Check code gen functions might not get inlined.
- Always avoid unions for trivial types. Check code gen functions might not get inlined. - Always avoid unions for trivial types. Check code gen functions might not get inlined.
- Try to not provide custom implementation for default constructor of trivial types. - Try to not provide custom implementation for default constructor of trivial types.
- When doing bit wise operations. Try to offload as much as possible to certain predefined tested functions. This is to save several hours debugging(`&& -> &`, `|| -> |`, ...) - When doing bit wise operations. Try to offload as much as possible to certain predefined tested functions. This is to save several hours debugging(`&& -> &`, `|| -> |`, ...)

View File

@@ -0,0 +1,66 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/deps.schema.json",
"type": "object",
"required": [
"deps"
],
"properties": {
"deps": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"files",
"version"
],
"properties": {
"version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
"description": "Dependency version (e.g. 0.1 or 1.2.3)"
},
"files": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"name",
"downloadUrl",
"hash",
"hashAlgo"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"downloadUrl": {
"type": "string",
"format": "uri"
},
"hash": {
"type": "string",
"minLength": 1,
"description": "Hex-encoded hash value"
},
"hashAlgo": {
"type": "string",
"enum": [
"SHA256"
],
"description": "Hash algorithm used for verification"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}

View File

@@ -1,95 +0,0 @@
cmake_minimum_required(VERSION 3.26)
set (deps_version_url "https://drive.jeslaspravin.com/f/99fa7758fbde40b4a57e/?dl=1")
# Release
# set (deps_archive_url "https://drive.jeslaspravin.com/f/011987e106b74776a5c1/?dl=1")
# Staging
set (deps_archive_url "https://drive.jeslaspravin.com/f/aa5aa4fadb214fcdbba5/?dl=1")
set (temp_download_folder CranberryDeps-Temp)
set (external_libs_path ${CMAKE_CURRENT_LIST_DIR})
set (deps_setup_status_file ${external_libs_path}/DepsSetupSuccess.txt)
message ("Setting up CPP libraries...")
file (GLOB current_deps
LIST_DIRECTORIES true
RELATIVE ${external_libs_path}
"${external_libs_path}/*"
)
# Ignore this CMakeLists.txt
list (REMOVE_ITEM current_deps "CMakeLists.txt")
# Getting latest version number
set (deps_version_file ${external_libs_path}/${temp_download_folder}/DependenciesVersion.txt)
file(DOWNLOAD "${deps_version_url}" "${deps_version_file}"
STATUS download_status
LOG download_log
)
list(GET download_status 0 status_code)
if (NOT ${status_code} EQUAL 0)
list(GET download_status 1 status_msg)
message (FATAL_ERROR "Status code ${status_code} Error grabbing version file: ${status_msg}\nLOG ${download_log}")
endif ()
file (READ ${deps_version_file} new_deps_version)
set (old_deps_version "0.0.0")
if (EXISTS ${deps_setup_status_file})
file (READ ${deps_setup_status_file} old_deps_version)
endif()
if (${new_deps_version} VERSION_LESS_EQUAL ${old_deps_version})
message("Current setup dependency version is up to date! Setup completed!")
file(REMOVE_RECURSE ${external_libs_path}/${temp_download_folder})
return()
endif()
set (deps_archive_file ${external_libs_path}/${temp_download_folder}/DepsArchive.zip)
if (EXISTS ${deps_archive_file})
message ("${deps_archive_file} Exists. Delete it to start a fresh download!")
else (EXISTS ${deps_archive_file})
message ("Downloading dependencies archive... \nfrom ${deps_archive_url}\nto ${deps_archive_file}")
file(DOWNLOAD "${deps_archive_url}" "${deps_archive_file}"
SHOW_PROGRESS
STATUS download_status
LOG download_log
)
list(GET download_status 0 status_code)
if (NOT ${status_code} EQUAL 0)
list(GET download_status 1 status_msg)
message (FATAL_ERROR "Status code ${status_code} Error: ${status_msg}\nLOG ${download_log}")
endif ()
message ("Success: Download finished!")
endif (EXISTS ${deps_archive_file})
message ("Extracting dependencies into ${external_libs_path}/${temp_download_folder}")
execute_process(COMMAND ${CMAKE_COMMAND}
-E tar xf "${deps_archive_file}"
WORKING_DIRECTORY "${external_libs_path}/${temp_download_folder}"
RESULT_VARIABLE exit_code
)
if (NOT ${exit_code} EQUAL 0)
message(FATAL_ERROR "Failed to extract dependencies!")
endif()
file (REMOVE "${deps_archive_file}")
list (LENGTH current_deps had_old_deps)
if (${had_old_deps} GREATER 0)
list(TRANSFORM current_deps PREPEND "${external_libs_path}/")
file (REMOVE_RECURSE ${current_deps})
endif()
message ("Copying dependencies...")
file (COPY_FILE ${deps_version_file} ${deps_setup_status_file})
execute_process(COMMAND ${CMAKE_COMMAND}
-E copy_directory "${external_libs_path}/${temp_download_folder}" "${external_libs_path}"
RESULT_VARIABLE exit_code
)
if (NOT ${exit_code} EQUAL 0)
message(FATAL_ERROR "Failed to copy dependencies from temporary dir to ${external_libs_path}!")
endif()
file(REMOVE_RECURSE ${external_libs_path}/${temp_download_folder})
message("SUCCESS: Extraction completed!")

View File

@@ -1,5 +1,7 @@
# Cranberry Game Engine # Cranberry Game Engine
![CranberryLogo]
**Cranberry Game Engine** is my Personal hobby game engine. I work on this as best as I could during my holidays. **Cranberry Game Engine** is my Personal hobby game engine. I work on this as best as I could during my holidays.
The goal of the engine is to have a set of tools required to develop a game without too much dependencies. The goal of the engine is to have a set of tools required to develop a game without too much dependencies.
@@ -7,6 +9,8 @@ In the renderer side I aim to be as efficient as possible given the little time
Physics will be optional for any game so I intend to keep the module and its integration into game objects as decoupled as possible. Physics will be optional for any game so I intend to keep the module and its integration into game objects as decoupled as possible.
Audio will always be needed so that will be tightly integrated with other objects. Audio will always be needed so that will be tightly integrated with other objects.
Some features are over engineered and I am fine with it. So if you want to contribute it is okay to over engineer as long as the changes itself is self contained.
Join the discord server at <https://discord.gg/2xfVG4QPt8> if you want to make some meaningful impact. Join the discord server at <https://discord.gg/2xfVG4QPt8> if you want to make some meaningful impact.
## Requirement ## Requirement
@@ -16,6 +20,18 @@ Join the discord server at <https://discord.gg/2xfVG4QPt8> if you want to make s
## Instructions ## Instructions
### Best practices
Can be found at [Best Practices]
### Contribution
If you are looking to contribute, try to pick a task or issue from [Cranberry Project]
Right now there is no contributor guideline. Regular workflow of forking the engine and creating a merge/pull request with description is good enough.
I will add guidelines as nice people starts contributing.
Project is in early stage so if you contribute you will get opportunity to be a maintainer or lead of certain module as project grows. So now is the best time to contribute.
### Getting started with first build ### Getting started with first build
* Install CMake from [CMake] * Install CMake from [CMake]
@@ -42,22 +58,9 @@ pip install pre-commit
* Validation layers in vulkan can be enabled in any build mode. However in non dev build the error messages get ignored. Use `Development` build if you need release matching performance and validations. * Validation layers in vulkan can be enabled in any build mode. However in non dev build the error messages get ignored. Use `Development` build if you need release matching performance and validations.
## Code lookups
Right now I have two runtime applications `Cranberry` and `TestEngine`
* For `Cranberry` start from [Cranberry-Main]
* Right now the scenes can be manually loaded using this line of code [CranberryAppLoadScene] at startup of the engine
* If engine cannot find any valid `obj` file then it auto creates a default scene with bunch of cubes like in the [Screen Shot](#cranberryeditor). It is done here [CranberryAppCubeScene]
* For `TestEngine` start from [TestEngine-Main]. In order to run `TestEngine` additional Assets directory with raw assets are necessary. If you want to run `TestEngine.exe` download and extract [Assets.zip] in Runtime folder
## Best practises
Can be found at [Best Practises]
## Features ## Features
Many features listed below are supported but tooling still needs to be developed Many features listed below are supported but tooling still needs to be developed. Some features are in branches waiting to be ported to latest rendering backend.
* Reflection generator for C++ * Reflection generator for C++
* Reflection supports metadata classes and flags * Reflection supports metadata classes and flags
@@ -111,6 +114,8 @@ Licenses for third party packages used is placed under `Licenses` folder
![CranberryEdSS] ![CranberryEdSS]
![CranberryActorPrefabEdSS]
## PS ## PS
If you found any piece of this software helpful or used it yourself, Please feel free to share it with your circle. I had invested substantial amount of my personal time in this project and would love some feedback in return😄 If you found any piece of this software helpful or used it yourself, Please feel free to share it with your circle. I had invested substantial amount of my personal time in this project and would love some feedback in return😄
@@ -120,13 +125,12 @@ If you found any piece of this software helpful or used it yourself, Please feel
[VisualStudio]: https://visualstudio.microsoft.com/downloads/ [VisualStudio]: https://visualstudio.microsoft.com/downloads/
[VulkanSDK]: https://vulkan.lunarg.com/ [VulkanSDK]: https://vulkan.lunarg.com/
[CoPaT]: https://github.com/jeslaspravin/CoPaT [CoPaT]: https://github.com/jeslaspravin/CoPaT
[Assets.zip]: https://drive.jeslaspravin.com/f/160666402e304e3f926a/
[Cranberry-Main]: https://github.com/jeslaspravin/Cranberry/blob/main/Source/Runtime/EngineModules/Cranberry/Private/EngineMain.cpp#L22 [CranberryLogo]: <https://blogs.jeslaspravin.com/assets/images/CranberryEngine/CranberryLogo_1k.png> "Three cranberries and three cranberry leaves"
[TestEngine-Main]: https://github.com/jeslaspravin/Cranberry/blob/main/Source/Runtime/ExampleModules/TestEngine/Private/StartMain.cpp#L44 [TestEngineSS]: <https://blogs.jeslaspravin.com/assets/images/CranberryEngine/TestEngine(08-01-2023).jpg> "Test Engine screenshot of PBR rendering with shadows and tone mapping"
[TestEngineSS]: https://jeslaspravin.github.io/assets/images/CranberryEngine/TestEngine(08-01-2023).jpg [CranberryEdSS]: <https://blogs.jeslaspravin.com/assets/images/CranberryEngine/CranberryEditor(24-12-2025).jpg> "Cranberry engine editor main window screenshot"
[CranberryEdSS]: https://jeslaspravin.github.io/assets/images/CranberryEngine/CranberryEngine(08-01-2023).jpg [CranberryActorPrefabEdSS]: <https://blogs.jeslaspravin.com/assets/images/CranberryEngine/ActorPrefabEditor(24-12-2025).jpg> "Actor prefab editor with two actor prefab being edited side by side"
[CranberryAppLoadScene]: https://github.com/jeslaspravin/Cranberry/blob/main/Source/Runtime/EngineModules/Cranberry/Private/CranberryEngineApp.cpp#L274 [Best Practices]: <https://git.jeslaspravin.com/jeslaspravin/Cranberry/raw/branch/main/Docs/BestPractises.md>
[CranberryAppCubeScene]: https://github.com/jeslaspravin/Cranberry/blob/main/Source/Runtime/EngineModules/Cranberry/Private/CranberryEngineApp.cpp#L326 [Cranberry Project]: <https://git.jeslaspravin.com/jeslaspravin/Cranberry/projects/2>
[Best Practises]: https://github.com/jeslaspravin/Cranberry/blob/main/Docs/BestPractises.md
[pre-commit webpage]: https://pre-commit.com/ [pre-commit webpage]: https://pre-commit.com/

View File

@@ -27,33 +27,34 @@ option( Cranberry_ENABLE_CONSOLE_LOG "Should log write to console as well?" ON )
option( Cranberry_ENABLE_VERBOSE_LOG "Should write verbose log to log file?" OFF ) option( Cranberry_ENABLE_VERBOSE_LOG "Should write verbose log to log file?" OFF )
# Setup.bat will populate this directory # Setup.bat will populate this directory
set( Cranberry_CPP_LIBS_PATH ${CMAKE_SOURCE_DIR}/External CACHE PATH "Path to CPP libraries" ) set( Cranberry_CPP_LIBS_PATH "${CMAKE_SOURCE_DIR}/Dependencies/Libs" CACHE PATH "Path to CPP libraries" )
set( Cranberry_ED_DEPS_PATH "${CMAKE_SOURCE_DIR}/Dependencies" CACHE INTERNAL "Path to Engine editor dependencies" )
set( Cranberry_VULKAN_SDK_PATH $ENV{VULKAN_SDK} CACHE PATH "Vulkan SDK path" ) set( Cranberry_VULKAN_SDK_PATH $ENV{VULKAN_SDK} CACHE PATH "Vulkan SDK path" )
# By default tries to get it from Vulkan SDK # By default tries to get it from Vulkan SDK
set( Cranberry_DXC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Package CACHE PATH "DXC path, must be base directory of DXC installed path. By default tries to get it from Vulkan SDK." ) set( Cranberry_DXC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Package" CACHE PATH "DXC path, must be base directory of DXC installed path. By default tries to get it from Vulkan SDK." )
# Physics related # Physics related
set( Cranberry_JOLT_PHYSICS_PATH ${Cranberry_CPP_LIBS_PATH}/JoltPhysics CACHE PATH "JoltPhysics cmake install path." ) set( Cranberry_JOLT_PHYSICS_PATH "${Cranberry_CPP_LIBS_PATH}/JoltPhysics" CACHE PATH "JoltPhysics cmake install path." )
# SPIRV-Tools path # SPIRV-Tools path
set( Cranberry_SPIRV_TOOLS_PATH ${Cranberry_CPP_LIBS_PATH}/SPIRV-Tools CACHE PATH "SPIRV-Tools path must be modified version that has SPIRV-Tools-opt.dll support" ) set( Cranberry_SPIRV_TOOLS_PATH "${Cranberry_CPP_LIBS_PATH}/SPIRV-Tools" CACHE PATH "SPIRV-Tools path must be modified version that has SPIRV-Tools-opt.dll support" )
# LLVM installed path # LLVM installed path
set( Cranberry_LLVM_INSTALL_PATH ${Cranberry_CPP_LIBS_PATH}/llvm CACHE PATH "LLVM installed path(For libclang)" ) set( Cranberry_LLVM_INSTALL_PATH "${Cranberry_CPP_LIBS_PATH}/llvm" CACHE PATH "LLVM installed path(For libclang)" )
option( Cranberry_ENABLE_MIMALLOC "Compile with mimalloc?" ON ) option( Cranberry_ENABLE_MIMALLOC "Compile with mimalloc?" ON )
set( Cranberry_MIMALLOC_INSTALL_PATH ${Cranberry_CPP_LIBS_PATH}/mimalloc CACHE PATH "mimalloc installed path" ) set( Cranberry_MIMALLOC_INSTALL_PATH "${Cranberry_CPP_LIBS_PATH}/mimalloc" CACHE PATH "mimalloc installed path" )
option( Cranberry_ENABLE_TESTS "Create test targets and compile tests?" ON ) option( Cranberry_ENABLE_TESTS "Create test targets and compile tests?" ON )
set( Cranberry_DOCTEST_PATH ${Cranberry_CPP_LIBS_PATH}/doctest CACHE PATH "Doctest path" ) set( Cranberry_DOCTEST_PATH "${Cranberry_CPP_LIBS_PATH}/doctest" CACHE PATH "Doctest path" )
# Profiler options # Profiler options
option( Cranberry_ENABLE_SECURE_PROFILING "Should the profiler availability needs to be check every time?" OFF ) option( Cranberry_ENABLE_SECURE_PROFILING "Should the profiler availability needs to be check every time?" OFF )
option( Cranberry_ENABLE_MEMORY_PROFILING "Should the memory allocations needs to be tracked?" OFF ) option( Cranberry_ENABLE_MEMORY_PROFILING "Should the memory allocations needs to be tracked?" OFF )
option( Cranberry_ENABLE_TRACY "Should use tracy for profiling?" ON ) option( Cranberry_ENABLE_TRACY "Should use tracy for profiling?" ON )
set( Cranberry_TRACY_INSTALL_PATH ${Cranberry_CPP_LIBS_PATH}/tracy CACHE PATH "tracy installed path" ) set( Cranberry_TRACY_INSTALL_PATH "${Cranberry_CPP_LIBS_PATH}/tracy" CACHE PATH "tracy installed path" )
option( Cranberry_ENABLE_CLANG_FORMAT "If enabled, Creates clang formatting sources project" ON ) option( Cranberry_ENABLE_CLANG_FORMAT "If enabled, Creates clang formatting sources project" ON )
@@ -185,6 +186,8 @@ if( ${Cranberry_EDITOR_BUILD} AND ${Cranberry_STATIC_MODULES} )
message( FATAL_ERROR "Editor build cannot be static linked! Consider disabling Cranberry_STATIC_MODULES" ) message( FATAL_ERROR "Editor build cannot be static linked! Consider disabling Cranberry_STATIC_MODULES" )
endif() endif()
string( TIMESTAMP build_year "%Y" )
# Common compile definitions that depends on project configurations. # Common compile definitions that depends on project configurations.
add_compile_definitions( add_compile_definitions(
@@ -205,6 +208,9 @@ add_compile_definitions(
ENGINE_MINOR_VERSION=1 ENGINE_MINOR_VERSION=1
ENGINE_PATCH_VERSION=0 ENGINE_PATCH_VERSION=0
ENGINE_NAME=${CMAKE_PROJECT_NAME} ENGINE_NAME=${CMAKE_PROJECT_NAME}
CBE_CORE_BUILD_YEAR=${build_year}
$<$<BOOL:${Cranberry_ENABLE_CONSOLE_LOG}>:LOG_TO_CONSOLE=1>
$<$<BOOL:${Cranberry_ENABLE_VERBOSE_LOG}>:ENABLE_VERBOSE_LOG=1>
# Project definitions # Project definitions
$<$<CONFIG:Debug>:CBE_DEBUG=1> $<$<CONFIG:Debug>:CBE_DEBUG=1>

View File

@@ -4,7 +4,7 @@
# \author Jeslas Pravin # \author Jeslas Pravin
# \date January 2022 # \date January 2022
# \copyright # \copyright
# Copyright (C) Jeslas Pravin, 2022-2024 # Copyright (C) Jeslas Pravin, 2022-2025
# @jeslaspravin pravinjeslas@gmail.com # @jeslaspravin pravinjeslas@gmail.com
# License can be read in LICENSE file at this repository's root # License can be read in LICENSE file at this repository's root
# #
@@ -80,6 +80,7 @@ function( reflect_target )
set( multi_value_args SCAN_DIRS GEN_FILES RELEVANT_SRCS TARGET_DEPS ) set( multi_value_args SCAN_DIRS GEN_FILES RELEVANT_SRCS TARGET_DEPS )
cmake_parse_arguments( reflect_target "" "${one_value_args}" "${multi_value_args}" ${ARGN} ) cmake_parse_arguments( reflect_target "" "${one_value_args}" "${multi_value_args}" ${ARGN} )
set( reflect_target_suffix _reflect )
set( reflect_intm_folder Reflection ) set( reflect_intm_folder Reflection )
set( target_intermediate_dir ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${reflect_intm_folder} ) set( target_intermediate_dir ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${reflect_intm_folder} )
set( target_full_reflect_ts_file FullReflect.timestamp ) set( target_full_reflect_ts_file FullReflect.timestamp )
@@ -117,10 +118,12 @@ function( reflect_target )
) )
set( dep_intermediate_dirs ) set( dep_intermediate_dirs )
set( dep_reflect_targets )
# Dependent intermediate directories list # Dependent intermediate directories list
foreach( dep_target ${reflect_target_TARGET_DEPS} ) foreach( dep_target ${reflect_target_TARGET_DEPS} )
list( APPEND dep_intermediate_dirs $<TARGET_PROPERTY:${dep_target},BINARY_DIR>/$<CONFIG>/${reflect_intm_folder} ) list( APPEND dep_intermediate_dirs $<TARGET_PROPERTY:${dep_target},BINARY_DIR>/$<CONFIG>/${reflect_intm_folder} )
list( APPEND dep_reflect_targets "$<TARGET_NAME_IF_EXISTS:${dep_target}${reflect_target_suffix}>" )
endforeach( dep_target ${reflect_target_TARGET_DEPS} ) endforeach( dep_target ${reflect_target_TARGET_DEPS} )
file( GENERATE OUTPUT $<CONFIG>/${reflect_intm_folder}/${target_dep_intm_dirs_file} file( GENERATE OUTPUT $<CONFIG>/${reflect_intm_folder}/${target_dep_intm_dirs_file}
@@ -136,7 +139,6 @@ function( reflect_target )
--filterDiagnostics --filterDiagnostics
--generatedDir "\"${CMAKE_CURRENT_BINARY_DIR}/${target_generated_path}\"" --generatedDir "\"${CMAKE_CURRENT_BINARY_DIR}/${target_generated_path}\""
--reflectedTypesList "\"${target_intermediate_dir}/${target_ref_types_file}\"" --reflectedTypesList "\"${target_intermediate_dir}/${target_ref_types_file}\""
--reflectorRunning "\"${target_intermediate_dir}/${reflector_running_file}\""
--moduleRootDir "\"${CMAKE_CURRENT_LIST_DIR}\"" --moduleRootDir "\"${CMAKE_CURRENT_LIST_DIR}\""
--scanDirs ${scan_dirs} --scanDirs ${scan_dirs}
--moduleName ${reflect_target_TARGET_NAME} --moduleName ${reflect_target_TARGET_NAME}
@@ -162,7 +164,7 @@ function( reflect_target )
BYPRODUCTS ${all_generated_files} BYPRODUCTS ${all_generated_files}
USES_TERMINAL USES_TERMINAL
COMMAND_EXPAND_LISTS COMMAND_EXPAND_LISTS
DEPENDS ${reflect_target_RELEVANT_SRCS} $<TARGET_PROPERTY:${module_reflect_tool},INTERFACE_SOURCES> ${module_reflect_tool} DEPENDS ${reflect_target_RELEVANT_SRCS} $<TARGET_PROPERTY:${module_reflect_tool},INTERFACE_SOURCES> ${module_reflect_tool} ${dep_reflect_targets}
VERBATIM # not needed as we took care of quotes manually VERBATIM # not needed as we took care of quotes manually
COMMENT "${reflect_target_TARGET_NAME} : Generating reflection codes..." COMMENT "${reflect_target_TARGET_NAME} : Generating reflection codes..."
@@ -172,12 +174,12 @@ function( reflect_target )
set( cmake_folder_backup ${CMAKE_FOLDER} ) set( cmake_folder_backup ${CMAKE_FOLDER} )
set( CMAKE_FOLDER XGenTgts/ModuleReflect ) set( CMAKE_FOLDER XGenTgts/ModuleReflect )
add_custom_target( ${reflect_target_TARGET_NAME}_reflect add_custom_target( "${reflect_target_TARGET_NAME}${reflect_target_suffix}"
DEPENDS ${all_generated_files} DEPENDS ${all_generated_files}
) )
# ModuleReflect tool also clears deleted header's generated files # ModuleReflect tool also clears deleted header's generated files
set_target_properties( ${reflect_target_TARGET_NAME}_reflect set_target_properties( "${reflect_target_TARGET_NAME}${reflect_target_suffix}"
PROPERTIES PROPERTIES
ADDITIONAL_CLEAN_FILES "${clean_paths}" ADDITIONAL_CLEAN_FILES "${clean_paths}"
) )
@@ -185,7 +187,7 @@ function( reflect_target )
set( CMAKE_FOLDER ${cmake_folder_backup} ) set( CMAKE_FOLDER ${cmake_folder_backup} )
# Add custom target as dependency # Add custom target as dependency
add_dependencies( ${reflect_target_TARGET_NAME} ${reflect_target_TARGET_NAME}_reflect ) add_dependencies( ${reflect_target_TARGET_NAME} "${reflect_target_TARGET_NAME}${reflect_target_suffix}" )
# Public is already included along with export header generation, It is okay however # Public is already included along with export header generation, It is okay however
target_include_directories( ${reflect_target_TARGET_NAME} target_include_directories( ${reflect_target_TARGET_NAME}

View File

@@ -18,7 +18,7 @@ function Install-EngineDependencies {
return 1 return 1
} }
& cmake -P "$([IO.Path]::Combine($CBE_BUILD_INTERNAL_ENG_ROOT, "External", "CMakeLists.txt"))" & cmake -P "$([IO.Path]::Combine($CBE_BUILD_INTERNAL_ENG_ROOT, "Dependencies", "CMakeLists.txt"))"
} }
function Write-CMake-EngineProj { function Write-CMake-EngineProj {
@@ -31,7 +31,7 @@ function Write-CMake-EngineProj {
[string[]]$CMakeArgs [string[]]$CMakeArgs
) )
if ("$CMakePreset" -eq "") { if ("$CMakePreset" -eq "") {
if (!(Test-Path "$([IO.Path]::Combine($CBE_BUILD_INTERNAL_ENG_ROOT, "External", "DepsSetupSuccess.txt"))")) { if (!(Test-Path "$([IO.Path]::Combine($CBE_BUILD_INTERNAL_ENG_ROOT, "Dependencies", "DepsSetupSuccess.txt"))")) {
Install-EngineDependencies Install-EngineDependencies
} }

View File

@@ -0,0 +1,112 @@
#
# \file DependenciesUtils.ps1
#
# \author Jeslas Pravin
# \date October 2023
# \copyright
# Copyright (C) Jeslas Pravin, 2022-2025
# @jeslaspravin pravinjeslas@gmail.com
# License can be read in LICENSE file at this repository's root
#
function Add-Dependency-Folder {
param (
[Parameter(Mandatory = $true)]
[string]$DepRootDir,
[Parameter(Mandatory = $true)]
[string]$DepsManifestPath,
[Parameter(Mandatory = $true)]
[string]$VersionString,
[Parameter(Mandatory = $false)]
[string]$OutDir
)
if (-not $VersionString) {
Throw "Version string is mandatory!"
}
# Validate input paths
if (-not (Test-Path $DepRootDir)) {
Throw "Dependency root directory does not exist: $DepRootDir"
}
if (-not (Test-Path $DepsManifestPath)) {
# Create an empty manifest file if it doesn't exist
New-Item -ItemType File -Path $DepsManifestPath -Force | Out-Null
}
if (-not "$OutDir") {
$OutDir = $DepRootDir
Write-Host "Output dir $OutDir" -ForegroundColor Gray
}
# Load existing manifest or initialize a new one
$ManifestRaw = Get-Content -Raw -Path $DepsManifestPath -ErrorAction SilentlyContinue
if ($ManifestRaw -and $ManifestRaw.Trim()) {
try {
$Manifest = $ManifestRaw | ConvertFrom-Json
}
catch {
$Manifest = @{ }
}
}
else {
$Manifest = @{ }
}
if (-not $Manifest.deps) {
$Manifest.deps = @()
}
foreach ($dep in $Manifest.deps) {
if ($dep.version -eq "$VersionString") {
Throw "Manifest dependency entry with version string already exists $VersionString"
}
}
$NewManifestEntry = @{}
$NewManifestEntry.version = $VersionString
$NewManifestEntry.files = @()
$SubDirs = Get-ChildItem -Path "$DepRootDir" -Directory
foreach ($Dir in $SubDirs) {
$FolderName = $Dir.Name
$FolderPath = $Dir.FullName
# 1. Create zip archive named after the folder
$ZipFileName = "$FolderName.zip"
$ZipPath = Join-Path -Path $OutDir -ChildPath $ZipFileName
Write-Host "Compressing folder '$FolderName' -> '$ZipFileName'"
Compress-Archive -Path (Join-Path $FolderPath '*') `
-DestinationPath $ZipPath `
-CompressionLevel Optimal `
-Force
# 2. Compute SHA256 hash of the zip file
$HashAlgo = "SHA256"
$HashResult = Get-FileHash -Path $ZipPath -Algorithm $HashAlgo
$HashValue = $HashResult.Hash
# 3. Add entry to manifest
$NewEntry = @{
name = $FolderName
hashAlgo = $HashAlgo
hash = $HashValue
downloadUrl = ""
}
$NewManifestEntry.files += $NewEntry
Write-Host "Added Files from `"${FolderName}`" with hash $HashValue"
}
$Manifest.deps += $NewManifestEntry
# Persist updated manifest back to JSON
$JsonContent = $Manifest | ConvertTo-Json -Depth 5 -Compress
Set-Content -Path $DepsManifestPath -Value $JsonContent -Encoding UTF8
Write-Host "Added entry for version '$VersionString' to manifest $DepsManifestPath"
}

View File

@@ -22,7 +22,7 @@ ignore_file_pattern = [
"\\.vscode/.*", "\\.vscode/.*",
".*Build/.*", ".*Build/.*",
"ThirdParties/.*", "ThirdParties/.*",
"External/.*", "Dependencies/.*",
"Licenses/.*", "Licenses/.*",
"Scripts/Visualizers/.*", "Scripts/Visualizers/.*",
"Docs/.*", "Docs/.*",

View File

@@ -632,7 +632,7 @@ void WgContentsImGuiLayer::drawFolderTree(bool bEngineContent)
rootFolders, rootFolders,
[this](const TreeNodeIdx rootFolderTreeIdx) [this](const TreeNodeIdx rootFolderTreeIdx)
{ {
return !PathFunctions::isSubdirectory(assetManager->getContentDir(rootFolderTreeIdx), Paths::engineRuntimeRoot()); return !PathFunctions::isSubOrSameDir(assetManager->getContentDir(rootFolderTreeIdx), Paths::engineContentDirectory());
} }
); );
} }
@@ -643,7 +643,7 @@ void WgContentsImGuiLayer::drawFolderTree(bool bEngineContent)
rootFolders, rootFolders,
[this](const TreeNodeIdx rootFolderTreeIdx) [this](const TreeNodeIdx rootFolderTreeIdx)
{ {
return PathFunctions::isSubdirectory(assetManager->getContentDir(rootFolderTreeIdx), Paths::engineRuntimeRoot()); return PathFunctions::isSubOrSameDir(assetManager->getContentDir(rootFolderTreeIdx), Paths::engineContentDirectory());
} }
); );
} }

View File

@@ -234,6 +234,7 @@ void EditorEngine::engineStart()
{ {
CBE_PROFILER_SCOPE(CBE_PROFILER_CHAR("EditorStartup")); CBE_PROFILER_SCOPE(CBE_PROFILER_CHAR("EditorStartup"));
const String engContentDir = Paths::engineContentDirectory();
CbeApplication *application = IApplicationModule::get()->getApplication(); CbeApplication *application = IApplicationModule::get()->getApplication();
/* Initialize font data */ /* Initialize font data */
WgImGui::WgImGuiFont fonts[2]; WgImGui::WgImGuiFont fonts[2];
@@ -241,10 +242,9 @@ void EditorEngine::engineStart()
std::vector<ValueRange<uint32>> glyphRanges; std::vector<ValueRange<uint32>> glyphRanges;
SizeT fontIdx = 0; SizeT fontIdx = 0;
const String hackFontPath const String hackFontPath = PathFunctions::combinePath(engContentDir, TCHAR("Assets"), TCHAR("Fonts"), TCHAR("Hack-Bold.ttf"));
= PathFunctions::combinePath(Paths::engineRuntimeRoot(), TCHAR("Assets"), TCHAR("Fonts"), TCHAR("Hack-Bold.ttf"));
const String googleMatFontPath const String googleMatFontPath
= PathFunctions::combinePath(Paths::engineRuntimeRoot(), TCHAR("Assets"), TCHAR("Fonts"), TCHAR("MaterialSymbolsRounded-Bold.ttf")); = PathFunctions::combinePath(engContentDir, TCHAR("Assets"), TCHAR("Fonts"), TCHAR("MaterialSymbolsRounded-Bold.ttf"));
if (FileSystemFunctions::fileExists(hackFontPath.data())) if (FileSystemFunctions::fileExists(hackFontPath.data()))
{ {
FileHelper::readBytes(fontData[fontIdx], hackFontPath); FileHelper::readBytes(fontData[fontIdx], hackFontPath);
@@ -294,7 +294,6 @@ void EditorEngine::engineStart()
application->getMainWindow()->setContent(wgImgui); application->getMainWindow()->setContent(wgImgui);
/* Add engine content directory as content directory */ /* Add engine content directory as content directory */
const String engContentDir = Paths::engineContentDirectory();
if (!FileSystemFunctions::dirExists(engContentDir.getChar())) if (!FileSystemFunctions::dirExists(engContentDir.getChar()))
{ {
FileHelper::makeDir(engContentDir); FileHelper::makeDir(engContentDir);

View File

@@ -96,16 +96,15 @@ list( APPEND public_includes ${Cranberry_CPP_LIBS_PATH}/glm )
generate_engine_library() generate_engine_library()
target_compile_options( ${target_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/MP> ) target_compile_options( ${target_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/MP> )
string( TIMESTAMP build_year "%Y" )
# We do all non common but engine common defines once here, as this is the module which probably will get added to every engine related projects/targets # We do all non common but engine common defines once here, as this is the module which probably will get added to every engine related projects/targets
if( Cranberry_EDITOR_BUILD )
list( APPEND private_compile_defs "ED_DEPS_PATH=\"${Cranberry_ED_DEPS_PATH}\"" )
endif( Cranberry_EDITOR_BUILD )
target_compile_definitions( ${target_name} target_compile_definitions( ${target_name}
PUBLIC PUBLIC
${public_compile_defs} ${public_compile_defs}
$<$<BOOL:${Cranberry_ENABLE_CONSOLE_LOG}>:LOG_TO_CONSOLE=1> COPAT_USER_CFG_INCL=<Types/Platform/Threading/CoPaTConfig.hpp>
$<$<BOOL:${Cranberry_ENABLE_VERBOSE_LOG}>:ENABLE_VERBOSE_LOG=1>
"CBE_CORE_BUILD_YEAR=${build_year}"
"COPAT_USER_CFG_INCL=<Types/Platform/Threading/CoPaTConfig.hpp>"
PRIVATE PRIVATE
${private_compile_defs} ${private_compile_defs}
) )

View File

@@ -41,7 +41,18 @@ String Paths::savedDirectory()
String Paths::engineContentDirectory() String Paths::engineContentDirectory()
{ {
#if EDITOR_BUILD
#ifndef ED_DEPS_PATH
#error "Engine dependencies path not defined"
#else
static const String contentDir = PathFunctions::combinePath(TCHAR(ED_DEPS_PATH), TCHAR("EngineContent"));
#endif
#else
// TODO(Jeslas) : This is placeholder. Runtime structure is not yet planned.
static const String contentDir = PathFunctions::combinePath(applicationDirectory(), TCHAR("Content")); static const String contentDir = PathFunctions::combinePath(applicationDirectory(), TCHAR("Content"));
#endif
return contentDir; return contentDir;
} }

View File

@@ -4,7 +4,7 @@
* \author Jeslas Pravin * \author Jeslas Pravin
* \date January 2022 * \date January 2022
* \copyright * \copyright
* Copyright (C) Jeslas Pravin, 2022-2024 * Copyright (C) Jeslas Pravin, 2022-2025
* @jeslaspravin pravinjeslas@gmail.com * @jeslaspravin pravinjeslas@gmail.com
* License can be read in LICENSE file at this repository's root * License can be read in LICENSE file at this repository's root
*/ */
@@ -18,7 +18,6 @@ namespace ReflectToolCmdLineConst
CONST_EXPR StringLiteralStore<TCHAR("--generatedList")> GENERATED_TU_LIST; CONST_EXPR StringLiteralStore<TCHAR("--generatedList")> GENERATED_TU_LIST;
CONST_EXPR StringLiteralStore<TCHAR("--generatedDir")> GENERATED_DIR; CONST_EXPR StringLiteralStore<TCHAR("--generatedDir")> GENERATED_DIR;
CONST_EXPR StringLiteralStore<TCHAR("--reflectedTypesList")> REFLECTED_TYPES_LIST_FILE; CONST_EXPR StringLiteralStore<TCHAR("--reflectedTypesList")> REFLECTED_TYPES_LIST_FILE;
CONST_EXPR StringLiteralStore<TCHAR("--reflectorRunning")> REFLECTOR_RUNNING_FILE;
CONST_EXPR StringLiteralStore<TCHAR("--moduleRootDir")> MODULE_ROOT_DIR; CONST_EXPR StringLiteralStore<TCHAR("--moduleRootDir")> MODULE_ROOT_DIR;
CONST_EXPR StringLiteralStore<TCHAR("--scanDirs")> MODULE_SCAN_DIRS; CONST_EXPR StringLiteralStore<TCHAR("--scanDirs")> MODULE_SCAN_DIRS;
CONST_EXPR StringLiteralStore<TCHAR("--moduleName")> MODULE_NAME; CONST_EXPR StringLiteralStore<TCHAR("--moduleName")> MODULE_NAME;

View File

@@ -40,7 +40,6 @@ void initializeCmdArguments()
"File where all the reflected types from this module must be written out.", "File where all the reflected types from this module must be written out.",
ReflectToolCmdLineConst::REFLECTED_TYPES_LIST_FILE.getChar() ReflectToolCmdLineConst::REFLECTED_TYPES_LIST_FILE.getChar()
); );
REGISTER_CMDARG("File that exists if the module reflect tool is running.", ReflectToolCmdLineConst::REFLECTOR_RUNNING_FILE.getChar());
REGISTER_CMDARG( REGISTER_CMDARG(
"Root source directory of this module. If no '--scanDirs' is populated all sources under this directory will be scanned", "Root source directory of this module. If no '--scanDirs' is populated all sources under this directory will be scanned",
ReflectToolCmdLineConst::MODULE_ROOT_DIR.getChar() ReflectToolCmdLineConst::MODULE_ROOT_DIR.getChar()

View File

@@ -100,16 +100,6 @@ static void printDiagnostics(CXDiagnostic diagnostic, uint32 formatOptions)
//* ModuleSources impl */ //* ModuleSources impl */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static void doOnExit(bool bPanic)
{
cbe::ignoreUnused(bPanic);
String reflectorRunningFile;
ProgramCmdLine::get().getArg(reflectorRunningFile, ReflectToolCmdLineConst::REFLECTOR_RUNNING_FILE);
LOG_DEBUG("ModuleReflectTool", "Doing exit! {}", reflectorRunningFile);
FileHelper::deleteFile(reflectorRunningFile);
}
void ModuleSources::addAdditionalCompileOpts(std::vector<std::string> &compilerArgs) void ModuleSources::addAdditionalCompileOpts(std::vector<std::string> &compilerArgs)
{ {
if (!ProgramCmdLine::get().hasArg(ReflectToolCmdLineConst::FILTER_DIAGNOSTICS)) if (!ProgramCmdLine::get().hasArg(ReflectToolCmdLineConst::FILTER_DIAGNOSTICS))
@@ -151,17 +141,11 @@ ModuleSources::ModuleSources()
ProgramCmdLine::get().getArg(moduleName, ReflectToolCmdLineConst::MODULE_NAME); ProgramCmdLine::get().getArg(moduleName, ReflectToolCmdLineConst::MODULE_NAME);
ProgramCmdLine::get().getArg(genDir, ReflectToolCmdLineConst::GENERATED_DIR); ProgramCmdLine::get().getArg(genDir, ReflectToolCmdLineConst::GENERATED_DIR);
ProgramCmdLine::get().getArg(reflectedTypesFile, ReflectToolCmdLineConst::REFLECTED_TYPES_LIST_FILE); ProgramCmdLine::get().getArg(reflectedTypesFile, ReflectToolCmdLineConst::REFLECTED_TYPES_LIST_FILE);
ProgramCmdLine::get().getArg(reflectorRunningFile, ReflectToolCmdLineConst::REFLECTOR_RUNNING_FILE);
ProgramCmdLine::get().getArg(intermediateDir, ReflectToolCmdLineConst::INTERMEDIATE_DIR); ProgramCmdLine::get().getArg(intermediateDir, ReflectToolCmdLineConst::INTERMEDIATE_DIR);
ProgramCmdLine::get().getArg(includesFile, ReflectToolCmdLineConst::INCLUDE_LIST_FILE); ProgramCmdLine::get().getArg(includesFile, ReflectToolCmdLineConst::INCLUDE_LIST_FILE);
ProgramCmdLine::get().getArg(compileDefsFile, ReflectToolCmdLineConst::COMPILE_DEF_LIST_FILE); ProgramCmdLine::get().getArg(compileDefsFile, ReflectToolCmdLineConst::COMPILE_DEF_LIST_FILE);
ProgramCmdLine::get().getArg(depIntermDirsFile, ReflectToolCmdLineConst::DEP_INTERMEDIATE_DIRS_LIST_FILE); ProgramCmdLine::get().getArg(depIntermDirsFile, ReflectToolCmdLineConst::DEP_INTERMEDIATE_DIRS_LIST_FILE);
/* Setup running file first */
exitHandlerHndl.value = UnexpectedErrorHandler::registerExitHandler(&doOnExit);
const bool bTouched = FileHelper::touchFile(reflectorRunningFile);
debugAssertf(bTouched, "Failed creating reflector running file");
const SizeT erasedCnt = std::erase_if( const SizeT erasedCnt = std::erase_if(
scanDirs, scanDirs,
[this](const String &dir) [this](const String &dir)
@@ -289,9 +273,6 @@ ModuleSources::ModuleSources()
ModuleSources::~ModuleSources() ModuleSources::~ModuleSources()
{ {
UnexpectedErrorHandler::unregisterExitHandler(exitHandlerHndl.value);
doOnExit(false);
delete headerTracker; delete headerTracker;
headerTracker = nullptr; headerTracker = nullptr;
@@ -588,19 +569,6 @@ std::vector<ReflectedTypeItem> ModuleSources::getDepReflectedTypes() const
std::vector<ReflectedTypeItem> retVal; std::vector<ReflectedTypeItem> retVal;
for (const String &depIntermDir : depIntermDirs) for (const String &depIntermDir : depIntermDirs)
{ {
bool bLogAwait = true;
const String depsRunningPath = PathFunctions::combinePath(depIntermDir, PathFunctions::fileOrDirectoryName(reflectorRunningFile));
while (FileSystemFunctions::fileExists(depsRunningPath.getChar()))
{
if (bLogAwait)
{
LOG_WARN("ModuleReflectTool", "{} awaiting deps... ", moduleName);
bLogAwait = false;
}
/* Sleep 500ms */
PlatformThreadingFunctions::sleep(500);
}
const String reflectedTypesPath = PathFunctions::combinePath(depIntermDir, PathFunctions::fileOrDirectoryName(reflectedTypesFile)); const String reflectedTypesPath = PathFunctions::combinePath(depIntermDir, PathFunctions::fileOrDirectoryName(reflectedTypesFile));
debugAssert(FileSystemFunctions::fileExists(reflectedTypesPath.getChar())); debugAssert(FileSystemFunctions::fileExists(reflectedTypesPath.getChar()));
String content; String content;

View File

@@ -31,9 +31,6 @@ private:
std::vector<String> scanDirs; std::vector<String> scanDirs;
String moduleName; String moduleName;
String reflectedTypesFile; String reflectedTypesFile;
String reflectorRunningFile;
DelegateHandle exitHandlerHndl;
FileChangesTracker *headerTracker; FileChangesTracker *headerTracker;
std::vector<SourceInformation> sources; std::vector<SourceInformation> sources;