dfhack/library/CMakeLists.txt

217 lines
5.3 KiB
CMake

PROJECT (dfapi)
cmake_minimum_required(VERSION 2.8)
## build options
OPTION(BUILD_DEVEL "Install/package files required for development (For SDK)." OFF)
OPTION(BUILD_DOXYGEN "Create/install/package doxygen documentation for DFHack (For SDK)." OFF)
IF(UNIX)
OPTION(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
OPTION(MALLOC_FILL "Make malloc calls fill the allocated memory with 0xCC values." OFF)
ENDIF()
2011-03-20 10:17:33 -06:00
include_directories (include)
include_directories (depends/md5)
include_directories (depends/tinyxml)
include_directories (depends/tthread)
2009-09-13 18:02:46 -06:00
2011-12-31 04:48:42 -07:00
execute_process(COMMAND perl xml/list.pl xml include/df ";"
2011-12-24 03:37:00 -07:00
WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
OUTPUT_VARIABLE GENERATED_HDRS)
SET(PROJECT_HDRS_INTERNAL
)
SET(PROJECT_HDRS
2011-12-31 04:48:42 -07:00
include/Internal.h
include/DFHack.h
2011-12-31 04:48:42 -07:00
include/Console.h
include/Core.h
include/DataDefs.h
include/Error.h
include/Export.h
include/Hooks.h
include/MiscUtils.h
include/Module.h
include/Pragma.h
include/MemAccess.h
include/SDL_events.h
include/SDL_keyboard.h
include/SDL_keysym.h
include/TileTypes.h
include/Types.h
include/VersionInfo.h
include/VersionInfoFactory.h
include/Virtual.h
include/modules/Buildings.h
include/modules/Constructions.h
include/modules/Units.h
include/modules/Engravings.h
include/modules/Gui.h
include/modules/Items.h
include/modules/Job.h
2011-12-31 04:48:42 -07:00
include/modules/kitchen.h
include/modules/Maps.h
include/modules/MapCache.h
include/modules/Materials.h
include/modules/Notes.h
include/modules/Translation.h
include/modules/Vegetation.h
include/modules/Vermin.h
include/modules/World.h
include/modules/Graphic.h
)
2009-09-13 18:02:46 -06:00
SET(PROJECT_SRCS
Core.cpp
DataDefs.cpp
DataStatics.cpp
DataStaticsCtor.cpp
2011-12-31 04:48:42 -07:00
MiscUtils.cpp
PluginManager.cpp
2011-07-15 23:59:36 -06:00
TileTypes.cpp
VersionInfo.cpp
VersionInfoFactory.cpp
2011-07-09 03:33:58 -06:00
Virtual.cpp
depends/md5/md5.cpp
depends/md5/md5wrapper.cpp
depends/tinyxml/tinystr.cpp
depends/tinyxml/tinyxml.cpp
depends/tinyxml/tinyxmlerror.cpp
depends/tinyxml/tinyxmlparser.cpp
depends/tthread/tinythread.cpp
modules/Buildings.cpp
modules/Constructions.cpp
2011-12-02 02:56:40 -07:00
modules/Units.cpp
2011-04-02 16:15:47 -06:00
modules/Engravings.cpp
modules/Gui.cpp
modules/Items.cpp
modules/Job.cpp
modules/kitchen.cpp
modules/Maps.cpp
modules/Materials.cpp
modules/Notes.cpp
2010-04-06 09:11:58 -06:00
modules/Translation.cpp
2010-04-07 04:49:37 -06:00
modules/Vegetation.cpp
modules/Vermin.cpp
modules/World.cpp
2011-12-07 12:37:09 -07:00
modules/Graphic.cpp
2010-08-12 18:35:10 -06:00
)
SET(PROJECT_HDRS_LINUX
)
SET(PROJECT_HDRS_WINDOWS
2011-12-31 04:48:42 -07:00
include/wdirent.h
)
SET(PROJECT_SRCS_LINUX
2011-06-22 00:14:21 -06:00
Console-linux.cpp
2011-12-31 04:48:42 -07:00
Hooks-linux.cpp
Process-linux.cpp
)
SET(PROJECT_SRCS_WINDOWS
2011-06-22 00:14:21 -06:00
Console-windows.cpp
2011-12-31 04:48:42 -07:00
Hooks-windows.cpp
Process-windows.cpp
)
IF(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
ELSE()
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
ENDIF()
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
2011-12-24 03:37:00 -07:00
# Generation
SET_SOURCE_FILES_PROPERTIES(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE)
FILE(GLOB GENERATE_INPUT_SCRIPTS ${dfapi_SOURCE_DIR}/xml/*.pm ${dfapi_SOURCE_DIR}/xml/*.xslt)
2011-12-24 03:37:00 -07:00
FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/*.xml)
ADD_CUSTOM_COMMAND(
2011-12-31 04:48:42 -07:00
OUTPUT ${dfapi_SOURCE_DIR}/include/df/static.inc
COMMAND perl xml/codegen.pl xml include/df
2011-12-24 03:37:00 -07:00
WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
MAIN_DEPENDENCY ${dfapi_SOURCE_DIR}/xml/codegen.pl
DEPENDS ${GENERATE_INPUT_XMLS} ${GENERATE_INPUT_SCRIPTS}
2011-12-24 03:37:00 -07:00
)
2011-12-31 04:48:42 -07:00
ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/df/static.inc)
2011-12-24 03:37:00 -07:00
# Compilation
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB)
IF(UNIX)
IF(CONSOLE_NO_CATCH)
ADD_DEFINITIONS(-DCONSOLE_NO_CATCH)
ENDIF()
IF(MALLOC_FILL)
ADD_DEFINITIONS(-DMALLOC_FILL)
ENDIF()
ENDIF()
2009-09-13 18:02:46 -06:00
IF(UNIX)
SET(PROJECT_LIBS rt )
ELSE(WIN32)
#FIXME: do we really need this?
SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)
ENDIF()
2009-09-13 18:02:46 -06:00
ADD_LIBRARY(dfhack SHARED ${PROJECT_SRCS})
2011-12-24 03:37:00 -07:00
ADD_DEPENDENCIES(dfhack generate_headers)
2009-10-23 12:05:42 -06:00
2011-06-19 20:29:38 -06:00
IF(WIN32)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "SDL" )
ENDIF()
#effectively disables debug builds...
2009-12-12 12:52:30 -07:00
SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
2009-10-23 12:05:42 -06:00
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
IF(UNIX)
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack
DESTINATION .)
2011-07-16 02:32:18 -06:00
ELSE()
# On windows, copy the renamed SDL so DF can still run.
2011-07-16 02:32:18 -06:00
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/SDLreal.dll
DESTINATION ${DFHACK_LIBRARY_DESTINATION})
ENDIF()
#install the main lib
2011-03-17 17:07:40 -06:00
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
#install the offset file
2011-03-20 10:17:33 -06:00
install(FILES ${dfhack_SOURCE_DIR}/Memory.xml
2011-03-17 17:07:40 -06:00
DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack
if(BUILD_DEVEL)
if(WIN32)
install(TARGETS dfhack
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
endif()
# note the ending '/'. This means *contents* of the directory are installed
2011-03-20 10:24:34 -06:00
# without the '/', the directory itself is installed
install(DIRECTORY include/
DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" ) #linux: include
# Building the docs
IF(BUILD_DOXYGEN)
add_subdirectory (doc)
ENDIF()
2011-03-17 17:07:40 -06:00
endif()