Move OSX SDL library configuration from SDLh to proper CMakeLists 0.9.21
authorkoda
Tue, 02 Jun 2015 01:58:10 +0100
branch0.9.21
changeset 10759 0f4b38722400
parent 10756 4846f229b706
child 10762 a017ec64f675
Move OSX SDL library configuration from SDLh to proper CMakeLists
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
--- a/hedgewars/CMakeLists.txt	Mon Jun 01 14:30:22 2015 +0200
+++ b/hedgewars/CMakeLists.txt	Tue Jun 02 01:58:10 2015 +0100
@@ -122,9 +122,23 @@
 
 #DEPENDECIES AND EXECUTABLES SECTION
 if(APPLE AND (NOT BUILD_ENGINE_LIBRARY))
-    #on OSX we need to provide the SDL_main() function when building as executable
+    #on OSX we need to provide the SDL_main() function when building as
+    #executable and the entry point too
     add_subdirectory(sdlmain)
     list(APPEND HW_LINK_LIBS SDLmain)
+    add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdlmain")
+    add_flag_append(CMAKE_Pascal_FLAGS "-XMSDL_main")
+    #OpenGL deps
+    add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kCocoa")
+    add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kOpenGL")
+
+    #set the correct library or framework style depending on the main SDL
+    string(FIND "${SDL_LIBRARY}" "dylib" sdl_framework)
+    if(${sdl_framework} GREATER -1)
+        add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdl -k-lsdl_image -k-lsdl_mixer -k-lsdl_ttf -k-lsdl_net")
+    else()
+        add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kSDL -k-framework -kSDL_image -k-framework -k SDL_mixer -k-framework -k SDL_net -k-framework -kSDL_net")
+    endif()
 endif()
 
 if(LIBAV_FOUND)
--- a/hedgewars/SDLh.pas	Mon Jun 01 14:30:22 2015 +0200
+++ b/hedgewars/SDLh.pas	Tue Jun 02 01:58:10 2015 +0100
@@ -53,20 +53,6 @@
     type PLongInt = ^LongInt;
 {$ENDIF}
 
-{$IFDEF DARWIN}
-    {$IFNDEF HWLIBRARY}
-        {$linklib SDLmain}
-        {$PASCALMAINNAME SDL_main}
-        {$linkframework Cocoa}
-        {$linkframework SDL}
-        {$linkframework SDL_net}
-        {$linkframework SDL_image}
-        {$linkframework SDL_ttf}
-        {$linkframework SDL_mixer}
-        {$linkframework OpenGL}
-    {$ENDIF}
-{$ENDIF}
-
 
 (*  SDL  *)
 const