CMakeLists.txt
branchwebgl
changeset 7993 5b5083dc6837
parent 7973 afb67e34a6b5
child 7995 889ad929cc81
equal deleted inserted replaced
7991:1e5da73a3149 7993:5b5083dc6837
    53 option(NOPNG "Disable screenshoot compression [default: auto]" OFF)
    53 option(NOPNG "Disable screenshoot compression [default: auto]" OFF)
    54 option(NOVIDEOREC "Disable video recording [default: auto]" OFF)
    54 option(NOVIDEOREC "Disable video recording [default: auto]" OFF)
    55 
    55 
    56 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF)
    56 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF)
    57 option(ANDROID "Enable Android build [default: off]" OFF)
    57 option(ANDROID "Enable Android build [default: off]" OFF)
    58 option(WEBGL "Enable WebGL build [default: off]" OFF)
    58 option(WEBGL "Enable WebGL build (implies NOPASCAL) [default: off]" OFF)
       
    59 option(NOPASCAL "Compile hwengine as native C [default: off]" ${WEBGL})
    59 
    60 
    60 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
    61 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
    61 option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF)
    62 option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF)
    62 
    63 
    63 
    64 
   203 endif()
   204 endif()
   204 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
   205 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
   205 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
   206 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
   206 
   207 
   207 
   208 
   208 #Haskell compiler discovery (for server and webgl
   209 #Haskell compiler discovery (for server and engine in c)
   209 if((NOT NOSERVER) OR WEBGL)
   210 if((NOT NOSERVER) OR NOPASCAL)
   210     if(GHC)
   211     if(GHC)
   211         set(ghc_executable ${GHC})
   212         set(ghc_executable ${GHC})
   212     else()
   213     else()
   213         find_program(ghc_executable ghc)
   214         find_program(ghc_executable ghc)
   214     endif()
   215     endif()
   236 #lua discovery
   237 #lua discovery
   237 find_package(Lua)
   238 find_package(Lua)
   238 if(LUA_FOUND AND (NOT WEBGL))
   239 if(LUA_FOUND AND (NOT WEBGL))
   239     message(STATUS "Found LUA: ${LUA_DEFAULT}")
   240     message(STATUS "Found LUA: ${LUA_DEFAULT}")
   240 else()
   241 else()
   241     message(STATUS "LUA will be provided by the bundled sources")
   242     message(STATUS "Using internal LUA library")
   242     add_subdirectory(misc/liblua)
   243     add_subdirectory(misc/liblua)
   243     #linking with liblua.a requires system readline -- this works everywhere, right?
   244     #linking with liblua.a requires system readline -- this works everywhere, right?
   244     set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
   245     set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
   245 endif()
   246 endif()
   246 
   247 
   247 
   248 
   248 if(WEBGL)
   249 if(NOPASCAL)
   249     if (NOT ghc_executable)
   250     if (NOT ghc_executable)
   250         message(FATAL_ERROR "A Haskell compiler is required to build the WebGL port")
   251         message(FATAL_ERROR "A Haskell compiler is required to build engine in C")
   251     endif()
   252     endif()
   252     #pascal to c converter
   253     #pascal to c converter
   253     add_subdirectory(tools/pas2c)
   254     add_subdirectory(tools/pas2c)
   254 else()
   255 else()
   255     #main engine
   256     #main pascal engine
   256     add_subdirectory(hedgewars)
   257     add_subdirectory(hedgewars)
   257 
   258 endif()
       
   259 
       
   260 if(WEBGL)
       
   261     #WEBGL deps
       
   262 else()
   258     #Android related build scripts
   263     #Android related build scripts
   259     if(ANDROID)
   264     if(ANDROID)
   260         #run cmake -DANDROID=1 to enable this
       
   261         add_subdirectory(project_files/Android-build)
   265         add_subdirectory(project_files/Android-build)
   262     endif()
   266     endif()
   263 
   267 
   264     #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
   268     #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
   265     if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID OR WEBGL))
   269     if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID))
   266         add_subdirectory(bin)
   270         add_subdirectory(bin)
   267         add_subdirectory(misc/quazip)
   271         add_subdirectory(misc/quazip)
   268         add_subdirectory(QTfrontend)
   272         add_subdirectory(QTfrontend)
   269         add_subdirectory(share)
   273         add_subdirectory(share)
   270         add_subdirectory(tools)
   274         add_subdirectory(tools)