dcourtois / premake-qt

Premake module adding support for Qt to actions (Visual Studio, makefiles, etc.)
Do What The F*ck You Want To Public License
45 stars 11 forks source link

not running the qt tools #3

Closed waag42 closed 8 years ago

waag42 commented 8 years ago

Hey, I've set up a project more or less like the example I think. This is the build script:


-- premake5.lua

require( "premake-qt/qt" )
local qt = premake.extensions.qt
-- not used atm
qt5location = "E:/Development/Qt/5.7/msvc2015_64/"

workspace "HelloWorld"
    configurations { "Debug", "DebugOptimized", "Release" }
    architecture "x64"

project "HelloWorld"
    kind "WindowedApp"
    language "C++"
    targetdir "bin/%{cfg.buildcfg}"

    files { "**.h", "**.cpp", "**.ui", "**.qrc" }

    qt.enable()
    qtpath "E:/Development/Qt/5.7/msvc2015_64/"
    qtmodules { "core", "gui", "widgets" }
    qtprefix "Qt5"
    qtgenerateddir "qtgenerated"

    filter "configurations:Debug"
        defines { "DEBUG" }
        flags { "Symbols", "FatalWarnings" }
        qtsuffix "d"

    filter "configurations:Release"
        defines { "NDEBUG" }
        optimize "On"

It runs just fine and I can make a vs2015 solution and project out of this, but it doesn't run the qt tools. I ran it through the decoda IDE debugger with a custom-built debug version of premake5.exe to see what's happening, and I can step into the qt.enable() method, but breakpoints inside the overridden methods inside premake are never hit, so either the debugger can't detect those or they really aren't getting called anymore. The end result in any case is that the moc files are not generated and added to the project.

Any ideas? Maybe I've just got something simple wrong. This is with premake5 alpha 9 and/or alpha 8, tested with both, and the most recent premake-qt from commit c0e8dbc

Thanks, Håkan

dcourtois commented 8 years ago

Hi, I'm currently in holydays until next thursday, so I can't check what's happening. If you can package a small example project and attach it to a comment, I'll have a look at it as soon as I'm back !

dcourtois commented 8 years ago

Hi,

I've had the time to look at this issue, so I downloaded the alpha 9 of Premake, and tried to run it on a few of my projects to see if I could reproduce the issue. Unfortunately, I couldn't reproduce (all the generated projects worked fine, the Qt tools were correctly executed, generating the correct files)

Do you still have the issue, or did you find what was causing it ? If you still have it, can you pack a zip containing everything that you're using (except the Qt lib of course :p) so that I can reproduce it and debug it ? And if you don't, would you mind telling me what was causing it and how you fixed it ? (it might serve as a reference for people having the same problems in the future :) )

waag42 commented 8 years ago

Hey, I haven't resolved this yet. Been busy with other things I'm afraid, I'll give it another go asap and make a package of it.

waag42 commented 8 years ago

Alright, tested it again as well to see if I made some simple mistake, but it's still failing for me. I made a zip testing_qt_premake.zip package with my small test containing premake5.exe that I used, the lua script, the premake-qt scripts used and the source file. There's a .bat file in there as well that is just a shortcut to run premake5.exe vs2015 to generate the solution.

dcourtois commented 8 years ago

Hi, this is happening because you put your class definition in the cpp file. Moc tool only runs on headers (http://doc.qt.io/qt-5/moc.html and you can also checks this by compiling your main.cpp file with Qt Creator)

Try putting you classes definitions into a .h header file, run premake again and it should work fine.

Let me know if the files get correctly generated once you do that :)

waag42 commented 8 years ago

Yeah, that seems to be the issue. I tested this in Qt Creator and it can compile the code if I put the class definition in a header file. It also works using premake and compiling from Visual Studio now. Thanks for your patience and help!

dcourtois commented 8 years ago

You're welcome !