hedgewars/CMakeLists.txt
branchqmlfrontend
changeset 11403 b894922d58cc
parent 11071 3851ce4f2061
parent 11392 f4e19cd88747
child 11434 23912c93935a
equal deleted inserted replaced
11076:fcbdee9cdd74 11403:b894922d58cc
     1 find_package(SDL1or2)
     1 enable_language(Pascal)
     2 find_package(SDL_image)
     2 
     3 find_package(SDL_net)
     3 find_package(SDL2 REQUIRED)
     4 find_package(SDL_ttf)
     4 find_package(SDL2_image REQUIRED)
     5 find_package(SDL_mixer)
     5 find_package(SDL2_net REQUIRED)
       
     6 find_package(SDL2_ttf REQUIRED)
       
     7 find_package(SDL2_mixer REQUIRED)
     6 
     8 
     7 include(CheckLibraryExists)
     9 include(CheckLibraryExists)
     8 include(${CMAKE_MODULE_PATH}/utils.cmake)
    10 include(${CMAKE_MODULE_PATH}/utils.cmake)
     9 
    11 
    10 
    12 
   134 #generic folder where our libraries reside
   136 #generic folder where our libraries reside
   135 add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH}")
   137 add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH}")
   136 
   138 
   137 #DEPENDECIES AND EXECUTABLES SECTION
   139 #DEPENDECIES AND EXECUTABLES SECTION
   138 if(APPLE AND (NOT BUILD_ENGINE_LIBRARY))
   140 if(APPLE AND (NOT BUILD_ENGINE_LIBRARY))
   139     #on OSX we need to provide the SDL_main() function when building as
       
   140     #executable and the entry point too
       
   141     add_subdirectory(sdlmain)
       
   142     list(APPEND HW_LINK_LIBS SDLmain)
       
   143     add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdlmain")
       
   144     add_flag_append(CMAKE_Pascal_FLAGS "-XMSDL_main")
       
   145     #OpenGL deps
   141     #OpenGL deps
   146     add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kCocoa")
   142     add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kCocoa")
   147     add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kOpenGL")
   143     add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kOpenGL")
   148 
   144 
   149     #set the correct library or framework style depending on the main SDL
   145     #set the correct library or framework style depending on the main SDL
   150     string(FIND "${SDL_LIBRARY}" "dylib" sdl_framework)
   146     string(FIND "${SDL2_LIBRARY}" "dylib" sdl_framework)
   151     if(${sdl_framework} GREATER -1)
   147     if(${sdl_framework} GREATER -1)
   152         add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdl -k-lsdl_image -k-lsdl_mixer -k-lsdl_ttf -k-lsdl_net")
   148         add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdl2 -k-lsdl2_image -k-lsdl2_mixer -k-lsdl2_ttf -k-lsdl2_net")
   153     else()
   149     else()
   154         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")
   150         add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kSDL2 -k-framework -kSDL2_image -k-framework -kSDL2_mixer -k-framework -kSDL2_net -k-framework -kSDL2_net -k-framework -kSDL2_ttf")
   155     endif()
   151     endif()
   156 endif()
   152 endif()
   157 
   153 
   158 if(LIBAV_FOUND)
   154 if(LIBAV_FOUND)
   159     add_subdirectory(avwrapper)
   155     add_subdirectory(avwrapper)
   160     list(APPEND HW_LINK_LIBS avwrapper)
   156     list(APPEND HW_LINK_LIBS avwrapper)
   161     add_definitions(-dUSE_VIDEO_RECORDING)
   157     add_definitions(-dUSE_VIDEO_RECORDING)
   162     #only for SDL < 2, linking carried out by fpc
       
   163     find_package_or_disable_msg(GLUT NOVIDEOREC "Video recording will not be built")
       
   164 endif()
   158 endif()
   165 
   159 
   166 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   160 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   167 if(PNG_FOUND)
   161 if(PNG_FOUND)
   168     list(INSERT engine_sources 0 PNGh.pas)
   162     list(INSERT engine_sources 0 PNGh.pas)
   196     add_flag_append(CMAKE_Pascal_FLAGS "-XLAphysfs=${physfs_output_name}")
   190     add_flag_append(CMAKE_Pascal_FLAGS "-XLAphysfs=${physfs_output_name}")
   197 endif()
   191 endif()
   198 list(APPEND HW_LINK_LIBS physlayer)
   192 list(APPEND HW_LINK_LIBS physlayer)
   199 
   193 
   200 
   194 
   201 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
       
   202 check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
       
   203 if(HAVE_MIXINIT)
       
   204     add_definitions(-dSDL_MIXER_NEWER)
       
   205 endif(HAVE_MIXINIT)
       
   206 
       
   207 #IMG_Init/IMG_Quit from SDL_image 1.2.8
       
   208 check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT)
       
   209 if(HAVE_IMGINIT)
       
   210     add_definitions(-dSDL_IMAGE_NEWER)
       
   211 endif(HAVE_IMGINIT)
       
   212 
       
   213 if(${SDL_VERSION} VERSION_GREATER 1.3)
       
   214     add_definitions(-dSDL2)
       
   215 endif()
       
   216 
       
   217 #opengl 2
   195 #opengl 2
   218 IF(GL2)
   196 IF(GL2)
   219     add_definitions(-dGL2)
   197     add_definitions(-dGL2)
   220 ENDIF(GL2)
   198 ENDIF(GL2)
   221 
   199