minetestmapper/CMakeLists.txt

103 lines
2.7 KiB
CMake
Raw Normal View History

2012-10-14 09:46:26 +02:00
project(MinetestMapper C CXX)
2012-08-22 15:22:01 +02:00
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0003 NEW)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
2014-03-05 16:39:35 +01:00
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++0x -Wall -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -std=c++0x -Wall -Wextra -DDEBUG")
2012-08-22 15:31:26 +02:00
find_package(PkgConfig)
2012-08-23 14:21:34 +02:00
include(FindPackageHandleStandardArgs)
2012-08-22 15:31:26 +02:00
pkg_check_modules(PC_LIBSQLITE QUIET sqlite3)
set(LIBSQLITE3_DEFINITIONS ${PC_LIBSQLITE_CFLAGS_OTHER})
find_path(LIBSQLITE3_INCLUDE_DIR sqlite3.h HINTS ${PC_LIBSQLITE_INCLUDEDIR} ${PC_LIBSQLITE_INCLUDE_DIRS} PATH_SUFFIXES libsqlite3)
find_library(LIBSQLITE3_LIBRARY NAMES sqlite3 libsqlite3 HINTS ${PC_LIBSQLITE_LIBDIR} ${PC_LIBSQLITE_LIBRARY_DIRS})
set(LIBSQLITE3_LIBRARIES ${LIBSQLITE3_LIBRARY} )
2012-09-01 15:51:02 +02:00
set(LIBSQLITE3_INCLUDE_DIRS ${LIBSQLITE3_INCLUDE_DIR})
2012-08-22 15:31:26 +02:00
find_package_handle_standard_args(LibSqlite3 DEFAULT_MSG LIBSQLITE3_LIBRARY LIBSQLITE3_INCLUDE_DIR)
2012-09-01 15:51:02 +02:00
mark_as_advanced(LIBSQLITE3_INCLUDE_DIR LIBSQLITE3_LIBRARY)
if (LIBSQLITE3_INCLUDE_DIR)
else (LIBSQLITE3_INCLUDE_DIR)
message(FATAL_ERROR "Could not find sqlite3")
endif (LIBSQLITE3_INCLUDE_DIR)
2014-03-05 21:41:27 +01:00
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)
2012-09-01 15:51:02 +02:00
find_program(XXD_EXECUTABLE xxd)
if (XXD_EXECUTABLE)
message(STATUS "Found xxd")
else (XXD_EXECUTABLE)
2014-03-05 16:39:35 +01:00
message(FATAL_ERROR "xxd not found")
2012-09-01 15:51:02 +02:00
endif (XXD_EXECUTABLE)
add_custom_command(
OUTPUT colors.h
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/colors.txt colors.txt
COMMAND xxd -i colors.txt colors.h
DEPENDS colors.txt
)
set_property(SOURCE TileGenerator.cpp APPEND PROPERTY OBJECT_DEPENDS colors.h)
2012-08-22 15:31:26 +02:00
2012-08-22 15:22:01 +02:00
include_directories(
"${PROJECT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
2012-08-22 15:31:26 +02:00
${LIBSQLITE3_INCLUDE_DIRS}
2012-08-22 15:22:01 +02:00
)
2014-03-05 21:41:27 +01:00
configure_file(
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/cmake_config.h"
2012-08-22 15:22:01 +02:00
)
2014-03-05 21:41:27 +01:00
add_definitions ( -DUSE_CMAKE_CONFIG_H )
2012-08-22 15:22:01 +02:00
set(mapper_SRCS
2012-08-25 13:19:58 +02:00
PixelAttributes.cpp
PlayerAttributes.cpp
2012-08-23 12:46:22 +02:00
TileGenerator.cpp
2012-09-18 10:43:34 +02:00
ZlibDecompressor.cpp
mapper.cpp
2014-03-05 21:41:27 +01:00
db-sqlite3.cpp
2012-08-22 15:22:01 +02:00
)
2014-03-05 21:41:27 +01:00
if(USE_LEVELDB)
set(mapper_SRCS ${mapper_SRCS} db-leveldb.cpp)
endif(USE_LEVELDB)
2013-07-29 18:16:08 +02:00
add_executable(minetestmapper
2012-08-22 15:22:01 +02:00
${mapper_SRCS}
)
2012-08-22 15:31:26 +02:00
target_link_libraries(
2013-07-29 18:16:08 +02:00
minetestmapper
2012-08-22 15:31:26 +02:00
${LIBSQLITE3_LIBRARIES}
2014-03-05 21:41:27 +01:00
${LEVELDB_LIBRARY}
2012-08-23 14:21:34 +02:00
gd
2012-08-24 11:49:42 +02:00
z
2012-08-22 15:31:26 +02:00
)