view cmake/MalikaniaOptions.cmake @ 182:3107ce017c3a

Misc: switch back to SDL Qt Quick and QML was an exciting experiment but it's definitely not enough flexible and easy to use for game development. Using SDL2 will let us focusing on our own drawing functions without any kind of overhead. While here, start massive cleanup.
author David Demelier <markand@malikania.fr>
date Fri, 19 Oct 2018 20:18:19 +0200
parents 3e3040d085b5
children 387f6b0a5420
line wrap: on
line source

#
# CMakeLists.txt -- CMake build system for malikania
#
# Copyright (c) 2013-2018 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

#
# Backend selection.
# -------------------------------------------------------------------
#
# The following options are available:
#    WITH_BACKEND        - Type of backend to use. (Default: SDL)
#

set(WITH_BACKEND "SDL"
    CACHE STRING "Which backend to use")

#
# Documentation and technical references
# -------------------------------------------------------------------
#
# The following options are available:
#    WITH_DOCS            - Disable or enable all docs, if set to Off, disable all documentation.
#    WITH_DOXYGEN         - Enable doxygen
#

option(WITH_DOCS "Build all documentation" On)
option(WITH_DOXYGEN "Enable doxygen generation" On)

if (NOT WITH_DOCS)
    set(WITH_DOXYGEN Off)
endif ()

set(WITH_DRIVERDIR "lib/malikania/${MALIKANIA_VERSION}"
    CACHE STRING "Database driver directory")
set(WITH_BINDIR "libexec/malikania/${MALIKANIA_VERSION}"
    CACHE STRING "Front end directory")

if (IS_ABSOLUTE ${WITH_DRIVERDIR})
    message(FATAL_ERROR "WITH_DRIVERDIR must not be absolute")
elseif (IS_ABSOLUTE ${WITH_BINDIR})
    message(FATAL_ERROR "WITH_BINDIR must not be absolute")
endif ()

#
# Options for development.
# -------------------------------------------------------------------
#

option(WITH_VERA "Enable vera++ analyzer" On)
option(WITH_TESTS "Enable unit tests" On)
option(WITH_EXAMPLES "Enable examples" On)

find_program(VERA_EXECUTABLE vera++)

if (VERA_EXECUTABLE)
    if (WITH_VERA)
        execute_process(
            COMMAND ${VERA_EXECUTABLE} --version
            OUTPUT_VARIABLE VERA_VERSION
        )

        if (${VERA_VERSION} VERSION_LESS "1.3.0")
            malikania_setg(WITH_VERA Off)
            malikania_setg(WITH_VERA_MSG "No (1.3.0 or greater required)")
        else ()
            malikania_setg(WITH_VERA_MSG "Yes")
        endif () 
    else ()
        malikania_setg(WITH_VERA Off)
        malikania_setg(WITH_VERA_MSG "No (disabled by user)")
    endif ()
else ()
    malikania_setg(WITH_VERA Off)
    malikania_setg(WITH_VERA_MSG "No (vera++ not found)")
endif ()

if (NOT WITH_TESTS)
    malikania_setg(WITH_TESTS_MSG "No (disabled by user)")
else ()
    malikania_setg(WITH_TESTS_MSG "Yes")
endif ()

if (NOT WITH_EXAMPLES)
    malikania_setg(WITH_EXAMPLES_MSG "No (disabled by user)")
else ()
    malikania_setg(WITH_EXAMPLES_MSG "Yes")
endif ()

#
# Options for unit tests
# -------------------------------------------------------------------
#

set(WITH_TEST_PGSQL_HOST "localhost"
    CACHE STRING "Hostname for PostgreSQL driver")
set(WITH_TEST_PGSQL_PORT "5432"
    CACHE STRING "Port for PostgreSQL driver")
set(WITH_TEST_PGSQL_DATABASE "malikaniadb"
    CACHE STRING "Database for PostgreSQL driver")
set(WITH_TEST_PGSQL_USER "malikania"
    CACHE STRING "Username for PostgreSQL driver")

#
# Targets to build
# -------------------------------------------------------------------
#
# The following options are available:
#    WITH_LIBCLIENT    - Build the client library.
#    WITH_LIBSERVER    - Build the server library.
#

option(WITH_LIBCLIENT "Build libclient" On)
option(WITH_LIBSERVER "Build libserver" On)

if (WITH_BACKEND MATCHES "SDL")
    set(WITH_BACKEND_DIR "backend/sdl")
else ()
    message(FATAL_ERROR "Unknown backend selected: ${WITH_BACKEND}")
endif ()

configure_file(
    ${malikania_SOURCE_DIR}/cmake/internal/sysconfig-tests.h
    ${malikania_BINARY_DIR}/sysconfig-tests.h
)