From: Christoph Sommer Date: Fri, 12 Jan 2007 17:57:06 +0000 (+0000) Subject: Basic configure functionality for cmake X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=44e69c96435ae9e30bd7be23e272dc7b217b78a9;p=supertux.git Basic configure functionality for cmake SVN-Revision: 4552 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 200a517c9..ab32f9b78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,13 @@ PROJECT(SUPERTUX) +## Some default settings + +set(DEBUG 0 CACHE BOOL "Build with debugging options") +set(ENABLE_BINRELOC 0 CACHE BOOL "Enable autopackage's BINRELOC features") +set(APPDATADIR "" CACHE STRING "APPDATADIR for autopackage's BINRELOC features") +set(ENABLE_SQDBG 0 CACHE BOOL "Build squirrel script interpreter with debugging options") + ## Search here for additional cmake modules (for finding deps) set(CMAKE_MODULE_PATH ${SUPERTUX_SOURCE_DIR}/mk/cmake ${CMAKE_MODULE_PATH}) @@ -79,6 +86,19 @@ FIND_PACKAGE(PhysFS REQUIRED) INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR}) LINK_LIBRARIES(${PHYSFS_LIBRARY}) +#FIND_PACKAGE(ICONV REQUIRED) +#INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) +#LINK_LIBRARIES(${ICONV_LIBRARY}) + +## Check platform-dependent build options + +INCLUDE(ConfigureChecks) + +## Create config.h + +configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h ) +include_directories (${CMAKE_BINARY_DIR}/) + ## Also execute instructions in src/squirrel/CMakeLists.txt ADD_SUBDIRECTORY(src/squirrel) @@ -89,7 +109,6 @@ LINK_DIRECTORIES(src/squirrel) ## Some additional include paths -include_directories (${SUPERTUX_SOURCE_DIR}/) include_directories (${SUPERTUX_SOURCE_DIR}/src/) include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/include/) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 000000000..3838a396e --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,23 @@ +#define PACKAGE_NAME "supertux" +#define PACKAGE_VERSION "0.3.0" + +#cmakedefine DEBUG +#cmakedefine ENABLE_SQDBG + +#cmakedefine ENABLE_BINRELOC +#ifdef ENABLE_BINRELOC +#define APPDATADIR ${APPDATADIR} +#endif + +#define SIZEOF_VOID_P ${SIZEOF_VOID_P} +#if SIZEOF_VOID_P == 8 +#define _SQ64 +#endif + +#cmakedefine HAVE_ICONV_CONST +#ifdef HAVE_ICONV_CONST +#define ICONV_CONST const +#else +#define ICONV_CONST +#endif + diff --git a/mk/cmake/ConfigureChecks.cmake b/mk/cmake/ConfigureChecks.cmake new file mode 100644 index 000000000..90fcfd204 --- /dev/null +++ b/mk/cmake/ConfigureChecks.cmake @@ -0,0 +1,16 @@ +include(CheckCXXSourceCompiles) +include(CheckTypeSize) + +check_cxx_source_compiles( + " + #include + // this declaration will fail when there already exists a non const char** version which returns size_t + double iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); + int main() { return 0; } + " + HAVE_ICONV_CONST +) + +CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) +message(STATUS "Size of void* is ${SIZEOF_VOID_P}") +