BradyBrenot / huestacean

Philips Hue control app for desktop with screen syncing. C++ with Qt Quick GUI.
http://huestacean.com
Apache License 2.0
566 stars 53 forks source link

Instructions for building #2

Closed BradyBrenot closed 6 years ago

BradyBrenot commented 6 years ago

Write out and test instructions for compiling from source on Windows, Mac, Linux.

Collisionc commented 6 years ago

Was kinda sorta a pain in the ass to compile on windows (as it always tends to be), but it's probably all from microsoft's non-standardization of c++ on visual studio. I thought I'd post what I had to do here just in case you have a slightly different dev setup. There are probably better ways to workaround the compile errors, but I was just trying to get it to compile.

I ran this script from cmd prompt to build on vs2015. Creates a project file in the folder that you can run

set currdir=%cd% call C:\Qt\Qt5.10.1\5.10.1\msvc2015_64\bin\qtenv2.bat call "%VS140COMNTOOLS:~0,-14%VC\vcvarsall.bat" x64 cd /D %currdir% qmake -r -tp vc huestacean.pro

I did have to compile mbedtls and screen_capture_lite to get the library files, but once I added the .lib files and include folders into the huestacean folder (and realized that I was using qt 5.6, not 5.10 ) it compiled without any issues.

Gotchas along the way, probably vs2015 related: Had to compile mbedtls via windows xp toolkit on windows 10. Cmake created the solution file for screen_capture_lite, but then it failed to compile due to errors probably due to to visual studio stupidness. Line 45 of include/threadmanager.h - Had to remove the 'constexpr' from that line Line 365 of src/windows/DXFrameProcessor.cpp - Had to remove the '= {0}', which is fine because the values of 'ret' are initialized right below that.

Of course, after that run windeployqt.exe on the executable to drop the metric ton of qt dlls into the folder.

Solid program, the lights are so responsive it's kind of spooky.

BradyBrenot commented 6 years ago

So, I've been building it in VS2017. I haven't tried with an earlier compiler yet, VS2015 not complying as well with the most recent C++ spec is probably why you have the to latter issues compiling screen_capture_lite, maybe, I dunno.

I used the Qt Visual Studio add-on to make a sln out of the .pro file, then switched the SDK from 8.1 to 10.x (the former chokes on some compiler issue in the standard library, maybe I don't have it properly installed or something). That builds just fine.

To build screen_capture_light, I use VS2017's cmake integration. No issues here. Load the cmake project, build, done.

To build mbedtls, I use the sln files they distribute, retargeted to compile with same SDK. Again, I don't have to do anything else, it just works.

I've also built the app itself with QtCreator; I use the VS2017 compiler, and everything's more or less the same. QtCreator seems to be extremely slow though, at least in Windows, so I gave up on it.


I'm thinking of maybe switching to cmake so that it's just the same for every platform, and the same as the two libraries.

Collisionc commented 6 years ago

Yeah, VS2017 fixes a lot of the C++ spec issues, I just don't have it on my PC atm. I'll probably go install it this week sometime.

Great program tho, I was wondering how long till someone said "Screw it, I'll make a program since no one else will." with the entertainment SDK. :D

AbraKabastard commented 6 years ago

Yeah I'm having a bugger of a time getting it started in VS2017

BradyBrenot commented 6 years ago

@AbraKabastard but VS 2017's what I use. What's happening when you try? Did you do what I said I do in my comment (download Qt for VS add-on, open the .pro file, and in the generated project change the target SDK to 10.x; and the other instructions for the two libraries)? Do you have Qt5.10?

BradyBrenot commented 6 years ago

I'm going to have to try this on a clean machine too...

Collisionc commented 6 years ago

As an update, did a clean install of vs2017 -

Was able to build mbedtls and screen_capture_lite without editing the code. However, I did have to flag all project files in mbedtls to compile under VS2017 win xp toolset.

Overall order from nothing to building huestacean: 1: Install VS2017 Community with C++ options AND windows XP toolset for c++ - https://www.visualstudio.com/downloads/ 2: Install CMAKE - https://cmake.org/ 3: Install QT 5.10.1 - https://download.qt.io/official_releases/qt/5.10/5.10.1/qt-opensource-windows-x86-5.10.1.exe - Make sure to checkbox VS2017 x64 + vs addon 2: Clone this repo + https://github.com/smasherprog/screen_capture_lite + https://github.com/ARMmbed/mbedtls 3: Open cmake, select screen_capture_lite folder and generate vs2017 64 config/build files. 4: Tell cmake to "Open project" then compile the "ALL BUILD" screen_capture_lite release x64 5: Copy screen_capture_lite.lib file that is created into root of huestacean folder + also copy /include/ScreenCapture.h from screen capture lite into the hustacean/include folder 6: Open mbedtls\visualc\VS2010 folder, the .sln file is the file to open with visual studio. 7: On the left hand side of visual studio, there's a bunch of projects, select all 48 of them and then right click --> properties. Change Platform Toolset to v141_xp, apply. 8: Compile release 64 9: Copy mbedTLS.lib file that is created in the mbedtls\visualc\VS2010\x64\Release folder to the root of huestacean. Also copy the entire mbedtls\include\mbedtls\ folder into the root of huestacean 10: Use the QT for VS add on, open the .pro file and generate the project, then compile.

After you compile the program, unles syou add qt's bin folder to your path it'll complain about missing DLLs. You can either add that folder to your path, or open cmd prompt where the .exe file is located and run the following command:

C:\Qt\Qt5.10.1\5.10.1\msvc2017_64\bin\windeployqt.exe huestacean.exe

That'll copy all the necessary dlls (plus a bunch of not so necessary ones) to the folder and you'll be able to run the program.

BradyBrenot commented 6 years ago

Switched to ~qmake~ cmake and added build instructions. It'll build the two dependencies and Huestacean in one go with two commands (one to run cmake, one to compile the project). I hope that's less painful.

I'm going to test Mac and Linux... early next week. Would like to have a script that can do a minimal windeployqt too.

BradyBrenot commented 6 years ago
BradyBrenot commented 6 years ago

Build instructions tested on Windows and Mac now. Can reopen there's more questions or open a new issue if there's related problems but I think it's clear enough now.