premake-cmake icon indicating copy to clipboard operation
premake-cmake copied to clipboard

node.abspath is nil

Open WhoseTheNerd opened this issue 2 years ago • 2 comments

Generating Clion project needs to generate cmake files, which errors for me. Might want to document what this error means and how to fix it for most of the cases.

whosethenerd@whosethenerd-pc:[~/dev/minecraft]: premake5 clion
Building configurations...
Running action 'clion'...
Error: /home/whosethenerd/.premake/cmake/cmake_project.lua:38: bad argument #2 to 'getrelative' (string expected, got nil)
whosethenerd@whosethenerd-pc:[~/dev/minecraft]: ls -l
total 12
-rw-r--r-- 1 whosethenerd whosethenerd 979 Mar 18 19:44 CMakeLists.txt
drwxr-xr-x 1 whosethenerd whosethenerd  24 Mar 18 19:47 minecraft
-rw-r--r-- 1 whosethenerd whosethenerd 244 Mar 18 19:47 premake5.lua
-rw-r--r-- 1 whosethenerd whosethenerd 236 Mar 18 19:16 README.md
whosethenerd@whosethenerd-pc:[~/dev/minecraft]: ls -l minecraft/
total 4
-rw-r--r-- 1 whosethenerd whosethenerd 430 Mar 18 19:47 premake5.lua
whosethenerd@whosethenerd-pc:[~/dev/minecraft]: cat premake5.lua 
workspace "minecraft"
    architecture "x86_64"

    configurations
    {
        "Debug",
        "Release"
    }

    flags
        {
                "MultiProcessorCompile"
        }

outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

include "minecraft"
whosethenerd@whosethenerd-pc:[~/dev/minecraft]: cat minecraft/premake5.lua 
project "minecraft"
    kind "ConsoleApp"
    language "C++"
    cppdialect "C++17"
    staticruntime "on"

    targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}")
        objdir ("%{wks.location}/bin-int/" .. outputdir .. "/%{prj.name}")

    files
        {
                "src/**.h",
                "src/**.cpp"
        }

    filter "configurations:Debug"
                runtime "Debug"
                symbols "on"

        filter "configurations:Release"
                runtime "Release"
                optimize "on"
whosethenerd@whosethenerd-pc:[~/dev/minecraft]: 

WhoseTheNerd avatar Mar 18 '22 17:03 WhoseTheNerd

It seems that the issue occurs when no files exist in that "src" path, might want to add an error message detailing that?

WhoseTheNerd avatar Mar 18 '22 17:03 WhoseTheNerd

In my fork (https://github.com/Jarod42/premake-cmake), I have just handled that case. no errors for CMake generation. Issue is reported when running cmake as no files to generate app.

Jarod42 avatar Apr 15 '22 20:04 Jarod42