paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
3.05k stars 817 forks source link

How To For Windows + QT Creator #192

Closed jaitaiwan closed 4 years ago

jaitaiwan commented 6 years ago

Hi Folks,

Completely new to CPP, QT and this project. I'm wanting to build a visual scripting editor for go/python. I'm wondering if you have somewhere or someone that can point me in the direction of how to get setup for windows, qt creator.

I currently have VS2017 installed with the Windows 10 SDK and C++ tooks as well as a manually installed CMake. I tried building using the command line tooling provided with qt creator but it can't find Clang2 (or whatever the name of the 3rd undocumented dependency is).

Thanks in advance!

russelltg commented 6 years ago

You're probably having a problem with Catch2, the testing framework that this project uses. You can either install it (look at appveyor.yml for an example), or pass -DENABLE_TESTING=OFF to cmake when generating the buildfiles.

That definitely should be added to the readme.

JokerMartini commented 6 years ago

Could someone explain in more detail how to get this to build on windows. I messed with it for a few hours and was up able to do so. thank you

Quincunx271 commented 6 years ago

From the Windows Developer Command Prompt (might be called Visual Studio Command Prompt), inside the nodeeditor/build folder (make the directory if you need to), run the following command

cmake .. -DBUILD_TESTING=OFF 

The -DBUILD_TESTING=OFF turns off the woefully incomplete unit tests, so it will compile even without Catch2 set up on your machine. This command should generate a Visual Studio solution / projects which you can open up and work with. If you prefer to use your own code editor, you can build with cmake --build ..

If CMake says something about needing to specify a generator, look at the cmake-generators(7) doc for an appropriate option and pass that to cmake. For example: cmake .. -DBUILD_TESTING=OFF -G "Visual Studio 15 2017".


For more information on using CMake, vector-of-bool's How to CMake Good series is pretty good. This video explains how to use CMake with Visual Studio, and this video explains how to use CMake without Visual Studio.

I'm pretty sure Qt Creator can know about CMake and build CMake projects, but I don't use it, so I don't know how that works.

JokerMartini commented 6 years ago

I've been unable to build this project. Could someone please help out. The original author perhaps?

Quincunx271 commented 6 years ago

@JokerMartini What problem are you running into at what step of the process?

JokerMartini commented 6 years ago

I downloaded the zip file (containing all the project files) and then opened Qt Creator. From there I have no idea what to do. What I would normally do is open the .pro file to begin the project, however in this case there is not .pro file. So I do not know where to start.

JokerMartini commented 6 years ago

I would certainly appreciate your help @Quincunx271

Quincunx271 commented 6 years ago

This project uses CMake rather than Qt's qmake. First, make sure you've installed a recent version of CMake. Then, open the CMakeLists.txt file from Qt Creator. It should walk you through configuring CMake

JokerMartini commented 6 years ago

hmmm no luck. I wish the project had an pro file or a visual studio file. I downloaded and installed CMake but it does not appear to do anything different in Qt than it did before i had it installed.

Quincunx271 commented 6 years ago

The CMakeLists.txt is the equivalent of a .pro file. Did you open that file in Qt Creator?

JokerMartini commented 6 years ago

So i did what you said. I downloaded and installed CMake. After installing CMake I did the following:

  1. Qt Creator and when to File > Open File or Project...
  2. Selected the CMake file in the root folder of the project nodeeditor-master\CMakeLists.txt
  3. Qt then prompted me to selected a Build kit which I chose Desktop Qt 5.11.1 MinGW 32 Bit
  4. The Qt displayed the workspace where the Projects listed were node-editor-master with only one file underneath it called CMakerLists.txt and that's it.
  5. I then selected Build > Run CMake and nothing happened.

I'm not sure what else to do here?

JokerMartini commented 6 years ago

The CMakeLists.txt file says cmaker minimum requried is 3.2 but there is not version of 3.2 or 3.4. There is only 3.12.3 available.

JokerMartini commented 6 years ago

OK so i made some progress but now im getting this error... regarding FindCatch2.cmake. How can i just ignore or remove this entirely from the project.

nodeeditor-master\test\CMakeLists.txt:1: error: By not providing "FindCatch2.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Catch2", but CMake did not find one. Could not find a package configuration file provided by "Catch2" with any of the following names: Catch2Config.cmake catch2-config.cmake Add the installation prefix of "Catch2" to CMAKE_PREFIX_PATH or set "Catch2_DIR" to a directory containing one of the above files. If "Catch2" provides a separate development package or SDK, be sure it has been installed.

Quincunx271 commented 6 years ago

To ignore missing Catch2, pass -DBUILD_TESTING=OFF when you configure CMake. This is in a text field when you configure CMake with Qt Creator.

Quincunx271 commented 6 years ago

The CMakeLists.txt file says cmaker minimum requried is 3.2 but there is not version of 3.2 or 3.4. There is only 3.12.3 available.

Use the newest version of CMake you can. It's not "cmake maximum required"; it's "cmake minimum required"

JokerMartini commented 6 years ago

Where do i put this in Qt Creator? I don't know where this is added?

JokerMartini commented 6 years ago

:-1: error: No rule to make target 'Catch'. Stop.

JokerMartini commented 6 years ago

I downloaded the catch.hpp file but i have no idea where to put it so it works. haha this is such a pain in the ass. Why didn't the original author include all the files necessary to build the project.

Thanks for your help so far

Quincunx271 commented 6 years ago

I was actually the one who added the dependency on Catch. The way this library depends on Catch is standard for depending on libraries with CMake.

The easiest thing to do is to turn off building tests when configuring CMake. This will remove the dependency on Catch. I've outlined how to do that above.

If you do want to build the tests, see the .appveyor.yml file. Alternatively, you can run the following commands (slightly different from what's in the appveyor.yml):

> git clone https://github.com/catchorg/Catch2.git
> cd Catch2
> mkdir build
> cd build
> cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=path/to/some/directory
> cmake --build . --target install

Then, from this project's build directory, run cmake -DCatch2_DIR=path/to/some/directory/lib/cmake/Catch2 ...

JokerMartini commented 6 years ago

Alright, I'll take a look tomorrow. I've spent a few hours already trying to get this to work and I'm hitting some road blocks :) i thought this would be a quick and easy download > build to see some of the test projects. It appears to be a bit more complex than most projects I have exp with testing that are open source.

paceholder commented 6 years ago

I put some guidelines to Readme. It works on Linux with Qt Creator, have no chance to test it immediately on Windows. Let us know if it works for you.

@Quincunx271 don't you want to create a 3rdparty folder and put there the catch header? It looks like a straightforward solution.

Thanks, Dmitry

Quincunx271 commented 6 years ago

@paceholder Considering that Catch2 is the only non-qt dependency, that's probably the easiest solution. I'll go ahead and add this.

JokerMartini commented 6 years ago

I did get it to partially work. A lot of the examples didn't fully work because i just did a find and replace, removing everything that had the word Catch in it. I was just a bit anxious to see it compile and run and that was the quickest solution for me.

Once @Quincunx271 adds it to the project, ill redownload and try compiling again in hopes of having it fully up and running.

Thanks for your help guys.

DefinitlyEvil commented 5 years ago

I have successfully compiled but my IDE can't adapt to the code and the code completion system was a mess... :(