From 0fa5d178309abb804a9235c18ea9725d9eea9e49 Mon Sep 17 00:00:00 2001 From: Freeman Date: Sun, 28 Jun 2020 22:27:34 +0300 Subject: [PATCH] SDK preparation procedure reworked with init-for-IDE script --- Examples/.dof | 5 ++++ Examples/Examples.bpg | 2 +- Examples/GUI/{Hello => HelloGUI}/HelloGUI.dpr | 0 Examples/GUI/{Hello => HelloGUI}/build.bat | 0 {RTL => Lib}/SysInit.pas | 0 {RTL => Lib}/System.pas | 0 My/.dof | 5 ++++ Tools/build.bat | 16 +++-------- Tools/convert-all.bat | 8 ++++++ Tools/init.bat | 18 +++++++++++++ build-RTL.bat | 1 - init-for-IDE.bat | 27 +++++++++++++++++++ readme.md | 12 +++------ 13 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 Examples/.dof rename Examples/GUI/{Hello => HelloGUI}/HelloGUI.dpr (100%) rename Examples/GUI/{Hello => HelloGUI}/build.bat (100%) rename {RTL => Lib}/SysInit.pas (100%) rename {RTL => Lib}/System.pas (100%) create mode 100644 My/.dof create mode 100644 Tools/convert-all.bat create mode 100644 Tools/init.bat delete mode 100644 build-RTL.bat create mode 100644 init-for-IDE.bat diff --git a/Examples/.dof b/Examples/.dof new file mode 100644 index 0000000..d3ff19f --- /dev/null +++ b/Examples/.dof @@ -0,0 +1,5 @@ +[Directories] +OutputDir=..\..\..\Bin +UnitOutputDir=..\..\..\Bin\DCU +SearchPath=..\..\..\Lib;..\..\..\Bin\DCU +UsePackages=0 \ No newline at end of file diff --git a/Examples/Examples.bpg b/Examples/Examples.bpg index 49f0aba..f4515e6 100644 --- a/Examples/Examples.bpg +++ b/Examples/Examples.bpg @@ -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 diff --git a/Examples/GUI/Hello/HelloGUI.dpr b/Examples/GUI/HelloGUI/HelloGUI.dpr similarity index 100% rename from Examples/GUI/Hello/HelloGUI.dpr rename to Examples/GUI/HelloGUI/HelloGUI.dpr diff --git a/Examples/GUI/Hello/build.bat b/Examples/GUI/HelloGUI/build.bat similarity index 100% rename from Examples/GUI/Hello/build.bat rename to Examples/GUI/HelloGUI/build.bat diff --git a/RTL/SysInit.pas b/Lib/SysInit.pas similarity index 100% rename from RTL/SysInit.pas rename to Lib/SysInit.pas diff --git a/RTL/System.pas b/Lib/System.pas similarity index 100% rename from RTL/System.pas rename to Lib/System.pas diff --git a/My/.dof b/My/.dof new file mode 100644 index 0000000..40a8acd --- /dev/null +++ b/My/.dof @@ -0,0 +1,5 @@ +[Directories] +OutputDir=..\..\Bin +UnitOutputDir=..\..\Bin\DCU +SearchPath=..\..\Lib;..\..\Bin\DCU +UsePackages=0 \ No newline at end of file diff --git a/Tools/build.bat b/Tools/build.bat index b213a51..7dd2ddc 100644 --- a/Tools/build.bat +++ b/Tools/build.bat @@ -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 diff --git a/Tools/convert-all.bat b/Tools/convert-all.bat new file mode 100644 index 0000000..7336b7d --- /dev/null +++ b/Tools/convert-all.bat @@ -0,0 +1,8 @@ +@echo off + +for %%f in ("%~dp0*.exe") do ( + call "%~dp0..\Tools\convert.bat" "%%f" %* + if errorlevel 1 goto exit +) + +:exit \ No newline at end of file diff --git a/Tools/init.bat b/Tools/init.bat new file mode 100644 index 0000000..e9ce99b --- /dev/null +++ b/Tools/init.bat @@ -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 \ No newline at end of file diff --git a/build-RTL.bat b/build-RTL.bat deleted file mode 100644 index e97f1a3..0000000 --- a/build-RTL.bat +++ /dev/null @@ -1 +0,0 @@ -@dcc32 -m -y -z "%~dp0RTL\System" -n"%~dp0\RTL" %* \ No newline at end of file diff --git a/init-for-IDE.bat b/init-for-IDE.bat new file mode 100644 index 0000000..4381772 --- /dev/null +++ b/init-for-IDE.bat @@ -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 \ No newline at end of file diff --git a/readme.md b/readme.md index ce297bc..62ac308 100644 --- a/readme.md +++ b/readme.md @@ -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)