2011-03-20 10:17:33 -06:00
|
|
|
if(NOT DEFINED DFHACK_CONSISTENCY)
|
|
|
|
MESSAGE(FATAL_ERROR "Please build the whole thing, not parts. You can turn parts on/off using options.")
|
|
|
|
ENDIF()
|
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
PROJECT (dfhack-library)
|
2011-03-16 00:35:08 -06:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2010-05-26 04:24:45 -06:00
|
|
|
|
2011-03-20 10:17:33 -06:00
|
|
|
include_directories (include)
|
|
|
|
include_directories (depends/md5)
|
|
|
|
include_directories (depends/tinyxml)
|
|
|
|
include_directories (depends/argstream)
|
|
|
|
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-02-23 02:02:14 -07:00
|
|
|
private/SHMProcess.h
|
2011-02-23 03:26:33 -07:00
|
|
|
private/LinuxProcess.h
|
2011-02-23 04:08:30 -07:00
|
|
|
private/ProcessFactory.h
|
2011-02-23 13:55:07 -07:00
|
|
|
private/MicrosoftSTL.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
|
|
|
|
include/dfhack/DFContext.h
|
|
|
|
include/dfhack/DFContextManager.h
|
2010-05-25 22:48:23 -06:00
|
|
|
include/dfhack/DFError.h
|
2010-08-30 21:32:40 -06:00
|
|
|
include/dfhack/DFExport.h
|
|
|
|
include/dfhack/DFGlobal.h
|
|
|
|
include/dfhack/DFIntegers.h
|
|
|
|
include/dfhack/DFMiscUtils.h
|
|
|
|
include/dfhack/DFModule.h
|
|
|
|
include/dfhack/DFPragma.h
|
2010-05-25 22:48:23 -06:00
|
|
|
include/dfhack/DFProcess.h
|
2010-08-30 21:32:40 -06:00
|
|
|
include/dfhack/DFProcessEnumerator.h
|
2010-05-25 22:48:23 -06:00
|
|
|
include/dfhack/DFTileTypes.h
|
|
|
|
include/dfhack/DFTypes.h
|
|
|
|
include/dfhack/DFVector.h
|
2010-08-30 21:32:40 -06:00
|
|
|
include/dfhack/VersionInfoFactory.h
|
|
|
|
include/dfhack/VersionInfo.h
|
2011-03-18 09:47:55 -06:00
|
|
|
include/dfhack/extra/MapExtras.h
|
2010-05-26 04:24:45 -06:00
|
|
|
include/dfhack/modules/Buildings.h
|
|
|
|
include/dfhack/modules/Constructions.h
|
|
|
|
include/dfhack/modules/Creatures.h
|
|
|
|
include/dfhack/modules/Gui.h
|
|
|
|
include/dfhack/modules/Items.h
|
|
|
|
include/dfhack/modules/Maps.h
|
|
|
|
include/dfhack/modules/Materials.h
|
|
|
|
include/dfhack/modules/Translation.h
|
|
|
|
include/dfhack/modules/Vegetation.h
|
|
|
|
include/dfhack/modules/WindowIO.h
|
|
|
|
include/dfhack/modules/World.h
|
2009-10-26 15:50:08 -06:00
|
|
|
)
|
|
|
|
|
2010-08-12 18:35:10 -06:00
|
|
|
SET(PROJECT_C_HDRS
|
2010-08-30 21:32:40 -06:00
|
|
|
include/DFHack_C.h
|
2010-08-12 18:35:10 -06:00
|
|
|
include/dfhack-c/DFTypes_C.h
|
|
|
|
include/dfhack-c/DFContext_C.h
|
2010-08-30 21:32:40 -06:00
|
|
|
include/dfhack-c/modules/Buildings_C.h
|
|
|
|
include/dfhack-c/modules/Constructions_C.h
|
|
|
|
include/dfhack-c/modules/Creatures_C.h
|
|
|
|
include/dfhack-c/modules/Gui_C.h
|
|
|
|
include/dfhack-c/modules/Items_C.h
|
|
|
|
include/dfhack-c/modules/Maps_C.h
|
|
|
|
include/dfhack-c/modules/Materials_C.h
|
|
|
|
include/dfhack-c/modules/Translation_C.h
|
|
|
|
include/dfhack-c/modules/Vegetation_C.h
|
|
|
|
include/dfhack-c/modules/WindowIO_C.h
|
|
|
|
include/dfhack-c/modules/World_C.h
|
2010-08-12 18:35:10 -06:00
|
|
|
)
|
|
|
|
|
2009-09-13 18:02:46 -06:00
|
|
|
SET(PROJECT_SRCS
|
2010-08-20 06:10:05 -06:00
|
|
|
VersionInfo.cpp
|
|
|
|
VersionInfoFactory.cpp
|
2010-05-23 15:06:10 -06:00
|
|
|
DFContextManager.cpp
|
|
|
|
DFContext.cpp
|
2010-11-17 12:50:50 -07:00
|
|
|
DFTileTypes.cpp
|
2010-05-27 21:18:32 -06:00
|
|
|
DFProcessEnumerator.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
ContextShared.cpp
|
2011-02-23 02:02:14 -07:00
|
|
|
DFProcess-SHM.cpp
|
2011-02-23 13:55:07 -07:00
|
|
|
MicrosoftSTL.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
|
|
|
|
|
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
|
|
|
|
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
|
2010-04-06 09:11:58 -06:00
|
|
|
modules/Translation.cpp
|
2010-04-07 04:49:37 -06:00
|
|
|
modules/Vegetation.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/World.cpp
|
2010-08-12 18:35:10 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_C_SRCS
|
|
|
|
DFContext_C.cpp
|
|
|
|
DFTypes_C.cpp
|
2010-04-30 15:04:17 -06:00
|
|
|
|
2010-05-25 14:40:24 -06:00
|
|
|
modules/Buildings_C.cpp
|
|
|
|
modules/Constructions_C.cpp
|
|
|
|
modules/Creatures_C.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/Gui_C.cpp
|
2010-05-25 14:40:24 -06:00
|
|
|
modules/Items_C.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/Maps_C.cpp
|
|
|
|
modules/Materials_C.cpp
|
|
|
|
modules/Translation_C.cpp
|
|
|
|
modules/Vegetation_C.cpp
|
2010-05-26 13:51:39 -06:00
|
|
|
modules/WindowIO_C.cpp
|
|
|
|
modules/World_C.cpp
|
2009-09-13 18:02:46 -06:00
|
|
|
)
|
|
|
|
|
2009-11-16 20:19:13 -07:00
|
|
|
SET(PROJECT_HDRS_LINUX
|
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_HDRS_WINDOWS
|
2010-05-26 00:42:09 -06:00
|
|
|
include/dfhack/DFstdint_win.h
|
2009-11-16 20:19:13 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_SRCS_LINUX
|
|
|
|
DFProcess-linux.cpp
|
2011-02-23 03:26:33 -07:00
|
|
|
DFProcess-linux-base.cpp
|
2009-12-22 14:19:39 -07:00
|
|
|
DFProcess-linux-SHM.cpp
|
2010-02-15 16:04:15 -07:00
|
|
|
DFProcess-linux-wine.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/WindowIO-linux.cpp
|
2009-11-16 20:19:13 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(PROJECT_SRCS_WINDOWS
|
|
|
|
DFProcess-windows.cpp
|
2010-01-10 23:27:59 -07:00
|
|
|
DFProcess-windows-SHM.cpp
|
2010-05-26 04:24:45 -06:00
|
|
|
modules/WindowIO-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
|
|
|
|
2010-08-30 11:36:40 -06:00
|
|
|
IF(BUILD_DFHACK_C_BINDINGS)
|
2010-08-12 18:35:10 -06:00
|
|
|
LIST(APPEND PROJECT_HDRS ${PROJECT_C_HDRS})
|
|
|
|
LIST(APPEND PROJECT_SRCS ${PROJECT_C_SRCS})
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
2010-08-12 18:35:10 -06: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})
|
|
|
|
|
2010-04-26 16:12:22 -06:00
|
|
|
# Are we 64bit? (Damn you, ptrace()!)
|
2011-03-19 23:20:23 -06:00
|
|
|
IF( CMAKE_SIZEOF_VOID_P MATCHES 8 )
|
|
|
|
ADD_DEFINITIONS(-DHAVE_64_BIT)
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
2009-10-29 18:56:40 -06:00
|
|
|
|
2011-03-19 23:20:23 -06:00
|
|
|
ADD_DEFINITIONS(-DMEMXML_DATA_PATH="${MEMXML_DATA_PATH}")
|
2011-02-28 23:50:56 -07:00
|
|
|
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL)
|
2009-10-29 18:56:40 -06:00
|
|
|
|
2009-09-13 18:02:46 -06:00
|
|
|
IF(UNIX)
|
|
|
|
add_definitions(-DLINUX_BUILD)
|
2009-12-12 12:52:30 -07:00
|
|
|
find_library(X11_LIBRARY X11)
|
2010-05-01 18:38:18 -06:00
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
|
2010-02-25 15:43:37 -07:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
|
2010-08-20 06:10:05 -06:00
|
|
|
|
2011-03-17 17:07:40 -06:00
|
|
|
SET(PROJECT_LIBS ${X11_LIBRARY} 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
|
|
|
ELSE()
|
2011-02-17 17:14:16 -07:00
|
|
|
SET(PROJECT_LIBS psapi ntdll)
|
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
|
|
|
|
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-03-24 16:21:50 -06:00
|
|
|
#ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD
|
|
|
|
ADD_CUSTOM_TARGET( memxmlcopy ALL
|
2011-03-20 10:17:33 -06:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${dfhack_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/)
|
2011-03-16 00:35:08 -06:00
|
|
|
|
2011-03-17 17:07:40 -06:00
|
|
|
install(TARGETS dfhack
|
|
|
|
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
|
|
|
|
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) #linux: lib
|
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-03-19 19:06:50 -06:00
|
|
|
if(BUILD_DFHACK_DEVEL)
|
|
|
|
if(WIN32)
|
|
|
|
install(TARGETS dfhack
|
|
|
|
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
|
|
|
|
endif()
|
2011-03-20 10:24:34 -06:00
|
|
|
# note the ending '/'. This means *constents* of the directory are installed
|
|
|
|
# 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-03-17 17:07:40 -06:00
|
|
|
endif()
|