view cmake/MalikaniaOptions.cmake @ 197:b203bde850cb

doc: update template
author David Demelier <markand@malikania.fr>
date Tue, 20 Nov 2018 12:25:00 +0100
parents 387f6b0a5420
children 0a285d62ace7
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_TESTS "Enable unit tests" On)
option(WITH_EXAMPLES "Enable examples" On)

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
)