hedgewars/CMakeLists.txt
changeset 9942 0562f28ccb7a
parent 9921 7227cc2acba1
child 9924 aa7e7544ae41
equal deleted inserted replaced
9941:d33d4727b39e 9942:0562f28ccb7a
   100 elseif(CMAKE_Pascal_COMPILER_VERSION VERSION_GREATER 2.4)
   100 elseif(CMAKE_Pascal_COMPILER_VERSION VERSION_GREATER 2.4)
   101     #enable INLINE only with a recent version of fpc
   101     #enable INLINE only with a recent version of fpc
   102     add_flag_prepend(CMAKE_Pascal_FLAGS_RELEASE -Si)
   102     add_flag_prepend(CMAKE_Pascal_FLAGS_RELEASE -Si)
   103 endif()
   103 endif()
   104 
   104 
       
   105 #generic folder where our libraries reside
       
   106 add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH}")
   105 
   107 
   106 #DEPENDECIES AND EXECUTABLES SECTION
   108 #DEPENDECIES AND EXECUTABLES SECTION
   107 if(NOT ${BUILD_ENGINE_LIBRARY} AND APPLE)
   109 if(NOT ${BUILD_ENGINE_LIBRARY} AND APPLE)
   108     #on OSX we need to provide the SDL_main() function when building as executable
   110     #on OSX we need to provide the SDL_main() function when building as executable
   109     add_subdirectory(sdlmain)
   111     add_subdirectory(sdlmain)
   110     list(APPEND HW_LINK_LIBS SDLmain)
   112     list(APPEND HW_LINK_LIBS SDLmain)
   111     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
       
   112 endif()
   113 endif()
   113 
   114 
   114 if(FFMPEG_FOUND)
   115 if(FFMPEG_FOUND)
   115     add_subdirectory(avwrapper)
   116     add_subdirectory(avwrapper)
   116     list(APPEND HW_LINK_LIBS avwrapper)
   117     list(APPEND HW_LINK_LIBS avwrapper)
   117     add_definitions(-dUSE_VIDEO_RECORDING)
   118     add_definitions(-dUSE_VIDEO_RECORDING)
   118     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
       
   119     #only for SDL < 2, linking carried out by fpc
   119     #only for SDL < 2, linking carried out by fpc
   120     find_package_or_disable_msg(GLUT NOVIDEOREC "Video recording will not be built")
   120     find_package_or_disable_msg(GLUT NOVIDEOREC "Video recording will not be built")
   121 endif()
   121 endif()
   122 
   122 
   123 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   123 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
   124 if(PNG_FOUND)
   124 if(PNG_FOUND)
   125     list(INSERT engine_sources 0 PNGh.pas)
   125     list(INSERT engine_sources 0 PNGh.pas)
   126     list(REMOVE_AT PNG_LIBRARIES 1) #removing the zlib library path
   126     list(REMOVE_AT PNG_LIBRARIES 1) #removing the zlib library path
   127     get_filename_component(PNG_LIBRARY_DIR ${PNG_LIBRARIES} PATH)
   127     get_filename_component(PNG_LIBRARY_DIR ${PNG_LIBRARIES} PATH)
   128     add_flag_append(CMAKE_Pascal_FLAGS -Fl${PNG_LIBRARY_DIR})
   128     add_flag_append(CMAKE_Pascal_FLAGS "-k-L${PNG_LIBRARY_DIR} -Fl${PNG_LIBRARY_DIR}")
   129     add_definitions(-dPNG_SCREENSHOTS)
   129     add_definitions(-dPNG_SCREENSHOTS)
   130 endif()
   130 endif()
   131 
   131 
   132 if(LUA_FOUND AND LUA_SYSTEM)
   132 if(LUA_FOUND AND LUA_SYSTEM)
   133     get_filename_component(LUA_LIBRARY_DIR ${LUA_LIBRARY} PATH)
   133     get_filename_component(LUA_LIBRARY_DIR ${LUA_LIBRARY} PATH)
   139     add_definitions(-dLUA_INTERNAL)
   139     add_definitions(-dLUA_INTERNAL)
   140     list(APPEND HW_LINK_LIBS lua)
   140     list(APPEND HW_LINK_LIBS lua)
   141     add_flag_append(CMAKE_Pascal_FLAGS "-XLAlua=${lua_output_name}")
   141     add_flag_append(CMAKE_Pascal_FLAGS "-XLAlua=${lua_output_name}")
   142 endif()
   142 endif()
   143 
   143 
   144 
   144 if(PHYSFS_FOUND)
   145 if(NOT PHYSFS_FOUND)
   145     get_filename_component(PHYSFS_LIBRARY_DIR ${PHYSFS_LIBRARY} PATH)
       
   146     add_flag_append(CMAKE_Pascal_FLAGS "-Fl${PHYSFS_LIBRARY}")
       
   147 else()
   146     add_definitions(-dPHYSFS_INTERNAL)
   148     add_definitions(-dPHYSFS_INTERNAL)
   147     list(APPEND HW_LINK_LIBS physfs)
   149     list(APPEND HW_LINK_LIBS physfs)
   148     #-XLA is a beta fpc flag that renames libraries before passing them to the linker
   150     #-XLA is a beta fpc flag that renames libraries before passing them to the linker
   149     #we also have to pass PHYSFS_INTERNAL to satisfy windows runtime requirements
   151     #we also have to pass PHYSFS_INTERNAL to satisfy windows runtime requirements
   150     #(should be harmless on other platforms)
   152     #(should be harmless on other platforms)
   151     add_flag_append(CMAKE_Pascal_FLAGS "-Fl${LIBRARY_OUTPUT_PATH} -XLAphysfs=${physfs_output_name}")
   153     add_flag_append(CMAKE_Pascal_FLAGS "-XLAphysfs=${physfs_output_name}")
   152 endif()
   154 endif()
   153 list(APPEND HW_LINK_LIBS physlayer)
   155 list(APPEND HW_LINK_LIBS physlayer)
       
   156 
   154 
   157 
   155 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
   158 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
   156 check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
   159 check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
   157 if(HAVE_MIXINIT)
   160 if(HAVE_MIXINIT)
   158     add_definitions(-dSDL_MIXER_NEWER)
   161     add_definitions(-dSDL_MIXER_NEWER)