hedgewars/CMakeLists.txt
branchcmake_pascal
changeset 8813 a932b10fc1d0
parent 8811 dcdfcddf37ee
child 8819 8e25b820b360
equal deleted inserted replaced
8811:dcdfcddf37ee 8813:a932b10fc1d0
     5 find_package(SDL_mixer)
     5 find_package(SDL_mixer)
     6 
     6 
     7 include (CheckLibraryExists)
     7 include (CheckLibraryExists)
     8 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
     8 #Mix_Init/Mix_Quit from SDL_mixer 1.2.10
     9 check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
     9 check_library_exists(${SDLMIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
    10 if(HAVE_MIXINIT)
       
    11     add_definitions(-dSDL_MIXER_NEWER)
       
    12 endif()
       
    13 #IMG_Init/IMG_Quit from SDL_image 1.2.8
    10 #IMG_Init/IMG_Quit from SDL_image 1.2.8
    14 check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT)
    11 check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT)
    15 if(HAVE_IMGINIT)
       
    16     add_definitions(-dSDL_IMAGE_NEWER)
       
    17 endif()
       
    18 
       
    19 
    12 
    20 enable_language(Pascal)
    13 enable_language(Pascal)
    21 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
    14 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
    22 
    15 
    23 #SOURCE AND PROGRAMS SECTION
    16 #SOURCE AND PROGRAMS SECTION
   101     ArgParsers.inc
    94     ArgParsers.inc
   102     options.inc
    95     options.inc
   103     ${CMAKE_CURRENT_BINARY_DIR}/config.inc
    96     ${CMAKE_CURRENT_BINARY_DIR}/config.inc
   104     )
    97     )
   105 
    98 
   106 if(${BUILD_ENGINE_LIBRARY})
       
   107     message(${WARNING} "Engine will be built as library (experimental)")
       
   108     add_definitions(-dHWLIBRARY)
       
   109 
       
   110     # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
       
   111     if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
       
   112         add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits")
       
   113     endif()
       
   114     set(destination_dir ${target_library_install_dir})
       
   115 else(${BUILD_ENGINE_LIBRARY})
       
   116     set(destination_dir ${target_binary_install_dir})
       
   117 endif(${BUILD_ENGINE_LIBRARY})
       
   118 
       
   119 
    99 
   120 include(${CMAKE_MODULE_PATH}/utils.cmake)
   100 include(${CMAKE_MODULE_PATH}/utils.cmake)
   121 
   101 
   122 find_package_or_fail(FreePascal)
   102 find_package_or_fail(FreePascal)
   123 
   103 
   145         add_subdirectory(sdlmain)
   125         add_subdirectory(sdlmain)
   146         add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   126         add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   147     endif()
   127     endif()
   148 endif(APPLE)
   128 endif(APPLE)
   149 
   129 
   150 
   130 if(FFMPEG_FOUND)
   151 if(${FFMPEG_FOUND})
       
   152     add_subdirectory(avwrapper)
   131     add_subdirectory(avwrapper)
   153     add_definitions(-dUSE_VIDEO_RECORDING)
   132     add_definitions(-dUSE_VIDEO_RECORDING)
   154     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   133     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
   155 endif()
   134 endif()
   156 
   135 
   181     add_flag_append(CMAKE_Pascal_FLAGS -Px86_64)
   160     add_flag_append(CMAKE_Pascal_FLAGS -Px86_64)
   182 else()
   161 else()
   183     add_flag_append(CMAKE_Pascal_FLAGS -Pi386)
   162     add_flag_append(CMAKE_Pascal_FLAGS -Pi386)
   184 endif()
   163 endif()
   185 
   164 
       
   165 
       
   166 if(BUILD_ENGINE_LIBRARY)
       
   167     message(${WARNING} "Engine will be built as library (experimental)")
       
   168     add_definitions(-dHWLIBRARY)
       
   169 
       
   170     # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
       
   171     if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
       
   172         add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits")
       
   173     endif()
       
   174     set(destination_dir ${target_library_install_dir})
       
   175 else(BUILD_ENGINE_LIBRARY)
       
   176     set(destination_dir ${target_binary_install_dir})
       
   177 endif(BUILD_ENGINE_LIBRARY)
       
   178 
       
   179 
       
   180 if(HAVE_MIXINIT)
       
   181     add_definitions(-dSDL_MIXER_NEWER)
       
   182 endif(HAVE_MIXINIT)
       
   183 
       
   184 if(HAVE_IMGINIT)
       
   185     add_definitions(-dSDL_IMAGE_NEWER)
       
   186 endif(HAVE_IMGINIT)
       
   187 
   186 add_definitions(-dDEBUGFILE)
   188 add_definitions(-dDEBUGFILE)
   187 add_executable(hwengine ${engine_sources})
   189 add_executable(hwengine ${engine_sources})
   188 
   190 
   189 #when system Lua is not found we need to compile it before engine
   191 #when system Lua is not found we need to compile it before engine
   190 if(NOT LUA_FOUND)
   192 if(NOT LUA_FOUND)