SDK preparation procedure reworked with init-for-IDE script

This commit is contained in:
Владислав Джавадов 2020-06-28 22:27:34 +03:00
parent 311e2d94a8
commit 0fa5d17830
13 changed files with 72 additions and 22 deletions

5
Examples/.dof Normal file
View File

@ -0,0 +1,5 @@
[Directories]
OutputDir=..\..\..\Bin
UnitOutputDir=..\..\..\Bin\DCU
SearchPath=..\..\..\Lib;..\..\..\Bin\DCU
UsePackages=0

View File

@ -52,7 +52,7 @@ GetPointOwner.exe: GUI\GetPointOwner\GetPointOwner.dpr
Hello.exe: Console\Hello\Hello.dpr
$(DCC)
HelloGUI.exe: GUI\Hello\HelloGUI.dpr
HelloGUI.exe: GUI\HelloGUI\HelloGUI.dpr
$(DCC)
LoadFile.exe: Console\LoadFile\LoadFile.dpr

5
My/.dof Normal file
View File

@ -0,0 +1,5 @@
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Bin\DCU
SearchPath=..\..\Lib;..\..\Bin\DCU
UsePackages=0

View File

@ -7,24 +7,16 @@ if #%Source%#==## (
goto exit
)
call "%~dp0init.bat"
set Bin=%~dp0..\Bin
set DCU=%~dp0..\Bin\DCU
set DCU=%Bin%\DCU
set Options=-$C- -$I- -$T+
set Target=%Bin%\%~n1
set Units=%~dp0..\RTL;%~dp0..\Lib
set Units=%~dp0..\Lib;%DCU%
if not exist "%Bin%" mkdir "%Bin%"
if not exist "%DCU%" mkdir "%DCU%"
if exist "%Source%.cfg" del "%Source%.cfg"
if not exist "%~dp0..\RTL\SysInit.dcu" call "%~dp0..\build-RTL.bat"
if errorlevel 1 goto exit
if not exist "%Bin%\convert.bat" (
echo @call "%%~dp0..\Tools\convert.bat" %%* >"%Bin%\convert.bat"
if errorlevel 1 goto exit
)
dcc32 %Source%.dpr -e"%Bin%" -n"%DCU%" -u"%Units%" %Options%
if errorlevel 1 goto exit

8
Tools/convert-all.bat Normal file
View File

@ -0,0 +1,8 @@
@echo off
for %%f in ("%~dp0*.exe") do (
call "%~dp0..\Tools\convert.bat" "%%f" %*
if errorlevel 1 goto exit
)
:exit

18
Tools/init.bat Normal file
View File

@ -0,0 +1,18 @@
@echo off
set Bin=%~dp0..\Bin
set DCU=%Bin%\DCU
if not exist "%Bin%" mkdir "%Bin%"
if not exist "%DCU%" mkdir "%DCU%"
echo @call "%%~dp0..\Tools\convert.bat" %%* >"%Bin%\convert.bat"
if errorlevel 1 goto exit
copy "%~dp0convert-all.bat" "%Bin%" >nul
if errorlevel 1 goto exit
dcc32 -m -y -z "%~dp0..\Lib\System" -n"%DCU%"
if errorlevel 1 goto exit
:exit

View File

@ -1 +0,0 @@
@dcc32 -m -y -z "%~dp0RTL\System" -n"%~dp0\RTL" %*

27
init-for-IDE.bat Normal file
View File

@ -0,0 +1,27 @@
@echo off
if #%1#==## (
call "%~dp0Tools\init.bat"
if errorlevel 1 goto exit
call %0 Examples Examples\Console
if errorlevel 1 goto exit
call %0 Examples Examples\GUI
if errorlevel 1 goto exit
call %0 My My
goto exit
)
if exist "%~dp0%1\.dof" (
for /d %%f in ("%~dp0%2\*") do (
if not exist "%%f\%%~nf.dof" (
echo %%f\%%~nf.dof
copy "%~dp0%1\.dof" "%%f\%%~nf.dof" >nul
if errorlevel 1 goto exit
)
)
)
:exit

View File

@ -27,7 +27,7 @@ end.
````
## Compiling from Delphi IDE
First, you need to build RTL for you version of Delphi. Please run `build-RTL.bat` script to do it. Compiled DCUs will appear in `RTL` directory.
First, you need to initialize projects before open them in Delphi IDE. Please run `init-for-IDE.bat` script. It will build RTL for your version of Delphi, and then generate project configuration files contain correct paths to libraries, DCU and EXE/DLL directories for Delphi IDE.
Open program in the IDE, press `Ctrl+F9`. Compiled `.exe` file will appear in `Bin` directory. Use `convert.bat` to convert it to KolibriOS executable:
````
@ -70,16 +70,12 @@ Default KolibriOS code page is [CP866](https://en.wikipedia.org/wiki/Code_page_8
* `build-all.bat` builds RTL and all programs, including your programs.
* `build-examples.bat` builds example programs.
* `build-my.bat` builds your programs have put to the subdirectories of `My` directory.
* `build-RTL.bat` builds Delphi RTL for KolibriOS.
* `Bin\convert.bat` helper script to convert manually compiled programs to KolibriOS format.
* `init-for-IDE.bat` initializes project for open in Delphi IDE, builds RTL as well.
* `Bin\convert.bat` helper script to convert manually compiled program to KolibriOS format.
* `Bin\convert-all.bat` helper script to convert all manually compiled programs to KolibriOS format.
* `Lib\build.bat` library build script calling by other ones when builings programs.
* `Lib\convert.bat` library conversion script calling by other ones when builings or converting programs compiled manually.
## Tips and Tricks
Release archive contains `.dof` files with correct Delphi IDE settings, especially paths. If you want to use latest [hot version](https://github.com/vapaamies/KolibriOS) of SDK from the `master` branch on GitHub, download the latest release archive before, unpack it. Then unpack the archive of hot version to same directory with file overwriting. It gives you correctly prepared environment to compile hot versions of programs.
If particular program not yet exist in SDK release, copy existing `.dof` file from the directory of other program was included to the release, for example `GUI\ColorButtons.dof`.
## See also
* **Programs not included to SDK**
* [2048 Game](http://forum.cantorsys.com/viewtopic.php?id=123)