From 273494257b171420a34b00db0807927468865660 Mon Sep 17 00:00:00 2001 From: mgr Date: Fri, 16 Oct 2020 23:07:22 +0200 Subject: [PATCH] Make so many libraries as modules in the SFML library The problem with this approach is that the list of sources has to be specified and that the documentation is not generated by gnatdoc, so it is left in this experimental branch, until a solution is found. See issue #6 --- Makefile | 2 +- asfml.gpr | 35 +++------------- asfml_audio.gpr | 60 ++++++++++++++++++++++++++++ asfml_doc.gpr | 27 +++++++++++++ asfml_graphics.gpr | 79 +++++++++++++++++++++++++++++++++++++ asfml_network.gpr | 61 ++++++++++++++++++++++++++++ asfml_system.gpr | 58 +++++++++++++++++++++++++++ asfml_window.gpr | 62 +++++++++++++++++++++++++++++ tests/music/main.gpr | 2 +- tests/renderwindow/main.gpr | 2 +- tests/thread/main.gpr | 2 +- 11 files changed, 357 insertions(+), 33 deletions(-) create mode 100644 asfml_audio.gpr create mode 100644 asfml_doc.gpr create mode 100644 asfml_graphics.gpr create mode 100644 asfml_network.gpr create mode 100644 asfml_system.gpr create mode 100644 asfml_window.gpr diff --git a/Makefile b/Makefile index 0244cbc..f69d8b1 100644 --- a/Makefile +++ b/Makefile @@ -4,4 +4,4 @@ all: gprbuild -j0 -P asfml.gpr doc: - gnatdoc -P asfml.gpr + gnatdoc -P asfml_doc.gpr diff --git a/asfml.gpr b/asfml.gpr index 7fe6462..eaeaf6b 100644 --- a/asfml.gpr +++ b/asfml.gpr @@ -1,15 +1,10 @@ +aggregate library project ASFML is -library project ASFML is - - type T_OS is ("Windows_NT", "Linux"); - V_OS : T_OS := external ("OS", "Linux"); - - for Languages use ("Ada"); - - for Create_Missing_Dirs use "True"; - - for Source_Dirs use ("include"); - for Object_Dir use "obj"; + for Project_Files use + ("asfml_system.gpr", + "asfml_audio.gpr", + "asfml_window.gpr", + "asfml_graphics.gpr"); for Library_Name use "asfml"; @@ -17,24 +12,6 @@ library project ASFML is for Library_ALI_Dir use "lib"; for Library_Kind use "static"; - - package Linker is - case V_OS is - when "Windows_NT" => - for Linker_Options use - ("-LD:\Libraries\CSFML-2.5\lib\gcc", - "-lcsfml-system", "-lcsfml-audio", "-lcsfml-network", - "-lcsfml-audio", "-lcsfml-graphics", "-lcsfml-window", - "-lasfml"); - when others => - for Linker_Options use - ("-lcsfml-system", "-lcsfml-audio", "-lcsfml-network", - "-lcsfml-audio", "-lcsfml-graphics", "-lcsfml-window", - "-lasfml"); - end case; - end Linker; - - package Documentation is for Documentation_Dir use "doc"; for Doc_Pattern use "^/ |^/< "; diff --git a/asfml_audio.gpr b/asfml_audio.gpr new file mode 100644 index 0000000..898382f --- /dev/null +++ b/asfml_audio.gpr @@ -0,0 +1,60 @@ +with "asfml_system.gpr"; + +library project ASFML_Audio is + + type T_OS is ("Windows_NT", "Linux"); + V_OS : T_OS := external ("OS", "Linux"); + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Source_Files use + ("sf-audio.ads", + "sf-audio-listener.ads", + "sf-audio-music.adb", + "sf-audio-music.ads", + "sf-audio-sound.ads", + "sf-audio-soundbuffer.adb", + "sf-audio-soundbuffer.ads", + "sf-audio-soundbufferrecorder.adb", + "sf-audio-soundbufferrecorder.ads", + "sf-audio-soundrecorder.adb", + "sf-audio-soundrecorder.ads", + "sf-audio-soundstatus.ads", + "sf-audio-soundstream.ads", + "sf-audio-types.ads"); + for Object_Dir use "obj"; + + for Library_Name use "asfml-audio"; + + for Library_Dir use "lib/audio"; + for Library_ALI_Dir use "lib/audio"; + for Library_Kind use "static"; + + + package Linker is + case V_OS is + when "Windows_NT" => + for Linker_Options use + ("-LD:\Libraries\CSFML-2.5\lib\gcc", + "-lcsfml-audio", + "-lasfml-audio"); + when others => + for Linker_Options use + ("-lcsfml-audio", + "-lasfml-audio"); + end case; + end Linker; + + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_Audio; diff --git a/asfml_doc.gpr b/asfml_doc.gpr new file mode 100644 index 0000000..db261dd --- /dev/null +++ b/asfml_doc.gpr @@ -0,0 +1,27 @@ +-- This project is only for generating documentation, not for building. +-- When using gnatdoc (Ubuntu 18.04) with asfml.gpr there are errors. + +library project ASFML_doc is + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Object_Dir use "obj"; + + for Library_Name use "asfml"; + + for Library_Dir use "lib"; + for Library_ALI_Dir use "lib"; + for Library_Kind use "static"; + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_doc; diff --git a/asfml_graphics.gpr b/asfml_graphics.gpr new file mode 100644 index 0000000..b26df8d --- /dev/null +++ b/asfml_graphics.gpr @@ -0,0 +1,79 @@ +with "asfml_system.gpr"; +with "asfml_window.gpr"; + +library project ASFML_Graphics is + + type T_OS is ("Windows_NT", "Linux"); + V_OS : T_OS := external ("OS", "Linux"); + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Source_Files use + ("sf-graphics.ads", + "sf-graphics-blendmode.ads", + "sf-graphics-circleshape.ads", + "sf-graphics-color.ads", + "sf-graphics-convexshape.ads", + "sf-graphics-font.adb", + "sf-graphics-font.ads", + "sf-graphics-fontinfo.ads", + "sf-graphics-glsl.ads", + "sf-graphics-glyph.ads", + "sf-graphics-image.adb", + "sf-graphics-image.ads", + "sf-graphics-primitivetype.ads", + "sf-graphics-rect.ads", + "sf-graphics-rectangleshape.ads", + "sf-graphics-renderstates.ads", + "sf-graphics-rendertexture.ads", + "sf-graphics-renderwindow.adb", + "sf-graphics-renderwindow.ads", + "sf-graphics-shader.ads", + "sf-graphics-shape.ads", + "sf-graphics-sprite.ads", + "sf-graphics-text.adb", + "sf-graphics-text.ads", + "sf-graphics-texture.adb", + "sf-graphics-texture.ads", + "sf-graphics-transformable.ads", + "sf-graphics-transform.ads", + "sf-graphics-types.ads", + "sf-graphics-vertex.ads", + "sf-graphics-vertexarray.ads", + "sf-graphics-view.ads"); + for Object_Dir use "obj"; + + for Library_Name use "asfml-graphics"; + + for Library_Dir use "lib/graphics"; + for Library_ALI_Dir use "lib/graphics"; + for Library_Kind use "static"; + + + package Linker is + case V_OS is + when "Windows_NT" => + for Linker_Options use + ("-LD:\Libraries\CSFML-2.5\lib\gcc", + "-lcsfml-graphics", + "-lasfml-graphics"); + when others => + for Linker_Options use + ("-lcsfml-graphics", + "-lasfml-graphics"); + end case; + end Linker; + + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_Graphics; diff --git a/asfml_network.gpr b/asfml_network.gpr new file mode 100644 index 0000000..705535f --- /dev/null +++ b/asfml_network.gpr @@ -0,0 +1,61 @@ +with "asfml_system.gpr"; + +library project ASFML_Network is + + type T_OS is ("Windows_NT", "Linux"); + V_OS : T_OS := external ("OS", "Linux"); + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Source_Files use + ("sf-network.ads", + "sf-network-ftp.adb", + "sf-network-ftp.ads", + "sf-network-http.adb", + "sf-network-http.ads", + "sf-network-ipaddress.adb", + "sf-network-ipaddress.ads", + "sf-network-packet.adb", + "sf-network-packet.ads", + "sf-network-socketselector.ads", + "sf-network-socketstatus.ads", + "sf-network-tcplistener.ads", + "sf-network-tcpsocket.ads", + "sf-network-types.ads", + "sf-network-udpsocket.ads"); + for Object_Dir use "obj"; + + for Library_Name use "asfml-network"; + + for Library_Dir use "lib"; + for Library_ALI_Dir use "lib"; + for Library_Kind use "static"; + + + package Linker is + case V_OS is + when "Windows_NT" => + for Linker_Options use + ("-LD:\Libraries\CSFML-2.5\lib\gcc", + "-lcsfml-network", + "-lasfml-network"); + when others => + for Linker_Options use + ("-lcsfml-network", + "-lasfml-network"); + end case; + end Linker; + + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_Network; diff --git a/asfml_system.gpr b/asfml_system.gpr new file mode 100644 index 0000000..b06e3c7 --- /dev/null +++ b/asfml_system.gpr @@ -0,0 +1,58 @@ + +library project ASFML_System is + + type T_OS is ("Windows_NT", "Linux"); + V_OS : T_OS := external ("OS", "Linux"); + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Source_Files use + ("sf.ads", + "sf-config.ads", + "sf-system.ads", + "sf-system-clock.ads", + "sf-system-inputstream.ads", + "sf-system-mutex.ads", + "sf-system-sleep.adb", + "sf-system-sleep.ads", + "sf-system-thread.ads", + "sf-system-time.ads", + "sf-system-types.ads", + "sf-system-vector2.ads", + "sf-system-vector3.ads"); + for Object_Dir use "obj"; + + for Library_Name use "asfml-system"; + + for Library_Dir use "lib/system"; + for Library_ALI_Dir use "lib/system"; + for Library_Kind use "static"; + + + package Linker is + case V_OS is + when "Windows_NT" => + for Linker_Options use + ("-LD:\Libraries\CSFML-2.5\lib\gcc", + "-lcsfml-system", + "-lasfml-system"); + when others => + for Linker_Options use + ("-lcsfml-system", + "-lasfml-system"); + end case; + end Linker; + + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_System; diff --git a/asfml_window.gpr b/asfml_window.gpr new file mode 100644 index 0000000..3f1b4cb --- /dev/null +++ b/asfml_window.gpr @@ -0,0 +1,62 @@ +with "asfml_system.gpr"; + +library project ASFML_Window is + + type T_OS is ("Windows_NT", "Linux"); + V_OS : T_OS := external ("OS", "Linux"); + + for Languages use ("Ada"); + + for Create_Missing_Dirs use "True"; + + for Source_Dirs use ("include"); + for Source_Files use + ("sf-window.ads", + "sf-window-context.ads", + "sf-window-event.ads", + "sf-window-gl.ads", + "sf-window-glu.ads", + "sf-window-joystick.ads", + "sf-window-joystickidentification.ads", + "sf-window-keyboard.ads", + "sf-window-mouse.ads", + "sf-window-sensor.ads", + "sf-window-touch.ads", + "sf-window-types.ads", + "sf-window-videomode.ads", + "sf-window-window.adb", + "sf-window-window.ads", + "sf-window-windowhandle.ads"); + for Object_Dir use "obj"; + + for Library_Name use "asfml-window"; + + for Library_Dir use "lib/window"; + for Library_ALI_Dir use "lib/window"; + for Library_Kind use "static"; + + + package Linker is + case V_OS is + when "Windows_NT" => + for Linker_Options use + ("-LD:\Libraries\CSFML-2.5\lib\gcc", + "-lcsfml-window", + "-lasfml-window"); + when others => + for Linker_Options use + ("-lcsfml-window", + "-lasfml-window"); + end case; + end Linker; + + + package Documentation is + for Documentation_Dir use "doc"; + for Doc_Pattern use "^/ |^/< "; + -- This considers comments beginning with "--/ " to be documentation + for Custom_Tags_Definition use "tools/sfml-doc-tags.py"; + -- GNATdoc loads provided file on startup to process custom tags + end Documentation; + +end ASFML_Window; diff --git a/tests/music/main.gpr b/tests/music/main.gpr index c590600..021dc33 100644 --- a/tests/music/main.gpr +++ b/tests/music/main.gpr @@ -1,4 +1,4 @@ -with "../../asfml.gpr"; +with "../../asfml_audio.gpr"; project Main is diff --git a/tests/renderwindow/main.gpr b/tests/renderwindow/main.gpr index c590600..028cd35 100644 --- a/tests/renderwindow/main.gpr +++ b/tests/renderwindow/main.gpr @@ -1,4 +1,4 @@ -with "../../asfml.gpr"; +with "../../asfml_graphics.gpr"; project Main is diff --git a/tests/thread/main.gpr b/tests/thread/main.gpr index c590600..249d28f 100644 --- a/tests/thread/main.gpr +++ b/tests/thread/main.gpr @@ -1,4 +1,4 @@ -with "../../asfml.gpr"; +with "../../asfml_system.gpr"; project Main is