From 9ea4dc82e35f97474a819a06a5fcf72c2fba8c35 Mon Sep 17 00:00:00 2001 From: Glyn Leine Date: Fri, 3 Nov 2023 02:02:21 +0100 Subject: [PATCH] starting to get dirs setup for projects --- premake/rythe/context.lua | 2 +- premake/rythe/projects.lua | 46 +++++++++++++++++++++++++++++++++----- premake/rythe/rythe.lua | 2 ++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/premake/rythe/context.lua b/premake/rythe/context.lua index 6e759534b..b9ec79228 100644 --- a/premake/rythe/context.lua +++ b/premake/rythe/context.lua @@ -33,7 +33,7 @@ function context.hasModule(module) return hasFilter(_OPTIONS["modules"], module) end --- Project types are e.g. test, module, application, static-libary, dynamic-library, header-only, util +-- Project types are e.g. test, module, application, editor, static-libary, dynamic-library, header-only, util function context.hasProjectType(projectType) return hasFilter(_OPTIONS["types"], projectType) end diff --git a/premake/rythe/projects.lua b/premake/rythe/projects.lua index 7aa3d4606..f39a3dfa9 100644 --- a/premake/rythe/projects.lua +++ b/premake/rythe/projects.lua @@ -30,6 +30,8 @@ local function kindName(projectType, config) return ctx.linkTarget() elseif projectType == "test" then return "ConsoleApp" + elseif projectType == "editor" then + return "SharedLib" elseif projectType == "application" then if config == rythe.Configuration.RELEASE then return "WindowedApp" @@ -46,6 +48,18 @@ local function kindName(projectType, config) assert(false, "Unknown project type: \"" .. projectType .. "\"") end +local function projectTypeGroupPrefix(projectType) + if projectType == "test" then + return "tests/" + elseif projectType == "application" then + return "applications/" + elseif projectType == "editor" then + return "editor/" + end + + return "" +end + function projects.load(projectPath) print("Loading project at \"" .. projectPath .. "\"") @@ -72,9 +86,6 @@ function projects.load(projectPath) assert(project.group == group, "Group folder structure mismatch \"" .. group .. "\" vs \"" .. project.group .. "\"") assert(project.name == name, "Project name folder structure mismatch \"" .. name .. "\" vs \"" .. project.name .. "\"") assert(not utils.tableIsEmpty(project.types), "Project must hold an assembly type. (Use the type \"util\" if no source code is required)") - if next(project.dependencies) == nil then - project.dependencies = nil - end if utils.tableIsEmpty(project.defines) then project.defines = { "PROJECT_NAME=" .. project.name } @@ -118,18 +129,41 @@ function projects.submit(project) } for i, projectType in ipairs(project.types) do - group(project.group) + local fullGroupPath = projectTypeGroupPrefix(projectType) .. project.group + local binDir = _ACTION .. "/bin/" + + group(fullGroupPath) project(project.name) + + location(_ACTION .. "/" .. fullGroupPath) + targetdir(binDir .. fullGroupPath) + objdir(binDir .. "obj") + + if not utils.tableIsEmpty(project.dependencies) then + local libDirs = {} + for i, dep in ipairs(project.dependencies) do + -- something + end + + libdirs(libDirs) + end + architecture(buildSettings.platform) - toolset("clang") + toolset(buildSettings.toolset) language("C++") - cppdialect("C++23") + cppdialect(buildSettings.cppVersion) + defines(project.defines) + for i, config in ipairs(rythe.Configuration) do configSetup[config]() kind(kindName(projectType, config)) end + + filter("") end + + group("") end function projects.scan(path) diff --git a/premake/rythe/rythe.lua b/premake/rythe/rythe.lua index edabfa2af..21e8fd957 100644 --- a/premake/rythe/rythe.lua +++ b/premake/rythe/rythe.lua @@ -9,6 +9,8 @@ premake.rythe = { loadedProjects = {}, buildSettings = { platform = "x86_64" + toolset = "clang" + cppVersion = "C++23" } }