vatsal chauhan
vatsal chauhan

Reputation: 99

Premake circular dependency of a project on itself

I am trying to create a build system that a static library and an app, where app inherits from the static library.

It works fine but I see in console. Circular dependency Core <- Core and Circular dependency App <- App. For some reason they both are depended on themselves but I only link app to core.

build.lua

-- build.lua

workspace "Algorithms"
  configurations { "Debug", "Release" }
  startproject "App"
  outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"

  group "Core"
    include "./core/build-core.lua"

  group "App"
    include "./app/build-app.lua"

  group ""

core/build-core.lua

-- build-core.lua

project "Core"
  language "C"
  kind "StaticLib"
  targetdir("../bin/" .. outputdir .. "/Core")
  objdir("..bin/intermediates/" .. outputdir .. "/Core")

  files {
    "source/**.c",
    "source/**.h"
  }

  includedirs { "source/" }

  filter "configurations:Debug"
    defines "DEBUG"
    symbols "On"
    runtime "Debug"

  filter "configurations:Release"
    defines "NDEBUG"
    optimize "On"
    runtime "Release"

app/build-app.lua


-- build-app.lua

project 'App'
  kind "ConsoleApp"
  language "C"
  targetdir ("../bin/" .. outputdir .. "/App")
  objdir ("../bin/intermediates/" .. outputdir .. "/App")

  files {
    "source/**.c",
    "source/**.h"
  }

  includedirs {
    "source/",
    "../core/source/"
  }

  links { "Core" }

-- configs

Here I have a main build.lua file which has the workspace settings and it includes my core and app projects. This not my own but copied from thecherno's build template(might be slightly modified)

in my core project I include some directories and that's it. I don't link to anything.

why is then core is depended on itself.

my exe runs but I would like to remove this warning

Upvotes: 1

Views: 44

Answers (1)

vatsal chauhan
vatsal chauhan

Reputation: 99

Removing group solves the warnings but I still don't know why. Modified build.lua like so

workspace "Algorithms"
  configurations { "Debug", "Release" }
  architecture "x86_64"
  startproject "App"

  -- cfg is a token visit:
  -- https://premake.github.io/docs/Tokens/#value-tokens
  -- for more info
  outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"

  -- group "Core"
    include "./core/build-core.lua"

  -- group "App"
    include "./app/build-app.lua"

  -- group ""

Simply changing the group name to something else also works. Using same name for group and project causes this warning.

Upvotes: 2

Related Questions