2010-08-08 07:17:11 +02:00
|
|
|
cmake_minimum_required(VERSION 2.4)
|
|
|
|
project (example C)
|
|
|
|
|
2012-05-23 22:51:52 +02:00
|
|
|
## CMake configuration ##
|
|
|
|
# You can pass these to cmake with -DNEED_OPTION=1
|
|
|
|
#
|
|
|
|
# if your system does not have libsqlite3-dev installed:
|
|
|
|
# set(NEED_SQLITE 1)
|
|
|
|
|
2011-02-26 18:30:42 +01:00
|
|
|
if (${CMAKE_C_COMPILER} MATCHES ".*tcc")
|
|
|
|
set(CMAKE_C_FLAGS "-Wall -g")
|
|
|
|
add_definitions(-DTINYCC)
|
|
|
|
endif(${CMAKE_C_COMPILER} MATCHES ".*tcc")
|
|
|
|
|
|
|
|
if (${CMAKE_C_COMPILER} MATCHES ".*gcc")
|
2011-03-08 08:44:20 +01:00
|
|
|
set(CMAKE_C_FLAGS "-g -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -pedantic -Wno-long-long")
|
2011-02-26 18:30:42 +01:00
|
|
|
endif(${CMAKE_C_COMPILER} MATCHES ".*gcc")
|
|
|
|
|
2010-08-08 07:17:11 +02:00
|
|
|
if (WIN32)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
|
|
|
|
else (WIN32)
|
|
|
|
include_directories (/usr/include/lua5.1/ /usr/include/libxml2)
|
|
|
|
endif (WIN32)
|
2012-05-31 04:17:08 +02:00
|
|
|
|
|
|
|
include_directories (
|
|
|
|
../external/bson
|
|
|
|
../external/crypto
|
|
|
|
../external/cutest
|
|
|
|
../external/critbit
|
|
|
|
../external/iniparser
|
|
|
|
../external/pdcurses
|
|
|
|
../shared/src
|
|
|
|
)
|
2010-08-08 07:17:11 +02:00
|
|
|
|
|
|
|
set (LIB_SRCS
|
|
|
|
../external/bson/bson.c
|
|
|
|
../external/bson/numbers.c
|
2012-05-31 04:17:08 +02:00
|
|
|
../external/critbit/critbit.c
|
|
|
|
../external/crypto/md5.c
|
|
|
|
../external/crypto/mt19937ar.c
|
2010-08-08 07:17:11 +02:00
|
|
|
../external/cutest/CuTest.c
|
2012-05-31 04:17:08 +02:00
|
|
|
../external/dlmalloc/malloc.c
|
|
|
|
../external/iniparser/iniparser.c
|
2010-08-08 07:17:11 +02:00
|
|
|
../shared/src/build/gamecode.c
|
|
|
|
../shared/src/build/kernel.c
|
|
|
|
../shared/src/build/lib.c
|
|
|
|
../shared/src/build/util.c
|
|
|
|
)
|
|
|
|
|
2012-05-23 22:55:03 +02:00
|
|
|
set (LINK_LIBS tolua xml2 ncurses lua5.1 pthread)
|
|
|
|
|
2012-05-23 22:51:52 +02:00
|
|
|
if (NEED_SQLITE)
|
|
|
|
set(LIB_SRCS
|
|
|
|
${LIB_SRCS}
|
2012-05-31 04:17:08 +02:00
|
|
|
../external/sqlite3/sqlite3.c
|
2012-05-23 22:51:52 +02:00
|
|
|
)
|
2012-05-31 04:17:08 +02:00
|
|
|
include_directories (../external/sqlite3)
|
2012-05-23 22:51:52 +02:00
|
|
|
else (NEED_SQLITE)
|
|
|
|
set (LINK_LIBS ${LINK_LIBS} sqlite3)
|
|
|
|
endif (NEED_SQLITE)
|
|
|
|
|
2010-08-08 07:17:11 +02:00
|
|
|
set (EXE_SRCS
|
|
|
|
src/server.c
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable (example ${LIB_SRCS} ${EXE_SRCS})
|
|
|
|
if (WIN32)
|
|
|
|
else (WIN32)
|
2012-05-23 22:51:52 +02:00
|
|
|
target_link_libraries (example ${LINK_LIBS})
|
2010-08-08 07:17:11 +02:00
|
|
|
endif (WIN32)
|