diff --git a/.gitmodules b/.gitmodules index 1027d510b..072c58ceb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "libraries/rythe/rythe-standard-library"] path = libraries/rythe/rythe-standard-library url = https://github.com/Rythe-Interactive/Rythe-Standard-Library.git +[submodule "libraries/third_party/catch2"] + path = libraries/third_party/catch2 + url = https://github.com/catchorg/Catch2.git diff --git a/libraries/rythe/rythe-standard-library b/libraries/rythe/rythe-standard-library index 7eb3ea7be..e7877e40b 160000 --- a/libraries/rythe/rythe-standard-library +++ b/libraries/rythe/rythe-standard-library @@ -1 +1 @@ -Subproject commit 7eb3ea7be9b4f133780af6c4f64b064f3c808999 +Subproject commit e7877e40bacb3df948047e0ccfd68a09cd02ee57 diff --git a/libraries/third_party/catch2 b/libraries/third_party/catch2 new file mode 160000 index 000000000..3acb8b30f --- /dev/null +++ b/libraries/third_party/catch2 @@ -0,0 +1 @@ +Subproject commit 3acb8b30f1ce0c801de0e3880ea1f6467dd0105c diff --git a/modules/rythe/application b/modules/rythe/application index faa3de614..7c79ffc16 160000 --- a/modules/rythe/application +++ b/modules/rythe/application @@ -1 +1 @@ -Subproject commit faa3de6140abf2c1e8399d1f5e78ec5bdbc9d717 +Subproject commit 7c79ffc1633e76dc7643d54b3150a20594dc3ed2 diff --git a/modules/rythe/audio b/modules/rythe/audio index d4e849711..548e3db5f 160000 --- a/modules/rythe/audio +++ b/modules/rythe/audio @@ -1 +1 @@ -Subproject commit d4e8497111fd2749d0f7940f3c565a2699ae9dca +Subproject commit 548e3db5fd7753a2058fbea01aa96138253773e9 diff --git a/modules/rythe/core b/modules/rythe/core index f5739b157..8f3044e9e 160000 --- a/modules/rythe/core +++ b/modules/rythe/core @@ -1 +1 @@ -Subproject commit f5739b1570129e9c54e12f11a5dd206bcf6fb4c5 +Subproject commit 8f3044e9ec77dd79975203f1b5adc576709432ce diff --git a/modules/rythe/graphics b/modules/rythe/graphics index 7db9b3559..c8a1c2d26 160000 --- a/modules/rythe/graphics +++ b/modules/rythe/graphics @@ -1 +1 @@ -Subproject commit 7db9b3559d818a39e3797a904f5adf9badd333ba +Subproject commit c8a1c2d26494a515c94bd3d0d4578ffa571a15df diff --git a/modules/rythe/physics b/modules/rythe/physics index 3a401789b..8b5e9c04d 160000 --- a/modules/rythe/physics +++ b/modules/rythe/physics @@ -1 +1 @@ -Subproject commit 3a401789b9b0b8b90eccaf1026a53f8e6b2ff12c +Subproject commit 8b5e9c04d714738a2c4bd716355c25136055bc81 diff --git a/premake/rythe/filesystem.lua b/premake/rythe/filesystem.lua index 86ff9472e..9e623be0d 100644 --- a/premake/rythe/filesystem.lua +++ b/premake/rythe/filesystem.lua @@ -1,9 +1,15 @@ local fs = {} function fs.exists(file) - local f = io.open(file, "rb") - if f then io.close(f) end - return f ~= nil + local ok, err, code = os.rename(file, file) + if not ok then + if code == 13 then + -- Permission denied, but it exists + return true + end + return false + end + return true end function fs.readLines(file) diff --git a/premake/rythe/projects.lua b/premake/rythe/projects.lua index 8fcf22b52..e9140e0b5 100644 --- a/premake/rythe/projects.lua +++ b/premake/rythe/projects.lua @@ -152,14 +152,18 @@ local function projectNameSuffix(projectType) return "" end -local function projectTypeFilesDir(projectType) +local function projectTypeFilesDir(projectType, namespace) if projectType == "test" then return "/tests/" elseif projectType == "editor" then return "/editor/" end - return "/src/" + if namespace == "" or namespace == nil then + return "/src/" + end + + return "/src/" .. namespace .. "/" end local function isProjectTypeMainType(projectType) @@ -293,6 +297,10 @@ local function getDepsRecursive(project, projectType) deps = {} end + if projectType == "test" then + deps[#deps + 1] = "third_party/catch2" + end + local copy = deps local set = {} @@ -312,13 +320,32 @@ local function getDepsRecursive(project, projectType) } local path = project.location .. "/third_party/" .. thirdPartyProject.name - thirdPartyProject.files = { - path .. "/src/**", - path .. "/include/**" - } - depProject = loadProject(depId, thirdPartyProject, project.src, path, thirdPartyProject.name, "library") - depType = "library" + if not fs.exists(path .. "/") then + path = _WORKING_DIR .. "/libraries/third_party/" .. thirdPartyProject.name + end + + if fs.exists(path .. "/") then + thirdPartyProject.files = {} + + if fs.exists(path .. "/src/" .. thirdPartyProject.name .. "/") then + thirdPartyProject.files[#thirdPartyProject.files + 1] = path .. "/src/" .. thirdPartyProject.name .. "/**" + end + + if fs.exists(path .. "/include/" .. thirdPartyProject.name .. "/") then + thirdPartyProject.files[#thirdPartyProject.files + 1] = path .. "/include/" .. thirdPartyProject.name .. "/**" + end + + if utils.tableIsEmpty(thirdPartyProject.files) then + thirdPartyProject.files = { + path .. "/src/**", + path .. "/include/**" + } + end + + depProject = loadProject(depId, thirdPartyProject, project.src, path, thirdPartyProject.name, "library") + depType = "library" + end end if depProject ~= nil then @@ -391,7 +418,7 @@ function projects.submit(proj) local depProject, depId, depType = findAssembly(assemblyId) if depProject ~= nil then - externalIncludeDirs[#externalIncludeDirs + 1] = depProject.location .. "/" .. projectTypeFilesDir(depType) + externalIncludeDirs[#externalIncludeDirs + 1] = depProject.location .. "/" .. projectTypeFilesDir(depType, "") depNames[#depNames + 1] = depProject.alias .. projectNameSuffix(depType) @@ -423,10 +450,17 @@ function projects.submit(proj) if string.find(pattern, "^(%.[/\\])") == nil then filePatterns[#filePatterns + 1] = pattern else - filePatterns[#filePatterns + 1] = proj.location .. projectTypeFilesDir(projectType) .. proj.namespace .. "/" .. string.sub(pattern, 3) + filePatterns[#filePatterns + 1] = proj.location .. projectTypeFilesDir(projectType, proj.namespace) .. string.sub(pattern, 3) end end + if projectType == "test" then + filePatterns[#filePatterns + 1] = _WORKING_DIR .. "/utils/test utils/**" + + vpaths({ ["test utils"] = _WORKING_DIR .. "/utils/test utils/**" }) + end + + vpaths({ ["*"] = proj.location .. projectTypeFilesDir(projectType, proj.namespace) }) files(filePatterns) if not utils.tableIsEmpty(proj.exclude_files) then @@ -435,7 +469,7 @@ function projects.submit(proj) if string.find(pattern, "^(%.[/\\])") == nil then excludePatterns[#excludePatterns + 1] = pattern else - excludePatterns[#excludePatterns + 1] = proj.location .. projectTypeFilesDir(projectType) .. proj.namespace .. "/" .. string.sub(pattern, 3) + excludePatterns[#excludePatterns + 1] = proj.location .. projectTypeFilesDir(projectType, proj.namespace) .. string.sub(pattern, 3) end end diff --git a/utils/test utils/main.cpp b/utils/test utils/main.cpp new file mode 100644 index 000000000..e69de29bb