Move OSX SDL library configuration from SDLh to proper CMakeLists
authorkoda
Tue, 02 Jun 2015 01:58:10 +0100
changeset 10973 36b84888934c
parent 10972 bba0f1b7ebbc
child 10974 0f9fc5923be4
Move OSX SDL library configuration from SDLh to proper CMakeLists
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
--- a/hedgewars/CMakeLists.txt	Tue Jun 02 01:28:21 2015 +0100
+++ 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	Tue Jun 02 01:28:21 2015 +0100
+++ 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