CMakeLists.txt
changeset 8347 716c05f19401
parent 8333 416cb5e5a405
child 8348 c039ac6f33e0
equal deleted inserted replaced
8346:3443e0de2c9d 8347:716c05f19401
   128     #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
   128     #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
   129     if(current_macosx_version VERSION_EQUAL "10.4")
   129     if(current_macosx_version VERSION_EQUAL "10.4")
   130         find_package(SDL_mixer REQUIRED)
   130         find_package(SDL_mixer REQUIRED)
   131         set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
   131         set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
   132         set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
   132         set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
   133         set(pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}" ${pascal_flags})
   133         set(CMAKE_C_FLAGS "${DYLIB_SMPEG}" "${DYLIB_MIKMOD}")
   134         set(CMAKE_C_FLAGS "${DYLIB_SMPEG}" "${DYLIB_MIKMOD}" ${CMAKE_C_FLAGS})
   134         list(APPEND pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}")
   135     endif()
   135     endif()
   136 
   136 
   137     #CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT need to be set for universal binary and correct linking
   137     #CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT need to be set for universal binary and correct linking
   138     if(NOT CMAKE_OSX_ARCHITECTURES)
   138     if(NOT CMAKE_OSX_ARCHITECTURES)
   139         if(current_macosx_version VERSION_LESS "10.6")
   139         if(current_macosx_version VERSION_LESS "10.6")
   159             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
   159             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
   160         endif()
   160         endif()
   161     endif()
   161     endif()
   162 
   162 
   163     #add user framework directory, other paths can be passed via FPFLAGS
   163     #add user framework directory, other paths can be passed via FPFLAGS
   164     set(pascal_flags "-Ff~/Library/Frameworks" ${pascal_flags})
   164     list(APPEND pascal_flags "-Ff~/Library/Frameworks")
   165     #set deployment target
   165     #set deployment target
   166     set(pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_flags})
   166     list(APPEND pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}")
   167 
   167 
   168     #silly libav that always brings in VideoDecoderAcceleration, avaible only from 10.6.3
   168     #silly libav that always brings in VideoDecoderAcceleration, avaible only from 10.6.3
   169     if(NOT NOVIDEOREC AND ${minimum_macosx_version} VERSION_LESS "10.6")
   169     if(NOT NOVIDEOREC AND ${minimum_macosx_version} VERSION_LESS "10.6")
   170         set(WARNING "Video recording support before OS X 10.6 is experimental")
   170         set(WARNING "Video recording support before OS X 10.6 is experimental")
   171     endif()
   171     endif()
   182 else (CMAKE_BUILD_TYPE)
   182 else (CMAKE_BUILD_TYPE)
   183     set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Choose the build type, options are: Debug Release." FORCE)
   183     set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Choose the build type, options are: Debug Release." FORCE)
   184 endif (CMAKE_BUILD_TYPE)
   184 endif (CMAKE_BUILD_TYPE)
   185 
   185 
   186 #set default flags values for all projects (unless MINIMAL_FLAGS is true)
   186 #set default flags values for all projects (unless MINIMAL_FLAGS is true)
   187 if(NOT MINIMAL_FLAGS)
   187 if(NOT ${MINIMAL_FLAGS})
   188     set(CMAKE_C_FLAGS "-pipe")
   188     set(CMAKE_C_FLAGS "-pipe")
   189     set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer")
   189     set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer")
   190     set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG")
   190     set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG")
   191     set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
   191     set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
   192     set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
   192     set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
   208         separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS})
   208         separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS})
   209         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
   209         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
   210     endif()
   210     endif()
   211 endif()
   211 endif()
   212 
   212 
   213 set(pascal_flags ${fpflags_parsed}              # user flags
   213 list(APPEND pascal_flags ${fpflags_parsed}              # user flags
   214                  "-vm4079,4080,4081"            # fpc output format
   214                  "-vm4079,4080,4081"            # fpc output format
   215                  "-B"                           # compile all units
   215                  "-B"                           # compile all units
   216                  "-FE${PROJECT_BINARY_DIR}/bin" # fpc output directory
   216                  "-FE${PROJECT_BINARY_DIR}/bin" # fpc output directory
   217                  "-Fl${PROJECT_BINARY_DIR}/bin" # fpc linking directory
   217                  "-Fl${PROJECT_BINARY_DIR}/bin" # fpc linking directory
   218                  "-Cs2000000"                   # stack size
   218                  "-Cs2000000"                   # stack size
   219                  "-vewnq"                       # fpc output verbosity
   219                  "-vewnq"                       # fpc output verbosity
   220                  "-dDEBUGFILE"                  # macro for engine output
   220                  "-dDEBUGFILE"                  # macro for engine output
   221                  ${pascal_flags}                # adding to list
       
   222                  )
   221                  )
   223 set(haskell_flags "-O2" ${ghflags_parsed} ${haskell_flags})
   222 list(APPEND haskell_flags "-O2" ${ghflags_parsed})
   224 
   223 
   225 #get BUILD_TYPE and enable/disable optimisation
   224 #get BUILD_TYPE and enable/disable optimisation
   226 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   225 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   227 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   226 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   228     set(pascal_flags "-O-" "-g" "-gl" "-gv" ${pascal_flags})
   227     list(APPEND pascal_flags "-O-" "-g" "-gl" "-gv")
   229     set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
   228     list(APPEND haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind")
   230 else()
   229 else()
   231 #    set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
   230 #    set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
   232     set(pascal_flags "-Os" "-Xs" "-Si" ${pascal_flags})
   231     list(APPEND pascal_flags "-Os" "-Xs" "-Si")
   233     set(haskell_flags "-w" "-fno-warn-unused-do-bind" ${haskell_flags})
   232     list(APPEND haskell_flags "-w" "-fno-warn-unused-do-bind")
   234 endif()
   233 endif()
   235 
   234 
   236 
   235 
   237 #server discovery
   236 #server discovery
   238 if(NOT NOSERVER)
   237 if(NOT NOSERVER)
   262     message(STATUS "Found LUA: ${LUA_DEFAULT}")
   261     message(STATUS "Found LUA: ${LUA_DEFAULT}")
   263 else()
   262 else()
   264     message(STATUS "LUA will be provided by the bundled sources")
   263     message(STATUS "LUA will be provided by the bundled sources")
   265     add_subdirectory(misc/liblua)
   264     add_subdirectory(misc/liblua)
   266     #linking with liblua.a requires system readline
   265     #linking with liblua.a requires system readline
   267     set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
   266     list(APPEND pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline")
   268 endif()
   267 endif()
   269 
   268 
   270 
   269 
   271 #physfs library (static on unix, dll on win32)
   270 #physfs library (static on unix, dll on win32)
   272 add_subdirectory(misc/physfs)
   271 add_subdirectory(misc/physfs)
   273 if(NOT WIN32)
   272 if(NOT WIN32)
   274     set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libphysfs.a" ${pascal_flags})
   273     list(APPEND pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libphysfs.a")
   275 endif()
   274 endif()
   276 
   275 
   277 
   276 
   278 #main engine
   277 #main engine
   279 add_subdirectory(hedgewars)
   278 add_subdirectory(hedgewars)