-find_package(SQLite3 REQUIRED)
-find_package(Json REQUIRED)
-
-option(ENABLE_GLES "Enable OpenGL ES support" 0)
-mark_as_advanced(ENABLE_GLES)
-if(ENABLE_GLES)
- find_package(OpenGLES2)
-endif(ENABLE_GLES)
-
-if(USE_FREETYPE)
- if(UNIX)
- include(FindPkgConfig)
- if(PKG_CONFIG_FOUND)
- pkg_check_modules(FREETYPE QUIET freetype2)
- if(FREETYPE_FOUND)
- SET(FREETYPE_PKGCONFIG_FOUND TRUE)
- SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
- # because cmake is idiotic
- string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS})
- string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS})
- endif(FREETYPE_FOUND)
- endif(PKG_CONFIG_FOUND)
- endif(UNIX)
- if(NOT FREETYPE_FOUND)
- find_package(Freetype REQUIRED)
- endif(NOT FREETYPE_FOUND)
- set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
- set(CGUITTFONT_LIBRARY cguittfont)
-endif(USE_FREETYPE)
-
-if (NOT DISABLE_LUAJIT)
- find_library(LUA_LIBRARY luajit
- NAMES luajit-5.1)
- find_path(LUA_INCLUDE_DIR luajit.h
- NAMES luajit.h
- PATH_SUFFIXES luajit-2.0)
- message (STATUS "LuaJIT library: ${LUA_LIBRARY}")
- message (STATUS "LuaJIT headers: ${LUA_INCLUDE_DIR}")
-else (NOT ${DISABLE_LUAJIT} MATCHES "1")
- message (STATUS "LuaJIT detection disabled! (DISABLE_LUAJIT=1)")
- set(LUA_LIBRARY "")
- set(LUA_INCLUDE_DIR "")
-endif (NOT DISABLE_LUAJIT)
-
-set(USE_LUAJIT 0)
-if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
- message (STATUS "LuaJIT found, checking for broken versions...")
- if(CMAKE_CROSSCOMPILING)
- message(WARNING "Cross-compiling enabled, assuming LuaJIT is not broken")
- set(VALID_LUAJIT_VERSION 1)
- else(CMAKE_CROSSCOMPILING)
- set(BACKUP_REQUIRED_INCS CMAKE_REQUIRED_INCLUDES)
- set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${LUA_INCLUDE_DIR}")
- CHECK_C_SOURCE_RUNS("
- #include <luajit.h>
- #include <stdio.h>
- #include <string.h>
-
- #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
-
- static char *broken_luajit_versions[] = {
- \"LuaJIT 2.0.0-beta7\",
- \"LuaJIT 2.0.0-beta6\",
- \"LuaJIT 2.0.0-beta5\",
- \"LuaJIT 2.0.0-beta4\",
- \"LuaJIT 2.0.0-beta3\",
- \"LuaJIT 2.0.0-beta2\",
- \"LuaJIT 2.0.0-beta1\"
- };
-
- int main(int argc, char *argv[]) {
- unsigned int i;
- for (i = 0; i < ARRAYSIZE(broken_luajit_versions); i++) {
- if (strcmp(LUAJIT_VERSION, broken_luajit_versions[i]) == 0) {
- return 1;
- }
- }
- return 0;
- }
- "
- VALID_LUAJIT_VERSION)
- set(CMAKE_REQUIRED_INCLUDES BACKUP_REQUIRED_INCS)
- endif(CMAKE_CROSSCOMPILING)
- if (VALID_LUAJIT_VERSION)
- message (STATUS "LuaJIT version ok")
- set(USE_LUAJIT 1)
- else (VALID_LUAJIT_VERSION)
- message (STATUS "LuaJIT versions till 2.0.0beta7 known to be broken, update to at least beta8")
- set(USE_LUAJIT 0)
- endif (VALID_LUAJIT_VERSION)
-endif (LUA_LIBRARY AND LUA_INCLUDE_DIR)
-
-if(NOT USE_LUAJIT)
- message (STATUS "LuaJIT not found, using bundled Lua.")
- set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
- set(LUA_LIBRARY "lua")
- add_subdirectory(lua)
-endif(NOT USE_LUAJIT)
-
-mark_as_advanced(LUA_LIBRARY)
-mark_as_advanced(LUA_INCLUDE_DIR)
-
-set(USE_LEVELDB 0)
-
-OPTION(ENABLE_LEVELDB "Enable LevelDB backend")
-
-if(ENABLE_LEVELDB)
- find_library(LEVELDB_LIBRARY leveldb)
- find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
- message (STATUS "LevelDB library: ${LEVELDB_LIBRARY}")
- message (STATUS "LevelDB headers: ${LEVELDB_INCLUDE_DIR}")
- if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
- set(USE_LEVELDB 1)
- message(STATUS "LevelDB backend enabled")
- include_directories(${LEVELDB_INCLUDE_DIR})
- else(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
- set(USE_LEVELDB 0)
- message(STATUS "LevelDB not found!")
- endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
-endif(ENABLE_LEVELDB)
-
-set(USE_REDIS 0)
-
-OPTION(ENABLE_REDIS "Enable redis backend" 0)
-
-if(ENABLE_REDIS)
- find_library(REDIS_LIBRARY hiredis)
- find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis)
- message(STATUS "redis library: ${REDIS_LIBRARY}")
- message(STATUS "redis headers: ${REDIS_INCLUDE_DIR}")
- if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
- set(USE_REDIS 1)
- message(STATUS "redis backend enabled")
- include_directories(${REDIS_INCLUDE_DIR})
- else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
- set(USE_REDIS 0)
- message(STATUS "redis not found!")
- endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
-endif(ENABLE_REDIS)
-
-CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
-if(NOT HAVE_ENDIAN_H)
- set(HAVE_ENDIAN_H 0)
-endif(NOT HAVE_ENDIAN_H)