KDEConnect/Build Windows: Difference between revisions

From KDE Community Wiki
No edit summary
m (Fix minor typos)
(38 intermediate revisions by 2 users not shown)
Line 1: Line 1:
NOTE: This tutorial assumes Craft is being installed in <code>C:/</code> [default]
 
{{Warning|This is an unfinished article}}
 
 
== X. DEVELOPER RECOMMENDATIONS ==
In case you get stuck, check out these recommendations for the build process.
 
* As a developer you'd naturally want to be able to test out all the features offered by KDE Connect. Right now '''MSVC does the best job as a compiler''' for KDE Connect for Windows, so you may choose that.
* We recommend to '''install Craft in '''C:/''' [default]''' as the guide uses '''C:/''' as the installation directory.
* Check out [https://community.kde.org/Craft Craft docs] for more help on how to use it.
 
<div class="noautonum">__TOC__</div>
 


== 0. SETTING UP ENVIRONMENT ==
== 0. SETTING UP ENVIRONMENT ==
The environment for KDE Connect on Windows simply consists of two parts- A compiler of choice and a build system. While we do have a couple of options for the compiler, our recommended build system is [https://community.kde.org/Craft Craft]. While this is an all-in-one build guide, you should definitely refer to Craft's documentation for further information on using the build system in your development environment!
Choose your compiler of choice:-
<p align = "center"> [https://community.kde.org/KDEConnect/Build_Windows#0.1-A_installing_MSVC '''MSVC'''] (full-support) | [https://community.kde.org/KDEConnect/Build_Windows#0.1-B_installing_MinGW-w64 '''MinGW-w64'''] (partial support) </p>
=== 0.1-A installing MSVC ===


1. Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.
1. Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.


2. Install these packages.
2. Install these packages.
Line 19: Line 36:
** Test Adapter for Google Test
** Test Adapter for Google Test


=== 0.1-B installing MinGW-w64 ===
1. Install MinGW-w64 through the GUI installer located [http://www.mingw.org/wiki/Getting_Started here].
2. While installing Craft, feel free to select '''Mingw-w64''' as your compiler!
Afterward, there is no difference in the commands used in the development.
Note that due to the lacking of some definitions in MinGW provided header file, some plugins could not be compiled with all functions on Windows using MinGW.
'''This is still an experimental feature, and you might need some developer know-how to get past any build problems.'''
=== 0.2 installing Craft ===
1. Call the following commands in a Powershell window with ''Administrator Privileges''


3. Call the following commands in a Powershell window with ''Administrator Privileges''


<pre>
<syntaxhighlight>
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
</pre>
</syntaxhighlight>




4. During command 2, select the default ('''Visual Studio 17''') as your compiler!
2. During command 2, select '''Visual Studio 19''' if you chose MSVC earlier, otherwise '''Mingw-w64''' as your compiler.


[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]
[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]


<pre>Select compiler
<syntaxhighlight>
[0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2015): 1
Select compiler
[0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2017): 2
Select architecture
Select architecture
[0] x86 [1] x64 (Default is x64): 1
[0] x86 [1] x64 (Default is x64): 1
</pre>
</syntaxhighlight>




5. When installation is done, note the Environment variables to match the ones in top of this image:-  
3. When the installation is done, note the Environment variables to match the ones in the top of this image:-  


[[File:kdeconnect_win03.jpeg|env vars]]
[[File:kdeconnect_win03.jpeg|env vars]]


<pre>
<syntaxhighlight>
[Environment]
[Environment]
PATH=
PATH=


Craft                             : C:\CraftRoot
Craft               : C:\CraftRoot
Version                         : master
Version             : master
ABI                               : windows-msvc2017_64-c1
ABI                 : windows-msvc2019_64-c1
Download directory  : C:\CraftRoot\download
Download directory  : C:\CraftRoot\download
</pre>
</syntaxhighlight>
 
== 1. BUILDING KDE CONNECT OUT OF LATEST SOURCE CODE==
 
Craft has automated most of the redundant parts of the build process and exposed just the really useful parameters like ''which version to build'', ''where to install'' ''et al''.
 
1. Open '''Craft CraftRoot''' from search (in taskbar).
 
2. Run the following commands now.
 


<syntaxhighlight>


== 1. Getting the source code and building ==
REM First, we set the various dependencies of kdeconnect-kde to be installed from the code in the master branch.


# Open '''Craft CraftRoot''' from search (in taskbar)
craft --set version=master kdeconnect-kde
craft --set version=master craft
craft --set version=master kde/frameworks/tier3
craft --set version=master dev-utils/snoretoast
craft --set version=master kde/frameworks/tier1/sonnet
craft --set version=master libs/libssh2
craft --set version=master kde/frameworks/tier3/kio
craft --set version=master kde/kdenetwork/kio-extras
craft --set version=master kde/frameworks/tier1/kcoreaddons
craft --set version=master kde/frameworks/tier2/kauth
craft --set version=master kde/frameworks/extra-cmake-modules
craft --set version=master kde/frameworks/tier1/kwindowsystem
craft --set version=master kde/frameworks/tier1/kconfig
craft --set version=master kde/frameworks/tier1/kcodecs
craft --set version=master kde/frameworks/tier1/kwidgetsaddons
craft --set version=master kde/frameworks/tier1/kitemviews
craft --set version=master kde/frameworks/tier1/kguiaddons
craft --set version=master kde/frameworks/tier2/kcrash
craft --set version=master kde/frameworks/tier1/kdbusaddons
craft --set version=master kde/frameworks/tier2/kdoctools
craft --set version=master kde/frameworks/tier1/karchive
craft --set version=master kde/frameworks/tier2/kcompletion
craft --set version=master kde/frameworks/tier3/kiconthemes
craft --set version=master kde/frameworks/tier1/solid
craft --set version=master kde/pim/kcontacts


# Run the following commands now.
REM Now we install kdeconnect-kde within CraftRoot.
<pre>
craft --set version=master kdeconnect-kde  # set the version of kdeconnect-kde to be installed to the master branch
craft -i kdeconnect-kde # install kdeconnect-kde within CraftRoot
</pre>


craft -i kdeconnect-kde
</syntaxhighlight>




== Building an installer ==
== 2. TESTING CHANGES ==


# To create an installable setup, you need [https://sourceforge.net/projects/nsis/ '''NSIS- a open source system to create Windows installers''']. Install it by this command: <code>craft nsis</code>  
TODO: Fill stuff here from Craft's documentation.
 
 
== 3. BUILDING A SHARE-ABLE INSTALLER ==
 
Choose your package of choice:-
<p align = "center"> [https://community.kde.org/KDEConnect/Build_Windows#3.1-A_creating_a_desktop_application_.exe_setup '''.EXE Setup'''] (full-support) | [https://community.kde.org/KDEConnect/Build_Windows#3.1-B_creating_a_Windows_App_.Appx_package '''.Appx package for Windows Store'''] (partial support) </p>
 
 
 
=== 3.1-A creating a desktop application <code>.exe</code> setup ===
 
0. Make sure PackageType is set as <code>PackageType = NullsoftInstallerPackager</code> in <code>CraftRoot/etc/CraftSettings.ini</code>.
 
1. To create an installable setup, you need [https://sourceforge.net/projects/nsis/ '''NSIS- a open source system to create Windows installers''']. Install it by this command: <code>craft nsis</code>  




Line 74: Line 152:




# Now you can use the <code>--package</code> flag to build an installable '''.EXE''' out of latest source code available [https://invent.kde.org/kde/kdeconnect-kde here]. The command should look like this: <code>craft --package extragear/kdeconnect-kde</code>
=== 3.1-B creating a Windows App <code>.Appx</code> package ===
 
0. Make sure PackageType is set as <code>PackageType = AppxPackager</code> in <code>CraftRoot/etc/CraftSettings.ini</code>.
 
=== 3.2 packaging through Craft ===
 
1. Now you can use the <code>--package</code> flag to build an installer. Run this in '''Craft CraftRoot'''.
<syntaxhighlight>
craft --package extragear/kdeconnect-kde
</syntaxhighlight>
 
'''Note''': The output files are saved here: <code>C:\CraftRoot\tmp\</code>


Note the output file here:
== FAQs : FREQUENTLY ASKED QUESTIONS ==


<code>Output: &quot;C:\CraftRoot\tmp\kdeconnect-kde-master-86e5cd48-windows-msvc2017_64-cl.exe&quot;</code>
We are only human! There are many doubts that we face commonly, during DevSprints and during the onboarding of new contributors. We'd like to expedite this process for you by enlisting all the commonly asked questions in one place so you don't have to ask around like others had to!


Great thanks to &lt;TheOneRing_m&gt; (Hannah) on IRC Freenode! She is the maintainer of KDE Craft, and a magician! <span class="emoji" data-emoji="smile">😄</span>
'''1. I see double plugins in my KDE Connect installation. How do I fix it?'''


== SETTING UP ENVIRONMENT of MinGW environment (Experimental, Option) ==
Just rename your <code>CraftRoot/</code> folder to something different. Even <code>CraftRoot1/</code> will work! Applications packaged by Craft look in <code>CraftRoot/</code> for the plugins first and then into their own installation folder.


<ol start="1">
<li>Call the following commands in a Powershell window with ''Administrator Privileges'' :-</li></ol>


'''2. I don't get the notification buttons, and the application name in the notifications is weird (something like <code>kdeconnect.daemon</code>. How do I fix it?'''


<pre>Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Just run this command:
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
<syntaxhighlight>
</pre>
C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "org.kde.kdeconnect.daemon"
 
</syntaxhighlight>
A detailed explanation is available on my blog [https://journal.piyush.tech/gsoc_milestone_1/ here] and also in the code of SnoreToast backend for KNotifications [https://cgit.kde.org/knotifications.git/tree/src/notifybysnore.cpp#n32 here].
 
'''3. What versions of packages did I just install? What version of KDE Connect did I just build?'''
 
At the <code>CraftRoot/</code> prompt, to see the catalog of installed packages, run this command:
<syntaxhighlight>
craft --print-installed
 
</syntaxhighlight>
 
The KDE Connect version will be based on the latest git commit in the repository. To see what is the latest release (latest tag) and any commits since the release, run these commands:
<syntaxhighlight>
cd download/git/extragear/kdeconnect-kde
git tag
git log --tags
echo notice the commit date for the latest tag.
echo release v1.3.5 commit date is "May 19 2019"
echo the following will show all the commits since release v1.3.5
echo (assuming the current year is 2019)
git log --since="May 19"
 
</syntaxhighlight>
 
 
'''4. I am unable to package KDE Connect for Windows. How to fix this?'''
[[File:Error.png|thumb]]
 
 
At the <code>CraftRoot/</code> prompt, run these commands to update all the packages:
<syntaxhighlight>
craft --unmerge kde/frameworks; craft knotifications
craft --update
craft --package kdeconnect-kde
</syntaxhighlight>




<ol start="2">
<li>During command 2, feel free to select '''Mingw-w64''' as your compiler! </li>


'''5. How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.'''


<pre>Select compiler
* Telegram: You can find a link to our Telegram group [https://community.kde.org/Telegram here].
[0] Mingw-w64, [1] Microsoft Visual Studio 2015, [2] Microsoft Visual Studio 2017 (default is Microsoft Visual Studio 2015): 0
* IRC on Freenode: #kdeconnect
Select architecture
* Mailing List: [https://mail.kde.org/mailman/listinfo/kdeconnect https://mail.kde.org/mailman/listinfo/kdeconnect]
[0] x86 [1] x64 (Default is x64): 1
* email ID: [email protected]
</pre>




Then there is no difference between this way and the one above.
''Be sure to tell us if you got stuck somewhere in the process of setting up the developer environment. You can [mailto:kdeconnect@kde.org mail us.] Yes we read the mails!'' 😜
Note that due to the lacking of some definitions in MinGW provided header file, system volume plugin could not be compiled with all functions on Windows using MinGW.
This feature is still an experimental feature.

Revision as of 11:06, 9 November 2019

Warning

This is an unfinished article


X. DEVELOPER RECOMMENDATIONS

In case you get stuck, check out these recommendations for the build process.

  • As a developer you'd naturally want to be able to test out all the features offered by KDE Connect. Right now MSVC does the best job as a compiler for KDE Connect for Windows, so you may choose that.
  • We recommend to install Craft in C:/ [default] as the guide uses C:/ as the installation directory.
  • Check out Craft docs for more help on how to use it.


0. SETTING UP ENVIRONMENT

The environment for KDE Connect on Windows simply consists of two parts- A compiler of choice and a build system. While we do have a couple of options for the compiler, our recommended build system is Craft. While this is an all-in-one build guide, you should definitely refer to Craft's documentation for further information on using the build system in your development environment!

Choose your compiler of choice:-

MSVC (full-support) | MinGW-w64 (partial support)

0.1-A installing MSVC

1. Install Visual Studio 2019 (Community) from here and select Desktop development with C++.

2. Install these packages.

Select these components

    • Just-in-Time debugger
    • VC++ 2019 version
    • C++ profiling tools
    • Windows 10 SDK
    • Visual C++ tools for CMake
    • Visual C++ ATL for x86 and x64
    • Test Adapter for Boost.Test
    • Test Adapter for Google Test

0.1-B installing MinGW-w64

1. Install MinGW-w64 through the GUI installer located here.

2. While installing Craft, feel free to select Mingw-w64 as your compiler!

Afterward, there is no difference in the commands used in the development. Note that due to the lacking of some definitions in MinGW provided header file, some plugins could not be compiled with all functions on Windows using MinGW.

This is still an experimental feature, and you might need some developer know-how to get past any build problems.


0.2 installing Craft

1. Call the following commands in a Powershell window with Administrator Privileges


Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))


2. During command 2, select Visual Studio 19 if you chose MSVC earlier, otherwise Mingw-w64 as your compiler.

INSTALLATION 1

Select compiler
[0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2017): 2
Select architecture
[0] x86 [1] x64 (Default is x64): 1


3. When the installation is done, note the Environment variables to match the ones in the top of this image:-

env vars

[Environment]
PATH=

Craft                : C:\CraftRoot
Version              : master
ABI                  : windows-msvc2019_64-c1
Download directory   : C:\CraftRoot\download

1. BUILDING KDE CONNECT OUT OF LATEST SOURCE CODE

Craft has automated most of the redundant parts of the build process and exposed just the really useful parameters like which version to build, where to install et al.

1. Open Craft CraftRoot from search (in taskbar).

2. Run the following commands now.


REM First, we set the various dependencies of kdeconnect-kde to be installed from the code in the master branch.

craft --set version=master kdeconnect-kde
craft --set version=master craft
craft --set version=master kde/frameworks/tier3
craft --set version=master dev-utils/snoretoast
craft --set version=master kde/frameworks/tier1/sonnet
craft --set version=master libs/libssh2
craft --set version=master kde/frameworks/tier3/kio
craft --set version=master kde/kdenetwork/kio-extras
craft --set version=master kde/frameworks/tier1/kcoreaddons
craft --set version=master kde/frameworks/tier2/kauth
craft --set version=master kde/frameworks/extra-cmake-modules
craft --set version=master kde/frameworks/tier1/kwindowsystem
craft --set version=master kde/frameworks/tier1/kconfig
craft --set version=master kde/frameworks/tier1/kcodecs
craft --set version=master kde/frameworks/tier1/kwidgetsaddons
craft --set version=master kde/frameworks/tier1/kitemviews 
craft --set version=master kde/frameworks/tier1/kguiaddons 
craft --set version=master kde/frameworks/tier2/kcrash 
craft --set version=master kde/frameworks/tier1/kdbusaddons 
craft --set version=master kde/frameworks/tier2/kdoctools 
craft --set version=master kde/frameworks/tier1/karchive 
craft --set version=master kde/frameworks/tier2/kcompletion 
craft --set version=master kde/frameworks/tier3/kiconthemes 
craft --set version=master kde/frameworks/tier1/solid 
craft --set version=master kde/pim/kcontacts

REM Now we install kdeconnect-kde within CraftRoot.

craft -i kdeconnect-kde


2. TESTING CHANGES

TODO: Fill stuff here from Craft's documentation.


3. BUILDING A SHARE-ABLE INSTALLER

Choose your package of choice:-

.EXE Setup (full-support) | .Appx package for Windows Store (partial support)


3.1-A creating a desktop application .exe setup

0. Make sure PackageType is set as PackageType = NullsoftInstallerPackager in CraftRoot/etc/CraftSettings.ini.

1. To create an installable setup, you need NSIS- a open source system to create Windows installers. Install it by this command: craft nsis


install NSIS


3.1-B creating a Windows App .Appx package

0. Make sure PackageType is set as PackageType = AppxPackager in CraftRoot/etc/CraftSettings.ini.

3.2 packaging through Craft

1. Now you can use the --package flag to build an installer. Run this in Craft CraftRoot.

craft --package extragear/kdeconnect-kde

Note: The output files are saved here: C:\CraftRoot\tmp\

FAQs : FREQUENTLY ASKED QUESTIONS

We are only human! There are many doubts that we face commonly, during DevSprints and during the onboarding of new contributors. We'd like to expedite this process for you by enlisting all the commonly asked questions in one place so you don't have to ask around like others had to!

1. I see double plugins in my KDE Connect installation. How do I fix it?

Just rename your CraftRoot/ folder to something different. Even CraftRoot1/ will work! Applications packaged by Craft look in CraftRoot/ for the plugins first and then into their own installation folder.


2. I don't get the notification buttons, and the application name in the notifications is weird (something like kdeconnect.daemon. How do I fix it?

Just run this command:

C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "org.kde.kdeconnect.daemon"

A detailed explanation is available on my blog here and also in the code of SnoreToast backend for KNotifications here.

3. What versions of packages did I just install? What version of KDE Connect did I just build?

At the CraftRoot/ prompt, to see the catalog of installed packages, run this command:

craft --print-installed

The KDE Connect version will be based on the latest git commit in the repository. To see what is the latest release (latest tag) and any commits since the release, run these commands:

cd download/git/extragear/kdeconnect-kde
git tag
git log --tags
echo notice the commit date for the latest tag.
echo release v1.3.5 commit date is "May 19 2019"
echo the following will show all the commits since release v1.3.5
echo (assuming the current year is 2019)
git log --since="May 19"


4. I am unable to package KDE Connect for Windows. How to fix this?


At the CraftRoot/ prompt, run these commands to update all the packages:

craft --unmerge kde/frameworks; craft knotifications
craft --update 
craft --package kdeconnect-kde


5. How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.


Be sure to tell us if you got stuck somewhere in the process of setting up the developer environment. You can mail us. Yes we read the mails! 😜