Make the build system sane, pt. 1 - no install or packages yet

develop
Petr Mrázek 2011-03-16 07:35:08 +01:00
parent 115a256ff5
commit 557d6733e2
10 changed files with 149 additions and 2599 deletions

@ -1,39 +1,37 @@
# main project file. use it from a build sub-folder, see COMPILE for details # main project file. use it from a build sub-folder, see COMPILE for details
## some generic CMake magic
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
PROJECT (dfhack) PROJECT (dfhack)
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
SET ( DFHACK_VERSION "0.5.5" )
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# Set this to project source dir. When dfhack is used # Set this to project source dir. When dfhack is used
# as a submodule, CMAKE_SOURCE_DIR is not pointing to # as a submodule, CMAKE_SOURCE_DIR is not pointing to
# the root where this particular CMakeLists.txt file sits. # the root where this particular CMakeLists.txt file sits.
SET(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR}) SET(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
# disable warning, autosearch
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.") message(SEND_ERROR "In-source builds are not allowed.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") endif()
## version - only set this for actual releases
SET (DFHACK_VERSION "dev" CACHE STRING "Version number of dfhack. Set to 'dev' by default. Only set for releases." )
## setting the build type
IF(NOT DEFINED CMAKE_BUILD_TYPE) IF(NOT DEFINED CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT DEFINED CMAKE_BUILD_TYPE) ENDIF()
SET( LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack library" ) ## put everything in one big ugly directory to make MSVC and KDevelop happy
SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack tools" ) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
SET( DATA_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack data (offset files)" ) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
SET( DOXYGEN_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/output/doxygen CACHE PATH "Output directory for doxygen") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
OPTION(BUILD_DFHACK_DOCUMENTATION "Create doxygen documentation for developers" OFF) OPTION(BUILD_DFHACK_DOXYGEN "Create doxygen documentation for developers" ON)
OPTION(BUILD_DFHACK_EXAMPLES "Build example tools" OFF) OPTION(BUILD_DFHACK_EXAMPLES "Build example tools" OFF)
OPTION(BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF) OPTION(BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF)
OPTION(BUILD_DFHACK_C_BINDINGS "Build the C portion of the library" ON) OPTION(BUILD_DFHACK_C_BINDINGS "Build the C portion of the library" ON)
OPTION(BUILD_OFFSET_EDITOR "Build the Offset GUI editor (not ready for use)." OFF)
OPTION(BUILD_DFHACK_SUPPORTED "Build the supported toold." ON) OPTION(BUILD_DFHACK_SUPPORTED "Build the supported toold." ON)
OPTION(BUILD_DFHACK_SHM "Build the SHM." OFF)
include_directories (${CMAKE_SOURCE_DIR}/library/include/) include_directories (${CMAKE_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/) include_directories (${CMAKE_SOURCE_DIR}/library/shm/)
@ -41,26 +39,30 @@ include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
add_subdirectory (library) add_subdirectory (library)
# macro to save on typing in the tool subdirs
MACRO(DFHACK_TOOL TOOL_NAME TOOL_SOURCES)
ADD_EXECUTABLE(${TOOL_NAME} ${TOOL_SOURCES})
TARGET_LINK_LIBRARIES(${TOOL_NAME} dfhack)
if(DEFINED LOCAL_DEPNAME)
ADD_DEPENDENCIES(${TOOL_NAME} ${LOCAL_DEPNAME})
endif()
install(TARGETS
${TOOL_NAME}
RUNTIME DESTINATION bin)
ENDMACRO()
IF(BUILD_DFHACK_SUPPORTED) IF(BUILD_DFHACK_SUPPORTED)
add_subdirectory (tools/supported) add_subdirectory (tools/supported)
ENDIF(BUILD_DFHACK_SUPPORTED) ENDIF()
IF(BUILD_OFFSET_EDITOR)
add_subdirectory (offsetedit)
ENDIF(BUILD_OFFSET_EDITOR)
IF(BUILD_DFHACK_SHM)
add_subdirectory (library/shm)
ENDIF(BUILD_DFHACK_SHM)
IF(BUILD_DFHACK_EXAMPLES) IF(BUILD_DFHACK_EXAMPLES)
add_subdirectory (tools/examples) add_subdirectory (tools/examples)
ENDIF(BUILD_DFHACK_EXAMPLES) ENDIF()
IF(BUILD_DFHACK_PLAYGROUND) IF(BUILD_DFHACK_PLAYGROUND)
add_subdirectory (tools/playground) add_subdirectory (tools/playground)
ENDIF(BUILD_DFHACK_PLAYGROUND) ENDIF()
IF(BUILD_DFHACK_DOCUMENTATION) IF(BUILD_DFHACK_DOXYGEN)
add_subdirectory (doc) add_subdirectory (doc)
ENDIF(BUILD_DFHACK_DOCUMENTATION) ENDIF()

File diff suppressed because it is too large Load Diff

@ -10,7 +10,7 @@
# http://tobias.rautenkranz.ch/cmake/doxygen/ # http://tobias.rautenkranz.ch/cmake/doxygen/
# but it is hard to understand... # but it is hard to understand...
FIND_PACKAGE(Doxygen) FIND_PACKAGE(Doxygen QUIET)
IF(DOXYGEN_FOUND) IF(DOXYGEN_FOUND)
SET(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen") SET(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
@ -59,5 +59,5 @@ IF(DOXYGEN_FOUND)
# INSTALL( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" DESTINATION "/usr/share/doc/dfhack-${DFHACK_VERSION}" ) # INSTALL( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" DESTINATION "/usr/share/doc/dfhack-${DFHACK_VERSION}" )
ELSE(DOXYGEN_FOUND) ELSE(DOXYGEN_FOUND)
MESSAGE (FATAL_ERROR "doxygen binary couldn't be found") MESSAGE (WARNING "Doxygen binary couldn't be found. Can't build development documentation.'")
ENDIF(DOXYGEN_FOUND) ENDIF(DOXYGEN_FOUND)

@ -38,7 +38,8 @@ PROJECT_NUMBER = @DFHACK_VERSION@
# If a relative path is entered, it will be relative to the location # If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used. # where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIR@ OUTPUT_DIRECTORY = html
# @DOXYGEN_OUTPUT_DIR@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output # 4096 sub-directories (in 2 levels) under the output directory of each output

@ -1,23 +1,15 @@
# don't use this file directly. use the one in the root folder of the project # don't use this file directly. use the one in the root folder of the project
PROJECT (dfhack-library) PROJECT (dfhack-library)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# disable warning, autosearch
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.") message(SEND_ERROR "In-source builds are not allowed.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") endif()
IF(NOT DEFINED CMAKE_BUILD_TYPE) IF(NOT DEFINED CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT DEFINED CMAKE_BUILD_TYPE) ENDIF()
SET( LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack library" )
SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack tools" )
include_directories (${CMAKE_SOURCE_DIR}/library/include/) include_directories (${CMAKE_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/) include_directories (${CMAKE_SOURCE_DIR}/library/shm/)
@ -159,31 +151,28 @@ modules/WindowIO-windows.cpp
IF(UNIX) IF(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX}) LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX}) LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
ELSE(UNIX) ELSE()
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS}) LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS}) LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
ENDIF(UNIX) ENDIF()
IF(BUILD_DFHACK_C_BINDINGS) IF(BUILD_DFHACK_C_BINDINGS)
LIST(APPEND PROJECT_HDRS ${PROJECT_C_HDRS}) LIST(APPEND PROJECT_HDRS ${PROJECT_C_HDRS})
LIST(APPEND PROJECT_SRCS ${PROJECT_C_SRCS}) LIST(APPEND PROJECT_SRCS ${PROJECT_C_SRCS})
ENDIF(BUILD_DFHACK_C_BINDINGS) ENDIF()
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
SET( MEMXML_DATA_PATH . CACHE PATH "search path for Memory.xml") SET( MEMXML_DATA_PATH . CACHE PATH "search path for Memory.xml")
# OPTION( VARIABLE "Description" Initial state)
#OPTION( WITH_FOO "Enable FOO support" ON )
#OPTION( WITH_BAR "Enable BAR component" OFF )
# Are we 64bit? (Damn you, ptrace()!) # Are we 64bit? (Damn you, ptrace()!)
IF( CMAKE_SIZEOF_VOID_P MATCHES 4 ) IF( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET( HAVE_64_BIT 0 ) SET( HAVE_64_BIT 0 )
ELSE( CMAKE_SIZEOF_VOID_P MATCHES 4 ) ELSE()
SET( HAVE_64_BIT 1 ) SET( HAVE_64_BIT 1 )
ENDIF( CMAKE_SIZEOF_VOID_P MATCHES 4 ) ENDIF()
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h ) CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h )
@ -197,14 +186,13 @@ IF(UNIX)
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
SET(PROJECT_LIBS ${X11_LIBRARY} rt ) #dfhack-md5 dfhack-tixml SET(PROJECT_LIBS ${X11_LIBRARY} rt ) #dfhack-md5 dfhack-tixml
ELSE(UNIX) ELSE()
IF(MSVC) IF(MSVC)
SET(PROJECT_LIBS psapi ${CMAKE_SOURCE_DIR}/library/depends/ntdll/ntdll.lib) SET(PROJECT_LIBS psapi ${CMAKE_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)
ELSE(MSVC) ELSE()
SET(PROJECT_LIBS psapi ntdll) SET(PROJECT_LIBS psapi ntdll)
ENDIF(MSVC) ENDIF()
ENDIF()
ENDIF(UNIX)
ADD_LIBRARY(dfhack SHARED ${PROJECT_SRCS}) ADD_LIBRARY(dfhack SHARED ${PROJECT_SRCS})
@ -212,38 +200,41 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS}) TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
if(MSVC) ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/)
#if(MSVC)
# This is a MSVC hack used for copying files into the target directory # This is a MSVC hack used for copying files into the target directory
# of build target set in MSVC. # of build target set in MSVC.
# It exploits the fact that MSVC has some variables in .vcproj files, much like cmake does here. # It exploits the fact that MSVC has some variables in .vcproj files, much like cmake does here.
# #
# So, $(TargetDir) is ignored by cmake, and replaced with the actual output directory by MSVC # So, $(TargetDir) is ignored by cmake, and replaced with the actual output directory by MSVC
ADD_CUSTOM_COMMAND(TARGET dfhack #ADD_CUSTOM_COMMAND(TARGET dfhack
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/data/Memory-ng.xml "$(TargetDir)/Memory.xml" #COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/data/Memory-ng.xml "$(TargetDir)/Memory.xml"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/data/Memory-ng.xml #MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/data/Memory-ng.xml
) #)
ADD_CUSTOM_COMMAND(TARGET dfhack #ADD_CUSTOM_COMMAND(TARGET dfhack
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Compile.html "$(TargetDir)/Compile.html" #COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Compile.html "$(TargetDir)/Compile.html"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/Compile.html #MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/Compile.html
) #)
ADD_CUSTOM_COMMAND(TARGET dfhack #ADD_CUSTOM_COMMAND(TARGET dfhack
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Readme.html "$(TargetDir)/Readme.html" #COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Readme.html "$(TargetDir)/Readme.html"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/Readme.html #MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/Readme.html
) #)
ADD_CUSTOM_COMMAND(TARGET dfhack #ADD_CUSTOM_COMMAND(TARGET dfhack
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/LICENSE "$(TargetDir)/LICENSE.txt" #COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/LICENSE "$(TargetDir)/LICENSE.txt"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/LICENSE #MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/LICENSE
) #)
else(MSVC) #else(MSVC)
# Just put the file in the output directory on Linux and Mac # Just put the file in the output directory on Linux and Mac
configure_file(${CMAKE_SOURCE_DIR}/data/Memory-ng.xml ${DATA_OUTPUT_PATH}/Memory.xml COPYONLY) #configure_file(${CMAKE_SOURCE_DIR}/data/Memory-ng.xml ${DATA_OUTPUT_PATH}/Memory.xml COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Compile.html ${DATA_OUTPUT_PATH}/Compile.html COPYONLY) #configure_file(${CMAKE_SOURCE_DIR}/Compile.html ${DATA_OUTPUT_PATH}/Compile.html COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Readme.html ${DATA_OUTPUT_PATH}/Readme.html COPYONLY) #configure_file(${CMAKE_SOURCE_DIR}/Readme.html ${DATA_OUTPUT_PATH}/Readme.html COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${DATA_OUTPUT_PATH}/LICENSE.txt COPYONLY) #configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${DATA_OUTPUT_PATH}/LICENSE.txt COPYONLY)
endif(MSVC) #endif(MSVC)
IF(UNIX) #IF(UNIX)
install(TARGETS dfhack LIBRARY DESTINATION lib) # install(TARGETS dfhack LIBRARY DESTINATION lib)
install(FILES ${CMAKE_SOURCE_DIR}/output/Memory.xml DESTINATION share/dfhack) # install(FILES ${CMAKE_SOURCE_DIR}/output/Memory.xml DESTINATION share/dfhack)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/library/include/ DESTINATION include FILES_MATCHING PATTERN "*.h") # install(DIRECTORY ${CMAKE_SOURCE_DIR}/library/include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
ENDIF(UNIX) #ENDIF(UNIX)

@ -5,57 +5,42 @@ IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF(UNIX) ENDIF(UNIX)
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-examples
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
)
set(LOCAL_DEPNAME memxml-for-examples)
ENDIF()
# buildingsdump - dump buildings and their raw data filtered by type # buildingsdump - dump buildings and their raw data filtered by type
ADD_EXECUTABLE(dfbuildingsdump buildingsdump.cpp) DFHACK_TOOL(dfbuildingsdump buildingsdump.cpp)
TARGET_LINK_LIBRARIES(dfbuildingsdump dfhack)
# constructiondump - dump constructions! # constructiondump - dump constructions!
ADD_EXECUTABLE(dfconstructiondump construction_dump.cpp) DFHACK_TOOL(dfconstructiondump construction_dump.cpp)
TARGET_LINK_LIBRARIES(dfconstructiondump dfhack)
# creaturedump - basic creature dump - a test of the creature related exports # creaturedump - basic creature dump - a test of the creature related exports
ADD_EXECUTABLE(dfcreaturedump creaturedump.cpp) DFHACK_TOOL(dfcreaturedump creaturedump.cpp)
TARGET_LINK_LIBRARIES(dfcreaturedump dfhack)
# materialtest - just list the first material of each type # materialtest - just list the first material of each type
ADD_EXECUTABLE(dfmaterialtest materialtest.cpp) DFHACK_TOOL(dfmaterialtest materialtest.cpp)
TARGET_LINK_LIBRARIES(dfmaterialtest dfhack)
# itemdump - dump the item under the cursor # itemdump - dump the item under the cursor
ADD_EXECUTABLE(dfitemdump dfitemdump.cpp) DFHACK_TOOL(dfitemdump dfitemdump.cpp)
TARGET_LINK_LIBRARIES(dfitemdump dfhack)
# hotkeynotedump - dumps the hotkeys and notes for the loaded map # hotkeynotedump - dumps the hotkeys and notes for the loaded map
# Author: belal # Author: belal
ADD_EXECUTABLE(dfhotkeynotedump hotkeynotedump.cpp) DFHACK_TOOL(dfhotkeynotedump hotkeynotedump.cpp)
TARGET_LINK_LIBRARIES(dfhotkeynotedump dfhack)
# settlementdump - dumps the settlements on the loaded map # settlementdump - dumps the settlements on the loaded map
# Author: belal # Author: belal
# ADD_EXECUTABLE(dfsettlementdump settlementdump.cpp) # DFHACK_TOOL(dfsettlementdump settlementdump.cpp)
# TARGET_LINK_LIBRARIES(dfsettlementdump dfhack)
# treedump - dump them trees! # treedump - dump them trees!
ADD_EXECUTABLE(dftreedump treedump.cpp) DFHACK_TOOL(dftreedump treedump.cpp)
TARGET_LINK_LIBRARIES(dftreedump dfhack)
# spatterdump - dump spatter 'veins' # spatterdump - dump spatter 'veins'
ADD_EXECUTABLE(dfspatterdump spatterdump.cpp) DFHACK_TOOL(dfspatterdump spatterdump.cpp)
TARGET_LINK_LIBRARIES(dfspatterdump dfhack)
# processenum - demonstrates the use of ProcessEnumerator # processenum - demonstrates the use of ProcessEnumerator
ADD_EXECUTABLE(dfprocessenum processenum.cpp) DFHACK_TOOL(dfprocessenum processenum.cpp)
TARGET_LINK_LIBRARIES(dfprocessenum dfhack)
install(TARGETS
dfbuildingsdump
dfconstructiondump
dfcreaturedump
dfmaterialtest
dfitemdump
dfhotkeynotedump
dftreedump
dfspatterdump
dfprocessenum
RUNTIME DESTINATION bin
)

@ -5,105 +5,81 @@ IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF(UNIX) ENDIF(UNIX)
# deep magic. make sure it runs to be able to do debug runs for MSVC projects out of the box
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-playground
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
)
set(LOCAL_DEPNAME memxml-for-playground)
ENDIF()
# a creature mood dump hack. has hardcoded offsets # a creature mood dump hack. has hardcoded offsets
ADD_EXECUTABLE(dfmoodump moodump.cpp) DFHACK_TOOL(dfmoodump moodump.cpp)
TARGET_LINK_LIBRARIES(dfmoodump dfhack)
# bauxite - turn all mechanisms into bauxite mechanisms # bauxite - turn all mechanisms into bauxite mechanisms
# Author: Alex Legg # Author: Alex Legg
#ADD_EXECUTABLE(dfbauxite dfbauxite.cpp) #DFHACK_TOOL(dfbauxite dfbauxite.cpp)
#TARGET_LINK_LIBRARIES(dfbauxite dfhack)
# digger - designate for digging by tile class # digger - designate for digging by tile class
# Author: mizipzor # Author: mizipzor
ADD_EXECUTABLE(dfdigger digger.cpp) DFHACK_TOOL(dfdigger digger.cpp)
TARGET_LINK_LIBRARIES(dfdigger dfhack)
# digger2 - designate for digging from a text file # digger2 - designate for digging from a text file
# Author: rOut # Author: rOut
ADD_EXECUTABLE(dfdigger2 digger2.cpp) DFHACK_TOOL(dfdigger2 digger2.cpp)
TARGET_LINK_LIBRARIES(dfdigger2 dfhack)
ADD_EXECUTABLE(primitives primitives.cpp)
# itemdesignator - change some item designations (dump, forbid, on-fire) for all # itemdesignator - change some item designations (dump, forbid, on-fire) for all
# items of a given type and material # items of a given type and material
# Author: belal # Author: belal
#ADD_EXECUTABLE(dfitemdesignator itemdesignator.cpp) #DFHACK_TOOL(dfitemdesignator itemdesignator.cpp)
#TARGET_LINK_LIBRARIES(dfitemdesignator dfhack)
# catsplosion - Accelerates pregnancy # catsplosion - Accelerates pregnancy
# Author: Zhentar # Author: Zhentar
ADD_EXECUTABLE(dfcatsplosion catsplosion.cpp) DFHACK_TOOL(dfcatsplosion catsplosion.cpp)
TARGET_LINK_LIBRARIES(dfcatsplosion dfhack)
# findnameindexes # findnameindexes
# Author: belal # Author: belal
#ADD_EXECUTABLE(dffindnameindexes findnameindexes.cpp) #DFHACK_TOOL(dffindnameindexes findnameindexes.cpp)
#TARGET_LINK_LIBRARIES(dffindnameindexes dfhack)
# renamer - change the custom names and professions of creatures, sends keys to # renamer - change the custom names and professions of creatures, sends keys to
# df directly # df directly
# Author: belal # Author: belal
#ADD_EXECUTABLE(dfrenamer renamer.cpp) #DFHACK_TOOL(dfrenamer renamer.cpp)
#TARGET_LINK_LIBRARIES(dfrenamer dfhack)
# copypaste # copypaste
# Author: belal # Author: belal
# copies the current buildings in a df map, and then designates the area to be dug # copies the current buildings in a df map, and then designates the area to be dug
# mainly a proof of concept for my gui application dfCopyPaste # mainly a proof of concept for my gui application dfCopyPaste
ADD_EXECUTABLE(dfcopypaste copypaste.cpp) DFHACK_TOOL(dfcopypaste copypaste.cpp)
TARGET_LINK_LIBRARIES(dfcopypaste dfhack)
# paths # paths
# Author: belal # Author: belal
# dumps the current path to the DF exe, as well as the relative paths to the # dumps the current path to the DF exe, as well as the relative paths to the
# current tileset and color files # current tileset and color files
ADD_EXECUTABLE(dfpaths paths.cpp) DFHACK_TOOL(dfpaths paths.cpp)
TARGET_LINK_LIBRARIES(dfpaths dfhack)
# deramp # deramp
# Author: zilpin # Author: zilpin
# seeks entire map for 'remove ramp' designation, makes a floor, removes designation. # seeks entire map for 'remove ramp' designation, makes a floor, removes designation.
# intended use is to simulate old 'channel' functionality. # intended use is to simulate old 'channel' functionality.
ADD_EXECUTABLE(dfderamp deramp.cpp) DFHACK_TOOL(dfderamp deramp.cpp)
TARGET_LINK_LIBRARIES(dfderamp dfhack)
# printtiletypes # printtiletypes
# Author: zilpin # Author: zilpin
# Prints CSV dump of all tile type information. # Prints CSV dump of all tile type information.
# No DF process needed. Intended only for debugging and information purposes. # No DF process needed. Intended only for debugging and information purposes.
ADD_EXECUTABLE(dfprinttiletypes printtiletypes.cpp) DFHACK_TOOL(dfprinttiletypes printtiletypes.cpp)
TARGET_LINK_LIBRARIES(dfprinttiletypes dfhack)
# hellhole # hellhole
# Author: zilpin # Author: zilpin
# Creates a bottomless hole to hell. # Creates a bottomless hole to hell.
# Experimental version hard-codes values. # Experimental version hard-codes values.
# Will have many options in the future. # Will have many options in the future.
ADD_EXECUTABLE(dfhellhole hellhole.cpp) DFHACK_TOOL(dfhellhole hellhole.cpp)
TARGET_LINK_LIBRARIES(dfhellhole dfhack)
# this needs the C bindings # this needs the C bindings
IF(BUILD_DFHACK_C_BINDINGS) IF(BUILD_DFHACK_C_BINDINGS)
# for trying out some 'stuff' # for trying out some 'stuff'
ADD_EXECUTABLE(dftest test.cpp) DFHACK_TOOL(dftest test.cpp)
TARGET_LINK_LIBRARIES(dftest dfhack)
install(TARGETS
dftest
RUNTIME DESTINATION bin
)
ENDIF(BUILD_DFHACK_C_BINDINGS) ENDIF(BUILD_DFHACK_C_BINDINGS)
install(TARGETS
dfmoodump
dfdigger
dfdigger2
dfcatsplosion
dfderamp
dfprinttiletypes
dfhellhole
RUNTIME DESTINATION bin
)

@ -3,84 +3,72 @@
# this is required to ensure we use the right configuration for the system. # this is required to ensure we use the right configuration for the system.
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF(UNIX) ENDIF()
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-supported
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}")
set(LOCAL_DEPNAME memxml-for-supported)
ENDIF()
# a reveal clone # a reveal clone
ADD_EXECUTABLE(dfreveal reveal.cpp) DFHACK_TOOL(dfreveal reveal.cpp)
TARGET_LINK_LIBRARIES(dfreveal dfhack)
# force pause! # force pause!
ADD_EXECUTABLE(dfpause forcepause.cpp) DFHACK_TOOL(dfpause forcepause.cpp)
TARGET_LINK_LIBRARIES(dfpause dfhack)
# prospector - produces a list of available materials and their quantities # prospector - produces a list of available materials and their quantities
ADD_EXECUTABLE(dfprospector prospector.cpp) DFHACK_TOOL(dfprospector prospector.cpp)
TARGET_LINK_LIBRARIES(dfprospector dfhack)
# vdig - dig the vein under the cursor # vdig - dig the vein under the cursor
ADD_EXECUTABLE(dfvdig vdig.cpp) DFHACK_TOOL(dfvdig vdig.cpp)
TARGET_LINK_LIBRARIES(dfvdig dfhack)
# cleanmap - removes mud, snow, blood and similar stuff from a map. farmers beware # cleanmap - removes mud, snow, blood and similar stuff from a map. farmers beware
ADD_EXECUTABLE(dfcleanmap cleanmap.cpp) DFHACK_TOOL(dfcleanmap cleanmap.cpp)
TARGET_LINK_LIBRARIES(dfcleanmap dfhack)
# unstuck - make DF run if something goes wrong with the 'normal' memory access method # unstuck - make DF run if something goes wrong with the 'normal' memory access method
ADD_EXECUTABLE(dfunstuck unstuck.cpp) DFHACK_TOOL(dfunstuck unstuck.cpp)
TARGET_LINK_LIBRARIES(dfunstuck dfhack)
# probe - map tile probe # probe - map tile probe
ADD_EXECUTABLE(dfprobe probe.cpp) DFHACK_TOOL(dfprobe probe.cpp)
TARGET_LINK_LIBRARIES(dfprobe dfhack)
# attachtest - 100x attach/detach, suspend/resume # attachtest - 100x attach/detach, suspend/resume
ADD_EXECUTABLE(dfattachtest attachtest.cpp) DFHACK_TOOL(dfattachtest attachtest.cpp)
TARGET_LINK_LIBRARIES(dfattachtest dfhack)
# a benchmark program, reads the map 1000x # a benchmark program, reads the map 1000x
ADD_EXECUTABLE(dfexpbench expbench.cpp) DFHACK_TOOL(dfexpbench expbench.cpp)
TARGET_LINK_LIBRARIES(dfexpbench dfhack)
# suspendtest - test if suspend works. df should stop responding when suspended # suspendtest - test if suspend works. df should stop responding when suspended
# by dfhack # by dfhack
ADD_EXECUTABLE(dfsuspend suspendtest.cpp) DFHACK_TOOL(dfsuspend suspendtest.cpp)
TARGET_LINK_LIBRARIES(dfsuspend dfhack)
# flows - check flows impact on fps # flows - check flows impact on fps
ADD_EXECUTABLE(dfflows flows.cpp) DFHACK_TOOL(dfflows flows.cpp)
TARGET_LINK_LIBRARIES(dfflows dfhack)
# liquids manipulation tool # liquids manipulation tool
# Original author: Aleric # Original author: Aleric
ADD_EXECUTABLE(dfliquids liquids.cpp) DFHACK_TOOL(dfliquids liquids.cpp)
TARGET_LINK_LIBRARIES(dfliquids dfhack)
# Solves the problem of unusable items after reclaim by clearing the 'in_job' bit of all items. # Solves the problem of unusable items after reclaim by clearing the 'in_job' bit of all items.
# Original author: Quietust # Original author: Quietust
#ADD_EXECUTABLE(dfcleartask cleartask.cpp) #DFHACK_TOOL(dfcleartask cleartask.cpp)
#TARGET_LINK_LIBRARIES(dfcleartask dfhack)
# position - check the DF window and cursor parameters # position - check the DF window and cursor parameters
ADD_EXECUTABLE(dfposition position.cpp) DFHACK_TOOL(dfposition position.cpp)
TARGET_LINK_LIBRARIES(dfposition dfhack)
# mode - a utility to change the current game and control modes # mode - a utility to change the current game and control modes
ADD_EXECUTABLE(dfmode mode.cpp) DFHACK_TOOL(dfmode mode.cpp)
TARGET_LINK_LIBRARIES(dfmode dfhack)
# just dump offsets of the current version # just dump offsets of the current version
ADD_EXECUTABLE(dfdoffsets dumpoffsets.cpp) DFHACK_TOOL(dfdoffsets dumpoffsets.cpp)
TARGET_LINK_LIBRARIES(dfdoffsets dfhack)
# change the weather # change the weather
ADD_EXECUTABLE(dfweather weather.cpp) DFHACK_TOOL(dfweather weather.cpp)
TARGET_LINK_LIBRARIES(dfweather dfhack)
# incrementalsearch - a bit like cheat engine, only DF-specific, very basic # incrementalsearch - a bit like cheat engine, only DF-specific, very basic
#ADD_EXECUTABLE(dfautosearch autosearch.cpp) #DFHACK_TOOL(dfautosearch autosearch.cpp)
#TARGET_LINK_LIBRARIES(dfautosearch dfhack) DFHACK_TOOL(dfincremental incrementalsearch.cpp)
ADD_EXECUTABLE(dfincremental incrementalsearch.cpp)
TARGET_LINK_LIBRARIES(dfincremental dfhack)
IF(UNIX) IF(UNIX)
@ -117,27 +105,3 @@ IF(UNIX)
MESSAGE(STATUS "Wide-character ncurses library not found - veinlook can't be built") MESSAGE(STATUS "Wide-character ncurses library not found - veinlook can't be built")
ENDIF(CURSES_FOUND) ENDIF(CURSES_FOUND)
ENDIF(UNIX) ENDIF(UNIX)
install(TARGETS
dfmode
dfreveal
dfprospector
dfposition
dfvdig
dfcleanmap
dfunstuck
dfprobe
dfpause
dfdoffsets
dfattachtest
#dfcleartask
dfexpbench
dfsuspend
dfflows
dfliquids
dfweather
#dfautosearch
dfincremental
RUNTIME DESTINATION bin
)