CMakeLists.txt
changeset 9224 bce8cf41d666
parent 9220 5e7db24f3489
parent 8869 11438c0bd46b
child 9227 c02e081ba481
equal deleted inserted replaced
9223:71fc5893071c 9224:bce8cf41d666
     7         cmake_policy(SET ${hwpolicy} NEW)
     7         cmake_policy(SET ${hwpolicy} NEW)
     8     endif()
     8     endif()
     9 endforeach()
     9 endforeach()
    10 
    10 
    11 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
    11 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
    12 
    12 include(${CMAKE_MODULE_PATH}/utils.cmake)
    13 
    13 
    14 #possible cmake configuration
    14 #possible cmake configuration
    15 option(NOSERVER "Disable gameServer build (off)]" OFF)
    15 option(NOSERVER "Disable gameServer build (off)]" OFF)
    16 option(NOPNG "Disable screenshoot compression (off)" OFF)
    16 option(NOPNG "Disable screenshoot compression (off)" OFF)
    17 option(NOVIDEOREC "Disable video recording (off)" OFF)
    17 option(NOVIDEOREC "Disable video recording (off)" OFF)
    90     set(CMAKE_CXX_FLAGS_RELEASE "")
    90     set(CMAKE_CXX_FLAGS_RELEASE "")
    91     set(CMAKE_CXX_FLAGS_DEBUG "-Wall")
    91     set(CMAKE_CXX_FLAGS_DEBUG "-Wall")
    92 endif()
    92 endif()
    93 
    93 
    94 #parse additional parameters
    94 #parse additional parameters
    95 if(FPFLAGS OR GHFLAGS)
    95 if(FPFLAGS)
    96     if(CMAKE_VERSION VERSION_GREATER "2.6")
    96     add_flag_prepend(CMAKE_Pascal_FLAGS ${FPFLAGS})
    97         separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS})
    97 endif()
       
    98 if(GHFLAGS)
       
    99     if(${allow_parse_args})
    98         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
   100         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
    99     else()
   101     else()
   100         message("*** FPFLAGS and GHFLAGS are available only when using CMake >= 2.8 ***")
   102         message(${WARNING} "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8")
   101     endif()
   103     endif()
   102 endif()
   104 endif()
   103 
   105 
   104 list(APPEND pascal_flags ${fpflags_parsed}            # user flags
   106 
   105                  "-B"                                 # compile all units
       
   106                  "-vm4079,4080,4081"                  # fpc verbosity output format
       
   107                  "-FE${PROJECT_BINARY_DIR}/bin"       # fpc binaries output directory
       
   108                  "-FU${PROJECT_BINARY_DIR}/hedgewars" # fpc units output directory
       
   109                  "-Fl${PROJECT_BINARY_DIR}/bin"       # fpc linking directory (win/unix)
       
   110                  "-Fi${PROJECT_BINARY_DIR}/hedgewars" # fpc .inc path (for out of source builds)
       
   111                  "-k-L${PROJECT_BINARY_DIR}/bin"      # ld linking directory (unix/osx)
       
   112                  "-Cs2000000"                         # stack size
       
   113                  "-vewnq"                             # fpc output verbosity
       
   114                  "-dDEBUGFILE"                        # macro for engine output
       
   115                  )
       
   116 list(APPEND haskell_flags ${ghflags_parsed} # user flags
   107 list(APPEND haskell_flags ${ghflags_parsed} # user flags
   117                  "-O2"                      # optimise for faster code
   108                  "-O2"                      # optimise for faster code
   118                  )
   109                  )
   119 
   110 
       
   111 #-vm4079,4080,4081
       
   112 add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000")
       
   113 add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv")
       
   114 add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs")
   120 
   115 
   121 #get BUILD_TYPE and enable/disable optimisation
   116 #get BUILD_TYPE and enable/disable optimisation
   122 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   117 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   123 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   118 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   124     list(APPEND pascal_flags "-O-" # disable all optimisations
       
   125                              "-g"  # enable debug symbols
       
   126                              "-gl" # add line info to bt
       
   127                              "-gv" # allow valgrind
       
   128                              )
       
   129     list(APPEND haskell_flags "-Wall"       # all warnings
   119     list(APPEND haskell_flags "-Wall"       # all warnings
   130                               "-debug"      # debug mode
   120                               "-debug"      # debug mode
   131                               "-dcore-lint" # internal sanity check
   121                               "-dcore-lint" # internal sanity check
   132                               )
   122                               )
   133 else()
   123 else()
   134     list(APPEND pascal_flags "-Os" # optimise for size
       
   135                              "-Xs" # strip binary
       
   136                              "-Si" # turn on inlining
       
   137                              )
       
   138     list(APPEND haskell_flags "-w" # no warnings
   124     list(APPEND haskell_flags "-w" # no warnings
   139                               )
   125                               )
   140 endif()
   126 endif()
   141 
   127 
   142 
   128 
   190     if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
   176     if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
   191         message(STATUS "PhysFS will be provided by the bundled sources")
   177         message(STATUS "PhysFS will be provided by the bundled sources")
   192     endif()
   178     endif()
   193     set(physfs_output_name "hwphysfs")
   179     set(physfs_output_name "hwphysfs")
   194     add_subdirectory(misc/libphysfs)
   180     add_subdirectory(misc/libphysfs)
   195     #-XLA is a beta fpc flag that renames libraries before passing them to the linker
       
   196     #we also have to pass PHYSFS_INTERNAL to satisfy windows runtime requirements
       
   197     #(should be harmless on other platforms)
       
   198     list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}" "-dPHYSFS_INTERNAL")
       
   199 endif()
   181 endif()
   200 
   182 
   201 find_package_or_disable_msg(FFMPEG NOVIDEOREC "Video recording will not be built")
   183 find_package_or_disable_msg(FFMPEG NOVIDEOREC "Video recording will not be built")
   202 
   184 
   203 #physfs helper library
   185 #physfs helper library