Skip to content

Compiling on Windows

spora-dun edited this page Jul 9, 2022 · 41 revisions

You can compile ScreenCloud using both MSVC and MinGW on Windows. Step by step instructions for both compilers are given below. Please note that the MSVC instructions are for Qt5, while the MinGW instructions are for Qt4 (The MinGW instructions need to be updated at some point).

MSVC (Qt5)

  1. Download and install Visual Studio.

  2. Download and install Python 3.

  3. Download and build OpenSSL. You'll need working installations of Perl and NASM added to your PATH. Extract the files in a way that preserves symlinks. Enter the following commands in a Visual Studio command prompt:
    perl Configure VC-WIN32 --prefix=C:\OpenSSL
    ms\do_nasm
    nmake -f ms\ntdll.mak
    nmake -f ms\ntdll.mak install

  4. UPDATE: Prebuilt libraries are now available and can be used instead. You may therefore skip this step and install Qt from qt.io. Download and compile Qt. As of right now there are no prebuilt libraries for Visual Studio 2015. Follow these steps if you're going to use Qt 5.5.1. Make sure Python, Perl, Ruby, Cygwin and Qt\gnuwin32\bin is in your PATH. Adding -opengl dynamic and -openssl -I C:/OpenSSL/include to the configure params in the .bat files is a good idea to avoid issues later on with PythonQt.

  5. Download and build zlib:
    nmake -f win32\Makefile.msc

  6. Download and compile QuaZip. We need to pass some extra params to cmake because of a bug in the 0.7 version (has been fixed upstream). If you get linker errors, try removing the line with SET(ZLIB_LIBRARIES "") in CMakeLists.txt.
    mkdir build
    cd build
    cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=<path to qt>\lib\cmake -DZLIB_INCLUDE_DIRS=<path to zlib> -DZLIB_LIBRARIES=<path to zlib>\zdll.lib -DQT_QTCORE_LIBRARY=<path to qt>\lib\Qt5Core.lib
    nmake
    nmake install

  7. Download and compile PythonQt. We'll use qmake since cmake builds dosen't work properly with qt5 yet (as of PythonQt 3.0). First, edit build/python.prf to use the python version you installed earlier. If you run into problems with opengl, either re-run the generator, or compile Qt with Opengl support.
    cd PythonQt3.0
    set PYTHON_PATH=c:\Python35
    set PYTHON_LIB=c:\Python35\libs
    qmake CONFIG+=debug_and_release
    nmake all
    nmake install

  8. You should now be able to build ScreenCloud:
    git clone https://github.com/olav-st/screencloud.git
    mkdir build
    cd build
    cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=<path to qt>\lib\cmake -DZLIB_INCLUDE_DIRS=<path to zlib> -DPYTHON_EXECUTABLE=<path to python>\python.exe -DQUAZIP_INCLUDE_DIR=<path to quazip>\include\quazip -DQUAZIP_LIBRARY=<path to quazip>\lib\quazip.lib -DPYTHONQT_INCLUDE_DIR=<path to pythonqt>\src -DPYTHONQT_LIBRARY=<path to pythonqt>\lib\PythonQt.lib -DPYTHONQT_QTALL_INCLUDE_DIR=<path to pythonqt>\extensions\PythonQt_QtAll -DPYTHONQT_QTALL_LIBRARY=<path to pythonqt>\lib\PythonQt_QtAll.lib
    nmake

MinGW (Qt4)

  1. Download and install the newest version of MinGW with MSYS.
  2. Download and build OpenSSL. You'll need a working Perl installation. Run these commands from an MSYS shell:
    tar xf openssl-1.0.1c.tar.gz #Use tar to preserve symlinks
    perl Configure mingw --prefix=/c/OpenSSL shared
    make make install
  3. Download and compile Qt. We cannot use the prebuilt binaries since they were built for an older version of MinGW.
    configure.exe -platform win32-g++ -no-phonon -no-phonon-backend -no-webkit -no-qt3support -no-script -no-scripttools -nomake demos -nomake examples -openssl -I C:/OpenSSL/include
    mingw32-make
    Add <path to qt>/bin to your PATH.
    Note: You might run into this issue.
  4. Download and compile Qxt. ScreenCloud only needs two modules so you can safely ignore the rest:
    configure.bat -nomake web -nomake sql -nomake zeroconf -nomake berkeley -nomake designer -nomake network
    mingw32-make
    mingw32-make install
  5. Download and compile QuaZip.
    mkdir build
    cd build
    cmake .. -G "MinGW Makefiles" -DZLIB_INCLUDE_DIRS=<path to qt>/src/3rdparty/zlib
    mingw32-make
  6. The last library we need is Python. We need to use a patched version since the official one is built with MSVC.
  7. You should now be able to build ScreenCloud:
    git clone https://github.com/olav-st/screencloud.git
    mkdir build
    cd build
    cmake ../screencloud -G "MinGW Makefiles" -DZLIB_INCLUDE_DIRS=<path to qt>/src/3rdparty/zlib
    mingw32-make
Clone this wiki locally