Skip to content

GPS project view puzzled by Project'Target. #80

Open
@Blady-Com

Description

@Blady-Com

Hello,
Configuration: GPS Community 2019, macOS 10.13.6.
The main source code essai_gps withs a unit put_os depending on the OS.
Thus three source files implement put_os.
In GPR file the choice TARGET_OS is made with the help of Project'Target:

project Proj_Essai_Gps is
   for Source_Dirs use ("src");
   for Object_Dir use "obj";
   for Main use ("essai_gps.adb");
   TARGET_OS := "None";
   TARGET := Project'Target;
   case TARGET is
      when "x86_64-linux" =>
         TARGET_OS := "Unix";
      when "i686-pc-mingw32" =>
         TARGET_OS := "mingw";
      when "x86_64-darwin" =>
         TARGET_OS := "macOS";
      when others =>
         TARGET_OS := "None";
   end case;
      case TARGET_OS is
         when "Unix" =>
            for Source_Files use ("essai_gps.adb", "put_unix.adb");
         when "macOS" =>
            for Source_Files use ("essai_gps.adb", "put_macos.adb");
         when "mingw" =>
            for Source_Files use ("essai_gps.adb", "put_mingw.adb");
        when Others =>
            null;
      end case;
   package Naming is
      case TARGET_OS is
         when "Unix" =>
            for Body ("Put_OS") use "put_unix.adb";
         when "macOS" =>
            for Body ("Put_OS") use "put_macos.adb";
         when "mingw" =>
            for Body ("Put_OS") use "put_mingw.adb";
        when Others =>
            null;
      end case;
   end Naming;
end Proj_Essai_Gps;

In my case on macOS the output is ok:

Compile
   [Ada]          essai_gps.adb
   [Ada]          put_macos.adb
Bind
   [gprbind]      essai_gps.bexch
   [Ada]          essai_gps.ali
Link
   [link]         essai_gps.adb

$ obj/essai_gps 
macOS

Building and running with GPS is also ok.
But the GPS project wiew is not updated accordingly, see screen capture 20190608-GPS-101.png:
20190608-GPS-101
While when TARGET_OS is hardcoded (see proj_essai_gps3.gpr) GPS project wiew is ok, see screen capture 20190608-GPS-102.png:
20190608-GPS-102
What could be done to update GPS project view automatically with Project'Target help?

Thanks Pascal.
See source files in archive.
essai-gps.zip

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions