CMakeLists.txt
changeset 10015 4feced261c68
parent 10013 4d7302e9b617
parent 9980 a666e4eefd27
child 10040 4ac87acbaed9
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    30 option(BUILD_ENGINE_LIBRARY "Enable hwengine library (off)" OFF)
    30 option(BUILD_ENGINE_LIBRARY "Enable hwengine library (off)" OFF)
    31 option(ANDROID "Enable Android build (off)" OFF)
    31 option(ANDROID "Enable Android build (off)" OFF)
    32 
    32 
    33 option(MINIMAL_FLAGS "Respect system flags as much as possible (off)" OFF)
    33 option(MINIMAL_FLAGS "Respect system flags as much as possible (off)" OFF)
    34 option(NOAUTOUPDATE "Disable OS X Sparkle update checking (off)" OFF)
    34 option(NOAUTOUPDATE "Disable OS X Sparkle update checking (off)" OFF)
       
    35 
       
    36 option(BUILD_ENGINE_C "Compile hwengine as native C [default: off]" OFF)
       
    37 option(GL2 "Enable OpenGL 2 rendering [default: off]" OFF)
    35 
    38 
    36 set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
    39 set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
    37 if(UNIX AND NOT APPLE)
    40 if(UNIX AND NOT APPLE)
    38     set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path")
    41     set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path")
    39 endif()
    42 endif()
   109 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   112 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   110 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   113 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   111     list(APPEND haskell_flags "-Wall"       # all warnings
   114     list(APPEND haskell_flags "-Wall"       # all warnings
   112                               "-debug"      # debug mode
   115                               "-debug"      # debug mode
   113                               "-dcore-lint" # internal sanity check
   116                               "-dcore-lint" # internal sanity check
       
   117                               "-fno-warn-unused-do-bind"
   114                               )
   118                               )
   115 else()
   119 else()
   116     list(APPEND haskell_flags "-w" # no warnings
   120     list(APPEND haskell_flags "-w" # no warnings
   117                               )
   121                               )
       
   122 endif()
       
   123 
       
   124 
       
   125 #build engine without freepascal
       
   126 if(BUILD_ENGINE_C)
       
   127     find_package(Clang REQUIRED)
       
   128 
       
   129     if(${CLANG_VERSION} VERSION_LESS "3.0")
       
   130         message(FATAL_ERROR "LLVM/Clang compiler required version is 3.0 but version ${CLANG_VERSION} was found!")
       
   131     endif()
       
   132 
       
   133     set(CMAKE_C_COMPILER ${CLANG_EXECUTABLE})
       
   134     set(CMAKE_CXX_COMPILER ${CLANG_EXECUTABLE})
       
   135 endif()
       
   136 
       
   137 
       
   138 #server
       
   139 if(NOT NOSERVER)
       
   140     add_subdirectory(gameServer)
   118 endif()
   141 endif()
   119 
   142 
   120 
   143 
   121 #lua discovery
   144 #lua discovery
   122 if(LUA_SYSTEM)
   145 if(LUA_SYSTEM)
   180 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
   203 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
   181 
   204 
   182 #physfs helper library
   205 #physfs helper library
   183 add_subdirectory(misc/libphyslayer)
   206 add_subdirectory(misc/libphyslayer)
   184 
   207 
   185 #server
   208 #maybe this could be merged inside hedgewars/CMakeLists.txt
   186 if(NOT NOSERVER)
   209 if(BUILD_ENGINE_C)
   187     add_subdirectory(gameServer)
   210     #pascal to c converter
   188 endif()
   211     add_subdirectory(tools/pas2c)
   189 
   212     add_subdirectory(project_files/hwc)
   190 #main engine
   213 else()
   191 add_subdirectory(hedgewars)
   214     #main pascal engine
       
   215     add_subdirectory(hedgewars)
       
   216 endif()
   192 
   217 
   193 #Android related build scripts
   218 #Android related build scripts
       
   219 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
   194 if(ANDROID)
   220 if(ANDROID)
   195     #run cmake -DANDROID=1 to enable this
       
   196     add_subdirectory(project_files/Android-build)
   221     add_subdirectory(project_files/Android-build)
   197 endif()
   222 else(ANDROID)
   198 
       
   199 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
       
   200 if(NOT ANDROID)
       
   201     add_subdirectory(bin)
   223     add_subdirectory(bin)
   202     add_subdirectory(QTfrontend)
   224     add_subdirectory(QTfrontend)
   203     add_subdirectory(share)
   225     add_subdirectory(share)
   204     add_subdirectory(tools)
   226     add_subdirectory(tools)
   205 endif()
   227 endif(ANDROID)
   206 
       
   207 
   228 
   208 include(${CMAKE_MODULE_PATH}/cpackvars.cmake)
   229 include(${CMAKE_MODULE_PATH}/cpackvars.cmake)
   209 
   230 
   210 enable_testing()
   231 enable_testing()
   211 
   232