Skip to content

Latest commit

 

History

History
143 lines (117 loc) · 8.26 KB

README.md

File metadata and controls

143 lines (117 loc) · 8.26 KB

GWindows examples

Ada project Directory gwindows-examples\ contains Ada code examples coming from various websites - mostly from the GWindows project.

We support the following build tools :

Build tool Build file
gnatmake.exe 1
gprbuild.exe build.gpr

tutorial1 Example

Command build.bat 2 relies on gnatmake.exe to generate the executable target\tutorial1.exe from the Ada source file tutorial1.adb :

> build -verbose run
Compile 1 Ada source file to directory "target\obj"
Execute program "target\tutorial1.exe"

Command gprbuild.exe reads its configuration from file tutorial1.gpr and generate the executable target\tutorial1.exe :

> gprclean& gprbuild& target\tutorial1.exe
using project file tutorial1.gpr
using project file tutorial1.gpr
Compile
   [Ada]          tutorial1.adb
Bind
   [gprbind]      tutorial1.bexch
   [Ada]          tutorial1.ali
Link
   [link]         tutorial1.adb

tutorial2 Example

Command make.exe reads its configuration from file Makefile and relies on gnatmake to generate the executable target\tutorial2.exe from the Ada source file tutorial2.adb :

> make run
"C:/opt/GNAT/2021/bin/gnatmake.exe" -q -gnat2022 -we -aI"C:\opt\GWindows-20221113\gnatcom\framework" -aI"C:\opt\GWindows-20221113\gwindows\framework" -D "target/obj" -o "target/tutorial2.exe" src/tutorial2.adb
target/tutorial2.exe

Command gprbuild.exe reads its configuration from file tutorial2.gpr and generate the executable target\tutorial2.exe :

> gprclean& gprbuild& target\tutorial2.exe
using project file tutorial2.gpr
using project file tutorial2.gpr
Compile
   [Ada]          tutorial2.adb
   [Ada]          gwindows-windows-main.adb
Bind
   [gprbind]      tutorial2.bexch
   [Ada]          tutorial2.ali
Link
   [link]         tutorial2.adb

Footnotes

[1] Gnatmake

GNU tools such as gcc, gnatmake, objdump and windres are available both in the MSYS installation and in the GNAT 2021 installation; we use the tools from the MSYS installation which have newer versions.
> where gcc gnatmake windres
C:\opt\msys64\usr\bin\gcc.exe
C:\opt\msys64\mingw64\bin\gcc.exe
C:\opt\GNAT\2021\bin\gcc.exe
C:\opt\msys64\mingw64\bin\gnatmake.exe
C:\opt\GNAT\2021\bin\gnatmake.exe
C:\opt\msys64\usr\bin\windres.exe
C:\opt\msys64\mingw64\bin\windres.exe
C:\opt\GNAT\2021\bin\windres.exe
 
> C:\opt\msys64\mingw64\bin\gnatmake.exe --version
GNATMAKE 13.2.0
Copyright (C) 1995-2023, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
> C:\opt\GNAT\2021\bin\gnatmake.exe --version
GNATMAKE Community 2021 (20210519-103)
Copyright (C) 1995-2021, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[2] Tutorial1 output with -debug option

> build -debug run
[build] Properties : _PROJECT_NAME=tutorial1 _PROJECT_VERSION=0.1-SNAPSHOT
[build] Options    : _TIMER=0 _VERBOSE=0
[build] Subcommands: _CLEAN=1 _COMPILE=1 _DOC=0 _LINT=0 _RUN=1 _TEST=0
[build] Variables  : "ADACTL_HOME=C:\opt\adactl"
[build] Variables  : "GIT_HOME=C:\opt\Git"
[build] Variables  : "GNAT_HOME=C:\opt\GNAT\2021"
[build] Variables  : "GNAT2019_HOME=C:\opt\GNAT\2019"
[build] Variables  : _MAIN_NAME=Tutorial1 _MAIN_ARGS=
[build] 00000000000000 Target : 'W:\gwindows-examples\tutorial1\target\tutorial1.exe'
[build] 20090315071046 Sources: 'W:\gwindows-examples\tutorial1\src\*.ada','W:\gwindows-examples\tutorial1\src\*.adb','W:\gwindows-examples\tutorial1\src\*.ads'
[build] _ACTION_REQUIRED=1
[build] "C:\opt\GNAT\2021\bin\gnatmake.exe" -gnat2022 -we -aI"C:\opt\GWindows-20221113\gnatcom\framework" -aI"C:\opt\GWindows-20221113\gwindows\framework" -D "W:\gwindows-examples\tutorial1\target\obj" -o "W:\gwindows-examples\tutorial1\target\tutorial1.exe"  "W:\gwindows-examples\tutorial1\src\tutorial1.adb"
gcc -c -IW:\gwindows-examples\tutorial1\src\ -gnat2022 -IC:\opt\GWindows-20221113\gnatcom\framework -IC:\opt\GWindows-20221113\gwindows\framework -I- -o W:\gwindows-examples\tutorial1\target\obj\tutorial1.o W:\gwindows-examples\tutorial1\src\tutorial1.adb
[...]
gcc -c -IW:\gwindows-examples\tutorial1\src\ -gnat2022 -IC:\opt\GWindows-20221113\gnatcom\framework -IC:\opt\GWindows-20221113\gwindows\framework -I- -o W:\gwindows-examples\tutorial1\target\obj\gwindows-drawing-capabilities.o C:\opt\GWindows-20221113\gwindows\framework\gwindows-drawing-capabilities.adb
gnatbind -aIC:\opt\GWindows-20221113\gnatcom\framework -aIC:\opt\GWindows-20221113\gwindows\framework -aOW:\gwindows-examples\tutorial1\target\obj -x W:\gwindows-examples\tutorial1\target\obj\tutorial1.ali
gnatlink W:\gwindows-examples\tutorial1\target\obj\tutorial1.ali -o W:\gwindows-examples\tutorial1\target\tutorial1.exe
[build] _EXITCODE=0

mics/May 2024