2011-06-19 17:12:07 -06:00
|
|
|
PROJECT (dfapi)
|
2011-03-16 00:35:08 -06:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2010-05-26 04:24:45 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
## 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)
|
2011-08-18 14:09:30 -06:00
|
|
|
IF(UNIX)
|
|
|
|
OPTION(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
|
2011-09-24 17:29:55 -06:00
|
|
|
OPTION(MALLOC_FILL "Make malloc calls fill the allocated memory with 0xCC values." OFF)
|
2011-08-18 14:09:30 -06:00
|
|
|
ENDIF()
|
2011-06-19 17:12:07 -06:00
|
|
|
|
2011-03-20 10:17:33 -06:00
|
|
|
include_directories (include)
|
|
|
|
include_directories (depends/md5)
|
|
|
|
include_directories (depends/tinyxml)
|
2011-07-26 21:59:09 -06:00
|
|
|
include_directories (depends/tthread)
|
2011-03-20 10:17:33 -06:00
|
|
|
include_directories (private)
|
2009-09-13 18:02:46 -06:00
|
|
|
|
2010-08-30 21:32:40 -06:00
|
|
|
SET(PROJECT_HDRS_INTERNAL
|
|
|
|
private/ContextShared.h
|
|
|
|
private/Internal.h
|
2011-06-22 00:14:21 -06:00
|
|
|
private/wdirent.h
|
2010-08-30 21:32:40 -06:00
|
|
|
)
|
|
|
|
|
2009-10-26 15:50:08 -06:00
|
|
|
SET(PROJECT_HDRS
|
2010-08-30 21:32:40 -06:00
|
|
|
include/DFHack.h
|
2011-07-15 23:59:36 -06:00
|
|
|
include/dfhack/Console.h
|
|
|
|
include/dfhack/Core.h
|
2011-06-13 13:11:02 -06:00
|
|
|
include/dfhack/Error.h
|
|
|
|
include/dfhack/Export.h
|
2011-07-15 23:59:36 -06:00
|
|
|
include/dfhack/FakeSDL.h
|
2011-06-13 13:11:02 -06:00
|
|
|
include/dfhack/MiscUtils.h
|
|
|
|
include/dfhack/Module.h
|
|
|
|
include/dfhack/Pragma.h
|
2011-06-12 15:17:40 -06:00
|
|
|
include/dfhack/Process.h
|
|
|
|
include/dfhack/TileTypes.h
|
2011-06-13 13:11:02 -06:00
|
|
|
include/dfhack/Types.h
|
|
|
|
include/dfhack/Vector.h
|
2010-08-30 21:32:40 -06:00
|
|
|
include/dfhack/VersionInfo.h
|
2011-07-15 23:59:36 -06:00
|
|
|
include/dfhack/VersionInfoFactory.h
|
|
|
|
include/dfhack/Virtual.h
|
2011-03-18 09:47:55 -06:00
|
|
|
include/dfhack/extra/MapExtras.h
|
2011-05-21 13:54:53 -06:00
|
|
|
include/dfhack/extra/stopwatch.h
|
2011-07-15 23:59:36 -06:00
|
|
|
include/dfhack/extra/termutil.h
|
2010-05-26 04:24:45 -06:00
|
|
|
include/dfhack/modules/Buildings.h
|
|
|
|
include/dfhack/modules/Constructions.h
|
|
|
|
include/dfhack/modules/Creatures.h
|
2011-04-02 16:15:47 -06:00
|
|
|
include/dfhack/modules/Engravings.h
|
2010-05-26 04:24:45 -06:00
|
|
|
include/dfhack/modules/Gui.h
|
|
|
|
include/dfhack/modules/Items.h
|
|
|
|
include/dfhack/modules/Maps.h
|
|
|
|
include/dfhack/modules/Materials.h
|
2011-07-20 19:26:52 -06:00
|
|
|
include/dfhack/modules/Notes.h
|
2010-05-26 04:24:45 -06:00
|
|
|
include/dfhack/modules/Translation.h
|
|
|
|
include/dfhack/modules/Vegetation.h
|
2011-07-15 23:59:36 -06:00
|
|
|
include/dfhack/modules/Vermin.h
|
2010-05-26 04:24:45 -06:00
|
|
|
include/dfhack/modules/World.h
|
2009-10-26 15:50:08 -06:00
|
|
|
)
|
|
|
|
|
2009-09-13 18:02:46 -06:00
|
|
|
SET(PROJECT_SRCS
|
2011-06-17 07:02:43 -06:00
|
|
|
Core.cpp
|
2011-06-24 21:35:29 -06:00
|
|
|
PluginManager.cpp
|
2011-07-15 23:59:36 -06:00
|
|
|
TileTypes.cpp
|
2010-08-20 06:10:05 -06:00
|
|
|
VersionInfo.cpp
|
|
|
|
VersionInfoFactory.cpp
|
2011-07-09 03:33:58 -06:00
|
|
|
Virtual.cpp
|
2010-04-02 19:52:46 -06:00
|
|
|
|
|
|
|
depends/md5/md5.cpp
|
|
|
|
depends/md5/md5wrapper.cpp
|
|
|
|
|
|
|
|
depends/tinyxml/tinystr.cpp
|
|
|
|
depends/tinyxml/tinyxml.cpp
|
|
|
|
depends/tinyxml/tinyxmlerror.cpp
|
|
|
|
depends/tinyxml/tinyxmlparser.cpp
|
|
|
|
|
2011-07-26 21:59:09 -06:00
|
|
|
depends/tthread/tinythread.cpp
|
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/Buildings.cpp
|
|
|
|
modules/Constructions.cpp
|
2010-04-02 19:52:46 -06:00
|
|
|
modules/Creatures.cpp
|
2011-04-02 16:15:47 -06:00
|
|
|
modules/Engravings.cpp
|
2010-04-02 19:52:46 -06:00
|
|
|
modules/Gui.cpp
|
2010-05-02 02:35:23 -06:00
|
|
|
modules/Items.cpp
|
2010-04-02 19:52:46 -06:00
|
|
|
modules/Maps.cpp
|
|
|
|
modules/Materials.cpp
|
2011-07-20 19:26:52 -06:00
|
|
|
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
|
2011-07-13 00:17:51 -06:00
|
|
|
modules/Vermin.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/World.cpp
|
2010-08-12 18:35:10 -06:00
|
|
|
)
|
|
|
|
|
2009-11-16 20:19:13 -07:00
|
|
|
SET(PROJECT_HDRS_LINUX
|
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_HDRS_WINDOWS
|
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_SRCS_LINUX
|
2011-06-22 00:14:21 -06:00
|
|
|
Console-linux.cpp
|
2011-07-15 23:59:36 -06:00
|
|
|
FakeSDL-linux.cpp
|
2011-06-12 15:17:40 -06:00
|
|
|
Process-linux.cpp
|
2009-11-16 20:19:13 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_SRCS_WINDOWS
|
2011-06-22 00:14:21 -06:00
|
|
|
Console-windows.cpp
|
2011-07-15 23:59:36 -06:00
|
|
|
FakeSDL-windows.cpp
|
2011-06-12 15:17:40 -06:00
|
|
|
Process-windows.cpp
|
2009-11-16 20:19:13 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
IF(UNIX)
|
|
|
|
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
|
|
|
|
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
|
2011-03-16 00:35:08 -06:00
|
|
|
ELSE()
|
2009-11-16 20:19:13 -07:00
|
|
|
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
|
|
|
|
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
2009-11-16 20:19:13 -07:00
|
|
|
|
2009-10-26 15:50:08 -06:00
|
|
|
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
|
|
|
|
|
|
|
|
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
|
|
|
|
|
2011-03-30 17:12:50 -06:00
|
|
|
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB)
|
2009-10-29 18:56:40 -06:00
|
|
|
|
2011-08-18 14:09:30 -06:00
|
|
|
IF(UNIX)
|
|
|
|
IF(CONSOLE_NO_CATCH)
|
|
|
|
ADD_DEFINITIONS(-DCONSOLE_NO_CATCH)
|
|
|
|
ENDIF()
|
2011-09-24 17:29:55 -06:00
|
|
|
IF(MALLOC_FILL)
|
|
|
|
ADD_DEFINITIONS(-DMALLOC_FILL)
|
|
|
|
ENDIF()
|
2011-08-18 14:09:30 -06:00
|
|
|
ENDIF()
|
|
|
|
|
2009-09-13 18:02:46 -06:00
|
|
|
IF(UNIX)
|
|
|
|
add_definitions(-DLINUX_BUILD)
|
2010-05-01 18:38:18 -06:00
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
|
2011-07-30 08:47:49 -06:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -std=c++0x")
|
2011-07-30 14:08:24 -06:00
|
|
|
SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32")
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(PROJECT_LIBS rt )
|
2011-03-16 00:35:08 -06:00
|
|
|
ELSE()
|
2011-02-17 17:14:16 -07:00
|
|
|
IF(MSVC)
|
2011-03-20 10:17:33 -06:00
|
|
|
SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2009-09-13 18:02:46 -06:00
|
|
|
|
|
|
|
ADD_LIBRARY(dfhack SHARED ${PROJECT_SRCS})
|
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()
|
|
|
|
|
2011-08-14 00:42:21 -06:00
|
|
|
#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
|
|
|
|
2009-10-29 18:56:40 -06:00
|
|
|
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
|
|
|
|
|
2011-07-12 18:25:27 -06:00
|
|
|
IF(UNIX)
|
2011-08-14 00:42:21 -06:00
|
|
|
# On linux, copy our version of the df launch script which sets LD_PRELOAD
|
2011-07-13 03:45:30 -06:00
|
|
|
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack
|
2011-08-14 00:42:21 -06:00
|
|
|
DESTINATION .)
|
2011-07-16 02:32:18 -06:00
|
|
|
ELSE()
|
2011-08-14 00:42:21 -06:00
|
|
|
# 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})
|
2011-07-12 18:25:27 -06:00
|
|
|
ENDIF()
|
2011-08-14 00:42:21 -06:00
|
|
|
|
|
|
|
#install the main lib
|
2011-03-17 17:07:40 -06:00
|
|
|
install(TARGETS dfhack
|
|
|
|
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
|
2011-08-14 00:42:21 -06:00
|
|
|
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
|
2011-03-18 09:47:55 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
if(BUILD_DEVEL)
|
2011-03-19 19:06:50 -06:00
|
|
|
if(WIN32)
|
|
|
|
install(TARGETS dfhack
|
|
|
|
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
|
|
|
|
endif()
|
2011-06-16 15:53:39 -06:00
|
|
|
# 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/
|
2011-03-18 09:47:55 -06:00
|
|
|
DESTINATION ${DFHACK_INCLUDES_DESTINATION}
|
|
|
|
FILES_MATCHING PATTERN "*.h" ) #linux: include
|
2011-06-19 17:12:07 -06:00
|
|
|
# Building the docs
|
|
|
|
IF(BUILD_DOXYGEN)
|
|
|
|
add_subdirectory (doc)
|
|
|
|
ENDIF()
|
2011-03-17 17:07:40 -06:00
|
|
|
endif()
|