# HG changeset patch # User koda # Date 1370382504 -7200 # Node ID 4f4b71da3559ae0a8e866f94ac1fabc9e79a37af # Parent e350500c4edb3b9446f748cd33b333f347d2aa9c move sdlmain_osx aside in its own folder so its include path is not contaminated diff -r e350500c4edb -r 4f4b71da3559 CMakeLists.txt --- a/CMakeLists.txt Tue Jun 04 22:28:12 2013 +0200 +++ b/CMakeLists.txt Tue Jun 04 23:48:24 2013 +0200 @@ -402,6 +402,7 @@ if (NOT ghc_executable) message(FATAL_ERROR "A Haskell compiler is required to build engine in C") endif() + add_subdirectory(hedgewars/sdlmain_osx) #pascal to c converter add_subdirectory(tools/pas2c) add_subdirectory(project_files/hwc) diff -r e350500c4edb -r 4f4b71da3559 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Jun 04 22:28:12 2013 +0200 +++ b/hedgewars/CMakeLists.txt Tue Jun 04 23:48:24 2013 +0200 @@ -148,22 +148,8 @@ #on OSX we need to provide the SDL_main() function when building as executable if(NOT ${LIBENGINE}) - #let's look for the installed sdlmain file; if it is not found, let's build our own - find_package(SDL REQUIRED) - #remove the ";-framework Cocoa" from the SDL_LIBRARY variable - string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL_LIBRARY}") - #find libsdmain.a - find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_library_only}/Resources/) - - if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND") - include_directories(${SDL_INCLUDE_DIR}) - add_library (SDLmain STATIC sdlmain_osx/SDLMain.m) - #add a dependency to the hwengine target - list(APPEND engine_sources SDLmain) - set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a") - endif() - - list(APPEND pascal_flags "-k${SDLMAIN_LIB}") + add_subdirectory(sdlmain_osx) + list(APPEND pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libSDLmain.a") endif() #when you have multiple ld installation make sure you get the one bundled with the compiler @@ -267,6 +253,10 @@ add_dependencies(hwengine avwrapper) endif() +if(APPLE) + add_dependencies(hwengine SDLmain) +endif(APPLE) + #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6 if((FREEPASCAL_VERSION VERSION_LESS "2.6") AND (NOT ${FFMPEG_FOUND})) add_dependencies(hwengine ENGINECLEAN) diff -r e350500c4edb -r 4f4b71da3559 hedgewars/sdlmain_osx/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/sdlmain_osx/CMakeLists.txt Tue Jun 04 23:48:24 2013 +0200 @@ -0,0 +1,8 @@ +if(APPLE) + #let's look for the installed sdlmain file; if it is not found, let's build our own + find_package(SDL REQUIRED) + + include_directories(${SDL_INCLUDE_DIR}) + add_library (SDLmain STATIC ${CMAKE_CURRENT_SOURCE_DIR}/SDLMain.m) +endif(APPLE) + diff -r e350500c4edb -r 4f4b71da3559 project_files/hwc/CMakeLists.txt --- a/project_files/hwc/CMakeLists.txt Tue Jun 04 22:28:12 2013 +0200 +++ b/project_files/hwc/CMakeLists.txt Tue Jun 04 23:48:24 2013 +0200 @@ -59,28 +59,8 @@ #TODO: add other libraries ) if(APPLE) - target_link_libraries(hwengine IOKit) + target_link_libraries(hwengine IOKit SDLmain) endif() -#TODO: move this away in its proper findxxx.cmake -if(APPLE) - #let's look for the installed sdlmain file; if it is not found, let's build our own - find_package(SDL REQUIRED) - #remove the ";-framework Cocoa" from the SDL_LIBRARY variable - string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}") - #find libsdmain.a - find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/) - - if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND") - include_directories(${SDL_INCLUDE_DIR}) - add_library (SDLmain STATIC ${CMAKE_SOURCE_DIR}/hedgewars/sdlmain_osx/SDLMain.m) - #add a dependency to the hwengine target - set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a") - endif() - - target_link_libraries(hwengine ${SDLMAIN_LIB}) -endif(APPLE) - - install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_binary_install_dir})