diff --git a/build/gnat/makefile b/build/gnat/makefile index b13930f..0046490 100644 --- a/build/gnat/makefile +++ b/build/gnat/makefile @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS) tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Ptests.gpr ${SDL2_CONFIG} + -Ptests.gpr # ${SDL2_CONFIG} # Maths library @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests build_unit_tests/unit_tests: $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Punit_tests.gpr ${SDL2_CONFIG} + -Punit_tests.gpr # ${SDL2_CONFIG} .PHONY: clean-unit_tests diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr index adc77f5..13ef8ee 100644 --- a/build/gnat/sdlada.gpr +++ b/build/gnat/sdlada.gpr @@ -1,10 +1,21 @@ library project SDLAda is - type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android"); + type Platform_Type is ("linux", + "bsd", + "windows", + "macosx", + "macos_homebrew", + "macos_ports", + "ios", + "android"); type Mode_Type is ("debug", "release"); Platform : Platform_Type := external ("SDL_PLATFORM", "linux"); Mode : Mode_Type := external ("SDL_MODE", "debug"); + package Builder is + for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); + end Builder; + Source_Platform := ""; case Platform is @@ -52,6 +63,11 @@ library project SDLAda is "-I/usr/local/include", "-D_REENTRANT"); + when "macos_ports" => + C_Switches := C_Switches & ("-DSDL_MACPORTS", + "-I/opt/local/include", + "-D_THREAD_SAFE"); + when others => null; end case; @@ -59,4 +75,33 @@ library project SDLAda is for Default_Switches ("C") use Common_Switches & C_Switches; for Default_Switches ("Ada") use Common_Switches & Ada_Switches; end Compiler; + + package Linker is + Linker_Switches := (); + + case Platform is + when "linux" | "bsd" | "android" | "windows" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/lib64"); + + when "macos_homebrew" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/local/lib"); + + when "macos_ports" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/opt/local/lib"); + + when others => + null; + end case; + + for Switches ("Ada") use Linker_Switches; + end Linker; end SDLAda; diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr index 1098095..5a9764f 100644 --- a/build/gnat/sdlada_image.gpr +++ b/build/gnat/sdlada_image.gpr @@ -11,4 +11,5 @@ library project SDLAda_Image is for Library_Version use "libsdlada_image.so." & Version; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end SDLAda_Image; diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr index 70dceff..51ee201 100644 --- a/build/gnat/tests.gpr +++ b/build/gnat/tests.gpr @@ -15,24 +15,5 @@ project Tests is "ttf.adb"); package Compiler renames SDLAda.Compiler; - - package Linker is - - Linker_Switches := (); - - case Sdlada.Platform is - when "macos_homebrew" => - Linker_Switches := Linker_Switches & ("-lSDL2", - "-lSDL2_ttf", - "-lSDL2_image", - "-L/usr/local/lib"); - - when others => - null; - end case; - - for Switches ("Ada") use Linker_Switches; - - end Linker; - + package Linker renames SDLAda.Linker; end Tests; diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr index f23be3c..fd68309 100644 --- a/build/gnat/tests_image.gpr +++ b/build/gnat/tests_image.gpr @@ -8,6 +8,7 @@ project Tests_Image is for Main use ("load_surface.adb"); package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; -- package Builder is -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG"); diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr index c469a34..27dd38f 100644 --- a/build/gnat/unit_tests.gpr +++ b/build/gnat/unit_tests.gpr @@ -17,4 +17,5 @@ project Unit_Tests is -- end Ide; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end Unit_Tests; diff --git a/src/image/version_images.c b/src/image/version_images.c index ba5be68..47813a1 100644 --- a/src/image/version_images.c +++ b/src/image/version_images.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include #else #include diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c index cedfebc..0819103 100644 --- a/src/ttf/version_ttf.c +++ b/src/ttf/version_ttf.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include #else #include