Windows/Build/Environment: Difference between revisions
SaroEngels (talk | contribs) environment vars |
m Ochurlaud moved page Windows/Imported From TechBase/Build/Environment to Windows/Build/Environment |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
=== Setting up the | === Setting up the build 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 in this article: | |||
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. | |||
{{warning|Don't forget to change set MYKDEDIRS in the seconde line!}} | |||
Create a file and name it environment.bat: | Create a file and name it environment.bat: | ||
< | <syntaxhighlight lang="text"> | ||
@echo off | @echo off | ||
set | set MYKDEDIRS= | ||
:: | :: This script 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 | :: Microsoft Platform SDK install directory | ||
Line 23: | Line 27: | ||
if "% | if "%KDEDIRS%" equ "" ( | ||
set | set KDEDIRS=%MYKDEDIRS% | ||
) | ) | ||
if "% | if "%KDEDIRS%" equ "" ( | ||
echo | echo KDEDIRS not set | ||
echo set | echo set MYKDEDIRS in %0% or KDEDIRS at the environment | ||
goto ERROR | goto ERROR | ||
) | ) | ||
Line 39: | Line 43: | ||
if "%MSPSDKDIR%" equ "" ( | if "%MSPSDKDIR%" equ "" ( | ||
echo can't detect the Microsoft Platform SDK install directory | echo can't detect the Microsoft Platform SDK install directory | ||
echo set it at the start of %0% or with the MSPSDKDIR | echo set it at the start of %0% or with the MSPSDKDIR environment variable | ||
goto ERROR | goto ERROR | ||
) | ) | ||
if not exist "%MSPSDKDIR%\include\windows.h" ( | if not exist "%MSPSDKDIR%\include\windows.h" ( | ||
echo can't find windows.h in %MSPSDKDIR%\include\ | 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 | echo try to set the Microsoft Platform SDK install directory at the start of %0% or with the MSPSDKDIR environment variable | ||
goto ERROR | goto ERROR | ||
) | ) | ||
Line 56: | Line 60: | ||
if "%CMAKEROOT%" equ "" ( | if "%CMAKEROOT%" equ "" ( | ||
echo can't detect the cmake root directory | echo can't detect the cmake root directory | ||
echo set it at the start of %0% or with the CMAKEROOT | echo set it at the start of %0% or with the CMAKEROOT environment variable | ||
goto ERROR | goto ERROR | ||
) | ) | ||
if not exist "%CMAKEROOT%\bin\cmake.exe" ( | if not exist "%CMAKEROOT%\bin\cmake.exe" ( | ||
echo can't find cmake.exe in %CMAKEROOT%\bin | echo can't find cmake.exe in %CMAKEROOT%\bin | ||
echo set it at the start of %0% or with the CMAKEROOT | echo set it at the start of %0% or with the CMAKEROOT environment variable | ||
goto ERROR | goto ERROR | ||
) | ) | ||
Line 67: | Line 71: | ||
if "%VS80COMNTOOLS%" equ "" ( | if "%VS80COMNTOOLS%" equ "" ( | ||
echo can't find the Microsoft Visual Studio installation directory | echo can't find the Microsoft Visual Studio installation directory | ||
echo set the VS80COMNTOOLS | echo set the VS80COMNTOOLS environment variable | ||
goto ERROR | goto ERROR | ||
) | ) | ||
Line 74: | Line 78: | ||
echo cmake: %CMAKEROOT% | echo cmake: %CMAKEROOT% | ||
set PATH=% | set PATH=%KDEDIRS%\bin;%PATH%;%CMAKEROOT%\bin;%MSPSDKDIR%\bin | ||
set DBUSDIR=% | set DBUSDIR=%KDEDIRS% | ||
set QTDIR=% | set QTDIR=%KDEDIRS% | ||
set KDEWIN_DIR=% | set KDEWIN_DIR=%KDEDIRS% | ||
set KDEWIN32DIR=% | set KDEWIN32DIR=%KDEDIRS% | ||
set INCLUDE=% | set INCLUDE=%MSPSDKDIR%\include;%KDEDIRS%\include | ||
set LIB=% | set LIB=%MSPSDKDIR%\lib;%KDEDIRS%\lib | ||
set CMAKE_INCLUDE_PATH=%INCLUDE% | set CMAKE_INCLUDE_PATH=%INCLUDE% | ||
Line 95: | Line 99: | ||
pause | pause | ||
:END | :END | ||
</ | </syntaxhighlight> | ||
You will have to run this file every time you start a new cmd-shell (for building etc.). | |||
This script should be able to autodetect most of the required settings. | |||
Latest revision as of 14:58, 18 March 2016
Setting up the build 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 in this article: 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=
:: This script 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 environment
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 environment 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 environment 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 environment 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 environment variable
goto ERROR
)
if "%VS80COMNTOOLS%" equ "" (
echo can't find the Microsoft Visual Studio installation directory
echo set the VS80COMNTOOLS environment 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=%MSPSDKDIR%\include;%KDEDIRS%\include
set LIB=%MSPSDKDIR%\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.).
This script should be able to autodetect most of the required settings.