From b61fa2502b9e40f660ed9ce5e60de35bdee710e9 Mon Sep 17 00:00:00 2001 From: blaszijk Date: Wed, 4 Jan 2012 23:13:24 +0000 Subject: [PATCH] added compilation mode to widget units some clean-up and fixing of compiler warnings initial import of the fpmake build file git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2228 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/nvidia-widgets/src/config.inc | 18 ++++++ components/nvidia-widgets/src/fpmake.pp | 57 +++++++++++++++++++ .../src/nvglutils/nvShaderUtils.pas | 2 + .../src/nvwidgets/examples/example.pp | 3 - .../src/nvwidgets/nvglwidgets.pas | 5 +- 5 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 components/nvidia-widgets/src/config.inc create mode 100644 components/nvidia-widgets/src/fpmake.pp diff --git a/components/nvidia-widgets/src/config.inc b/components/nvidia-widgets/src/config.inc new file mode 100644 index 000000000..bb63c8616 --- /dev/null +++ b/components/nvidia-widgets/src/config.inc @@ -0,0 +1,18 @@ +type + //add more here + NV_CONTEXT = (GLUT); + NV_PAINTER = (GL); + +const + NV_DEBUG = True; + NV_DEBUG_FLAGS: array [0..2] of string = ('-g', '-gl', '-gh'); + + NV_PROFILE = False; + NV_PROFILE_FLAGS: array [0..0] of string = ('-pg'); + +var + //choose the context + NV_ACTIVE_CONTEXT: NV_CONTEXT = GLUT; + + //choose the painter + NV_ACTIVE_PAINTER: NV_PAINTER = GL; \ No newline at end of file diff --git a/components/nvidia-widgets/src/fpmake.pp b/components/nvidia-widgets/src/fpmake.pp new file mode 100644 index 000000000..efdaf3a3a --- /dev/null +++ b/components/nvidia-widgets/src/fpmake.pp @@ -0,0 +1,57 @@ +program fpmake; + +{$mode objfpc} {$H+} + +uses + fpmkunit; + +{$include config.inc} + +var + P: TPackage; + i: integer; + +begin + with Installer do + begin + //create nvwidgets package + P := AddPackage('nvwidget'); + + P.Version := '1.00'; + //P.Options.Add('-MObjFPC'); + + if NV_DEBUG then + for i := 0 to High(NV_DEBUG_FLAGS) do + P.Options.Add(NV_DEBUG_FLAGS[i]); + + if NV_PROFILE then + for i := 0 to High(NV_PROFILE_FLAGS) do + P.Options.Add(NV_PROFILE_FLAGS[i]); + + //base widget units + P.Targets.AddUnit('./nvwidgets/nvwidgets.pas'); + + write('package ', P.Name, ' configured for '); + + //context units + case NV_ACTIVE_CONTEXT of + GLUT: begin + write('the GLUT context'); + P.Targets.AddUnit('./nvwidgets/nvglutwidgets.pas'); + end; + end; + + //painter units + case NV_ACTIVE_PAINTER of + GL: begin + writeln(' with the OpenGL painter'); + P.UnitPath.Add('./gl/'); + P.UnitPath.Add('./nvglutils/.'); + P.Targets.AddUnit('./nvwidgets/nvglwidgets.pas'); + end; + end; + + Run; + end; +end. + diff --git a/components/nvidia-widgets/src/nvglutils/nvShaderUtils.pas b/components/nvidia-widgets/src/nvglutils/nvShaderUtils.pas index 76a37a1ad..43c47cf2f 100644 --- a/components/nvidia-widgets/src/nvglutils/nvShaderUtils.pas +++ b/components/nvidia-widgets/src/nvglutils/nvShaderUtils.pas @@ -6,6 +6,8 @@ //////////////////////////////////////////////////////////////////////////////// unit nvShaderUtils; +{$mode objfpc}{$H+} + interface { $define NV_REPORT_COMPILE_ERRORS} diff --git a/components/nvidia-widgets/src/nvwidgets/examples/example.pp b/components/nvidia-widgets/src/nvwidgets/examples/example.pp index 1327d20b2..9a21ecff1 100644 --- a/components/nvidia-widgets/src/nvwidgets/examples/example.pp +++ b/components/nvidia-widgets/src/nvwidgets/examples/example.pp @@ -25,7 +25,6 @@ var errorScale: double = 4; compressionRate: double = 1; texture: GLuint = 0; - let: string = 'linedit test'; procedure closeapp; begin @@ -80,8 +79,6 @@ var formatIdx: integer; Text: string; textureRect: Rect; - - c: integer; begin none.Rect(0, 0); diff --git a/components/nvidia-widgets/src/nvwidgets/nvglwidgets.pas b/components/nvidia-widgets/src/nvwidgets/nvglwidgets.pas index 75c832a1f..3c082c555 100644 --- a/components/nvidia-widgets/src/nvwidgets/nvglwidgets.pas +++ b/components/nvidia-widgets/src/nvwidgets/nvglwidgets.pas @@ -9,6 +9,8 @@ //////////////////////////////////////////////////////////////////////////////// unit nvGLWidgets; +{$mode objfpc}{$H+} + interface uses @@ -124,7 +126,7 @@ type public constructor Create; - destructor Destroy; + destructor Destroy; override; procedure _begin(const window: Rect); override; procedure _end; override; @@ -261,6 +263,7 @@ end; destructor GLUIPainter.Destroy; begin Font.Clean; + inherited Destroy; end; procedure GLUIPainter._begin(const window: Rect);