Windows/Build/Environment: Difference between revisions

From KDE Community Wiki
< Windows‎ | Build
(environment vars)
 
Line 1: Line 1:
=== Setting up the users environment ===
=== Setting up the users environment ===


The next step is setting up a proper environment to build KDE4 applications. This includes setting the PATH variable and some additional variables needed for CMake and running KDE applications.
For using most of the tools in the commandline you will have to set up a proper environment. This includes setting the PATH variable and some additional variables needed for CMake and running KDE applications.


The path C:\kde4\win32libs is used as the installation directory from the kdewin-installer, C:\kde4\kdelibs-install as the path where all kde4 modules will be installed to. Obviously you have to change the actual values to suite your system. The Sources from SVN reside in C:\kde4\kdelibs-src.
There are some assumptions made inhere:
The path C:\kde4\win32libs is used as the installation directory from the kdewin-installer (which will be called KDEWIN_DIR), C:\kde4\kdelibs-install as the path where all kde4 modules will be installed to(which will be called KDEDIRS). Obviously you have to change the actual values to suite your system. The sources from SVN would reside in C:\kde4\kdelibs-src.
Create a file and name it environment.bat:
Create a file and name it environment.bat:
<pre>
<pre>
@echo off
@echo off
set MYKDEDIR=
set MYKDEDIRS=


:: environment.bat should be able to autodetect the following values
:: environment.bat should be able to autodetect the following values
Line 23: Line 24:




if "%KDEDIR%" equ "" (
if "%KDEDIRS%" equ "" (
     set KDEDIR=%MYKDEDIR%
     set KDEDIRS=%MYKDEDIRS%
)
)
if "%KDEDIR%" equ "" (
if "%KDEDIRS%" equ "" (
     echo KDEDIR not set
     echo KDEDIRS not set
     echo set MYKDEDIR in %0% or KDEDIR at the enviroment
     echo set MYKDEDIRS in %0% or KDEDIRS at the enviroment
     goto ERROR
     goto ERROR
)
)
Line 74: Line 75:
echo cmake: %CMAKEROOT%
echo cmake: %CMAKEROOT%


set PATH=%KDEDIR%\bin;%PATH%;%CMAKEROOT%\bin;%MSPSDKDIR%\bin
set PATH=%KDEDIRS%\bin;%PATH%;%CMAKEROOT%\bin;%MSPSDKDIR%\bin
set DBUSDIR=%KDEDIR%
set DBUSDIR=%KDEDIRS%
set QTDIR=%KDEDIR%
set QTDIR=%KDEDIRS%
set KDEWIN_DIR=%KDEDIR%
set KDEWIN_DIR=%KDEDIRS%
set KDEWIN32DIR=%KDEDIR%
set KDEWIN32DIR=%KDEDIRS%


set INCLUDE=%PSDKDIR%\include;%KDEDIR%\include
set INCLUDE=%PSDKDIR%\include;%KDEDIRS%\include
set LIB=%PSDKDIR%\lib;%KDEDIR%\lib
set LIB=%PSDKDIR%\lib;%KDEDIRS%\lib


set CMAKE_INCLUDE_PATH=%INCLUDE%
set CMAKE_INCLUDE_PATH=%INCLUDE%
Line 96: Line 97:
:END
:END
</pre>
</pre>
take out the following paragraph:
Create a file environment.bat and add the following lines:<pre>
@set SOURCE_PATH=C:\kde4\kdelibs-src
@set INSTALL_PATH=C:\kde4\kdelibs-install
@set UTILS_PATH=C:\kde4\win32libs


@set DBUSDIR=%UTILS_PATH%
You will have to run this file every time you start a new cmd-shell (for building etc.).
@set KDEDIRS=%UTILS_PATH%;%INSTALL_PATH%
@set KDEWIN_DIR=%UTILS_PATH%
@set PATH=%PATH%;%UTILS_PATH%\bin;%INSTALL_PATH%\bin;%INSTALL_PATH%\lib
@set QT_PLUGIN_PATH=%INSTALL_PATH%\lib\kde4\plugins;%UTILS_PATH%\plugins
@set STRIGI_HOME=%UTILS_PATH%
@set XDG_DATA_DIRS=%UTILS_PATH%\share;%INSTALL_PATH%\share
</pre>
 
You will have to run this file every time you start a new cmd-shell. If you don't want to run this file you can make the variable entries permanent:
Open up the control panel and select the System Entry. Then go to the Extended tab and select Environment Variables. In the section titled 'user variables' add the above entries.
You should have cmake and mingw32-make etc. in your path as well.
You should have cmake and mingw32-make etc. in your path as well.

Revision as of 23:29, 5 August 2007

Setting up the users environment

For using most of the tools in the commandline you will have to set up a proper environment. This includes setting the PATH variable and some additional variables needed for CMake and running KDE applications.

There are some assumptions made inhere: The path C:\kde4\win32libs is used as the installation directory from the kdewin-installer (which will be called KDEWIN_DIR), C:\kde4\kdelibs-install as the path where all kde4 modules will be installed to(which will be called KDEDIRS). Obviously you have to change the actual values to suite your system. The sources from SVN would reside in C:\kde4\kdelibs-src. Create a file and name it environment.bat:

@echo off
set MYKDEDIRS=

:: environment.bat should be able to autodetect the following values
:: only set them manually, if the script complains about them
:: don't use quotes (") !

:: Microsoft Platform SDK install directory
:: set MSPSDKDIR=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2

:: CMake install directory
:: set CMAKEROOT=C:\Program Files\CMake 2.4


:: make only changes below this line, if you know, what you are doing


if "%KDEDIRS%" equ "" (
    set KDEDIRS=%MYKDEDIRS%
)
if "%KDEDIRS%" equ "" (
    echo KDEDIRS not set
    echo set MYKDEDIRS in %0% or KDEDIRS at the enviroment
    goto ERROR
)

if "%MSPSDKDIR%" equ "" (
    for /F "usebackq tokens=3 delims=	" %%i in (`@reg query "HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1" /v "Install Dir"`) DO (
        set MSPSDKDIR=%%i
    )
)
if "%MSPSDKDIR%" equ "" (
    echo can't detect the Microsoft Platform SDK install directory
    echo set it at the start of %0% or with the MSPSDKDIR enviroment variable
    goto ERROR
)
if not exist "%MSPSDKDIR%\include\windows.h" (
    echo can't find windows.h in %MSPSDKDIR%\include\
    echo try to set the Microsoft Platform SDK install directory at the start of %0% or with the MSPSDKDIR enviroment variable
    goto ERROR
)


if "%CMAKEROOT%" equ "" (
    for /F "usebackq tokens=3 delims=	" %%i in (`reg query "HKLM\SOFTWARE\Kitware\CMake 2.4.6" /ve`) DO (
        set CMAKEROOT=%%i
    )
)
if "%CMAKEROOT%" equ "" (
    echo can't detect the cmake root directory
    echo set it at the start of %0% or with the CMAKEROOT enviroment variable
    goto ERROR
)
if not exist "%CMAKEROOT%\bin\cmake.exe" (
    echo can't find cmake.exe in %CMAKEROOT%\bin
    echo set it at the start of %0% or with the CMAKEROOT enviroment variable
    goto ERROR
)

if "%VS80COMNTOOLS%" equ "" (
    echo can't find the Microsoft Visual Studio installation directory
    echo set the VS80COMNTOOLS enviroment variable
    goto ERROR
)

echo psdk: %MSPSDKDIR%
echo cmake: %CMAKEROOT%

set PATH=%KDEDIRS%\bin;%PATH%;%CMAKEROOT%\bin;%MSPSDKDIR%\bin
set DBUSDIR=%KDEDIRS%
set QTDIR=%KDEDIRS%
set KDEWIN_DIR=%KDEDIRS%
set KDEWIN32DIR=%KDEDIRS%

set INCLUDE=%PSDKDIR%\include;%KDEDIRS%\include
set LIB=%PSDKDIR%\lib;%KDEDIRS%\lib

set CMAKE_INCLUDE_PATH=%INCLUDE%
set CMAKE_LIBRARY_PATH=%LIB%

call "%VS80COMNTOOLS%vsvars32.bat"

cmd.exe

goto END

:ERROR
pause
:END

You will have to run this file every time you start a new cmd-shell (for building etc.). You should have cmake and mingw32-make etc. in your path as well.