hedgewars/CMakeLists.txt
branchsdl2transition
changeset 11360 7a7611adf715
parent 9798 f2b18754742f
child 11362 ed5a6478e710
equal deleted inserted replaced
9798:f2b18754742f 11360:7a7611adf715
     1 enable_language(Pascal)
     1 enable_language(Pascal)
     2 
     2 
     3 if(${NOSDL2})
     3 find_package(SDL2 REQUIRED)
     4     find_package(SDL REQUIRED)
     4 find_package(SDL2_image REQUIRED)
     5     find_package(SDL_image REQUIRED)
     5 find_package(SDL2_net REQUIRED)
     6     find_package(SDL_net REQUIRED)
     6 find_package(SDL2_ttf REQUIRED)
     7     find_package(SDL_ttf REQUIRED)
     7 find_package(SDL2_mixer REQUIRED)
     8     find_package(SDL_mixer REQUIRED)
       
     9 else(${NOSDL2})
       
    10     find_package(SDL2 REQUIRED)
       
    11     find_package(SDL2_image REQUIRED)
       
    12     find_package(SDL2_net REQUIRED)
       
    13     find_package(SDL2_ttf REQUIRED)
       
    14     find_package(SDL2_mixer REQUIRED)
       
    15     add_definitions(-dSDL2)
       
    16 endif(${NOSDL2})
       
    17 
     8 
    18 include (CheckLibraryExists)
     9 include (CheckLibraryExists)
    19 
    10 
    20 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
    11 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
    21 include_directories(${CMAKE_CURRENT_BINARY_DIR})
    12 include_directories(${CMAKE_CURRENT_BINARY_DIR})
   105     #enable INLINE only with a recent version of fpc
    96     #enable INLINE only with a recent version of fpc
   106     add_flag_prepend(CMAKE_Pascal_FLAGS_RELEASE -Si)
    97     add_flag_prepend(CMAKE_Pascal_FLAGS_RELEASE -Si)
   107 endif()
    98 endif()
   108 
    99 
   109 
   100 
   110 #DEPENDECIES AND EXECUTABLES SECTION
       
   111 if(NOT ${BUILD_ENGINE_LIBRARY} AND APPLE AND ${NOSDL2})
       
   112     #on OSX we need to provide the SDL_main() function when building as executable
       
   113     add_subdirectory(sdlmain)
       
   114     list(APPEND HW_LINK_LIBS SDLmain)
       
   115     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
       
   116 endif()
       
   117 
       
   118 if(FFMPEG_FOUND)
   101 if(FFMPEG_FOUND)
   119     add_subdirectory(avwrapper)
   102     add_subdirectory(avwrapper)
   120     list(APPEND HW_LINK_LIBS avwrapper)
   103     list(APPEND HW_LINK_LIBS avwrapper)
   121     add_definitions(-dUSE_VIDEO_RECORDING)
   104     add_definitions(-dUSE_VIDEO_RECORDING)
   122     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   105     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   123     
   106     
   124     if(${NOSDL2})
       
   125         #only for SDL < 2, linking carried out by fpc
       
   126         find_package_or_disable_msg(GLUT NOVIDEOREC "Video recording will not be built")
       
   127     endif(${NOSDL2})
       
   128 endif()
   107 endif()
   129 
   108 
   130 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   109 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   131 if(PNG_FOUND)
   110 if(PNG_FOUND)
   132     list(INSERT engine_sources 0 PNGh.pas)
   111     list(INSERT engine_sources 0 PNGh.pas)
   158     add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH} -XLAphysfs=${physfs_output_name}")
   137     add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH} -XLAphysfs=${physfs_output_name}")
   159 endif()
   138 endif()
   160 list(APPEND HW_LINK_LIBS physlayer)
   139 list(APPEND HW_LINK_LIBS physlayer)
   161 
   140 
   162 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
   141 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
   163 if(${NOSDL2})
       
   164     check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
       
   165     if(HAVE_MIXINIT)
       
   166         add_definitions(-dSDL_MIXER_NEWER)
       
   167     endif(HAVE_MIXINIT)
       
   168 
       
   169     #IMG_Init/IMG_Quit from SDL_image 1.2.8
       
   170     check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT)
       
   171     if(HAVE_IMGINIT)
       
   172         add_definitions(-dSDL_IMAGE_NEWER)
       
   173     endif(HAVE_IMGINIT)
       
   174 endif(${NOSDL2})
       
   175 
   142 
   176 #needs to be last
   143 #needs to be last
   177 add_definitions(-dDEBUGFILE)
   144 add_definitions(-dDEBUGFILE)
   178 
   145 
   179 
   146