Merge branch 'develop' of gh:DFHack/dfhack into develop

develop
lethosor 2020-01-18 22:31:33 -05:00
commit bcd7974561
22 changed files with 1465 additions and 1478 deletions

@ -1,71 +1,71 @@
# Helper to download files as needed # Helper to download files as needed
function(file_md5_if_exists FILE VAR) function(file_md5_if_exists FILE VAR)
if(EXISTS "${FILE}") if(EXISTS "${FILE}")
file(MD5 "${FILE}" "${VAR}") file(MD5 "${FILE}" "${VAR}")
set(${VAR} "${${VAR}}" PARENT_SCOPE) set(${VAR} "${${VAR}}" PARENT_SCOPE)
else() else()
set(${VAR} "" PARENT_SCOPE) set(${VAR} "" PARENT_SCOPE)
endif() endif()
endfunction() endfunction()
function(search_downloads FILE_MD5 VAR) function(search_downloads FILE_MD5 VAR)
set(${VAR} "" PARENT_SCOPE) set(${VAR} "" PARENT_SCOPE)
file(GLOB FILES ${CMAKE_SOURCE_DIR}/CMake/downloads/*) file(GLOB FILES ${CMAKE_SOURCE_DIR}/CMake/downloads/*)
foreach(FILE ${FILES}) foreach(FILE ${FILES})
file(MD5 "${FILE}" CUR_MD5) file(MD5 "${FILE}" CUR_MD5)
if("${CUR_MD5}" STREQUAL "${FILE_MD5}") if("${CUR_MD5}" STREQUAL "${FILE_MD5}")
set(${VAR} ${FILE} PARENT_SCOPE) set(${VAR} ${FILE} PARENT_SCOPE)
return() return()
endif() endif()
endforeach() endforeach()
endfunction() endfunction()
function(download_file URL DEST EXPECTED_MD5) function(download_file URL DEST EXPECTED_MD5)
get_filename_component(FILENAME "${URL}" NAME) get_filename_component(FILENAME "${URL}" NAME)
file_md5_if_exists("${DEST}" CUR_MD5) file_md5_if_exists("${DEST}" CUR_MD5)
if(NOT "${EXPECTED_MD5}" STREQUAL "${CUR_MD5}") if(NOT "${EXPECTED_MD5}" STREQUAL "${CUR_MD5}")
search_downloads(${EXPECTED_MD5} DLPATH) search_downloads(${EXPECTED_MD5} DLPATH)
if(NOT("${DLPATH}" STREQUAL "")) if(NOT("${DLPATH}" STREQUAL ""))
message("* Copying ${FILENAME} from ${DLPATH}") message("* Copying ${FILENAME} from ${DLPATH}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy execute_process(COMMAND "${CMAKE_COMMAND}" -E copy
"${DLPATH}" "${DLPATH}"
"${DEST}") "${DEST}")
return() return()
endif() endif()
message("* Downloading ${FILENAME}") message("* Downloading ${FILENAME}")
file(DOWNLOAD "${URL}" "${DEST}" EXPECTED_MD5 "${EXPECTED_MD5}" SHOW_PROGRESS) file(DOWNLOAD "${URL}" "${DEST}" EXPECTED_MD5 "${EXPECTED_MD5}" SHOW_PROGRESS)
endif() endif()
endfunction() endfunction()
# Download a file and uncompress it # Download a file and uncompress it
function(download_file_unzip URL ZIP_TYPE ZIP_DEST ZIP_MD5 UNZIP_DEST UNZIP_MD5) function(download_file_unzip URL ZIP_TYPE ZIP_DEST ZIP_MD5 UNZIP_DEST UNZIP_MD5)
get_filename_component(FILENAME "${URL}" NAME) get_filename_component(FILENAME "${URL}" NAME)
file_md5_if_exists("${UNZIP_DEST}" CUR_UNZIP_MD5) file_md5_if_exists("${UNZIP_DEST}" CUR_UNZIP_MD5)
# Redownload if the MD5 of the uncompressed file doesn't match # Redownload if the MD5 of the uncompressed file doesn't match
if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}") if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}")
download_file("${URL}" "${ZIP_DEST}" "${ZIP_MD5}") download_file("${URL}" "${ZIP_DEST}" "${ZIP_MD5}")
if(EXISTS "${ZIP_DEST}") if(EXISTS "${ZIP_DEST}")
message("* Decompressing ${FILENAME}") message("* Decompressing ${FILENAME}")
if("${ZIP_TYPE}" STREQUAL "gz") if("${ZIP_TYPE}" STREQUAL "gz")
execute_process(COMMAND execute_process(COMMAND
"${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/depends/gunzip.pl" "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/depends/gunzip.pl"
"${ZIP_DEST}" --force) "${ZIP_DEST}" --force)
else() else()
message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}") message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}")
endif() endif()
if(NOT EXISTS "${UNZIP_DEST}") if(NOT EXISTS "${UNZIP_DEST}")
message(SEND_ERROR "File failed to unzip to ${UNZIP_DEST}") message(SEND_ERROR "File failed to unzip to ${UNZIP_DEST}")
else() else()
file(MD5 "${UNZIP_DEST}" CUR_UNZIP_MD5) file(MD5 "${UNZIP_DEST}" CUR_UNZIP_MD5)
if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}") if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}")
message(SEND_ERROR "MD5 mismatch: ${UNZIP_DEST}: expected ${UNZIP_MD5}, got ${CUR_UNZIP_MD5}") message(SEND_ERROR "MD5 mismatch: ${UNZIP_DEST}: expected ${UNZIP_MD5}, got ${CUR_UNZIP_MD5}")
endif()
endif()
endif() endif()
endif()
endif() endif()
endif()
endfunction() endfunction()

@ -32,11 +32,11 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
################################################################################################## ##################################################################################################
# #
# CMake script for finding TinyXML. # CMake script for finding TinyXML.
# #
# Input variables: # Input variables:
# #
# - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in # - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
# ${TinyXML_ROOT_DIR}/include # ${TinyXML_ROOT_DIR}/include
# ${TinyXML_ROOT_DIR}/libs # ${TinyXML_ROOT_DIR}/libs
@ -46,23 +46,23 @@
# preference is given to the CMake variable. # preference is given to the CMake variable.
# Use this variable for finding packages installed in a nonstandard location, or for enforcing # Use this variable for finding packages installed in a nonstandard location, or for enforcing
# that one of multiple package installations is picked up. # that one of multiple package installations is picked up.
# #
# #
# Cache variables (not intended to be used in CMakeLists.txt files) # Cache variables (not intended to be used in CMakeLists.txt files)
# #
# - TinyXML_INCLUDE_DIR: Absolute path to package headers. # - TinyXML_INCLUDE_DIR: Absolute path to package headers.
# - TinyXML_LIBRARY: Absolute path to library. # - TinyXML_LIBRARY: Absolute path to library.
# #
# #
# Output variables: # Output variables:
# #
# - TinyXML_FOUND: Boolean that indicates if the package was found # - TinyXML_FOUND: Boolean that indicates if the package was found
# - TinyXML_INCLUDE_DIRS: Paths to the necessary header files # - TinyXML_INCLUDE_DIRS: Paths to the necessary header files
# - TinyXML_LIBRARIES: Package libraries # - TinyXML_LIBRARIES: Package libraries
# #
# #
# Example usage: # Example usage:
# #
# find_package(TinyXML) # find_package(TinyXML)
# if(NOT TinyXML_FOUND) # if(NOT TinyXML_FOUND)
# # Error handling # # Error handling
@ -71,19 +71,19 @@
# include_directories(${TinyXML_INCLUDE_DIRS} ...) # include_directories(${TinyXML_INCLUDE_DIRS} ...)
# ... # ...
# target_link_libraries(my_target ${TinyXML_LIBRARIES}) # target_link_libraries(my_target ${TinyXML_LIBRARIES})
# #
################################################################################################## ##################################################################################################
# Get package location hint from environment variable (if any) # Get package location hint from environment variable (if any)
if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR}) if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR})
set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
"TinyXML base directory location (optional, used for nonstandard installation paths)") "TinyXML base directory location (optional, used for nonstandard installation paths)")
endif() endif()
# Search path for nonstandard package locations # Search path for nonstandard package locations
if(TinyXML_ROOT_DIR) if(TinyXML_ROOT_DIR)
set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH) set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH)
set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH) set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH)
endif() endif()
# Find headers and libraries # Find headers and libraries
@ -102,6 +102,6 @@ set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriatel
unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
if(TinyXML_FOUND) if(TinyXML_FOUND)
set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR}) set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
set(TinyXML_LIBRARIES ${TinyXML_LIBRARY}) set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})
endif() endif()

@ -1,62 +1,62 @@
# 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
# Set up build types
if(CMAKE_CONFIGURATION_TYPES)
SET(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE)
else(CMAKE_CONFIGURATION_TYPES)
set(DFHACK_TYPE_HELP "Choose the type of build, options are: Release and RelWithDebInfo")
# Prevent cmake C module attempts to overwrite our help string
if (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "${DFHACK_TYPE_HELP}")
else (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "${DFHACK_TYPE_HELP}")
endif (NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;RelWithDebInfo")
endif(CMAKE_CONFIGURATION_TYPES)
OPTION(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF)
OPTION(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON)
## some generic CMake magic ## some generic CMake magic
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(dfhack) project(dfhack)
if("${CMAKE_GENERATOR}" STREQUAL Ninja) if("${CMAKE_GENERATOR}" STREQUAL Ninja)
if("${CMAKE_VERSION}" VERSION_LESS 3.9) if("${CMAKE_VERSION}" VERSION_LESS 3.9)
message(WARNING "You are using an old version of CMake (${CMAKE_VERSION}) with Ninja. This may result in ninja errors - see docs/Compile.rst for more details. Upgrading your CMake version is recommended.") message(WARNING "You are using an old version of CMake (${CMAKE_VERSION}) with Ninja. This may result in ninja errors - see docs/Compile.rst for more details. Upgrading your CMake version is recommended.")
endif() endif()
endif() endif()
macro(CHECK_GCC COMPILER_PATH) # Set up build types
execute_process(COMMAND ${COMPILER_PATH} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT) if(CMAKE_CONFIGURATION_TYPES)
string(STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT) set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE)
if (${GCC_VERSION_OUT} VERSION_LESS "4.8") else(CMAKE_CONFIGURATION_TYPES)
message(SEND_ERROR "${COMPILER_PATH} version ${GCC_VERSION_OUT} cannot be used - use GCC 4.8 or later") set(DFHACK_TYPE_HELP "Choose the type of build, options are: Release and RelWithDebInfo")
elseif (${GCC_VERSION_OUT} VERSION_GREATER "4.9.9") # Prevent cmake C module attempts to overwrite our help string
# GCC 5 changes ABI name mangling to enable C++11 changes. if(NOT CMAKE_BUILD_TYPE)
# This must be disabled to enable linking against DF. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "${DFHACK_TYPE_HELP}")
# http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/ else(NOT CMAKE_BUILD_TYPE)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "${DFHACK_TYPE_HELP}")
endif() endif(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;RelWithDebInfo")
endif(CMAKE_CONFIGURATION_TYPES)
option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF)
option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON)
macro(CHECK_GCC compiler_path)
execute_process(COMMAND ${compiler_path} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT)
string(STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT)
if(${GCC_VERSION_OUT} VERSION_LESS "4.8")
message(SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 4.8 or later")
elseif(${GCC_VERSION_OUT} VERSION_GREATER "4.9.9")
# GCC 5 changes ABI name mangling to enable C++11 changes.
# This must be disabled to enable linking against DF.
# http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
endmacro() endmacro()
if(UNIX) if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
CHECK_GCC(${CMAKE_C_COMPILER}) check_gcc(${CMAKE_C_COMPILER})
else() else()
message(SEND_ERROR "C compiler is not GCC") message(SEND_ERROR "C compiler is not GCC")
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
CHECK_GCC(${CMAKE_CXX_COMPILER}) check_gcc(${CMAKE_CXX_COMPILER})
else() else()
message(SEND_ERROR "C++ compiler is not GCC") message(SEND_ERROR "C++ compiler is not GCC")
endif() endif()
endif() endif()
if(WIN32) if(WIN32)
if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919)) if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919))
message(SEND_ERROR "MSVC 2015 or 2017 is required") message(SEND_ERROR "MSVC 2015 or 2017 is required")
endif() endif()
endif() endif()
# Ask for C++11 standard from compilers # Ask for C++11 standard from compilers
@ -67,52 +67,52 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC) if(MSVC)
# disable C4819 code-page warning # disable C4819 code-page warning
add_definitions( "/wd4819" ) add_definitions("/wd4819")
# Disable use of POSIX name warnings # disable use of POSIX name warnings
add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS") add_definitions("/D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS")
# supress C4503 - VC++ dislikes if a name is too long. If you get # supress C4503 - VC++ dislikes if a name is too long. If you get
# weird and mysterious linking errors, you can disable this, but you'll have to # weird and mysterious linking errors, you can disable this, but you'll have to
# deal with a LOT of compiler noise over it # deal with a LOT of compiler noise over it
# see https://msdn.microsoft.com/en-us/library/074af4b6.aspx # see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
add_definitions( "/wd4503") add_definitions("/wd4503")
# suppress C4267 - VC++ complains whenever we implicitly convert an integer to # suppress C4267 - VC++ complains whenever we implicitly convert an integer to
# a smaller type, and most of the time this is just conversion from 64 to 32 bits # a smaller type, and most of the time this is just conversion from 64 to 32 bits
# for things like vector sizes, which are never that big anyway. # for things like vector sizes, which are never that big anyway.
add_definitions( "/wd4267") add_definitions("/wd4267")
endif() endif()
# Automatically detect architecture based on Visual Studio generator # Automatically detect architecture based on Visual Studio generator
IF(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH) if(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH)
IF(${CMAKE_GENERATOR} MATCHES "Win64") if(${CMAKE_GENERATOR} MATCHES "Win64")
SET(DFHACK_BUILD_ARCH "64") set(DFHACK_BUILD_ARCH "64")
ELSE() else()
SET(DFHACK_BUILD_ARCH "32") set(DFHACK_BUILD_ARCH "32")
ENDIF() endif()
ELSE() else()
SET(DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')") set(DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')")
ENDIF() endif()
IF("${DFHACK_BUILD_ARCH}" STREQUAL "32") if("${DFHACK_BUILD_ARCH}" STREQUAL "32")
SET(DFHACK_BUILD_32 1) set(DFHACK_BUILD_32 1)
SET(DFHACK_BUILD_64 0) set(DFHACK_BUILD_64 0)
set(DFHACK_SETARCH "i386") set(DFHACK_SETARCH "i386")
ELSEIF("${DFHACK_BUILD_ARCH}" STREQUAL "64") elseif("${DFHACK_BUILD_ARCH}" STREQUAL "64")
SET(DFHACK_BUILD_32 0) set(DFHACK_BUILD_32 0)
SET(DFHACK_BUILD_64 1) set(DFHACK_BUILD_64 1)
set(DFHACK_SETARCH "x86_64") set(DFHACK_SETARCH "x86_64")
ADD_DEFINITIONS(-DDFHACK64) add_definitions(-DDFHACK64)
ELSE() else()
MESSAGE(SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}") message(SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}")
ENDIF() endif()
IF(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
SET(DFHACK_NATIVE_BUILD_DIR "DFHACK_NATIVE_BUILD_DIR-NOTFOUND" CACHE FILEPATH "Path to a native build directory") set(DFHACK_NATIVE_BUILD_DIR "DFHACK_NATIVE_BUILD_DIR-NOTFOUND" CACHE FILEPATH "Path to a native build directory")
INCLUDE("${DFHACK_NATIVE_BUILD_DIR}/ImportExecutables.cmake") include("${DFHACK_NATIVE_BUILD_DIR}/ImportExecutables.cmake")
ENDIF() endif()
find_package(Perl REQUIRED) find_package(Perl REQUIRED)
@ -121,34 +121,34 @@ find_package(Perl REQUIRED)
# Check for MFC! # Check for MFC!
find_package(MFC QUIET) find_package(MFC QUIET)
if(MFC_FOUND OR (NOT MSVC)) if(MFC_FOUND OR (NOT MSVC))
OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
else() else()
OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF) option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF)
endif() endif()
if(CMAKE_USE_FOLDERS) if(CMAKE_USE_FOLDERS)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
else() else()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF) set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
endif() endif()
# macro for setting up IDE folders without nasty IF()s everywhere # macro for setting up IDE folders without nasty if()s everywhere
MACRO(IDE_FOLDER target folder) macro(IDE_FOLDER target folder)
if(CMAKE_USE_FOLDERS) if(CMAKE_USE_FOLDERS)
SET_PROPERTY(TARGET ${target} PROPERTY FOLDER ${folder}) set_property(TARGET ${target} PROPERTY FOLDER ${folder})
endif() endif()
ENDMACRO() endmacro()
SET(CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH
${dfhack_SOURCE_DIR}/CMake/Modules ${dfhack_SOURCE_DIR}/CMake/Modules
${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH}
) )
# generates compile_commands.json, used for autocompletion by some editors # generates compile_commands.json, used for autocompletion by some editors
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXSourceCompiles) include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(" check_cxx_source_compiles("
#include <cstdlib> #include <cstdlib>
#include <cuchar> #include <cuchar>
int main(void) { int main(void) {
@ -164,11 +164,11 @@ endif()
# mixing the build system with the source code is ugly and stupid. enforce the opposite :) # mixing the build system with the source code is ugly and stupid. enforce the opposite :)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.") message(FATAL_ERROR "In-source builds are not allowed.")
endif() endif()
# make sure all the necessary submodules have been set up # make sure all the necessary submodules have been set up
if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhack_SOURCE_DIR}/depends/clsocket/CMakeLists.txt) if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhack_SOURCE_DIR}/depends/clsocket/CMakeLists.txt)
message(SEND_ERROR "One or more required submodules could not be found! Run 'git submodule update --init' from the root DFHack directory. (See the section 'Getting the Code' in docs/Compile.rst)") message(SEND_ERROR "One or more required submodules could not be found! Run 'git submodule update --init' from the root DFHack directory. (See the section 'Getting the Code' in docs/Compile.rst)")
endif() endif()
@ -185,68 +185,69 @@ set(DFHACK_BUILD_ID "" CACHE STRING "Build ID (should be specified on command li
## where to install things (after the build is done, classic 'make install' or package structure) ## where to install things (after the build is done, classic 'make install' or package structure)
# the dfhack libraries will be installed here: # the dfhack libraries will be installed here:
IF(UNIX) if(UNIX)
# put the lib into DF/hack # put the lib into DF/hack
SET(DFHACK_LIBRARY_DESTINATION hack) set(DFHACK_LIBRARY_DESTINATION hack)
SET(DFHACK_EGGY_DESTINATION libs) set(DFHACK_EGGY_DESTINATION libs)
ELSE() else()
# windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile...
SET(DFHACK_LIBRARY_DESTINATION .) set(DFHACK_LIBRARY_DESTINATION .)
SET(DFHACK_EGGY_DESTINATION .) set(DFHACK_EGGY_DESTINATION .)
ENDIF() endif()
# external tools will be installed here: # external tools will be installed here:
SET(DFHACK_BINARY_DESTINATION .) set(DFHACK_BINARY_DESTINATION .)
# dfhack data goes here: # dfhack data goes here:
SET(DFHACK_DATA_DESTINATION hack) set(DFHACK_DATA_DESTINATION hack)
# plugin libs go here: # plugin libs go here:
SET(DFHACK_PLUGIN_DESTINATION hack/plugins) set(DFHACK_PLUGIN_DESTINATION hack/plugins)
# dfhack header files go here: # dfhack header files go here:
SET(DFHACK_INCLUDES_DESTINATION hack/include) set(DFHACK_INCLUDES_DESTINATION hack/include)
# dfhack lua files go here: # dfhack lua files go here:
SET(DFHACK_LUA_DESTINATION hack/lua) set(DFHACK_LUA_DESTINATION hack/lua)
# the windows .lib file goes here: # the windows .lib file goes here:
SET(DFHACK_DEVLIB_DESTINATION hack) set(DFHACK_DEVLIB_DESTINATION hack)
# user documentation goes here: # user documentation goes here:
SET(DFHACK_USERDOC_DESTINATION hack) set(DFHACK_USERDOC_DESTINATION hack)
# developer documentation goes here: # developer documentation goes here:
SET(DFHACK_DEVDOC_DESTINATION hack) set(DFHACK_DEVDOC_DESTINATION hack)
## some options for the user/developer to play with # some options for the user/developer to play with
OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON) option(BUILD_LIBRARY "Build the library that goes into DF." ON)
OPTION(BUILD_PLUGINS "Build the plugins." ON) option(BUILD_PLUGINS "Build the plugins." ON)
SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
IF(UNIX) if(UNIX)
## flags for GCC ## flags for GCC
# default to hidden symbols # default to hidden symbols
# build 32bit # build 32bit
# ensure compatibility with older CPUs # ensure compatibility with older CPUs
# enable C++11 features # enable C++11 features
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99) add_definitions(-D_GLIBCXX_USE_C99)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic")
IF(DFHACK_BUILD_64) if(DFHACK_BUILD_64)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx")
ELSE() else()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686")
ENDIF() endif()
STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ELSEIF(MSVC) elseif(MSVC)
# for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od")
STRING(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
STRING(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ENDIF() endif()
# use shared libraries for protobuf # use shared libraries for protobuf
ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS) add_definitions(-DPROTOBUF_USE_DLLS)
ADD_DEFINITIONS(-DLUA_BUILD_AS_DLL) add_definitions(-DLUA_BUILD_AS_DLL)
if(APPLE) if(APPLE)
add_definitions(-D_DARWIN) add_definitions(-D_DARWIN)
@ -262,95 +263,93 @@ endif()
include(CMake/DownloadFile.cmake) include(CMake/DownloadFile.cmake)
if(WIN32) if(WIN32)
# Download zlib on Windows # Download zlib on Windows
set(ZLIB_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/depends/zlib/lib/win${DFHACK_BUILD_ARCH}) set(ZLIB_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/depends/zlib/lib/win${DFHACK_BUILD_ARCH})
if(${DFHACK_BUILD_ARCH} STREQUAL "64") if(${DFHACK_BUILD_ARCH} STREQUAL "64")
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib" download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib ${ZLIB_DOWNLOAD_DIR}/zlib.lib
"a3b2fc6b68efafa89b0882e354fc8418") "a3b2fc6b68efafa89b0882e354fc8418")
else() else()
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib" download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib ${ZLIB_DOWNLOAD_DIR}/zlib.lib
"f4ebaa21d9de28566e88b1edfcdff901") "f4ebaa21d9de28566e88b1edfcdff901")
endif() endif()
# Move zlib to the build folder so possible 32 and 64-bit builds
# in the same source tree don't conflict
file(COPY ${CMAKE_SOURCE_DIR}/depends/zlib
DESTINATION ${CMAKE_BINARY_DIR}/depends/)
file(COPY ${ZLIB_DOWNLOAD_DIR}/zlib.lib
DESTINATION ${CMAKE_BINARY_DIR}/depends/zlib/lib/)
# Do the same for SDLreal.dll
# (DFHack doesn't require this at build time, so no need to move it to the build folder)
set(SDLREAL_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH})
if(${DFHACK_BUILD_ARCH} STREQUAL "64")
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-SDL.dll"
${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll
"1ae242c4b94cb03756a1288122a66faf")
else()
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-SDL.dll"
${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll
"5a09604daca6b2b5ce049d79af935d6a")
endif()
endif()
option(EXTERNAL_LIBSTDCXX "macOS only: Avoid installing the DFHack-provided libstdc++." OFF) # Move zlib to the build folder so possible 32 and 64-bit builds
if(APPLE) # in the same source tree don't conflict
# libstdc++ (GCC 4.8.5 for OS X 10.6) file(COPY ${CMAKE_SOURCE_DIR}/depends/zlib
# fixes crash-on-unwind bug in DF's libstdc++ DESTINATION ${CMAKE_BINARY_DIR}/depends/)
set(LIBSTDCXX_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/package/darwin/osx${DFHACK_BUILD_ARCH}) file(COPY ${ZLIB_DOWNLOAD_DIR}/zlib.lib
DESTINATION ${CMAKE_BINARY_DIR}/depends/zlib/lib/)
if(${GCC_VERSION_OUT} VERSION_LESS "4.9")
set(LIBSTDCXX_GCC_VER "48") # Do the same for SDLreal.dll
else() # (DFHack doesn't require this at build time, so no need to move it to the build folder)
set(LIBSTDCXX_GCC_VER "7") set(SDLREAL_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH})
set(LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7") if(${DFHACK_BUILD_ARCH} STREQUAL "64")
endif() download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-SDL.dll"
${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll
if(${DFHACK_BUILD_ARCH} STREQUAL "64") "1ae242c4b94cb03756a1288122a66faf")
if(${LIBSTDCXX_GCC_VER} STREQUAL "48")
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc48-libstdcxx.6.dylib.gz"
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"cf26ed588be8e83c8e3a49919793b416"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"16dc6dbd4ecde7f9b95bb6dc91f07404")
else() else()
# GCC 7 download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-SDL.dll"
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc7-libstdcxx.6.dylib.gz" ${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll
"gz" "5a09604daca6b2b5ce049d79af935d6a")
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"81314b7846f9e8806409bef2160c76e6"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"93b6cf4b01e9a9084a508fd6a4a88992")
endif() endif()
endif()
else() # 32-bit if(APPLE)
# libstdc++ (GCC 4.8.5 for OS X 10.6)
# fixes crash-on-unwind bug in DF's libstdc++
set(LIBSTDCXX_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/package/darwin/osx${DFHACK_BUILD_ARCH})
if(${LIBSTDCXX_GCC_VER} STREQUAL "48") if(${GCC_VERSION_OUT} VERSION_LESS "4.9")
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc48-libstdcxx.6.dylib.gz" set(LIBSTDCXX_GCC_VER "48")
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"40f3d83871b114f0279240626311621b"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"c3f5678b8204917e03870834902c3e8b")
else() else()
# GCC 7 set(LIBSTDCXX_GCC_VER "7")
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc7-libstdcxx.6.dylib.gz" set(LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7")
"gz" endif()
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"dbd213171f66edb90d204d525f10c969" if(${DFHACK_BUILD_ARCH} STREQUAL "64")
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib if(${LIBSTDCXX_GCC_VER} STREQUAL "48")
"b14c857e7e485a097c70a9ccd3132da7") download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc48-libstdcxx.6.dylib.gz"
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"cf26ed588be8e83c8e3a49919793b416"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"16dc6dbd4ecde7f9b95bb6dc91f07404")
else()
# GCC 7
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc7-libstdcxx.6.dylib.gz"
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"81314b7846f9e8806409bef2160c76e6"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"93b6cf4b01e9a9084a508fd6a4a88992")
endif()
else() # 32-bit
if(${LIBSTDCXX_GCC_VER} STREQUAL "48")
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc48-libstdcxx.6.dylib.gz"
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"40f3d83871b114f0279240626311621b"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"c3f5678b8204917e03870834902c3e8b")
else()
# GCC 7
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc7-libstdcxx.6.dylib.gz"
"gz"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib.gz
"dbd213171f66edb90d204d525f10c969"
${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
"b14c857e7e485a097c70a9ccd3132da7")
endif()
endif() endif()
endif()
if(NOT EXTERNAL_LIBSTDCXX) if(NOT EXTERNAL_LIBSTDCXX)
install(PROGRAMS ${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib install(PROGRAMS ${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
DESTINATION ./hack/) DESTINATION ./hack/)
endif() endif()
endif() endif()
#### expose depends #### #### expose depends ####
@ -388,10 +387,10 @@ if(EXTERNAL_TINYXML)
if(NOT TinyXML_FOUND) if(NOT TinyXML_FOUND)
message(SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF.") message(SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF.")
endif() endif()
SET(DFHACK_TINYXML "tinyxml") set(DFHACK_TINYXML "tinyxml")
else() else()
include_directories(depends/tinyxml) include_directories(depends/tinyxml)
SET(DFHACK_TINYXML "dfhack-tinyxml") set(DFHACK_TINYXML "dfhack-tinyxml")
endif() endif()
include_directories(depends/tthread) include_directories(depends/tthread)
@ -405,8 +404,8 @@ if(NOT GIT_FOUND)
endif() endif()
# build the lib itself # build the lib itself
IF(BUILD_LIBRARY) if(BUILD_LIBRARY)
add_subdirectory (library) add_subdirectory(library)
install(FILES LICENSE.rst docs/changelog.txt DESTINATION ${DFHACK_USERDOC_DESTINATION}) install(FILES LICENSE.rst docs/changelog.txt DESTINATION ${DFHACK_USERDOC_DESTINATION})
endif() endif()
@ -416,131 +415,128 @@ install(FILES "${CMAKE_BINARY_DIR}/dfhack_setarch.txt" DESTINATION "${DFHACK_DAT
install(DIRECTORY dfhack-config/ DESTINATION dfhack-config/default) install(DIRECTORY dfhack-config/ DESTINATION dfhack-config/default)
install(DIRECTORY test DESTINATION "${DFHACK_DATA_DESTINATION}") install(DIRECTORY test DESTINATION "${DFHACK_DATA_DESTINATION}")
#build the plugins # build the plugins
IF(BUILD_PLUGINS) if(BUILD_PLUGINS)
add_subdirectory (plugins) add_subdirectory(plugins)
endif() endif()
add_subdirectory(scripts) add_subdirectory(scripts)
find_package(Sphinx QUIET) find_package(Sphinx QUIET)
if (BUILD_DOCS) if(BUILD_DOCS)
if (NOT SPHINX_FOUND) if(NOT SPHINX_FOUND)
message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled") message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled")
endif() endif()
file(GLOB SPHINX_DEPS file(GLOB SPHINX_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst" "${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/changelog.txt" "${CMAKE_CURRENT_SOURCE_DIR}/docs/changelog.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_changelog.py" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_changelog.py"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png" "${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*" "${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*"
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py" "${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt"
) )
file(GLOB_RECURSE SPHINX_SCRIPT_DEPS file(GLOB_RECURSE SPHINX_SCRIPT_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb"
) )
set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS} set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS}
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst" "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
) )
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo") set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo")
set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE) set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT ${SPHINX_OUTPUT} add_custom_command(OUTPUT ${SPHINX_OUTPUT}
COMMAND ${SPHINX_EXECUTABLE} COMMAND ${SPHINX_EXECUTABLE}
-a -E -q -b html -a -E -q -b html
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/html" "${CMAKE_CURRENT_SOURCE_DIR}/docs/html"
-w "${CMAKE_CURRENT_SOURCE_DIR}/docs/_sphinx-warnings.txt" -w "${CMAKE_CURRENT_SOURCE_DIR}/docs/_sphinx-warnings.txt"
-j 2 -j 2
DEPENDS ${SPHINX_DEPS} DEPENDS ${SPHINX_DEPS}
COMMENT "Building HTML documentation with Sphinx" COMMENT "Building HTML documentation with Sphinx"
) )
add_custom_target(dfhack_docs ALL add_custom_target(dfhack_docs ALL
DEPENDS ${SPHINX_OUTPUT} DEPENDS ${SPHINX_OUTPUT}
) )
# Sphinx doesn't touch this file if it didn't make changes, # Sphinx doesn't touch this file if it didn't make changes,
# which makes CMake think it didn't complete # which makes CMake think it didn't complete
add_custom_command(TARGET dfhack_docs POST_BUILD add_custom_command(TARGET dfhack_docs POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT}) COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT})
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/ install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/
DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs)
) install(FILES docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})
install(FILES docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION}) install(FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}")
install(FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}")
endif() endif()
# Packaging with CPack! # Packaging with CPack!
SET(DFHACK_PACKAGE_SUFFIX "") set(DFHACK_PACKAGE_SUFFIX "")
IF(UNIX) if(UNIX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
string(STRIP ${GCC_VERSION} GCC_VERSION) string(STRIP ${GCC_VERSION} GCC_VERSION)
SET(DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}") set(DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}")
SET(CPACK_GENERATOR "TBZ2") set(CPACK_GENERATOR "TBZ2")
ELSEIF(WIN32) elseif(WIN32)
SET(CPACK_GENERATOR "ZIP") set(CPACK_GENERATOR "ZIP")
ENDIF() endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
IF(APPLE) if(APPLE)
set(DFHACK_PACKAGE_PLATFORM_NAME OSX) set(DFHACK_PACKAGE_PLATFORM_NAME OSX)
ELSE() else()
set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME}) set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
ENDIF() endif()
# set on command line # set on command line
if(DFHACK_BUILD_ID STREQUAL "") if(DFHACK_BUILD_ID STREQUAL "")
set(DFHACK_BUILD_ID_PACKAGE "") set(DFHACK_BUILD_ID_PACKAGE "")
else() else()
set(DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-") set(DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-")
endif() endif()
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}") set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}")
INCLUDE(CPack) include(CPack)
OPTION(DFHACK_INCLUDE_CORE "Download and include Dwarf Fortress core files in DFHack. Useful for local testing, but should not be used in releases." OFF) option(DFHACK_INCLUDE_CORE "Download and include Dwarf Fortress core files in DFHack. Useful for local testing, but should not be used in releases." OFF)
IF(DFHACK_INCLUDE_CORE) if(DFHACK_INCLUDE_CORE)
STRING(REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}") string(REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}")
STRING(REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}") string(REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}")
IF(UNIX) if(UNIX)
IF(APPLE) if(APPLE)
STRING(APPEND DF_CORE_FILENAME "_osx") string(APPEND DF_CORE_FILENAME "_osx")
ELSE() else()
STRING(APPEND DF_CORE_FILENAME "_linux") string(APPEND DF_CORE_FILENAME "_linux")
ENDIF() endif()
IF(DFHACK_BUILD_32) if(DFHACK_BUILD_32)
STRING(APPEND DF_CORE_FILENAME "32") string(APPEND DF_CORE_FILENAME "32")
ENDIF() endif()
STRING(APPEND DF_CORE_FILENAME ".tar.bz2") string(APPEND DF_CORE_FILENAME ".tar.bz2")
ELSE() else()
STRING(APPEND DF_CORE_FILENAME "_win") string(APPEND DF_CORE_FILENAME "_win")
IF(DFHACK_BUILD_32) if(DFHACK_BUILD_32)
STRING(APPEND DF_CORE_FILENAME "32") string(APPEND DF_CORE_FILENAME "32")
ENDIF() endif()
STRING(APPEND DF_CORE_FILENAME ".zip") string(APPEND DF_CORE_FILENAME ".zip")
ENDIF() endif()
SET(DF_CORE_URL "http://bay12games.com/dwarves/${DF_CORE_FILENAME}") set(DF_CORE_URL "http://bay12games.com/dwarves/${DF_CORE_FILENAME}")
IF (NOT EXISTS "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}") if(NOT EXISTS "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}")
FILE(DOWNLOAD "${DF_CORE_URL}" "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" SHOW_PROGRESS) file(DOWNLOAD "${DF_CORE_URL}" "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" SHOW_PROGRESS)
ENDIF() endif()
FILE(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core") file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core")
FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
IF(UNIX) if(UNIX)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
ELSE() else()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "../${DF_CORE_FILENAME}" --format=zip execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "../${DF_CORE_FILENAME}" --format=zip
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
FILE(REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll") file(REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll")
ENDIF() endif()
INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/df-core/" install(DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
DESTINATION .) DESTINATION .)
ENDIF() endif()
#INCLUDE(FindSphinx.cmake)
# Store old build arch # Store old build arch
SET(DFHACK_BUILD_ARCH_PREV "${DFHACK_BUILD_ARCH}" CACHE STRING "Previous build architecture" FORCE) set(DFHACK_BUILD_ARCH_PREV "${DFHACK_BUILD_ARCH}" CACHE STRING "Previous build architecture" FORCE)

@ -1,4 +1,4 @@
#list depends here. # list depends here.
add_subdirectory(lua) add_subdirectory(lua)
add_subdirectory(md5) add_subdirectory(md5)
add_subdirectory(protobuf) add_subdirectory(protobuf)
@ -9,11 +9,11 @@ if(NOT TinyXML_FOUND)
endif() endif()
add_subdirectory(tthread) add_subdirectory(tthread)
OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" OFF) option(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" OFF)
OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF) option(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF)
add_subdirectory(jsoncpp-sub EXCLUDE_FROM_ALL) add_subdirectory(jsoncpp-sub EXCLUDE_FROM_ALL)
# build clsocket static and only as a dependency. Setting those options here overrides its own default settings. # build clsocket static and only as a dependency. Setting those options here overrides its own default settings.
OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." OFF) option(CLSOCKET_SHARED "Build clsocket lib as shared." OFF)
OPTION(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." ON) option(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." ON)
add_subdirectory(clsocket) add_subdirectory(clsocket)
IDE_FOLDER(clsocket "Depends") ide_folder(clsocket "Depends")

@ -1,118 +1,109 @@
PROJECT ( lua CXX ) project(lua CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLUA_USE_APICHECK") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLUA_USE_APICHECK")
# Make bit32 library available (for things like bit32.extract()) # Make bit32 library available (for things like bit32.extract())
ADD_DEFINITIONS(-DLUA_COMPAT_BITLIB) add_definitions(-DLUA_COMPAT_BITLIB)
IF(WIN32) if(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE /wd4334 ) add_definitions(-D_CRT_SECURE_NO_DEPRECATE /wd4334)
ELSE() else()
ADD_DEFINITIONS ( -DLUA_USE_POSIX -DLUA_USE_DLOPEN ) add_definitions(-DLUA_USE_POSIX -DLUA_USE_DLOPEN)
SET ( LIBS m dl ) set(LIBS m dl)
ENDIF() endif()
IF(UNIX) if(UNIX)
ADD_DEFINITIONS(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
IF(DFHACK_BUILD_64) if(DFHACK_BUILD_64)
SET(CMAKE_C_FLAGS "-m64 -mno-avx") set(CMAKE_C_FLAGS "-m64 -mno-avx")
ELSE() else()
SET(CMAKE_C_FLAGS "-m32") set(CMAKE_C_FLAGS "-m32")
ENDIF() endif()
ENDIF() endif()
SET (HDR_LIBLUA set(HDR_LIBLUA
include/lapi.h include/lapi.h
include/lauxlib.h include/lauxlib.h
include/lcode.h include/lcode.h
include/lctype.h include/lctype.h
include/ldebug.h include/ldebug.h
include/ldo.h include/ldo.h
include/lfunc.h include/lfunc.h
include/lgc.h include/lgc.h
include/llex.h include/llex.h
include/llimits.h include/llimits.h
include/lmem.h include/lmem.h
include/lobject.h include/lobject.h
include/lopcodes.h include/lopcodes.h
include/lparser.h include/lparser.h
include/lstate.h include/lstate.h
include/lstring.h include/lstring.h
include/ltable.h include/ltable.h
include/ltm.h include/ltm.h
include/lua.h include/lua.h
include/luaconf.h include/luaconf.h
include/lualib.h include/lualib.h
include/lundump.h include/lundump.h
include/lvm.h include/lvm.h
include/lzio.h include/lzio.h
) )
SET_SOURCE_FILES_PROPERTIES(${HDR_LIBLUA} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${HDR_LIBLUA} PROPERTIES HEADER_FILE_ONLY TRUE)
include_directories(include) include_directories(include)
# Build Libraries # Build Libraries
SET (SRC_LIBLUA set(SRC_LIBLUA
src/lapi.c src/lapi.c
src/lauxlib.c src/lauxlib.c
src/lbaselib.c src/lbaselib.c
src/lbitlib.c src/lbitlib.c
src/lcode.c src/lcode.c
src/lcorolib.c src/lcorolib.c
src/lctype.c src/lctype.c
src/ldblib.c src/ldblib.c
src/ldebug.c src/ldebug.c
src/ldo.c src/ldo.c
src/ldump.c src/ldump.c
src/lfunc.c src/lfunc.c
src/lgc.c src/lgc.c
src/linit.c src/linit.c
src/liolib.c src/liolib.c
src/llex.c src/llex.c
src/lmathlib.c src/lmathlib.c
src/lmem.c src/lmem.c
src/loadlib.c src/loadlib.c
src/lobject.c src/lobject.c
src/lopcodes.c src/lopcodes.c
src/loslib.c src/loslib.c
src/lparser.c src/lparser.c
src/lstate.c src/lstate.c
src/lstring.c src/lstring.c
src/lstrlib.c src/lstrlib.c
src/ltable.c src/ltable.c
src/ltablib.c src/ltablib.c
src/ltm.c src/ltm.c
src/lundump.c src/lundump.c
src/lutf8lib.c src/lutf8lib.c
src/lvm.c src/lvm.c
src/lzio.c src/lzio.c
) )
# compile with C++ compiler # compile with C++ compiler
set_source_files_properties(${SRC_LIBLUA} PROPERTIES LANGUAGE CXX) set_source_files_properties(${SRC_LIBLUA} PROPERTIES LANGUAGE CXX)
# append headers to sources to make them show up in MSVC GUI # append headers to sources to make them show up in MSVC GUI
LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA}) list(APPEND SRC_LIBLUA ${HDR_LIBLUA})
ADD_LIBRARY ( lua SHARED ${SRC_LIBLUA} ) add_library(lua SHARED ${SRC_LIBLUA})
TARGET_LINK_LIBRARIES ( lua ${LIBS}) target_link_libraries(lua ${LIBS})
if (MSVC) if(MSVC)
# need no space to prevent /FI from being stripped: https://github.com/DFHack/dfhack/issues/1455 # need no space to prevent /FI from being stripped: https://github.com/DFHack/dfhack/issues/1455
target_compile_options(lua PRIVATE "/FIdfhack_llimits.h") target_compile_options(lua PRIVATE "/FIdfhack_llimits.h")
else () else()
target_compile_options(lua PRIVATE -include dfhack_llimits.h) target_compile_options(lua PRIVATE -include dfhack_llimits.h)
endif () endif()
install(TARGETS lua install(TARGETS lua
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
IDE_FOLDER(lua "Depends")
#SET ( SRC_LUA src/lua.c )
#SET ( SRC_LUAC src/luac.c src/print.c )
#ADD_EXECUTABLE ( lua ${SRC_LUA} ${LUA_RC_FILE})
#ADD_EXECUTABLE ( luac ${SRC_LUAC} ${LUAC_RC_FILE})
#TARGET_LINK_LIBRARIES ( lua liblua )
#TARGET_LINK_LIBRARIES ( luac liblua_static )
ide_folder(lua "Depends")

@ -1,6 +1,6 @@
project(dfhack-md5) project(dfhack-md5)
ADD_LIBRARY(dfhack-md5 STATIC EXCLUDE_FROM_ALL md5.cpp md5wrapper.cpp) add_library(dfhack-md5 STATIC EXCLUDE_FROM_ALL md5.cpp md5wrapper.cpp)
IDE_FOLDER(dfhack-md5 "Depends") ide_folder(dfhack-md5 "Depends")
IF(UNIX) if(UNIX)
SET_TARGET_PROPERTIES(dfhack-md5 PROPERTIES COMPILE_FLAGS "-Wno-strict-aliasing") set_target_properties(dfhack-md5 PROPERTIES COMPILE_FLAGS "-Wno-strict-aliasing")
ENDIF() endif()

@ -1,195 +1,195 @@
PROJECT(protobuf) project(protobuf)
SET(HASH_MAP_H <unordered_map>) set(HASH_MAP_H <unordered_map>)
SET(HASH_SET_H <unordered_map>) set(HASH_SET_H <unordered_map>)
SET(HASH_NAMESPACE std) set(HASH_NAMESPACE std)
SET(HASH_MAP_CLASS unordered_map) set(HASH_MAP_CLASS unordered_map)
SET(HASH_SET_CLASS unordered_set) set(HASH_SET_CLASS unordered_set)
SET(HAVE_HASH_MAP 1) set(HAVE_HASH_MAP 1)
SET(HAVE_HASH_SET 1) set(HAVE_HASH_SET 1)
IF (HAVE_HASH_MAP EQUAL 0) if(HAVE_HASH_MAP EQUAL 0)
MESSAGE(SEND_ERROR "Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.") message(SEND_ERROR "Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.")
ENDIF() endif()
IF(UNIX) if(UNIX)
FIND_PACKAGE(Threads REQUIRED) find_package(Threads REQUIRED)
ENDIF() endif()
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")
SET(LIBPROTOBUF_LITE_HDRS set(LIBPROTOBUF_LITE_HDRS
google/protobuf/io/coded_stream.h google/protobuf/io/coded_stream.h
google/protobuf/io/coded_stream_inl.h google/protobuf/io/coded_stream_inl.h
google/protobuf/stubs/common.h google/protobuf/stubs/common.h
${CMAKE_CURRENT_BINARY_DIR}/config.h ${CMAKE_CURRENT_BINARY_DIR}/config.h
google/protobuf/extension_set.h google/protobuf/extension_set.h
google/protobuf/generated_message_util.h google/protobuf/generated_message_util.h
google/protobuf/stubs/hash.h google/protobuf/stubs/hash.h
google/protobuf/stubs/map-util.h google/protobuf/stubs/map-util.h
google/protobuf/message_lite.h google/protobuf/message_lite.h
google/protobuf/stubs/once.h google/protobuf/stubs/once.h
google/protobuf/repeated_field.h google/protobuf/repeated_field.h
google/protobuf/stubs/stl_util-inl.h google/protobuf/stubs/stl_util-inl.h
google/protobuf/wire_format_lite.h google/protobuf/wire_format_lite.h
google/protobuf/wire_format_lite_inl.h google/protobuf/wire_format_lite_inl.h
google/protobuf/io/zero_copy_stream.h google/protobuf/io/zero_copy_stream.h
google/protobuf/io/zero_copy_stream_impl_lite.h google/protobuf/io/zero_copy_stream_impl_lite.h
google/protobuf/io/gzip_stream.h google/protobuf/io/gzip_stream.h
google/protobuf/io/zero_copy_stream_impl.h google/protobuf/io/zero_copy_stream_impl.h
) )
SET(LIBPROTOBUF_FULL_HDRS set(LIBPROTOBUF_FULL_HDRS
google/protobuf/descriptor.h google/protobuf/descriptor.h
google/protobuf/descriptor.pb.h google/protobuf/descriptor.pb.h
google/protobuf/descriptor_database.h google/protobuf/descriptor_database.h
google/protobuf/dynamic_message.h google/protobuf/dynamic_message.h
google/protobuf/generated_message_reflection.h google/protobuf/generated_message_reflection.h
google/protobuf/compiler/importer.h google/protobuf/compiler/importer.h
google/protobuf/message.h google/protobuf/message.h
google/protobuf/compiler/parser.h google/protobuf/compiler/parser.h
google/protobuf/io/printer.h google/protobuf/io/printer.h
google/protobuf/reflection_ops.h google/protobuf/reflection_ops.h
google/protobuf/service.h google/protobuf/service.h
google/protobuf/stubs/strutil.h google/protobuf/stubs/strutil.h
google/protobuf/stubs/substitute.h google/protobuf/stubs/substitute.h
google/protobuf/text_format.h google/protobuf/text_format.h
google/protobuf/io/tokenizer.h google/protobuf/io/tokenizer.h
google/protobuf/unknown_field_set.h google/protobuf/unknown_field_set.h
google/protobuf/wire_format.h google/protobuf/wire_format.h
) )
LIST(APPEND LIBPROTOBUF_FULL_HDRS ${LIBPROTOBUF_LITE_HDRS}) list(APPEND LIBPROTOBUF_FULL_HDRS ${LIBPROTOBUF_LITE_HDRS})
SET(LIBPROTOBUF_LITE_SRCS set(LIBPROTOBUF_LITE_SRCS
google/protobuf/io/coded_stream.cc google/protobuf/io/coded_stream.cc
google/protobuf/stubs/common.cc google/protobuf/stubs/common.cc
google/protobuf/extension_set.cc google/protobuf/extension_set.cc
google/protobuf/generated_message_util.cc google/protobuf/generated_message_util.cc
google/protobuf/message_lite.cc google/protobuf/message_lite.cc
google/protobuf/stubs/once.cc google/protobuf/stubs/once.cc
google/protobuf/repeated_field.cc google/protobuf/repeated_field.cc
google/protobuf/wire_format_lite.cc google/protobuf/wire_format_lite.cc
google/protobuf/io/zero_copy_stream.cc google/protobuf/io/zero_copy_stream.cc
google/protobuf/io/zero_copy_stream_impl_lite.cc google/protobuf/io/zero_copy_stream_impl_lite.cc
google/protobuf/io/gzip_stream.cc google/protobuf/io/gzip_stream.cc
google/protobuf/io/zero_copy_stream_impl.cc google/protobuf/io/zero_copy_stream_impl.cc
) )
SET(LIBPROTOBUF_FULL_SRCS set(LIBPROTOBUF_FULL_SRCS
google/protobuf/descriptor.cc google/protobuf/descriptor.cc
google/protobuf/descriptor.pb.cc google/protobuf/descriptor.pb.cc
google/protobuf/descriptor_database.cc google/protobuf/descriptor_database.cc
google/protobuf/dynamic_message.cc google/protobuf/dynamic_message.cc
google/protobuf/extension_set_heavy.cc google/protobuf/extension_set_heavy.cc
google/protobuf/generated_message_reflection.cc google/protobuf/generated_message_reflection.cc
google/protobuf/compiler/importer.cc google/protobuf/compiler/importer.cc
google/protobuf/io/gzip_stream.cc google/protobuf/io/gzip_stream.cc
google/protobuf/message.cc google/protobuf/message.cc
google/protobuf/compiler/parser.cc google/protobuf/compiler/parser.cc
google/protobuf/io/printer.cc google/protobuf/io/printer.cc
google/protobuf/reflection_ops.cc google/protobuf/reflection_ops.cc
google/protobuf/service.cc google/protobuf/service.cc
google/protobuf/stubs/structurally_valid.cc google/protobuf/stubs/structurally_valid.cc
google/protobuf/stubs/strutil.cc google/protobuf/stubs/strutil.cc
google/protobuf/stubs/substitute.cc google/protobuf/stubs/substitute.cc
google/protobuf/text_format.cc google/protobuf/text_format.cc
google/protobuf/io/tokenizer.cc google/protobuf/io/tokenizer.cc
google/protobuf/unknown_field_set.cc google/protobuf/unknown_field_set.cc
google/protobuf/wire_format.cc google/protobuf/wire_format.cc
google/protobuf/io/zero_copy_stream_impl.cc google/protobuf/io/zero_copy_stream_impl.cc
) )
SET(LIBPROTOC_HDRS set(LIBPROTOC_HDRS
google/protobuf/compiler/code_generator.h google/protobuf/compiler/code_generator.h
google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/command_line_interface.h
google/protobuf/compiler/cpp/cpp_enum.h google/protobuf/compiler/cpp/cpp_enum.h
google/protobuf/compiler/cpp/cpp_enum_field.h google/protobuf/compiler/cpp/cpp_enum_field.h
google/protobuf/compiler/cpp/cpp_extension.h google/protobuf/compiler/cpp/cpp_extension.h
google/protobuf/compiler/cpp/cpp_field.h google/protobuf/compiler/cpp/cpp_field.h
google/protobuf/compiler/cpp/cpp_file.h google/protobuf/compiler/cpp/cpp_file.h
google/protobuf/compiler/cpp/cpp_generator.h google/protobuf/compiler/cpp/cpp_generator.h
google/protobuf/compiler/cpp/cpp_helpers.h google/protobuf/compiler/cpp/cpp_helpers.h
google/protobuf/compiler/cpp/cpp_message.h google/protobuf/compiler/cpp/cpp_message.h
google/protobuf/compiler/cpp/cpp_message_field.h google/protobuf/compiler/cpp/cpp_message_field.h
google/protobuf/compiler/cpp/cpp_primitive_field.h google/protobuf/compiler/cpp/cpp_primitive_field.h
google/protobuf/compiler/cpp/cpp_service.h google/protobuf/compiler/cpp/cpp_service.h
google/protobuf/compiler/cpp/cpp_string_field.h google/protobuf/compiler/cpp/cpp_string_field.h
google/protobuf/compiler/plugin.h google/protobuf/compiler/plugin.h
google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/plugin.pb.h
google/protobuf/compiler/subprocess.h google/protobuf/compiler/subprocess.h
google/protobuf/compiler/zip_writer.h google/protobuf/compiler/zip_writer.h
) )
SET(LIBPROTOC_SRCS set(LIBPROTOC_SRCS
google/protobuf/compiler/code_generator.cc google/protobuf/compiler/code_generator.cc
google/protobuf/compiler/command_line_interface.cc google/protobuf/compiler/command_line_interface.cc
google/protobuf/compiler/cpp/cpp_enum.cc google/protobuf/compiler/cpp/cpp_enum.cc
google/protobuf/compiler/cpp/cpp_enum_field.cc google/protobuf/compiler/cpp/cpp_enum_field.cc
google/protobuf/compiler/cpp/cpp_extension.cc google/protobuf/compiler/cpp/cpp_extension.cc
google/protobuf/compiler/cpp/cpp_field.cc google/protobuf/compiler/cpp/cpp_field.cc
google/protobuf/compiler/cpp/cpp_file.cc google/protobuf/compiler/cpp/cpp_file.cc
google/protobuf/compiler/cpp/cpp_generator.cc google/protobuf/compiler/cpp/cpp_generator.cc
google/protobuf/compiler/cpp/cpp_helpers.cc google/protobuf/compiler/cpp/cpp_helpers.cc
google/protobuf/compiler/cpp/cpp_message.cc google/protobuf/compiler/cpp/cpp_message.cc
google/protobuf/compiler/cpp/cpp_message_field.cc google/protobuf/compiler/cpp/cpp_message_field.cc
google/protobuf/compiler/cpp/cpp_primitive_field.cc google/protobuf/compiler/cpp/cpp_primitive_field.cc
google/protobuf/compiler/cpp/cpp_service.cc google/protobuf/compiler/cpp/cpp_service.cc
google/protobuf/compiler/cpp/cpp_string_field.cc google/protobuf/compiler/cpp/cpp_string_field.cc
google/protobuf/compiler/plugin.cc google/protobuf/compiler/plugin.cc
google/protobuf/compiler/plugin.pb.cc google/protobuf/compiler/plugin.pb.cc
google/protobuf/compiler/subprocess.cc google/protobuf/compiler/subprocess.cc
google/protobuf/compiler/zip_writer.cc google/protobuf/compiler/zip_writer.cc
) )
LIST(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS}) list(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS})
IF(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation")
ELSEIF(MSVC) elseif(MSVC)
# Disable warnings for integer conversion to smaller type # Disable warnings for integer conversion to smaller type
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
ENDIF() endif()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
SET(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) set(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Protobuf shared libraries # Protobuf shared libraries
ADD_LIBRARY(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS}) add_library(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS})
IDE_FOLDER(protobuf "Depends") ide_folder(protobuf "Depends")
ADD_LIBRARY(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS}) add_library(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS})
IDE_FOLDER(protobuf-lite "Depends") ide_folder(protobuf-lite "Depends")
SET_TARGET_PROPERTIES(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) set_target_properties(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
SET_TARGET_PROPERTIES(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) set_target_properties(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
TARGET_LINK_LIBRARIES(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) target_link_libraries(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
TARGET_LINK_LIBRARIES(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) target_link_libraries(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
install(TARGETS protobuf-lite install(TARGETS protobuf-lite
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
IF(NOT CMAKE_CROSSCOMPILING) if(NOT CMAKE_CROSSCOMPILING)
# Protobuf compiler shared library # Protobuf compiler shared library
ADD_LIBRARY(protoc SHARED ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS}) add_library(protoc SHARED ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS})
IDE_FOLDER(protoc "Depends") ide_folder(protoc "Depends")
SET_TARGET_PROPERTIES(protoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS) set_target_properties(protoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS)
TARGET_LINK_LIBRARIES(protoc protobuf) target_link_libraries(protoc protobuf)
# Protobuf compiler executable # Protobuf compiler executable
ADD_EXECUTABLE(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h) add_executable(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h)
IDE_FOLDER(protoc-bin "Depends") ide_folder(protoc-bin "Depends")
SET_TARGET_PROPERTIES(protoc-bin PROPERTIES OUTPUT_NAME protoc) set_target_properties(protoc-bin PROPERTIES OUTPUT_NAME protoc)
TARGET_LINK_LIBRARIES(protoc-bin protoc) target_link_libraries(protoc-bin protoc)
EXPORT(TARGETS protoc-bin FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake ) export(TARGETS protoc-bin FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
ENDIF() endif()

@ -1,5 +1,5 @@
if(NOT TinyXML_FOUND) if(NOT TinyXML_FOUND)
project(dfhack-tinyxml) project(dfhack-tinyxml)
ADD_LIBRARY(dfhack-tinyxml STATIC EXCLUDE_FROM_ALL tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp) add_library(dfhack-tinyxml STATIC EXCLUDE_FROM_ALL tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp)
IDE_FOLDER(dfhack-tinyxml "Depends") ide_folder(dfhack-tinyxml "Depends")
endif() endif()

@ -1,6 +1,6 @@
PROJECT(dfhack-tinythread) project(dfhack-tinythread)
ADD_LIBRARY(dfhack-tinythread STATIC EXCLUDE_FROM_ALL tinythread.cpp tinythread.h fast_mutex.h) add_library(dfhack-tinythread STATIC EXCLUDE_FROM_ALL tinythread.cpp tinythread.h fast_mutex.h)
if(UNIX) if(UNIX)
target_link_libraries(dfhack-tinythread pthread) target_link_libraries(dfhack-tinythread pthread)
endif() endif()
IDE_FOLDER(dfhack-tinythread "Depends") ide_folder(dfhack-tinythread "Depends")

@ -1,277 +1,277 @@
PROJECT (dfapi) project(dfapi)
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
# prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES # prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES
CMAKE_POLICY(SET CMP0022 NEW) cmake_policy(SET CMP0022 NEW)
## build options # build options
OPTION(BUILD_DEVEL "Install/package files required for development (For SDK)." OFF) option(BUILD_DEVEL "Install/package files required for development(For SDK)." OFF)
IF(UNIX) if(UNIX)
OPTION(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF) option(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
ENDIF() endif()
include_directories (proto) include_directories(proto)
include_directories (include) include_directories(include)
execute_process(COMMAND ${PERL_EXECUTABLE} xml/list.pl xml ${dfapi_SOURCE_DIR}/include/df ";" execute_process(COMMAND ${PERL_EXECUTABLE} xml/list.pl xml ${dfapi_SOURCE_DIR}/include/df ";"
WORKING_DIRECTORY ${dfapi_SOURCE_DIR} WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
OUTPUT_VARIABLE GENERATED_HDRS) OUTPUT_VARIABLE GENERATED_HDRS)
SET_SOURCE_FILES_PROPERTIES(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE) set_source_files_properties(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE)
SET(MAIN_HEADERS set(MAIN_HEADERS
include/Internal.h include/Internal.h
include/DFHack.h include/DFHack.h
include/DFHackVersion.h include/DFHackVersion.h
include/Console.h include/Console.h
include/Core.h include/Core.h
include/ColorText.h include/ColorText.h
include/DataDefs.h include/DataDefs.h
include/DataIdentity.h include/DataIdentity.h
include/Debug.h include/Debug.h
include/DebugManager.h include/DebugManager.h
include/VTableInterpose.h include/VTableInterpose.h
include/LuaWrapper.h include/LuaWrapper.h
include/LuaTools.h include/LuaTools.h
include/Error.h include/Error.h
include/Export.h include/Export.h
include/Hooks.h include/Hooks.h
include/MiscUtils.h include/MiscUtils.h
include/Module.h include/Module.h
include/Pragma.h include/Pragma.h
include/MemAccess.h include/MemAccess.h
include/Signal.hpp include/Signal.hpp
include/TileTypes.h include/TileTypes.h
include/Types.h include/Types.h
include/VersionInfo.h include/VersionInfo.h
include/VersionInfoFactory.h include/VersionInfoFactory.h
include/RemoteClient.h include/RemoteClient.h
include/RemoteServer.h include/RemoteServer.h
include/RemoteTools.h include/RemoteTools.h
) )
SET(MAIN_HEADERS_WINDOWS set(MAIN_HEADERS_WINDOWS
include/wdirent.h include/wdirent.h
) )
SET(MAIN_SOURCES set(MAIN_SOURCES
Core.cpp Core.cpp
ColorText.cpp ColorText.cpp
CompilerWorkAround.cpp CompilerWorkAround.cpp
DataDefs.cpp DataDefs.cpp
Debug.cpp Debug.cpp
Error.cpp Error.cpp
VTableInterpose.cpp VTableInterpose.cpp
LuaWrapper.cpp LuaWrapper.cpp
LuaTypes.cpp LuaTypes.cpp
LuaTools.cpp LuaTools.cpp
LuaApi.cpp LuaApi.cpp
DataStatics.cpp DataStatics.cpp
DataStaticsCtor.cpp DataStaticsCtor.cpp
DataStaticsFields.cpp DataStaticsFields.cpp
MiscUtils.cpp MiscUtils.cpp
Types.cpp Types.cpp
PluginManager.cpp PluginManager.cpp
TileTypes.cpp TileTypes.cpp
VersionInfoFactory.cpp VersionInfoFactory.cpp
RemoteClient.cpp RemoteClient.cpp
RemoteServer.cpp RemoteServer.cpp
RemoteTools.cpp RemoteTools.cpp
) )
SET(MAIN_SOURCES_WINDOWS set(MAIN_SOURCES_WINDOWS
Console-windows.cpp Console-windows.cpp
Hooks-windows.cpp Hooks-windows.cpp
PlugLoad-windows.cpp PlugLoad-windows.cpp
Process-windows.cpp Process-windows.cpp
) )
IF(WIN32) if(WIN32)
SOURCE_GROUP("Main\\Headers" FILES ${MAIN_HEADERS} ${MAIN_HEADERS_WINDOWS}) source_group("Main\\Headers" FILES ${MAIN_HEADERS} ${MAIN_HEADERS_WINDOWS})
SOURCE_GROUP("Main\\Sources" FILES ${MAIN_SOURCES} ${MAIN_SOURCES_WINDOWS}) source_group("Main\\Sources" FILES ${MAIN_SOURCES} ${MAIN_SOURCES_WINDOWS})
ENDIF() endif()
SET(MAIN_SOURCES_LINUX set(MAIN_SOURCES_LINUX
Console-posix.cpp Console-posix.cpp
Hooks-linux.cpp Hooks-linux.cpp
PlugLoad-posix.cpp PlugLoad-posix.cpp
Process-linux.cpp Process-linux.cpp
) )
SET(MAIN_SOURCES_DARWIN set(MAIN_SOURCES_DARWIN
Console-posix.cpp Console-posix.cpp
Hooks-darwin.cpp Hooks-darwin.cpp
PlugLoad-posix.cpp PlugLoad-posix.cpp
Process-darwin.cpp Process-darwin.cpp
) )
SET(MAIN_SOURCES_LINUX_EGGY set(MAIN_SOURCES_LINUX_EGGY
Console-linux.cpp Console-linux.cpp
Hooks-egg.cpp Hooks-egg.cpp
PlugLoad-linux.cpp PlugLoad-linux.cpp
Process-linux.cpp Process-linux.cpp
) )
SET(MODULE_HEADERS set(MODULE_HEADERS
include/modules/Buildings.h include/modules/Buildings.h
include/modules/Burrows.h include/modules/Burrows.h
include/modules/Constructions.h include/modules/Constructions.h
include/modules/Designations.h include/modules/Designations.h
include/modules/Engravings.h include/modules/Engravings.h
include/modules/EventManager.h include/modules/EventManager.h
include/modules/Filesystem.h include/modules/Filesystem.h
include/modules/Graphic.h include/modules/Graphic.h
include/modules/Gui.h include/modules/Gui.h
include/modules/GuiHooks.h include/modules/GuiHooks.h
include/modules/Items.h include/modules/Items.h
include/modules/Job.h include/modules/Job.h
include/modules/Kitchen.h include/modules/Kitchen.h
include/modules/MapCache.h include/modules/MapCache.h
include/modules/Maps.h include/modules/Maps.h
include/modules/Materials.h include/modules/Materials.h
include/modules/Notes.h include/modules/Notes.h
include/modules/Once.h include/modules/Once.h
include/modules/Persistence.h include/modules/Persistence.h
include/modules/Random.h include/modules/Random.h
include/modules/Renderer.h include/modules/Renderer.h
include/modules/Screen.h include/modules/Screen.h
include/modules/Translation.h include/modules/Translation.h
include/modules/Units.h include/modules/Units.h
include/modules/World.h include/modules/World.h
) )
SET( MODULE_SOURCES set(MODULE_SOURCES
modules/Buildings.cpp modules/Buildings.cpp
modules/Burrows.cpp modules/Burrows.cpp
modules/Constructions.cpp modules/Constructions.cpp
modules/Designations.cpp modules/Designations.cpp
modules/Engravings.cpp modules/Engravings.cpp
modules/EventManager.cpp modules/EventManager.cpp
modules/Filesystem.cpp modules/Filesystem.cpp
modules/Graphic.cpp modules/Graphic.cpp
modules/Gui.cpp modules/Gui.cpp
modules/Items.cpp modules/Items.cpp
modules/Job.cpp modules/Job.cpp
modules/Kitchen.cpp modules/Kitchen.cpp
modules/MapCache.cpp modules/MapCache.cpp
modules/Maps.cpp modules/Maps.cpp
modules/Materials.cpp modules/Materials.cpp
modules/Notes.cpp modules/Notes.cpp
modules/Once.cpp modules/Once.cpp
modules/Persistence.cpp modules/Persistence.cpp
modules/Random.cpp modules/Random.cpp
modules/Renderer.cpp modules/Renderer.cpp
modules/Screen.cpp modules/Screen.cpp
modules/Translation.cpp modules/Translation.cpp
modules/Units.cpp modules/Units.cpp
modules/Windows.cpp modules/Windows.cpp
modules/World.cpp modules/World.cpp
) )
SET(STATIC_FIELDS_FILES) set(STATIC_FIELDS_FILES)
FOREACH(GROUP other a b c d e f g h i j k l m n o p q r s t u v w x y z) foreach(GROUP other a b c d e f g h i j k l m n o p q r s t u v w x y z)
SET(STATIC_FIELDS_FILENAME ${dfhack_SOURCE_DIR}/library/DataStaticsFields/${GROUP}.cpp) set(STATIC_FIELDS_FILENAME ${dfhack_SOURCE_DIR}/library/DataStaticsFields/${GROUP}.cpp)
IF(${GROUP} STREQUAL "other") if(${GROUP} STREQUAL "other")
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields.inc") set(STATIC_FIELDS_INC_FILENAME "df/static.fields.inc")
ELSE() else()
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields-${GROUP}.inc") set(STATIC_FIELDS_INC_FILENAME "df/static.fields-${GROUP}.inc")
ENDIF() endif()
FILE(WRITE ${STATIC_FIELDS_FILENAME}.tmp file(WRITE ${STATIC_FIELDS_FILENAME}.tmp
"#define STATIC_FIELDS_GROUP\n" "#define STATIC_FIELDS_GROUP\n"
"#include \"../DataStaticsFields.cpp\"\n" "#include \"../DataStaticsFields.cpp\"\n"
"#include \"${STATIC_FIELDS_INC_FILENAME}\"\n" "#include \"${STATIC_FIELDS_INC_FILENAME}\"\n"
) )
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${STATIC_FIELDS_FILENAME}.tmp ${STATIC_FIELDS_FILENAME}) ${STATIC_FIELDS_FILENAME}.tmp ${STATIC_FIELDS_FILENAME})
FILE(REMOVE ${STATIC_FIELDS_FILENAME}.tmp) file(REMOVE ${STATIC_FIELDS_FILENAME}.tmp)
LIST(APPEND STATIC_FIELDS_FILES ${STATIC_FIELDS_FILENAME}) list(APPEND STATIC_FIELDS_FILES ${STATIC_FIELDS_FILENAME})
ENDFOREACH() endforeach()
LIST(APPEND MAIN_SOURCES ${STATIC_FIELDS_FILES}) list(APPEND MAIN_SOURCES ${STATIC_FIELDS_FILES})
IF(WIN32) if(WIN32)
SOURCE_GROUP("Modules\\Headers" FILES ${MODULE_HEADERS}) source_group("Modules\\Headers" FILES ${MODULE_HEADERS})
SOURCE_GROUP("Modules\\Sources" FILES ${MODULE_SOURCES}) source_group("Modules\\Sources" FILES ${MODULE_SOURCES})
SOURCE_GROUP("Generated" FILES ${GENERATED_HDRS}) source_group("Generated" FILES ${GENERATED_HDRS})
ENDIF() endif()
SET(PROJECT_HEADERS) set(PROJECT_HEADERS)
LIST(APPEND PROJECT_HEADERS ${MAIN_HEADERS}) list(APPEND PROJECT_HEADERS ${MAIN_HEADERS})
LIST(APPEND PROJECT_HEADERS ${MODULE_HEADERS}) list(APPEND PROJECT_HEADERS ${MODULE_HEADERS})
SET(PROJECT_SOURCES) set(PROJECT_SOURCES)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES}) list(APPEND PROJECT_SOURCES ${MAIN_SOURCES})
LIST(APPEND PROJECT_SOURCES ${MODULE_SOURCES}) list(APPEND PROJECT_SOURCES ${MODULE_SOURCES})
IF(UNIX) if(UNIX)
OPTION(BUILD_EGGY "Make DFHack strangely egg-shaped." OFF) option(BUILD_EGGY "Make DFHack strangely egg-shaped." OFF)
IF(BUILD_EGGY) if(BUILD_EGGY)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX_EGGY}) list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX_EGGY})
ELSEIF(APPLE) elseif(APPLE)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_DARWIN}) list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_DARWIN})
ELSE() else()
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX}) list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX})
ENDIF() endif()
ELSEIF(WIN32) elseif(WIN32)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_WINDOWS}) list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_WINDOWS})
LIST(APPEND PROJECT_HEADERS ${MAIN_HEADERS_WINDOWS}) list(APPEND PROJECT_HEADERS ${MAIN_HEADERS_WINDOWS})
ENDIF() endif()
# Protobuf # Protobuf
FILE(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto) file(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto)
STRING(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${PROJECT_PROTOS}") string(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${PROJECT_PROTOS}")
STRING(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}") string(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}")
STRING(REPLACE "/proto/" "/proto/tmp/" PROJECT_PROTO_TMP_FILES "${PROJECT_PROTO_SRCS};${PROJECT_PROTO_HDRS}") string(REPLACE "/proto/" "/proto/tmp/" PROJECT_PROTO_TMP_FILES "${PROJECT_PROTO_SRCS};${PROJECT_PROTO_HDRS}")
SET_SOURCE_FILES_PROPERTIES(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} set_source_files_properties(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
PROPERTIES GENERATED TRUE) PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing # Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing) # (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS) foreach(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
IF(NOT EXISTS ${file}) if(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto_core because '${file}' is missing") # message("Resetting generate_proto_core because '${file}' is missing")
FILE(REMOVE ${PROJECT_PROTO_TMP_FILES}) file(REMOVE ${PROJECT_PROTO_TMP_FILES})
BREAK() break()
ENDIF() endif()
ENDFOREACH() endforeach()
LIST(APPEND PROJECT_HEADERS ${PROJECT_PROTO_HDRS}) list(APPEND PROJECT_HEADERS ${PROJECT_PROTO_HDRS})
LIST(APPEND PROJECT_SOURCES ${PROJECT_PROTO_SRCS}) list(APPEND PROJECT_SOURCES ${PROJECT_PROTO_SRCS})
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${PROJECT_PROTO_TMP_FILES} OUTPUT ${PROJECT_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/ --cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PROJECT_PROTOS} ${PROJECT_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
${PROJECT_PROTO_TMP_FILES} ${PROJECT_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${CMAKE_CURRENT_SOURCE_DIR}/proto/
COMMENT "Generating core protobufs" COMMENT "Generating core protobufs"
DEPENDS protoc-bin ${PROJECT_PROTOS} DEPENDS protoc-bin ${PROJECT_PROTOS}
) )
IF(UNIX) if(UNIX)
SET_SOURCE_FILES_PROPERTIES(${PROJECT_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation") set_source_files_properties(${PROJECT_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation")
ENDIF() endif()
ADD_CUSTOM_TARGET(generate_proto_core DEPENDS ${PROJECT_PROTO_TMP_FILES}) add_custom_target(generate_proto_core DEPENDS ${PROJECT_PROTO_TMP_FILES})
# Merge headers into sources # Merge headers into sources
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( ${PROJECT_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SOURCES ${PROJECT_HEADERS}) list(APPEND PROJECT_SOURCES ${PROJECT_HEADERS})
# Generation # Generation
LIST(APPEND PROJECT_SOURCES ${GENERATED_HDRS}) list(APPEND PROJECT_SOURCES ${GENERATED_HDRS})
FILE(GLOB GENERATE_INPUT_SCRIPTS ${dfapi_SOURCE_DIR}/xml/*.pm ${dfapi_SOURCE_DIR}/xml/*.xslt) file(GLOB GENERATE_INPUT_SCRIPTS ${dfapi_SOURCE_DIR}/xml/*.pm ${dfapi_SOURCE_DIR}/xml/*.xslt)
FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/df.*.xml) file(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/df.*.xml)
set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml) set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml)
IF(NOT("${CMAKE_GENERATOR}" STREQUAL Ninja)) if(NOT("${CMAKE_GENERATOR}" STREQUAL Ninja))
# use BYPRODUCTS instead under Ninja to avoid rebuilds # use BYPRODUCTS instead under Ninja to avoid rebuilds
LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS}) list(APPEND CODEGEN_OUT ${GENERATED_HDRS})
ENDIF() endif()
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${CODEGEN_OUT} OUTPUT ${CODEGEN_OUT}
BYPRODUCTS ${GENERATED_HDRS} BYPRODUCTS ${GENERATED_HDRS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl
@ -282,143 +282,143 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${GENERATE_INPUT_XMLS} ${GENERATE_INPUT_SCRIPTS} DEPENDS ${GENERATE_INPUT_XMLS} ${GENERATE_INPUT_SCRIPTS}
) )
ADD_CUSTOM_TARGET(generate_headers add_custom_target(generate_headers
DEPENDS ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml) DEPENDS ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml)
IF(REMOVE_SYMBOLS_FROM_DF_STUBS) if(REMOVE_SYMBOLS_FROM_DF_STUBS)
IF(UNIX) if(UNIX)
# Don't produce debug info for generated stubs # Don't produce debug info for generated stubs
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES} set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "-g0 -O1") PROPERTIES COMPILE_FLAGS "-g0 -O1")
ELSE(WIN32) else(WIN32)
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES} set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/O1 /bigobj") PROPERTIES COMPILE_FLAGS "/O1 /bigobj")
ENDIF() endif()
ELSE() else()
IF(WIN32) if(WIN32)
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES} set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/Od /bigobj") PROPERTIES COMPILE_FLAGS "/Od /bigobj")
ENDIF() endif()
ENDIF() endif()
# Compilation # Compilation
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB) add_definitions(-DBUILD_DFHACK_LIB)
IF(UNIX) if(UNIX)
IF(CONSOLE_NO_CATCH) if(CONSOLE_NO_CATCH)
ADD_DEFINITIONS(-DCONSOLE_NO_CATCH) add_definitions(-DCONSOLE_NO_CATCH)
ENDIF() endif()
ENDIF() endif()
IF(APPLE) if(APPLE)
SET(PROJECT_LIBS dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) set(PROJECT_LIBS dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ELSEIF(UNIX) elseif(UNIX)
SET(PROJECT_LIBS rt dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) set(PROJECT_LIBS rt dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ELSE(WIN32) else(WIN32)
#FIXME: do we really need psapi? # FIXME: do we really need psapi?
SET(PROJECT_LIBS psapi dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) set(PROJECT_LIBS psapi dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ENDIF() endif()
set(VERSION_SRCS DFHackVersion.cpp) set(VERSION_SRCS DFHackVersion.cpp)
set(VERSION_HDRS include/git-describe.h) set(VERSION_HDRS include/git-describe.h)
SET_SOURCE_FILES_PROPERTIES(${VERSION_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${VERSION_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND VERSION_SRCS ${VERSION_HDRS}) list(APPEND VERSION_SRCS ${VERSION_HDRS})
ADD_LIBRARY(dfhack-version STATIC ${VERSION_SRCS}) add_library(dfhack-version STATIC ${VERSION_SRCS})
SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
DFHACK_VERSION="${DFHACK_VERSION}" DFHACK_VERSION="${DFHACK_VERSION}"
DF_VERSION="${DF_VERSION}" DF_VERSION="${DF_VERSION}"
DFHACK_RELEASE="${DFHACK_RELEASE}" DFHACK_RELEASE="${DFHACK_RELEASE}"
DFHACK_ABI_VERSION=${DFHACK_ABI_VERSION} DFHACK_ABI_VERSION=${DFHACK_ABI_VERSION}
) )
IF(DFHACK_PRERELEASE) if(DFHACK_PRERELEASE)
SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
DFHACK_PRERELEASE=1 DFHACK_PRERELEASE=1
) )
ENDIF() endif()
configure_file(git-describe.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake @ONLY) configure_file(git-describe.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake @ONLY)
if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index AND EXISTS ${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index) if(EXISTS ${CMAKE_SOURCE_DIR}/.git/index AND EXISTS ${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/git-describe.h add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/git-describe.h
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D dfhack_SOURCE_DIR:STRING=${dfhack_SOURCE_DIR} -D dfhack_SOURCE_DIR:STRING=${dfhack_SOURCE_DIR}
-D GIT_EXECUTABLE:STRING=${GIT_EXECUTABLE} -D GIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
COMMENT "Obtaining git commit information" COMMENT "Obtaining git commit information"
DEPENDS ${CMAKE_SOURCE_DIR}/.git/index DEPENDS ${CMAKE_SOURCE_DIR}/.git/index
${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index ${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index
${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
include/git-describe.h.in include/git-describe.h.in
) )
endif () endif()
ADD_LIBRARY(dfhack SHARED ${PROJECT_SOURCES}) add_library(dfhack SHARED ${PROJECT_SOURCES})
ADD_DEPENDENCIES(dfhack generate_proto_core) add_dependencies(dfhack generate_proto_core)
ADD_DEPENDENCIES(dfhack generate_headers) add_dependencies(dfhack generate_headers)
ADD_LIBRARY(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS}) add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS})
ADD_DEPENDENCIES(dfhack-client dfhack) add_dependencies(dfhack-client dfhack)
ADD_EXECUTABLE(dfhack-run dfhack-run.cpp) add_executable(dfhack-run dfhack-run.cpp)
ADD_EXECUTABLE(binpatch binpatch.cpp) add_executable(binpatch binpatch.cpp)
TARGET_LINK_LIBRARIES(binpatch dfhack-md5) target_link_libraries(binpatch dfhack-md5)
IF(BUILD_EGGY) if(BUILD_EGGY)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "egg" ) set_target_properties(dfhack PROPERTIES OUTPUT_NAME "egg" )
else() else()
IF(WIN32) if(WIN32)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "SDL" ) set_target_properties(dfhack PROPERTIES OUTPUT_NAME "SDL" )
ENDIF() endif()
endif()
if(WIN32)
set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
else()
set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "-include Export.h" )
set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" )
endif()
# effectively disables debug builds...
set_target_properties(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
if(APPLE)
set(DF_SDL_LIBRARY ${CMAKE_INSTALL_PREFIX}/libs/SDL.framework/Versions/A/SDL)
if(NOT EXISTS ${DF_SDL_LIBRARY})
message(SEND_ERROR "SDL framework not found. Make sure CMAKE_INSTALL_PREFIX is specified and correct.")
endif()
set(SDL_LIBRARY ${CMAKE_BINARY_DIR}/SDL)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DF_SDL_LIBRARY} ${SDL_LIBRARY})
set(CXX_LIBRARY ${CMAKE_INSTALL_PREFIX}/libs/libstdc++.6.dylib)
set(ZIP_LIBRARY /usr/lib/libz.dylib)
target_link_libraries(dfhack ${SDL_LIBRARY})
target_link_libraries(dfhack ${CXX_LIBRARY})
target_link_libraries(dfhack ${ZIP_LIBRARY})
target_link_libraries(dfhack ncurses)
set_target_properties(dfhack PROPERTIES VERSION 1.0.0)
set_target_properties(dfhack PROPERTIES SOVERSION 1.0.0)
endif() endif()
IF(WIN32) target_link_libraries(dfhack protobuf-lite clsocket lua jsoncpp_lib_static dfhack-version ${PROJECT_LIBS})
SET_TARGET_PROPERTIES(dfhack PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" ) set_target_properties(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "")
SET_TARGET_PROPERTIES(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
ELSE() target_link_libraries(dfhack-client protobuf-lite clsocket jsoncpp_lib_static)
SET_TARGET_PROPERTIES(dfhack PROPERTIES COMPILE_FLAGS "-include Export.h" ) target_link_libraries(dfhack-run dfhack-client)
SET_TARGET_PROPERTIES(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" )
ENDIF()
#effectively disables debug builds...
SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
IF(APPLE)
SET(DF_SDL_LIBRARY ${CMAKE_INSTALL_PREFIX}/libs/SDL.framework/Versions/A/SDL)
IF(NOT EXISTS ${DF_SDL_LIBRARY})
MESSAGE(SEND_ERROR "SDL framework not found. Make sure CMAKE_INSTALL_PREFIX is specified and correct.")
ENDIF()
SET(SDL_LIBRARY ${CMAKE_BINARY_DIR}/SDL)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DF_SDL_LIBRARY} ${SDL_LIBRARY})
SET(CXX_LIBRARY ${CMAKE_INSTALL_PREFIX}/libs/libstdc++.6.dylib)
SET(ZIP_LIBRARY /usr/lib/libz.dylib)
TARGET_LINK_LIBRARIES(dfhack ${SDL_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ${CXX_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ${ZIP_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ncurses)
SET_TARGET_PROPERTIES(dfhack PROPERTIES VERSION 1.0.0)
SET_TARGET_PROPERTIES(dfhack PROPERTIES SOVERSION 1.0.0)
ENDIF()
TARGET_LINK_LIBRARIES(dfhack protobuf-lite clsocket lua jsoncpp_lib_static dfhack-version ${PROJECT_LIBS})
SET_TARGET_PROPERTIES(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "")
TARGET_LINK_LIBRARIES(dfhack-client protobuf-lite clsocket jsoncpp_lib_static)
TARGET_LINK_LIBRARIES(dfhack-run dfhack-client)
if(APPLE) if(APPLE)
add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...") add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...")
endif() endif()
IF(UNIX) if(UNIX)
if (APPLE) if(APPLE)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack
DESTINATION .) DESTINATION .)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack-run install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack-run
DESTINATION .) DESTINATION .)
else() else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD # On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack
@ -426,53 +426,53 @@ IF(UNIX)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run
DESTINATION .) DESTINATION .)
endif() endif()
ELSE() else()
if(NOT BUILD_EGGY) if(NOT BUILD_EGGY)
# On windows, copy the renamed SDL so DF can still run. # On windows, copy the renamed SDL so DF can still run.
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH}/SDLreal.dll install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH}/SDLreal.dll
DESTINATION ${DFHACK_LIBRARY_DESTINATION}) DESTINATION ${DFHACK_LIBRARY_DESTINATION})
endif() endif()
ENDIF() endif()
#install the main lib # install the main lib
if(NOT BUILD_EGGY) if(NOT BUILD_EGGY)
install(TARGETS dfhack install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
else() else()
install(TARGETS dfhack install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_EGGY_DESTINATION} LIBRARY DESTINATION ${DFHACK_EGGY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_EGGY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_EGGY_DESTINATION})
endif() endif()
#install the offset file # install the offset file
install(FILES xml/symbols.xml install(FILES xml/symbols.xml
DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack DESTINATION ${DFHACK_DATA_DESTINATION})
#install the example autoexec file # install the example autoexec file
install(FILES ../dfhack.init-example ../onLoad.init-example install(FILES ../dfhack.init-example ../onLoad.init-example
DESTINATION ${DFHACK_BINARY_DESTINATION}) DESTINATION ${DFHACK_BINARY_DESTINATION})
install(TARGETS dfhack-run dfhack-client binpatch install(TARGETS dfhack-run dfhack-client binpatch
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
install(DIRECTORY lua/ install(DIRECTORY lua/
DESTINATION ${DFHACK_LUA_DESTINATION} DESTINATION ${DFHACK_LUA_DESTINATION}
FILES_MATCHING PATTERN "*.lua") FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY ${dfhack_SOURCE_DIR}/patches install(DIRECTORY ${dfhack_SOURCE_DIR}/patches
DESTINATION ${DFHACK_DATA_DESTINATION} DESTINATION ${DFHACK_DATA_DESTINATION}
FILES_MATCHING PATTERN "*.dif") FILES_MATCHING PATTERN "*.dif")
# Unused for so long that it's not even relevant now... # Unused for so long that it's not even relevant now...
if(BUILD_DEVEL) if(BUILD_DEVEL)
if(WIN32) if(WIN32)
install(TARGETS dfhack install(TARGETS dfhack
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION}) ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
endif() endif()
# note the ending '/'. This means *contents* of the directory are installed # note the ending '/'. This means *contents* of the directory are installed
# without the '/', the directory itself is installed # without the '/', the directory itself is installed
install(DIRECTORY include/ install(DIRECTORY include/
DESTINATION ${DFHACK_INCLUDES_DESTINATION} DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" PATTERN "*.inc" ) #linux: include FILES_MATCHING PATTERN "*.h" PATTERN "*.inc" )
endif() endif()

@ -1,64 +1,64 @@
INCLUDE(Plugins.cmake) include(Plugins.cmake)
OPTION(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF) option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
if(BUILD_STONESENSE) if(BUILD_STONESENSE)
add_subdirectory (stonesense) add_subdirectory(stonesense)
endif() endif()
OPTION(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF) option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD) if(BUILD_ISOWORLD)
add_subdirectory (isoworld) add_subdirectory(isoworld)
IF(UNIX) if(UNIX)
if (APPLE) if(APPLE)
#TODO: add an OSX runner script # TODO: add an OSX runner script
else() else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD # On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld
DESTINATION .) DESTINATION .)
endif() endif()
ENDIF() endif()
endif() endif()
OPTION(BUILD_DEV_PLUGINS "Build developer plugins." OFF) option(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
if(BUILD_DEV_PLUGINS) if(BUILD_DEV_PLUGINS)
add_subdirectory (devel) add_subdirectory(devel)
endif() endif()
OPTION(BUILD_RUBY "Build ruby binding." ON) option(BUILD_RUBY "Build ruby binding." ON)
if (BUILD_RUBY) if(BUILD_RUBY)
add_subdirectory (ruby) add_subdirectory(ruby)
endif() endif()
install(DIRECTORY lua/ install(DIRECTORY lua/
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
FILES_MATCHING PATTERN "*.lua") FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY raw/ install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.txt") FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY raw/ install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.diff") FILES_MATCHING PATTERN "*.diff")
# Protobuf # Protobuf
FILE(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto) file(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto)
STRING(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${PROJECT_PROTOS}") string(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${PROJECT_PROTOS}")
STRING(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}") string(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}")
STRING(REPLACE "/proto/" "/proto/tmp/" PROJECT_PROTO_TMP_FILES "${PROJECT_PROTO_SRCS};${PROJECT_PROTO_HDRS}") string(REPLACE "/proto/" "/proto/tmp/" PROJECT_PROTO_TMP_FILES "${PROJECT_PROTO_SRCS};${PROJECT_PROTO_HDRS}")
SET_SOURCE_FILES_PROPERTIES(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} set_source_files_properties(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
PROPERTIES GENERATED TRUE) PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing # Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing) # (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS) foreach(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
IF(NOT EXISTS ${file}) if(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto because '${file}' is missing") # message("Resetting generate_proto because '${file}' is missing")
FILE(REMOVE ${PROJECT_PROTO_TMP_FILES}) file(REMOVE ${PROJECT_PROTO_TMP_FILES})
BREAK() break()
ENDIF() endif()
ENDFOREACH() endforeach()
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${PROJECT_PROTO_TMP_FILES} OUTPUT ${PROJECT_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/ COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/
-I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
@ -70,126 +70,126 @@ ADD_CUSTOM_COMMAND(
COMMENT "Generating plugin protobufs" COMMENT "Generating plugin protobufs"
DEPENDS protoc-bin ${PROJECT_PROTOS} DEPENDS protoc-bin ${PROJECT_PROTOS}
) )
ADD_CUSTOM_TARGET(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES}) add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
SET_SOURCE_FILES_PROPERTIES( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
ADD_LIBRARY(buildingplan-lib STATIC buildingplan-lib.cpp) add_library(buildingplan-lib STATIC buildingplan-lib.cpp)
TARGET_LINK_LIBRARIES(buildingplan-lib dfhack) target_link_libraries(buildingplan-lib dfhack)
# Plugins # Plugins
OPTION(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON) option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if (BUILD_SUPPORTED) if(BUILD_SUPPORTED)
DFHACK_PLUGIN(3dveins 3dveins.cpp) dfhack_plugin(3dveins 3dveins.cpp)
DFHACK_PLUGIN(add-spatter add-spatter.cpp) dfhack_plugin(add-spatter add-spatter.cpp)
#DFHACK_PLUGIN(advtools advtools.cpp) # dfhack_plugin(advtools advtools.cpp)
DFHACK_PLUGIN(autochop autochop.cpp) dfhack_plugin(autochop autochop.cpp)
DFHACK_PLUGIN(autoclothing autoclothing.cpp) dfhack_plugin(autoclothing autoclothing.cpp)
DFHACK_PLUGIN(autodump autodump.cpp) dfhack_plugin(autodump autodump.cpp)
DFHACK_PLUGIN(autofarm autofarm.cpp) dfhack_plugin(autofarm autofarm.cpp)
DFHACK_PLUGIN(autogems autogems.cpp LINK_LIBRARIES jsoncpp_lib_static) dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(autohauler autohauler.cpp) dfhack_plugin(autohauler autohauler.cpp)
DFHACK_PLUGIN(autolabor autolabor.cpp) dfhack_plugin(autolabor autolabor.cpp)
DFHACK_PLUGIN(automaterial automaterial.cpp) dfhack_plugin(automaterial automaterial.cpp)
DFHACK_PLUGIN(automelt automelt.cpp) dfhack_plugin(automelt automelt.cpp)
DFHACK_PLUGIN(autotrade autotrade.cpp) dfhack_plugin(autotrade autotrade.cpp)
DFHACK_PLUGIN(blueprint blueprint.cpp LINK_LIBRARIES lua) dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(burrows burrows.cpp LINK_LIBRARIES lua) dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(building-hacks building-hacks.cpp LINK_LIBRARIES lua) dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(buildingplan buildingplan.cpp LINK_LIBRARIES buildingplan-lib) dfhack_plugin(buildingplan buildingplan.cpp LINK_LIBRARIES buildingplan-lib)
DFHACK_PLUGIN(changeitem changeitem.cpp) dfhack_plugin(changeitem changeitem.cpp)
DFHACK_PLUGIN(changelayer changelayer.cpp) dfhack_plugin(changelayer changelayer.cpp)
DFHACK_PLUGIN(changevein changevein.cpp) dfhack_plugin(changevein changevein.cpp)
DFHACK_PLUGIN(cleanconst cleanconst.cpp) dfhack_plugin(cleanconst cleanconst.cpp)
DFHACK_PLUGIN(cleaners cleaners.cpp) dfhack_plugin(cleaners cleaners.cpp)
DFHACK_PLUGIN(cleanowned cleanowned.cpp) dfhack_plugin(cleanowned cleanowned.cpp)
DFHACK_PLUGIN(command-prompt command-prompt.cpp) dfhack_plugin(command-prompt command-prompt.cpp)
DFHACK_PLUGIN(confirm confirm.cpp LINK_LIBRARIES lua) dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(createitem createitem.cpp) dfhack_plugin(createitem createitem.cpp)
DFHACK_PLUGIN(cursecheck cursecheck.cpp) dfhack_plugin(cursecheck cursecheck.cpp)
DFHACK_PLUGIN(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua) dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(deramp deramp.cpp) dfhack_plugin(deramp deramp.cpp)
DFHACK_PLUGIN(debug debug.cpp LINK_LIBRARIES jsoncpp_lib_static) dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(dig dig.cpp) dfhack_plugin(dig dig.cpp)
DFHACK_PLUGIN(digFlood digFlood.cpp) dfhack_plugin(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders) add_subdirectory(diggingInvaders)
DFHACK_PLUGIN(dwarfvet dwarfvet.cpp) dfhack_plugin(dwarfvet dwarfvet.cpp)
DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua) dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
add_subdirectory(embark-assistant) add_subdirectory(embark-assistant)
DFHACK_PLUGIN(embark-tools embark-tools.cpp) dfhack_plugin(embark-tools embark-tools.cpp)
DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua) dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp) dfhack_plugin(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp) dfhack_plugin(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(fix-armory fix-armory.cpp) dfhack_plugin(fix-armory fix-armory.cpp)
DFHACK_PLUGIN(fix-unit-occupancy fix-unit-occupancy.cpp) dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp) dfhack_plugin(fixveins fixveins.cpp)
DFHACK_PLUGIN(flows flows.cpp) dfhack_plugin(flows flows.cpp)
DFHACK_PLUGIN(follow follow.cpp) dfhack_plugin(follow follow.cpp)
DFHACK_PLUGIN(forceequip forceequip.cpp) dfhack_plugin(forceequip forceequip.cpp)
DFHACK_PLUGIN(fortplan fortplan.cpp LINK_LIBRARIES buildingplan-lib) dfhack_plugin(fortplan fortplan.cpp LINK_LIBRARIES buildingplan-lib)
DFHACK_PLUGIN(generated-creature-renamer generated-creature-renamer.cpp) dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp)
DFHACK_PLUGIN(getplants getplants.cpp) dfhack_plugin(getplants getplants.cpp)
DFHACK_PLUGIN(hotkeys hotkeys.cpp) dfhack_plugin(hotkeys hotkeys.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp) dfhack_plugin(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote) dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
DFHACK_PLUGIN(jobutils jobutils.cpp) dfhack_plugin(jobutils jobutils.cpp)
add_subdirectory(labormanager) add_subdirectory(labormanager)
DFHACK_PLUGIN(lair lair.cpp) dfhack_plugin(lair lair.cpp)
DFHACK_PLUGIN(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua) dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
DFHACK_PLUGIN(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread) dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread)
DFHACK_PLUGIN(manipulator manipulator.cpp) dfhack_plugin(manipulator manipulator.cpp)
DFHACK_PLUGIN(map-render map-render.cpp LINK_LIBRARIES lua) dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(misery misery.cpp) dfhack_plugin(misery misery.cpp)
DFHACK_PLUGIN(mode mode.cpp) dfhack_plugin(mode mode.cpp)
DFHACK_PLUGIN(mousequery mousequery.cpp) dfhack_plugin(mousequery mousequery.cpp)
DFHACK_PLUGIN(nestboxes nestboxes.cpp) dfhack_plugin(nestboxes nestboxes.cpp)
DFHACK_PLUGIN(orders orders.cpp LINK_LIBRARIES jsoncpp_lib_static) dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(pathable pathable.cpp LINK_LIBRARIES lua) dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(petcapRemover petcapRemover.cpp) dfhack_plugin(petcapRemover petcapRemover.cpp)
DFHACK_PLUGIN(plants plants.cpp) dfhack_plugin(plants plants.cpp)
DFHACK_PLUGIN(probe probe.cpp) dfhack_plugin(probe probe.cpp)
DFHACK_PLUGIN(prospector prospector.cpp) dfhack_plugin(prospector prospector.cpp)
DFHACK_PLUGIN(power-meter power-meter.cpp LINK_LIBRARIES lua) dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(regrass regrass.cpp) dfhack_plugin(regrass regrass.cpp)
add_subdirectory(remotefortressreader) add_subdirectory(remotefortressreader)
DFHACK_PLUGIN(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename) dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
add_subdirectory(rendermax) add_subdirectory(rendermax)
DFHACK_PLUGIN(resume resume.cpp) dfhack_plugin(resume resume.cpp)
DFHACK_PLUGIN(reveal reveal.cpp) dfhack_plugin(reveal reveal.cpp)
DFHACK_PLUGIN(search search.cpp) dfhack_plugin(search search.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp) dfhack_plugin(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(showmood showmood.cpp) dfhack_plugin(showmood showmood.cpp)
DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua) dfhack_plugin(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(sort sort.cpp LINK_LIBRARIES lua) dfhack_plugin(sort sort.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(steam-engine steam-engine.cpp) dfhack_plugin(steam-engine steam-engine.cpp)
DFHACK_PLUGIN(stockflow stockflow.cpp LINK_LIBRARIES lua) dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua)
add_subdirectory(stockpiles) add_subdirectory(stockpiles)
DFHACK_PLUGIN(stocks stocks.cpp) dfhack_plugin(stocks stocks.cpp)
DFHACK_PLUGIN(strangemood strangemood.cpp) dfhack_plugin(strangemood strangemood.cpp)
DFHACK_PLUGIN(tailor tailor.cpp) dfhack_plugin(tailor tailor.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp Brushes.h) dfhack_plugin(tiletypes tiletypes.cpp Brushes.h)
DFHACK_PLUGIN(title-folder title-folder.cpp) dfhack_plugin(title-folder title-folder.cpp)
DFHACK_PLUGIN(title-version title-version.cpp) dfhack_plugin(title-version title-version.cpp)
DFHACK_PLUGIN(trackstop trackstop.cpp) dfhack_plugin(trackstop trackstop.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp) dfhack_plugin(tubefill tubefill.cpp)
add_subdirectory(tweak) add_subdirectory(tweak)
DFHACK_PLUGIN(workflow workflow.cpp LINK_LIBRARIES lua) dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(workNow workNow.cpp) dfhack_plugin(workNow workNow.cpp)
DFHACK_PLUGIN(zone zone.cpp LINK_LIBRARIES lua) dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
endif() endif()
# this is the skeleton plugin. If you want to make your own, make a copy and then change it # this is the skeleton plugin. If you want to make your own, make a copy and then change it
OPTION(BUILD_SKELETON "Build the skeleton plugin." OFF) option(BUILD_SKELETON "Build the skeleton plugin." OFF)
if(BUILD_SKELETON) if(BUILD_SKELETON)
add_subdirectory(skeleton) add_subdirectory(skeleton)
endif() endif()
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt") if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt")
FILE(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt" "# You can add custom plugins here to avoid touching plugins/CMakeLists.txt, file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt" "# You can add custom plugins here to avoid touching plugins/CMakeLists.txt,
# This can be useful if you've made modifications to that file and try to # This can be useful if you've made modifications to that file and try to
# switch between branches that have also made modifications to it. # switch between branches that have also made modifications to it.
") ")
endif() endif()
INCLUDE(CMakeLists.custom.txt) include(CMakeLists.custom.txt)

@ -1,156 +1,156 @@
IF(UNIX) if(UNIX)
IF(NOT APPLE) if(NOT APPLE)
# Linux: Check for unresolved symbols at link time # Linux: Check for unresolved symbols at link time
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,defs") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,defs")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,defs") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,defs")
ENDIF() endif()
ENDIF() endif()
include_directories("${dfhack_SOURCE_DIR}/library/include") include_directories("${dfhack_SOURCE_DIR}/library/include")
include_directories("${dfhack_SOURCE_DIR}/library/proto") include_directories("${dfhack_SOURCE_DIR}/library/proto")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/proto") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/proto")
include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt") include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt")
MACRO(CAR var) macro(car var)
SET(${var} ${ARGV1}) set(${var} ${ARGV1})
ENDMACRO() endmacro()
MACRO(CDR var junk) macro(cdr var junk)
SET(${var} ${ARGN}) set(${var} ${ARGN})
ENDMACRO() endmacro()
MACRO(LIST_CONTAINS var value) macro(list_contains var value)
SET(${var}) set(${var})
FOREACH (value2 ${ARGN}) foreach(value2 ${ARGN})
IF (${value} STREQUAL ${value2}) if(${value} STREQUAL ${value2})
SET(${var} TRUE) set(${var} TRUE)
ENDIF() endif()
ENDFOREACH() endforeach()
ENDMACRO() endmacro()
MACRO(PARSE_ARGUMENTS prefix arg_names option_names) macro(parse_arguments prefix arg_names option_names)
SET(DEFAULT_ARGS) set(DEFAULT_ARGS)
FOREACH(arg_name ${arg_names}) foreach(arg_name ${arg_names})
SET(${prefix}_${arg_name}) set(${prefix}_${arg_name})
ENDFOREACH() endforeach()
FOREACH(option ${option_names}) foreach(option ${option_names})
SET(${prefix}_${option} FALSE) set(${prefix}_${option} FALSE)
ENDFOREACH() endforeach()
SET(current_arg_name DEFAULT_ARGS) set(current_arg_name DEFAULT_ARGS)
SET(current_arg_list) set(current_arg_list)
FOREACH(arg ${ARGN}) foreach(arg ${ARGN})
LIST_CONTAINS(is_arg_name ${arg} ${arg_names}) list_contains(is_arg_name ${arg} ${arg_names})
IF (is_arg_name) if(is_arg_name)
SET(${prefix}_${current_arg_name} ${current_arg_list}) set(${prefix}_${current_arg_name} ${current_arg_list})
SET(current_arg_name ${arg}) set(current_arg_name ${arg})
SET(current_arg_list) set(current_arg_list)
ELSE() else()
LIST_CONTAINS(is_option ${arg} ${option_names}) list_contains(is_option ${arg} ${option_names})
IF(is_option) if(is_option)
SET(${prefix}_${arg} TRUE) set(${prefix}_${arg} TRUE)
ELSE() else()
SET(current_arg_list ${current_arg_list} ${arg}) set(current_arg_list ${current_arg_list} ${arg})
ENDIF() endif()
ENDIF() endif()
ENDFOREACH() endforeach()
SET(${prefix}_${current_arg_name} ${current_arg_list}) set(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO() endmacro()
MACRO(DFHACK_PLUGIN) macro(dfhack_plugin)
PARSE_ARGUMENTS(PLUGIN parse_arguments(PLUGIN
"LINK_LIBRARIES;DEPENDS;PROTOBUFS;COMPILE_FLAGS;COMPILE_FLAGS_GCC;COMPILE_FLAGS_MSVC" "LINK_LIBRARIES;DEPENDS;PROTOBUFS;COMPILE_FLAGS;COMPILE_FLAGS_GCC;COMPILE_FLAGS_MSVC"
"SOME_OPT" "SOME_OPT"
${ARGN} ${ARGN}
) )
CAR(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS}) car(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS})
CDR(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS}) cdr(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS})
SET(PLUGIN_PROTOS) set(PLUGIN_PROTOS)
FOREACH(pbuf ${PLUGIN_PROTOBUFS}) foreach(pbuf ${PLUGIN_PROTOBUFS})
LIST(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/${pbuf}.proto) list(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/${pbuf}.proto)
ENDFOREACH() endforeach()
LIST(LENGTH PLUGIN_PROTOS NUM_PROTO) list(LENGTH PLUGIN_PROTOS NUM_PROTO)
IF(NUM_PROTO) if(NUM_PROTO)
STRING(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}")
STRING(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}")
STRING(REPLACE "/proto/" "/proto/tmp/" PLUGIN_PROTO_TMP_FILES "${PLUGIN_PROTO_SRCS};${PLUGIN_PROTO_HDRS}") string(REPLACE "/proto/" "/proto/tmp/" PLUGIN_PROTO_TMP_FILES "${PLUGIN_PROTO_SRCS};${PLUGIN_PROTO_HDRS}")
SET_SOURCE_FILES_PROPERTIES(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE) set_source_files_properties(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing # Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing) # (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PLUGIN_PROTO_SRCS PLUGIN_PROTO_HDRS) foreach(file IN LISTS PLUGIN_PROTO_SRCS PLUGIN_PROTO_HDRS)
IF(NOT EXISTS ${file}) if(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto_${PLUGIN_NAME} because '${file}' is missing") # MESSAGE("Resetting generate_proto_${PLUGIN_NAME} because '${file}' is missing")
FILE(REMOVE ${PLUGIN_PROTO_TMP_FILES}) file(REMOVE ${PLUGIN_PROTO_TMP_FILES})
BREAK() break()
ENDIF() endif()
ENDFOREACH() endforeach()
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${PLUGIN_PROTO_TMP_FILES} OUTPUT ${PLUGIN_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PLUGIN_PROTOS} ${PLUGIN_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
${PLUGIN_PROTO_TMP_FILES} ${PLUGIN_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${CMAKE_CURRENT_SOURCE_DIR}/proto/
COMMENT "Generating plugin ${PLUGIN_NAME} protobufs" COMMENT "Generating plugin ${PLUGIN_NAME} protobufs"
DEPENDS protoc-bin ${PLUGIN_PROTOS} DEPENDS protoc-bin ${PLUGIN_PROTOS}
) )
IF(UNIX) if(UNIX)
SET_SOURCE_FILES_PROPERTIES(${PLUGIN_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation") set_source_files_properties(${PLUGIN_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation")
ENDIF() endif()
ADD_CUSTOM_TARGET(generate_proto_${PLUGIN_NAME} DEPENDS ${PLUGIN_PROTO_TMP_FILES}) add_custom_target(generate_proto_${PLUGIN_NAME} DEPENDS ${PLUGIN_PROTO_TMP_FILES})
# Merge headers into sources # Merge headers into sources
SET_SOURCE_FILES_PROPERTIES( ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_HDRS}) list(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_HDRS})
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_SRCS}) list(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_SRCS})
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTOS}) list(APPEND PLUGIN_SOURCES ${PLUGIN_PROTOS})
IF(UNIX) if(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} -include Export.h") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} -include Export.h")
ELSE() else()
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} /FI\"Export.h\"") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} /FI\"Export.h\"")
ENDIF() endif()
ENDIF() endif()
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES}) add_library(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
IDE_FOLDER(${PLUGIN_NAME} "Plugins") ide_folder(${PLUGIN_NAME} "Plugins")
IF(NUM_PROTO) if(NUM_PROTO)
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME}) add_dependencies(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES}) target_link_libraries(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
ELSE() else()
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES}) target_link_libraries(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES})
ENDIF() endif()
ADD_DEPENDENCIES(${PLUGIN_NAME} dfhack-version) add_dependencies(${PLUGIN_NAME} dfhack-version)
# Make sure the source is generated before the executable builds. # Make sure the source is generated before the executable builds.
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto) add_dependencies(${PLUGIN_NAME} generate_proto)
IF(UNIX) if(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}")
ELSE() else()
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}")
ENDIF() endif()
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}") set_target_properties(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}")
IF(APPLE) if(APPLE)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "") set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "")
ELSEIF(UNIX) elseif(UNIX)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "") set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "")
ELSE() else()
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll) set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll)
ENDIF() endif()
install(TARGETS ${PLUGIN_NAME} install(TARGETS ${PLUGIN_NAME}
LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION} LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION}
RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION}) RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION})
ENDMACRO(DFHACK_PLUGIN) endmacro()

@ -1,28 +1,28 @@
IF(UNIX) if(UNIX)
DFHACK_PLUGIN(vectors vectors.cpp) dfhack_plugin(vectors vectors.cpp)
ENDIF() endif()
INCLUDE(FindThreads) include(FindThreads)
ADD_DEFINITIONS(-DDEV_PLUGIN) add_definitions(-DDEV_PLUGIN)
DFHACK_PLUGIN(buildprobe buildprobe.cpp) dfhack_plugin(buildprobe buildprobe.cpp)
DFHACK_PLUGIN(color-dfhack-text color-dfhack-text.cpp) dfhack_plugin(color-dfhack-text color-dfhack-text.cpp)
DFHACK_PLUGIN(counters counters.cpp) dfhack_plugin(counters counters.cpp)
DFHACK_PLUGIN(dumpmats dumpmats.cpp) dfhack_plugin(dumpmats dumpmats.cpp)
DFHACK_PLUGIN(eventExample eventExample.cpp) dfhack_plugin(eventExample eventExample.cpp)
DFHACK_PLUGIN(frozen frozen.cpp) dfhack_plugin(frozen frozen.cpp)
DFHACK_PLUGIN(kittens kittens.cpp LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) dfhack_plugin(kittens kittens.cpp LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
DFHACK_PLUGIN(memview memview.cpp memutils.cpp LINK_LIBRARIES lua) dfhack_plugin(memview memview.cpp memutils.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(notes notes.cpp) dfhack_plugin(notes notes.cpp)
DFHACK_PLUGIN(onceExample onceExample.cpp) dfhack_plugin(onceExample onceExample.cpp)
DFHACK_PLUGIN(renderer-msg renderer-msg.cpp) dfhack_plugin(renderer-msg renderer-msg.cpp)
DFHACK_PLUGIN(rprobe rprobe.cpp) dfhack_plugin(rprobe rprobe.cpp)
DFHACK_PLUGIN(stepBetween stepBetween.cpp) dfhack_plugin(stepBetween stepBetween.cpp)
DFHACK_PLUGIN(stockcheck stockcheck.cpp) dfhack_plugin(stockcheck stockcheck.cpp)
DFHACK_PLUGIN(stripcaged stripcaged.cpp) dfhack_plugin(stripcaged stripcaged.cpp)
DFHACK_PLUGIN(tilesieve tilesieve.cpp) dfhack_plugin(tilesieve tilesieve.cpp)
DFHACK_PLUGIN(zoom zoom.cpp) dfhack_plugin(zoom zoom.cpp)
IF(UNIX) if(UNIX)
DFHACK_PLUGIN(ref-index ref-index.cpp) dfhack_plugin(ref-index ref-index.cpp)
ENDIF() endif()

@ -1,18 +1,18 @@
PROJECT (diggingInvaders) project(diggingInvaders)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
diggingInvaders.cpp diggingInvaders.cpp
edgeCost.cpp edgeCost.cpp
assignJob.cpp assignJob.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
edgeCost.h edgeCost.h
assignJob.h assignJob.h
) )
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
DFHACK_PLUGIN(diggingInvaders ${PROJECT_SRCS}) dfhack_plugin(diggingInvaders ${PROJECT_SRCS})

@ -1,6 +1,6 @@
PROJECT (embark-assistant) project(embark-assistant)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
embark-assistant.cpp embark-assistant.cpp
finder_ui.cpp finder_ui.cpp
help_ui.cpp help_ui.cpp
@ -10,7 +10,7 @@ SET(PROJECT_SRCS
survey.cpp survey.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
defs.h defs.h
embark-assistant.h embark-assistant.h
finder_ui.h finder_ui.h
@ -20,9 +20,9 @@ SET(PROJECT_HDRS
screen.h screen.h
survey.h survey.h
) )
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
DFHACK_PLUGIN(embark-assistant ${PROJECT_SRCS}) dfhack_plugin(embark-assistant ${PROJECT_SRCS})

@ -1,17 +1,17 @@
PROJECT (labormanager) project(labormanager)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
labormanager.cpp labormanager.cpp
joblabormapper.cpp joblabormapper.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
labormanager.h labormanager.h
joblabormapper.h joblabormapper.h
) )
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
DFHACK_PLUGIN(labormanager ${PROJECT_SRCS}) dfhack_plugin(labormanager ${PROJECT_SRCS})

@ -1,6 +1,6 @@
PROJECT (remotefortressreader) project(remotefortressreader)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
remotefortressreader.cpp remotefortressreader.cpp
adventure_control.cpp adventure_control.cpp
building_reader.cpp building_reader.cpp
@ -8,15 +8,15 @@ SET(PROJECT_SRCS
item_reader.cpp item_reader.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
adventure_control.h adventure_control.h
building_reader.h building_reader.h
dwarf_control.h dwarf_control.h
item_reader.h item_reader.h
df_version_int.h df_version_int.h
) )
#proto files to include. # proto files to include.
SET(PROJECT_PROTO set(PROJECT_PROTO
RemoteFortressReader RemoteFortressReader
AdventureControl AdventureControl
ItemdefInstrument ItemdefInstrument
@ -24,23 +24,23 @@ SET(PROJECT_PROTO
ui_sidebar_mode ui_sidebar_mode
) )
SET(PLUGIN_PROTOS) set(PLUGIN_PROTOS)
FOREACH(pbuf ${PROJECT_PROTO}) foreach(pbuf ${PROJECT_PROTO})
LIST(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../proto/${pbuf}.proto) list(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../proto/${pbuf}.proto)
ENDFOREACH() endforeach()
STRING(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}")
STRING(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}")
SET_SOURCE_FILES_PROPERTIES(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE) set_source_files_properties(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties( ${PROJECT_HDRS} ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS} ${PLUGIN_PROTOS} ${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS} ${PLUGIN_PROTOS} ${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS})
IF(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
SET(PROJECT_LIBS ${PROJECT_LIBS} SDL) set(PROJECT_LIBS ${PROJECT_LIBS} SDL)
ENDIF() endif()
# this makes sure all the stuff is put in proper places and linked to dfhack # this makes sure all the stuff is put in proper places and linked to dfhack
DFHACK_PLUGIN(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES protobuf-lite ${PROJECT_LIBS} COMPILE_FLAGS_MSVC "/FI\"Export.h\"" COMPILE_FLAGS_GCC "-include Export.h -Wno-misleading-indentation" ) dfhack_plugin(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES protobuf-lite ${PROJECT_LIBS} COMPILE_FLAGS_MSVC "/FI\"Export.h\"" COMPILE_FLAGS_GCC "-include Export.h -Wno-misleading-indentation" )

@ -1,21 +1,21 @@
PROJECT (rendermax) project(rendermax)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
rendermax.cpp rendermax.cpp
renderer_light.cpp renderer_light.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
renderer_opengl.hpp renderer_opengl.hpp
renderer_light.hpp renderer_light.hpp
) )
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
# this makes sure all the stuff is put in proper places and linked to dfhack # this makes sure all the stuff is put in proper places and linked to dfhack
DFHACK_PLUGIN(rendermax ${PROJECT_SRCS} LINK_LIBRARIES lua dfhack-tinythread) dfhack_plugin(rendermax ${PROJECT_SRCS} LINK_LIBRARIES lua dfhack-tinythread)
install(FILES rendermax.lua install(FILES rendermax.lua
DESTINATION ${DFHACK_DATA_DESTINATION}/raw) DESTINATION ${DFHACK_DATA_DESTINATION}/raw)

@ -1,68 +1,68 @@
# Allow build system to turn off downloading of libruby.so. # Allow build system to turn off downloading of libruby.so.
OPTION(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." ON) option(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." ON)
IF (DOWNLOAD_RUBY) if(DOWNLOAD_RUBY)
IF (APPLE) if(APPLE)
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib) set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
SET(RUBYLIB_INSTALL_NAME "libruby.dylib") set(RUBYLIB_INSTALL_NAME "libruby.dylib")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64) if(${DFHACK_BUILD_ARCH} STREQUAL 64)
# MESSAGE("No ruby lib for 64-bit OS X yet") # message("No ruby lib for 64-bit OS X yet")
ELSE() else()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-libruby187.dylib.gz" download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-libruby187.dylib.gz"
"gz" "gz"
${RUBYLIB}.gz ${RUBYLIB}.gz
"e9bc4263557e652121b055a46abb4f97" "e9bc4263557e652121b055a46abb4f97"
${RUBYLIB} ${RUBYLIB}
"3ee5356759f764a440be5b5b44649826") "3ee5356759f764a440be5b5b44649826")
ENDIF() endif()
ELSEIF(UNIX) elseif(UNIX)
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/linux${DFHACK_BUILD_ARCH}/libruby.so) set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/linux${DFHACK_BUILD_ARCH}/libruby.so)
SET(RUBYLIB_INSTALL_NAME "libruby.so") set(RUBYLIB_INSTALL_NAME "libruby.so")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64) if(${DFHACK_BUILD_ARCH} STREQUAL 64)
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux64-libruby187.so.gz" download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux64-libruby187.so.gz"
"gz" "gz"
${RUBYLIB}.gz ${RUBYLIB}.gz
"8eb757bb9ada08608914d8ca8906c427" "8eb757bb9ada08608914d8ca8906c427"
${RUBYLIB} ${RUBYLIB}
"e8c36a06f031cfbf02def28169bb5f1f") "e8c36a06f031cfbf02def28169bb5f1f")
ELSE() else()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux32-libruby187.so.gz" download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux32-libruby187.so.gz"
"gz" "gz"
${RUBYLIB}.gz ${RUBYLIB}.gz
"2d06f5069ff07ea934ecd40db55a4ac5" "2d06f5069ff07ea934ecd40db55a4ac5"
${RUBYLIB} ${RUBYLIB}
"b00d8d7086cb39f6fde793f9d89cb2d7") "b00d8d7086cb39f6fde793f9d89cb2d7")
ENDIF() endif()
ELSE() else()
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/win${DFHACK_BUILD_ARCH}/libruby.dll) set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/win${DFHACK_BUILD_ARCH}/libruby.dll)
SET(RUBYLIB_INSTALL_NAME "libruby.dll") set(RUBYLIB_INSTALL_NAME "libruby.dll")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64) if(${DFHACK_BUILD_ARCH} STREQUAL 64)
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-libruby200.dll.gz" download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-libruby200.dll.gz"
"gz" "gz"
${RUBYLIB}.gz ${RUBYLIB}.gz
"81db54a8b8b3090c94c6ae2147d30b8f" "81db54a8b8b3090c94c6ae2147d30b8f"
${RUBYLIB} ${RUBYLIB}
"8a8564418aebddef3dfee1e96690e713") "8a8564418aebddef3dfee1e96690e713")
ELSE() else()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-libruby187.dll.gz" download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-libruby187.dll.gz"
"gz" "gz"
${RUBYLIB}.gz ${RUBYLIB}.gz
"ffc0f1b5b33748e2a36128e90c97f6b2" "ffc0f1b5b33748e2a36128e90c97f6b2"
${RUBYLIB} ${RUBYLIB}
"482c1c418f4ee1a5f04203eee1cda0ef") "482c1c418f4ee1a5f04203eee1cda0ef")
ENDIF() endif()
ENDIF() endif()
ENDIF() endif()
IF (APPLE OR UNIX) if(APPLE OR UNIX)
SET(RUBYAUTOGEN ruby-autogen-gcc.rb) set(RUBYAUTOGEN ruby-autogen-gcc.rb)
ELSE (APPLE OR UNIX) else(APPLE OR UNIX)
SET(RUBYAUTOGEN ruby-autogen-win.rb) set(RUBYAUTOGEN ruby-autogen-win.rb)
ENDIF (APPLE OR UNIX) endif(APPLE OR UNIX)
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} ${CMAKE_SYSTEM_NAME} ${DFHACK_BUILD_ARCH} COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} ${CMAKE_SYSTEM_NAME} ${DFHACK_BUILD_ARCH}
# cmake quirk: depending on codegen.out.xml or generate_headers only is not enough, needs both # cmake quirk: depending on codegen.out.xml or generate_headers only is not enough, needs both
@ -70,24 +70,24 @@ ADD_CUSTOM_COMMAND(
DEPENDS generate_headers ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl DEPENDS generate_headers ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl
COMMENT ${RUBYAUTOGEN} COMMENT ${RUBYAUTOGEN}
) )
ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN}) add_custom_target(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN})
INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") include_directories("${dfhack_SOURCE_DIR}/depends/tthread")
DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) dfhack_plugin(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread)
ADD_DEPENDENCIES(ruby ruby-autogen-rb) add_dependencies(ruby ruby-autogen-rb)
IF(EXISTS ${RUBYLIB}) if(EXISTS ${RUBYLIB})
INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME}) install(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME})
ELSE() else()
# Only fire this warning if DOWNLOAD_RUBY was set. # Only fire this warning if DOWNLOAD_RUBY was set.
IF(NOT(APPLE AND ${DFHACK_BUILD_ARCH} STREQUAL 64) AND DOWNLOAD_RUBY) if(NOT(APPLE AND ${DFHACK_BUILD_ARCH} STREQUAL 64) AND DOWNLOAD_RUBY)
MESSAGE(WARNING "Ruby library not found at ${RUBYLIB} - will not be installed") message(WARNING "Ruby library not found at ${RUBYLIB} - will not be installed")
ENDIF() endif()
ENDIF() endif()
INSTALL(DIRECTORY . install(DIRECTORY .
DESTINATION hack/ruby DESTINATION hack/ruby
FILES_MATCHING PATTERN "*.rb") FILES_MATCHING PATTERN "*.rb")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby)

@ -1,36 +1,36 @@
PROJECT (skeleton) project(skeleton)
# A list of source files # A list of source files
SET(PROJECT_SRCS set(PROJECT_SRCS
skeleton.cpp skeleton.cpp
) )
# A list of headers # A list of headers
SET(PROJECT_HDRS set(PROJECT_HDRS
skeleton.h skeleton.h
) )
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them) # mash them together (headers are marked as headers and nothing will try to compile them)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
# option to use a thread for no particular reason # option to use a thread for no particular reason
OPTION(SKELETON_THREAD "Use threads in the skeleton plugin." ON) option(SKELETON_THREAD "Use threads in the skeleton plugin." ON)
IF(UNIX) if(UNIX)
IF(APPLE) if(APPLE)
SET(PROJECT_LIBS set(PROJECT_LIBS
# add any extra mac libraries here # add any extra mac libraries here
${PROJECT_LIBS} ${PROJECT_LIBS}
) )
ELSE() else()
SET(PROJECT_LIBS set(PROJECT_LIBS
# add any extra linux libraries here # add any extra linux libraries here
${PROJECT_LIBS} ${PROJECT_LIBS}
) )
ENDIF() endif()
ELSE() else()
SET(PROJECT_LIBS set(PROJECT_LIBS
# add any extra windows libraries here # add any extra windows libraries here
${PROJECT_LIBS} ${PROJECT_LIBS}
) )
ENDIF() endif()
# this makes sure all the stuff is put in proper places and linked to dfhack # this makes sure all the stuff is put in proper places and linked to dfhack
DFHACK_PLUGIN(skeleton ${PROJECT_SRCS} LINK_LIBRARIES ${PROJECT_LIBS}) dfhack_plugin(skeleton ${PROJECT_SRCS} LINK_LIBRARIES ${PROJECT_LIBS})

@ -1,23 +1,23 @@
PROJECT(stockpiles) project(stockpiles)
# add *our* headers here. # add *our* headers here.
SET(PROJECT_HDRS set(PROJECT_HDRS
StockpileUtils.h StockpileUtils.h
OrganicMatLookup.h OrganicMatLookup.h
StockpileSerializer.h StockpileSerializer.h
) )
SET(PROJECT_SRCS set(PROJECT_SRCS
OrganicMatLookup.cpp OrganicMatLookup.cpp
StockpileSerializer.cpp StockpileSerializer.cpp
stockpiles.cpp stockpiles.cpp
) )
SET(PROJECT_PROTOS set(PROJECT_PROTOS
stockpiles stockpiles
) )
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})
DFHACK_PLUGIN(stockpiles ${PROJECT_SRCS} ${PROJECT_HDRS} PROTOBUFS ${PROJECT_PROTOS} LINK_LIBRARIES protobuf-lite lua) dfhack_plugin(stockpiles ${PROJECT_SRCS} ${PROJECT_HDRS} PROTOBUFS ${PROJECT_PROTOS} LINK_LIBRARIES protobuf-lite lua)

@ -1,6 +1,6 @@
PROJECT (tweak) project(tweak)
SET(PROJECT_SRCS set(PROJECT_SRCS
tweak.cpp tweak.cpp
) )
DFHACK_PLUGIN(tweak ${PROJECT_SRCS}) dfhack_plugin(tweak ${PROJECT_SRCS})