Skip to content

Commit

Permalink
starting to get dirs setup for projects
Browse files Browse the repository at this point in the history
  • Loading branch information
GlynLeine committed Nov 3, 2023
1 parent da99bf8 commit 9ea4dc8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion premake/rythe/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 40 additions & 6 deletions premake/rythe/projects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 .. "\"")

Expand All @@ -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 }
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions premake/rythe/rythe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ premake.rythe = {
loadedProjects = {},
buildSettings = {
platform = "x86_64"
toolset = "clang"
cppVersion = "C++23"
}
}

Expand Down

0 comments on commit 9ea4dc8

Please sign in to comment.