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

@ -76,14 +76,14 @@
# Get package location hint from environment variable (if any)
if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR})
set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
"TinyXML base directory location (optional, used for nonstandard installation paths)")
set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
"TinyXML base directory location (optional, used for nonstandard installation paths)")
endif()
# Search path for nonstandard package locations
if(TinyXML_ROOT_DIR)
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_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH)
set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH)
endif()
# 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
if(TinyXML_FOUND)
set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})
set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})
endif()

@ -1,62 +1,62 @@
# 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
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(dfhack)
if("${CMAKE_GENERATOR}" STREQUAL Ninja)
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.")
endif()
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.")
endif()
endif()
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()
# 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)
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()
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC)
CHECK_GCC(${CMAKE_C_COMPILER})
else()
message(SEND_ERROR "C compiler is not GCC")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
CHECK_GCC(${CMAKE_CXX_COMPILER})
else()
message(SEND_ERROR "C++ compiler is not GCC")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
check_gcc(${CMAKE_C_COMPILER})
else()
message(SEND_ERROR "C compiler is not GCC")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
check_gcc(${CMAKE_CXX_COMPILER})
else()
message(SEND_ERROR "C++ compiler is not GCC")
endif()
endif()
if(WIN32)
if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919))
message(SEND_ERROR "MSVC 2015 or 2017 is required")
endif()
if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919))
message(SEND_ERROR "MSVC 2015 or 2017 is required")
endif()
endif()
# Ask for C++11 standard from compilers
@ -67,52 +67,52 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
# disable C4819 code-page warning
add_definitions( "/wd4819" )
# Disable use of POSIX name 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
# weird and mysterious linking errors, you can disable this, but you'll have to
# deal with a LOT of compiler noise over it
# see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
add_definitions( "/wd4503")
# 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
# for things like vector sizes, which are never that big anyway.
add_definitions( "/wd4267")
# disable C4819 code-page warning
add_definitions("/wd4819")
# disable use of POSIX name 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
# weird and mysterious linking errors, you can disable this, but you'll have to
# deal with a LOT of compiler noise over it
# see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
add_definitions("/wd4503")
# 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
# for things like vector sizes, which are never that big anyway.
add_definitions("/wd4267")
endif()
# Automatically detect architecture based on Visual Studio generator
IF(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH)
IF(${CMAKE_GENERATOR} MATCHES "Win64")
SET(DFHACK_BUILD_ARCH "64")
ELSE()
SET(DFHACK_BUILD_ARCH "32")
ENDIF()
ELSE()
SET(DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')")
ENDIF()
IF("${DFHACK_BUILD_ARCH}" STREQUAL "32")
SET(DFHACK_BUILD_32 1)
SET(DFHACK_BUILD_64 0)
set(DFHACK_SETARCH "i386")
ELSEIF("${DFHACK_BUILD_ARCH}" STREQUAL "64")
SET(DFHACK_BUILD_32 0)
SET(DFHACK_BUILD_64 1)
set(DFHACK_SETARCH "x86_64")
ADD_DEFINITIONS(-DDFHACK64)
ELSE()
MESSAGE(SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}")
ENDIF()
IF(CMAKE_CROSSCOMPILING)
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")
ENDIF()
if(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH)
if(${CMAKE_GENERATOR} MATCHES "Win64")
set(DFHACK_BUILD_ARCH "64")
else()
set(DFHACK_BUILD_ARCH "32")
endif()
else()
set(DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')")
endif()
if("${DFHACK_BUILD_ARCH}" STREQUAL "32")
set(DFHACK_BUILD_32 1)
set(DFHACK_BUILD_64 0)
set(DFHACK_SETARCH "i386")
elseif("${DFHACK_BUILD_ARCH}" STREQUAL "64")
set(DFHACK_BUILD_32 0)
set(DFHACK_BUILD_64 1)
set(DFHACK_SETARCH "x86_64")
add_definitions(-DDFHACK64)
else()
message(SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}")
endif()
if(CMAKE_CROSSCOMPILING)
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")
endif()
find_package(Perl REQUIRED)
@ -121,34 +121,34 @@ find_package(Perl REQUIRED)
# Check for MFC!
find_package(MFC QUIET)
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()
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()
if(CMAKE_USE_FOLDERS)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
else()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
endif()
# macro for setting up IDE folders without nasty IF()s everywhere
MACRO(IDE_FOLDER target folder)
# macro for setting up IDE folders without nasty if()s everywhere
macro(IDE_FOLDER target folder)
if(CMAKE_USE_FOLDERS)
SET_PROPERTY(TARGET ${target} PROPERTY FOLDER ${folder})
set_property(TARGET ${target} PROPERTY FOLDER ${folder})
endif()
ENDMACRO()
endmacro()
SET(CMAKE_MODULE_PATH
${dfhack_SOURCE_DIR}/CMake/Modules
${CMAKE_MODULE_PATH}
set(CMAKE_MODULE_PATH
${dfhack_SOURCE_DIR}/CMake/Modules
${CMAKE_MODULE_PATH}
)
# generates compile_commands.json, used for autocompletion by some editors
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
check_cxx_source_compiles("
#include <cstdlib>
#include <cuchar>
int main(void) {
@ -164,11 +164,11 @@ endif()
# mixing the build system with the source code is ugly and stupid. enforce the opposite :)
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()
# 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)")
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)
# the dfhack libraries will be installed here:
IF(UNIX)
if(UNIX)
# put the lib into DF/hack
SET(DFHACK_LIBRARY_DESTINATION hack)
SET(DFHACK_EGGY_DESTINATION libs)
ELSE()
set(DFHACK_LIBRARY_DESTINATION hack)
set(DFHACK_EGGY_DESTINATION libs)
else()
# 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_EGGY_DESTINATION .)
ENDIF()
set(DFHACK_LIBRARY_DESTINATION .)
set(DFHACK_EGGY_DESTINATION .)
endif()
# external tools will be installed here:
SET(DFHACK_BINARY_DESTINATION .)
set(DFHACK_BINARY_DESTINATION .)
# dfhack data goes here:
SET(DFHACK_DATA_DESTINATION hack)
set(DFHACK_DATA_DESTINATION hack)
# plugin libs go here:
SET(DFHACK_PLUGIN_DESTINATION hack/plugins)
set(DFHACK_PLUGIN_DESTINATION hack/plugins)
# dfhack header files go here:
SET(DFHACK_INCLUDES_DESTINATION hack/include)
set(DFHACK_INCLUDES_DESTINATION hack/include)
# dfhack lua files go here:
SET(DFHACK_LUA_DESTINATION hack/lua)
set(DFHACK_LUA_DESTINATION hack/lua)
# the windows .lib file goes here:
SET(DFHACK_DEVLIB_DESTINATION hack)
set(DFHACK_DEVLIB_DESTINATION hack)
# user documentation goes here:
SET(DFHACK_USERDOC_DESTINATION hack)
set(DFHACK_USERDOC_DESTINATION hack)
# developer documentation goes here:
SET(DFHACK_DEVDOC_DESTINATION hack)
## some options for the user/developer to play with
OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON)
OPTION(BUILD_PLUGINS "Build the plugins." ON)
SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
IF(UNIX)
## flags for GCC
# default to hidden symbols
# build 32bit
# ensure compatibility with older CPUs
# enable C++11 features
add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99)
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_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic")
IF(DFHACK_BUILD_64)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686")
ENDIF()
STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ELSEIF(MSVC)
# 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_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od")
STRING(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
STRING(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ENDIF()
set(DFHACK_DEVDOC_DESTINATION hack)
# some options for the user/developer to play with
option(BUILD_LIBRARY "Build the library that goes into DF." ON)
option(BUILD_PLUGINS "Build the plugins." ON)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
if(UNIX)
## flags for GCC
# default to hidden symbols
# build 32bit
# ensure compatibility with older CPUs
# enable C++11 features
add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99)
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_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic")
if(DFHACK_BUILD_64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686")
endif()
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
elseif(MSVC)
# 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_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od")
string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
# use shared libraries for protobuf
ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS)
ADD_DEFINITIONS(-DLUA_BUILD_AS_DLL)
add_definitions(-DPROTOBUF_USE_DLLS)
add_definitions(-DLUA_BUILD_AS_DLL)
if(APPLE)
add_definitions(-D_DARWIN)
@ -262,95 +263,93 @@ endif()
include(CMake/DownloadFile.cmake)
if(WIN32)
# Download zlib on Windows
set(ZLIB_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/depends/zlib/lib/win${DFHACK_BUILD_ARCH})
if(${DFHACK_BUILD_ARCH} STREQUAL "64")
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib
"a3b2fc6b68efafa89b0882e354fc8418")
else()
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib
"f4ebaa21d9de28566e88b1edfcdff901")
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()
# Download zlib on Windows
set(ZLIB_DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/depends/zlib/lib/win${DFHACK_BUILD_ARCH})
if(${DFHACK_BUILD_ARCH} STREQUAL "64")
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib
"a3b2fc6b68efafa89b0882e354fc8418")
else()
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib"
${ZLIB_DOWNLOAD_DIR}/zlib.lib
"f4ebaa21d9de28566e88b1edfcdff901")
endif()
option(EXTERNAL_LIBSTDCXX "macOS only: Avoid installing the DFHack-provided libstdc++." OFF)
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(${GCC_VERSION_OUT} VERSION_LESS "4.9")
set(LIBSTDCXX_GCC_VER "48")
else()
set(LIBSTDCXX_GCC_VER "7")
set(LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7")
endif()
if(${DFHACK_BUILD_ARCH} STREQUAL "64")
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")
# 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()
# 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")
download_file("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-SDL.dll"
${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll
"5a09604daca6b2b5ce049d79af935d6a")
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")
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")
if(${GCC_VERSION_OUT} VERSION_LESS "4.9")
set(LIBSTDCXX_GCC_VER "48")
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")
set(LIBSTDCXX_GCC_VER "7")
set(LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7")
endif()
if(${DFHACK_BUILD_ARCH} STREQUAL "64")
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()
# 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()
if(NOT EXTERNAL_LIBSTDCXX)
install(PROGRAMS ${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
DESTINATION ./hack/)
endif()
if(NOT EXTERNAL_LIBSTDCXX)
install(PROGRAMS ${LIBSTDCXX_DOWNLOAD_DIR}/libstdc++.6.dylib
DESTINATION ./hack/)
endif()
endif()
#### expose depends ####
@ -388,10 +387,10 @@ if(EXTERNAL_TINYXML)
if(NOT TinyXML_FOUND)
message(SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF.")
endif()
SET(DFHACK_TINYXML "tinyxml")
set(DFHACK_TINYXML "tinyxml")
else()
include_directories(depends/tinyxml)
SET(DFHACK_TINYXML "dfhack-tinyxml")
set(DFHACK_TINYXML "dfhack-tinyxml")
endif()
include_directories(depends/tthread)
@ -405,8 +404,8 @@ if(NOT GIT_FOUND)
endif()
# build the lib itself
IF(BUILD_LIBRARY)
add_subdirectory (library)
if(BUILD_LIBRARY)
add_subdirectory(library)
install(FILES LICENSE.rst docs/changelog.txt DESTINATION ${DFHACK_USERDOC_DESTINATION})
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 test DESTINATION "${DFHACK_DATA_DESTINATION}")
#build the plugins
IF(BUILD_PLUGINS)
add_subdirectory (plugins)
# build the plugins
if(BUILD_PLUGINS)
add_subdirectory(plugins)
endif()
add_subdirectory(scripts)
find_package(Sphinx QUIET)
if (BUILD_DOCS)
if (NOT SPHINX_FOUND)
message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled")
endif()
file(GLOB SPHINX_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/changelog.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_changelog.py"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*"
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt"
)
file(GLOB_RECURSE SPHINX_SCRIPT_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb"
)
set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS}
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
)
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo")
set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT ${SPHINX_OUTPUT}
COMMAND ${SPHINX_EXECUTABLE}
-a -E -q -b html
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/html"
-w "${CMAKE_CURRENT_SOURCE_DIR}/docs/_sphinx-warnings.txt"
-j 2
DEPENDS ${SPHINX_DEPS}
COMMENT "Building HTML documentation with Sphinx"
)
add_custom_target(dfhack_docs ALL
DEPENDS ${SPHINX_OUTPUT}
)
# Sphinx doesn't touch this file if it didn't make changes,
# which makes CMake think it didn't complete
add_custom_command(TARGET dfhack_docs POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT})
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/
DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs
)
install(FILES docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})
install(FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}")
if(BUILD_DOCS)
if(NOT SPHINX_FOUND)
message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled")
endif()
file(GLOB SPHINX_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/changelog.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_changelog.py"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*"
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt"
)
file(GLOB_RECURSE SPHINX_SCRIPT_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb"
)
set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS}
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
)
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo")
set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT ${SPHINX_OUTPUT}
COMMAND ${SPHINX_EXECUTABLE}
-a -E -q -b html
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/html"
-w "${CMAKE_CURRENT_SOURCE_DIR}/docs/_sphinx-warnings.txt"
-j 2
DEPENDS ${SPHINX_DEPS}
COMMENT "Building HTML documentation with Sphinx"
)
add_custom_target(dfhack_docs ALL
DEPENDS ${SPHINX_OUTPUT}
)
# Sphinx doesn't touch this file if it didn't make changes,
# which makes CMake think it didn't complete
add_custom_command(TARGET dfhack_docs POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT})
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/
DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs)
install(FILES docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})
install(FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}")
endif()
# Packaging with CPack!
SET(DFHACK_PACKAGE_SUFFIX "")
IF(UNIX)
set(DFHACK_PACKAGE_SUFFIX "")
if(UNIX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
string(STRIP ${GCC_VERSION} GCC_VERSION)
SET(DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}")
SET(CPACK_GENERATOR "TBZ2")
ELSEIF(WIN32)
SET(CPACK_GENERATOR "ZIP")
ENDIF()
set(DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}")
set(CPACK_GENERATOR "TBZ2")
elseif(WIN32)
set(CPACK_GENERATOR "ZIP")
endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
IF(APPLE)
if(APPLE)
set(DFHACK_PACKAGE_PLATFORM_NAME OSX)
ELSE()
else()
set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
ENDIF()
endif()
# set on command line
if(DFHACK_BUILD_ID STREQUAL "")
set(DFHACK_BUILD_ID_PACKAGE "")
set(DFHACK_BUILD_ID_PACKAGE "")
else()
set(DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-")
set(DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-")
endif()
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}")
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)
IF(DFHACK_INCLUDE_CORE)
STRING(REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}")
STRING(REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}")
IF(UNIX)
IF(APPLE)
STRING(APPEND DF_CORE_FILENAME "_osx")
ELSE()
STRING(APPEND DF_CORE_FILENAME "_linux")
ENDIF()
IF(DFHACK_BUILD_32)
STRING(APPEND DF_CORE_FILENAME "32")
ENDIF()
STRING(APPEND DF_CORE_FILENAME ".tar.bz2")
ELSE()
STRING(APPEND DF_CORE_FILENAME "_win")
IF(DFHACK_BUILD_32)
STRING(APPEND DF_CORE_FILENAME "32")
ENDIF()
STRING(APPEND DF_CORE_FILENAME ".zip")
ENDIF()
SET(DF_CORE_URL "http://bay12games.com/dwarves/${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)
ENDIF()
FILE(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core")
FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
IF(UNIX)
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)
if(DFHACK_INCLUDE_CORE)
string(REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}")
string(REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}")
if(UNIX)
if(APPLE)
string(APPEND DF_CORE_FILENAME "_osx")
else()
string(APPEND DF_CORE_FILENAME "_linux")
endif()
if(DFHACK_BUILD_32)
string(APPEND DF_CORE_FILENAME "32")
endif()
string(APPEND DF_CORE_FILENAME ".tar.bz2")
else()
string(APPEND DF_CORE_FILENAME "_win")
if(DFHACK_BUILD_32)
string(APPEND DF_CORE_FILENAME "32")
endif()
string(APPEND DF_CORE_FILENAME ".zip")
endif()
set(DF_CORE_URL "http://bay12games.com/dwarves/${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)
endif()
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
if(UNIX)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
ELSE()
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
else()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "../${DF_CORE_FILENAME}" --format=zip
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
FILE(REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll")
ENDIF()
INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
DESTINATION .)
ENDIF()
#INCLUDE(FindSphinx.cmake)
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core")
file(REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll")
endif()
install(DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
DESTINATION .)
endif()
# 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(md5)
add_subdirectory(protobuf)
@ -9,11 +9,11 @@ if(NOT TinyXML_FOUND)
endif()
add_subdirectory(tthread)
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_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)
add_subdirectory(jsoncpp-sub EXCLUDE_FROM_ALL)
# 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_DEP_ONLY "Build for use inside other CMake projects as dependency." ON)
option(CLSOCKET_SHARED "Build clsocket lib as shared." OFF)
option(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." ON)
add_subdirectory(clsocket)
IDE_FOLDER(clsocket "Depends")
ide_folder(clsocket "Depends")

@ -1,118 +1,109 @@
PROJECT ( lua CXX )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
project(lua CXX)
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())
ADD_DEFINITIONS(-DLUA_COMPAT_BITLIB)
add_definitions(-DLUA_COMPAT_BITLIB)
IF(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE /wd4334 )
ELSE()
ADD_DEFINITIONS ( -DLUA_USE_POSIX -DLUA_USE_DLOPEN )
SET ( LIBS m dl )
ENDIF()
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE /wd4334)
else()
add_definitions(-DLUA_USE_POSIX -DLUA_USE_DLOPEN)
set(LIBS m dl)
endif()
IF(UNIX)
ADD_DEFINITIONS(-DLINUX_BUILD)
IF(DFHACK_BUILD_64)
SET(CMAKE_C_FLAGS "-m64 -mno-avx")
ELSE()
SET(CMAKE_C_FLAGS "-m32")
ENDIF()
ENDIF()
if(UNIX)
add_definitions(-DLINUX_BUILD)
if(DFHACK_BUILD_64)
set(CMAKE_C_FLAGS "-m64 -mno-avx")
else()
set(CMAKE_C_FLAGS "-m32")
endif()
endif()
SET (HDR_LIBLUA
include/lapi.h
include/lauxlib.h
include/lcode.h
include/lctype.h
include/ldebug.h
include/ldo.h
include/lfunc.h
include/lgc.h
include/llex.h
include/llimits.h
include/lmem.h
include/lobject.h
include/lopcodes.h
include/lparser.h
include/lstate.h
include/lstring.h
include/ltable.h
include/ltm.h
include/lua.h
include/luaconf.h
include/lualib.h
include/lundump.h
include/lvm.h
include/lzio.h
set(HDR_LIBLUA
include/lapi.h
include/lauxlib.h
include/lcode.h
include/lctype.h
include/ldebug.h
include/ldo.h
include/lfunc.h
include/lgc.h
include/llex.h
include/llimits.h
include/lmem.h
include/lobject.h
include/lopcodes.h
include/lparser.h
include/lstate.h
include/lstring.h
include/ltable.h
include/ltm.h
include/lua.h
include/luaconf.h
include/lualib.h
include/lundump.h
include/lvm.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)
# Build Libraries
SET (SRC_LIBLUA
src/lapi.c
src/lauxlib.c
src/lbaselib.c
src/lbitlib.c
src/lcode.c
src/lcorolib.c
src/lctype.c
src/ldblib.c
src/ldebug.c
src/ldo.c
src/ldump.c
src/lfunc.c
src/lgc.c
src/linit.c
src/liolib.c
src/llex.c
src/lmathlib.c
src/lmem.c
src/loadlib.c
src/lobject.c
src/lopcodes.c
src/loslib.c
src/lparser.c
src/lstate.c
src/lstring.c
src/lstrlib.c
src/ltable.c
src/ltablib.c
src/ltm.c
src/lundump.c
src/lutf8lib.c
src/lvm.c
src/lzio.c
set(SRC_LIBLUA
src/lapi.c
src/lauxlib.c
src/lbaselib.c
src/lbitlib.c
src/lcode.c
src/lcorolib.c
src/lctype.c
src/ldblib.c
src/ldebug.c
src/ldo.c
src/ldump.c
src/lfunc.c
src/lgc.c
src/linit.c
src/liolib.c
src/llex.c
src/lmathlib.c
src/lmem.c
src/loadlib.c
src/lobject.c
src/lopcodes.c
src/loslib.c
src/lparser.c
src/lstate.c
src/lstring.c
src/lstrlib.c
src/ltable.c
src/ltablib.c
src/ltm.c
src/lundump.c
src/lutf8lib.c
src/lvm.c
src/lzio.c
)
# compile with C++ compiler
set_source_files_properties(${SRC_LIBLUA} PROPERTIES LANGUAGE CXX)
# 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} )
TARGET_LINK_LIBRARIES ( lua ${LIBS})
add_library(lua SHARED ${SRC_LIBLUA})
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
target_compile_options(lua PRIVATE "/FIdfhack_llimits.h")
else ()
else()
target_compile_options(lua PRIVATE -include dfhack_llimits.h)
endif ()
endif()
install(TARGETS lua
LIBRARY 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 )
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
ide_folder(lua "Depends")

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

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

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

@ -1,6 +1,6 @@
PROJECT(dfhack-tinythread)
ADD_LIBRARY(dfhack-tinythread STATIC EXCLUDE_FROM_ALL tinythread.cpp tinythread.h fast_mutex.h)
project(dfhack-tinythread)
add_library(dfhack-tinythread STATIC EXCLUDE_FROM_ALL tinythread.cpp tinythread.h fast_mutex.h)
if(UNIX)
target_link_libraries(dfhack-tinythread pthread)
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)
# prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES
CMAKE_POLICY(SET CMP0022 NEW)
cmake_policy(SET CMP0022 NEW)
## build options
OPTION(BUILD_DEVEL "Install/package files required for development (For SDK)." OFF)
IF(UNIX)
OPTION(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
ENDIF()
# build options
option(BUILD_DEVEL "Install/package files required for development(For SDK)." OFF)
if(UNIX)
option(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
endif()
include_directories (proto)
include_directories (include)
include_directories(proto)
include_directories(include)
execute_process(COMMAND ${PERL_EXECUTABLE} xml/list.pl xml ${dfapi_SOURCE_DIR}/include/df ";"
WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
OUTPUT_VARIABLE GENERATED_HDRS)
SET_SOURCE_FILES_PROPERTIES(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE)
SET(MAIN_HEADERS
include/Internal.h
include/DFHack.h
include/DFHackVersion.h
include/Console.h
include/Core.h
include/ColorText.h
include/DataDefs.h
include/DataIdentity.h
include/Debug.h
include/DebugManager.h
include/VTableInterpose.h
include/LuaWrapper.h
include/LuaTools.h
include/Error.h
include/Export.h
include/Hooks.h
include/MiscUtils.h
include/Module.h
include/Pragma.h
include/MemAccess.h
include/Signal.hpp
include/TileTypes.h
include/Types.h
include/VersionInfo.h
include/VersionInfoFactory.h
include/RemoteClient.h
include/RemoteServer.h
include/RemoteTools.h
WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
OUTPUT_VARIABLE GENERATED_HDRS)
set_source_files_properties(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE)
set(MAIN_HEADERS
include/Internal.h
include/DFHack.h
include/DFHackVersion.h
include/Console.h
include/Core.h
include/ColorText.h
include/DataDefs.h
include/DataIdentity.h
include/Debug.h
include/DebugManager.h
include/VTableInterpose.h
include/LuaWrapper.h
include/LuaTools.h
include/Error.h
include/Export.h
include/Hooks.h
include/MiscUtils.h
include/Module.h
include/Pragma.h
include/MemAccess.h
include/Signal.hpp
include/TileTypes.h
include/Types.h
include/VersionInfo.h
include/VersionInfoFactory.h
include/RemoteClient.h
include/RemoteServer.h
include/RemoteTools.h
)
SET(MAIN_HEADERS_WINDOWS
include/wdirent.h
set(MAIN_HEADERS_WINDOWS
include/wdirent.h
)
SET(MAIN_SOURCES
Core.cpp
ColorText.cpp
CompilerWorkAround.cpp
DataDefs.cpp
Debug.cpp
Error.cpp
VTableInterpose.cpp
LuaWrapper.cpp
LuaTypes.cpp
LuaTools.cpp
LuaApi.cpp
DataStatics.cpp
DataStaticsCtor.cpp
DataStaticsFields.cpp
MiscUtils.cpp
Types.cpp
PluginManager.cpp
TileTypes.cpp
VersionInfoFactory.cpp
RemoteClient.cpp
RemoteServer.cpp
RemoteTools.cpp
set(MAIN_SOURCES
Core.cpp
ColorText.cpp
CompilerWorkAround.cpp
DataDefs.cpp
Debug.cpp
Error.cpp
VTableInterpose.cpp
LuaWrapper.cpp
LuaTypes.cpp
LuaTools.cpp
LuaApi.cpp
DataStatics.cpp
DataStaticsCtor.cpp
DataStaticsFields.cpp
MiscUtils.cpp
Types.cpp
PluginManager.cpp
TileTypes.cpp
VersionInfoFactory.cpp
RemoteClient.cpp
RemoteServer.cpp
RemoteTools.cpp
)
SET(MAIN_SOURCES_WINDOWS
Console-windows.cpp
Hooks-windows.cpp
PlugLoad-windows.cpp
Process-windows.cpp
set(MAIN_SOURCES_WINDOWS
Console-windows.cpp
Hooks-windows.cpp
PlugLoad-windows.cpp
Process-windows.cpp
)
IF(WIN32)
SOURCE_GROUP("Main\\Headers" FILES ${MAIN_HEADERS} ${MAIN_HEADERS_WINDOWS})
SOURCE_GROUP("Main\\Sources" FILES ${MAIN_SOURCES} ${MAIN_SOURCES_WINDOWS})
ENDIF()
if(WIN32)
source_group("Main\\Headers" FILES ${MAIN_HEADERS} ${MAIN_HEADERS_WINDOWS})
source_group("Main\\Sources" FILES ${MAIN_SOURCES} ${MAIN_SOURCES_WINDOWS})
endif()
SET(MAIN_SOURCES_LINUX
Console-posix.cpp
Hooks-linux.cpp
PlugLoad-posix.cpp
Process-linux.cpp
set(MAIN_SOURCES_LINUX
Console-posix.cpp
Hooks-linux.cpp
PlugLoad-posix.cpp
Process-linux.cpp
)
SET(MAIN_SOURCES_DARWIN
Console-posix.cpp
Hooks-darwin.cpp
PlugLoad-posix.cpp
Process-darwin.cpp
set(MAIN_SOURCES_DARWIN
Console-posix.cpp
Hooks-darwin.cpp
PlugLoad-posix.cpp
Process-darwin.cpp
)
SET(MAIN_SOURCES_LINUX_EGGY
Console-linux.cpp
Hooks-egg.cpp
PlugLoad-linux.cpp
Process-linux.cpp
set(MAIN_SOURCES_LINUX_EGGY
Console-linux.cpp
Hooks-egg.cpp
PlugLoad-linux.cpp
Process-linux.cpp
)
SET(MODULE_HEADERS
include/modules/Buildings.h
include/modules/Burrows.h
include/modules/Constructions.h
include/modules/Designations.h
include/modules/Engravings.h
include/modules/EventManager.h
include/modules/Filesystem.h
include/modules/Graphic.h
include/modules/Gui.h
include/modules/GuiHooks.h
include/modules/Items.h
include/modules/Job.h
include/modules/Kitchen.h
include/modules/MapCache.h
include/modules/Maps.h
include/modules/Materials.h
include/modules/Notes.h
include/modules/Once.h
include/modules/Persistence.h
include/modules/Random.h
include/modules/Renderer.h
include/modules/Screen.h
include/modules/Translation.h
include/modules/Units.h
include/modules/World.h
set(MODULE_HEADERS
include/modules/Buildings.h
include/modules/Burrows.h
include/modules/Constructions.h
include/modules/Designations.h
include/modules/Engravings.h
include/modules/EventManager.h
include/modules/Filesystem.h
include/modules/Graphic.h
include/modules/Gui.h
include/modules/GuiHooks.h
include/modules/Items.h
include/modules/Job.h
include/modules/Kitchen.h
include/modules/MapCache.h
include/modules/Maps.h
include/modules/Materials.h
include/modules/Notes.h
include/modules/Once.h
include/modules/Persistence.h
include/modules/Random.h
include/modules/Renderer.h
include/modules/Screen.h
include/modules/Translation.h
include/modules/Units.h
include/modules/World.h
)
SET( MODULE_SOURCES
modules/Buildings.cpp
modules/Burrows.cpp
modules/Constructions.cpp
modules/Designations.cpp
modules/Engravings.cpp
modules/EventManager.cpp
modules/Filesystem.cpp
modules/Graphic.cpp
modules/Gui.cpp
modules/Items.cpp
modules/Job.cpp
modules/Kitchen.cpp
modules/MapCache.cpp
modules/Maps.cpp
modules/Materials.cpp
modules/Notes.cpp
modules/Once.cpp
modules/Persistence.cpp
modules/Random.cpp
modules/Renderer.cpp
modules/Screen.cpp
modules/Translation.cpp
modules/Units.cpp
modules/Windows.cpp
modules/World.cpp
set(MODULE_SOURCES
modules/Buildings.cpp
modules/Burrows.cpp
modules/Constructions.cpp
modules/Designations.cpp
modules/Engravings.cpp
modules/EventManager.cpp
modules/Filesystem.cpp
modules/Graphic.cpp
modules/Gui.cpp
modules/Items.cpp
modules/Job.cpp
modules/Kitchen.cpp
modules/MapCache.cpp
modules/Maps.cpp
modules/Materials.cpp
modules/Notes.cpp
modules/Once.cpp
modules/Persistence.cpp
modules/Random.cpp
modules/Renderer.cpp
modules/Screen.cpp
modules/Translation.cpp
modules/Units.cpp
modules/Windows.cpp
modules/World.cpp
)
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)
SET(STATIC_FIELDS_FILENAME ${dfhack_SOURCE_DIR}/library/DataStaticsFields/${GROUP}.cpp)
IF(${GROUP} STREQUAL "other")
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields.inc")
ELSE()
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields-${GROUP}.inc")
ENDIF()
FILE(WRITE ${STATIC_FIELDS_FILENAME}.tmp
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)
set(STATIC_FIELDS_FILENAME ${dfhack_SOURCE_DIR}/library/DataStaticsFields/${GROUP}.cpp)
if(${GROUP} STREQUAL "other")
set(STATIC_FIELDS_INC_FILENAME "df/static.fields.inc")
else()
set(STATIC_FIELDS_INC_FILENAME "df/static.fields-${GROUP}.inc")
endif()
file(WRITE ${STATIC_FIELDS_FILENAME}.tmp
"#define STATIC_FIELDS_GROUP\n"
"#include \"../DataStaticsFields.cpp\"\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})
FILE(REMOVE ${STATIC_FIELDS_FILENAME}.tmp)
LIST(APPEND STATIC_FIELDS_FILES ${STATIC_FIELDS_FILENAME})
ENDFOREACH()
LIST(APPEND MAIN_SOURCES ${STATIC_FIELDS_FILES})
IF(WIN32)
SOURCE_GROUP("Modules\\Headers" FILES ${MODULE_HEADERS})
SOURCE_GROUP("Modules\\Sources" FILES ${MODULE_SOURCES})
SOURCE_GROUP("Generated" FILES ${GENERATED_HDRS})
ENDIF()
SET(PROJECT_HEADERS)
LIST(APPEND PROJECT_HEADERS ${MAIN_HEADERS})
LIST(APPEND PROJECT_HEADERS ${MODULE_HEADERS})
SET(PROJECT_SOURCES)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES})
LIST(APPEND PROJECT_SOURCES ${MODULE_SOURCES})
IF(UNIX)
OPTION(BUILD_EGGY "Make DFHack strangely egg-shaped." OFF)
IF(BUILD_EGGY)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX_EGGY})
ELSEIF(APPLE)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_DARWIN})
ELSE()
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX})
ENDIF()
ELSEIF(WIN32)
LIST(APPEND PROJECT_SOURCES ${MAIN_SOURCES_WINDOWS})
LIST(APPEND PROJECT_HEADERS ${MAIN_HEADERS_WINDOWS})
ENDIF()
file(REMOVE ${STATIC_FIELDS_FILENAME}.tmp)
list(APPEND STATIC_FIELDS_FILES ${STATIC_FIELDS_FILENAME})
endforeach()
list(APPEND MAIN_SOURCES ${STATIC_FIELDS_FILES})
if(WIN32)
source_group("Modules\\Headers" FILES ${MODULE_HEADERS})
source_group("Modules\\Sources" FILES ${MODULE_SOURCES})
source_group("Generated" FILES ${GENERATED_HDRS})
endif()
set(PROJECT_HEADERS)
list(APPEND PROJECT_HEADERS ${MAIN_HEADERS})
list(APPEND PROJECT_HEADERS ${MODULE_HEADERS})
set(PROJECT_SOURCES)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES})
list(APPEND PROJECT_SOURCES ${MODULE_SOURCES})
if(UNIX)
option(BUILD_EGGY "Make DFHack strangely egg-shaped." OFF)
if(BUILD_EGGY)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX_EGGY})
elseif(APPLE)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_DARWIN})
else()
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX})
endif()
elseif(WIN32)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_WINDOWS})
list(APPEND PROJECT_HEADERS ${MAIN_HEADERS_WINDOWS})
endif()
# 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.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}")
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}
string(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${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}")
set_source_files_properties(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
IF(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto_core because '${file}' is missing")
FILE(REMOVE ${PROJECT_PROTO_TMP_FILES})
BREAK()
ENDIF()
ENDFOREACH()
LIST(APPEND PROJECT_HEADERS ${PROJECT_PROTO_HDRS})
LIST(APPEND PROJECT_SOURCES ${PROJECT_PROTO_SRCS})
ADD_CUSTOM_COMMAND(
foreach(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
if(NOT EXISTS ${file})
# message("Resetting generate_proto_core because '${file}' is missing")
file(REMOVE ${PROJECT_PROTO_TMP_FILES})
break()
endif()
endforeach()
list(APPEND PROJECT_HEADERS ${PROJECT_PROTO_HDRS})
list(APPEND PROJECT_SOURCES ${PROJECT_PROTO_SRCS})
add_custom_command(
OUTPUT ${PROJECT_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PROJECT_PROTOS}
--cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PROJECT_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
${PROJECT_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/
${PROJECT_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/
COMMENT "Generating core protobufs"
DEPENDS protoc-bin ${PROJECT_PROTOS}
)
IF(UNIX)
SET_SOURCE_FILES_PROPERTIES(${PROJECT_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation")
ENDIF()
if(UNIX)
set_source_files_properties(${PROJECT_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation")
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
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SOURCES ${PROJECT_HEADERS})
set_source_files_properties( ${PROJECT_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE )
list(APPEND PROJECT_SOURCES ${PROJECT_HEADERS})
# 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_XMLS ${dfapi_SOURCE_DIR}/xml/df.*.xml)
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)
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
LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS})
ENDIF()
list(APPEND CODEGEN_OUT ${GENERATED_HDRS})
endif()
ADD_CUSTOM_COMMAND(
add_custom_command(
OUTPUT ${CODEGEN_OUT}
BYPRODUCTS ${GENERATED_HDRS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl
@ -282,143 +282,143 @@ ADD_CUSTOM_COMMAND(
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)
IF(REMOVE_SYMBOLS_FROM_DF_STUBS)
IF(UNIX)
# Don't produce debug info for generated stubs
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "-g0 -O1")
ELSE(WIN32)
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/O1 /bigobj")
ENDIF()
ELSE()
IF(WIN32)
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/Od /bigobj")
ENDIF()
ENDIF()
if(REMOVE_SYMBOLS_FROM_DF_STUBS)
if(UNIX)
# Don't produce debug info for generated stubs
set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "-g0 -O1")
else(WIN32)
set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/O1 /bigobj")
endif()
else()
if(WIN32)
set_source_files_properties(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/Od /bigobj")
endif()
endif()
# Compilation
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB)
add_definitions(-DBUILD_DFHACK_LIB)
IF(UNIX)
IF(CONSOLE_NO_CATCH)
ADD_DEFINITIONS(-DCONSOLE_NO_CATCH)
ENDIF()
ENDIF()
if(UNIX)
if(CONSOLE_NO_CATCH)
add_definitions(-DCONSOLE_NO_CATCH)
endif()
endif()
IF(APPLE)
SET(PROJECT_LIBS dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ELSEIF(UNIX)
SET(PROJECT_LIBS rt dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ELSE(WIN32)
#FIXME: do we really need psapi?
SET(PROJECT_LIBS psapi dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
ENDIF()
if(APPLE)
set(PROJECT_LIBS dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
elseif(UNIX)
set(PROJECT_LIBS rt dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
else(WIN32)
# FIXME: do we really need psapi?
set(PROJECT_LIBS psapi dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread)
endif()
set(VERSION_SRCS DFHackVersion.cpp)
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})
SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
add_library(dfhack-version STATIC ${VERSION_SRCS})
set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
DFHACK_VERSION="${DFHACK_VERSION}"
DF_VERSION="${DF_VERSION}"
DFHACK_RELEASE="${DFHACK_RELEASE}"
DFHACK_ABI_VERSION=${DFHACK_ABI_VERSION}
)
IF(DFHACK_PRERELEASE)
SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
if(DFHACK_PRERELEASE)
set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
DFHACK_PRERELEASE=1
)
ENDIF()
endif()
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)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/git-describe.h
COMMAND ${CMAKE_COMMAND}
-D dfhack_SOURCE_DIR:STRING=${dfhack_SOURCE_DIR}
-D GIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
COMMENT "Obtaining git commit information"
DEPENDS ${CMAKE_SOURCE_DIR}/.git/index
${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index
${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
include/git-describe.h.in
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
COMMAND ${CMAKE_COMMAND}
-D dfhack_SOURCE_DIR:STRING=${dfhack_SOURCE_DIR}
-D GIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
COMMENT "Obtaining git commit information"
DEPENDS ${CMAKE_SOURCE_DIR}/.git/index
${CMAKE_SOURCE_DIR}/.git/modules/library/xml/index
${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
include/git-describe.h.in
)
endif ()
endif()
ADD_LIBRARY(dfhack SHARED ${PROJECT_SOURCES})
ADD_DEPENDENCIES(dfhack generate_proto_core)
ADD_DEPENDENCIES(dfhack generate_headers)
add_library(dfhack SHARED ${PROJECT_SOURCES})
add_dependencies(dfhack generate_proto_core)
add_dependencies(dfhack generate_headers)
ADD_LIBRARY(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS})
ADD_DEPENDENCIES(dfhack-client dfhack)
add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS})
add_dependencies(dfhack-client dfhack)
ADD_EXECUTABLE(dfhack-run dfhack-run.cpp)
add_executable(dfhack-run dfhack-run.cpp)
ADD_EXECUTABLE(binpatch binpatch.cpp)
TARGET_LINK_LIBRARIES(binpatch dfhack-md5)
add_executable(binpatch binpatch.cpp)
target_link_libraries(binpatch dfhack-md5)
IF(BUILD_EGGY)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "egg" )
if(BUILD_EGGY)
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "egg" )
else()
IF(WIN32)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "SDL" )
ENDIF()
if(WIN32)
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "SDL" )
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()
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()
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)
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)
add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...")
endif()
IF(UNIX)
if (APPLE)
if(UNIX)
if(APPLE)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack
DESTINATION .)
DESTINATION .)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack-run
DESTINATION .)
DESTINATION .)
else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack
@ -426,53 +426,53 @@ IF(UNIX)
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run
DESTINATION .)
endif()
ELSE()
else()
if(NOT BUILD_EGGY)
# On windows, copy the renamed SDL so DF can still run.
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH}/SDLreal.dll
DESTINATION ${DFHACK_LIBRARY_DESTINATION})
DESTINATION ${DFHACK_LIBRARY_DESTINATION})
endif()
ENDIF()
endif()
#install the main lib
# install the main lib
if(NOT BUILD_EGGY)
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
else()
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_EGGY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_EGGY_DESTINATION})
LIBRARY DESTINATION ${DFHACK_EGGY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_EGGY_DESTINATION})
endif()
#install the offset file
# install the offset file
install(FILES xml/symbols.xml
DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack
#install the example autoexec file
DESTINATION ${DFHACK_DATA_DESTINATION})
# install the example autoexec file
install(FILES ../dfhack.init-example ../onLoad.init-example
DESTINATION ${DFHACK_BINARY_DESTINATION})
DESTINATION ${DFHACK_BINARY_DESTINATION})
install(TARGETS dfhack-run dfhack-client binpatch
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
install(DIRECTORY lua/
DESTINATION ${DFHACK_LUA_DESTINATION}
FILES_MATCHING PATTERN "*.lua")
DESTINATION ${DFHACK_LUA_DESTINATION}
FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY ${dfhack_SOURCE_DIR}/patches
DESTINATION ${DFHACK_DATA_DESTINATION}
FILES_MATCHING PATTERN "*.dif")
DESTINATION ${DFHACK_DATA_DESTINATION}
FILES_MATCHING PATTERN "*.dif")
# Unused for so long that it's not even relevant now...
if(BUILD_DEVEL)
if(WIN32)
install(TARGETS dfhack
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
endif()
# note the ending '/'. This means *contents* of the directory are installed
# without the '/', the directory itself is installed
install(DIRECTORY include/
DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" PATTERN "*.inc" ) #linux: include
DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" PATTERN "*.inc" )
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)
add_subdirectory (stonesense)
add_subdirectory(stonesense)
endif()
OPTION(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD)
add_subdirectory (isoworld)
IF(UNIX)
if (APPLE)
#TODO: add an OSX runner script
add_subdirectory(isoworld)
if(UNIX)
if(APPLE)
# TODO: add an OSX runner script
else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld
DESTINATION .)
endif()
ENDIF()
endif()
endif()
OPTION(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
option(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
if(BUILD_DEV_PLUGINS)
add_subdirectory (devel)
add_subdirectory(devel)
endif()
OPTION(BUILD_RUBY "Build ruby binding." ON)
if (BUILD_RUBY)
add_subdirectory (ruby)
option(BUILD_RUBY "Build ruby binding." ON)
if(BUILD_RUBY)
add_subdirectory(ruby)
endif()
install(DIRECTORY lua/
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
FILES_MATCHING PATTERN "*.lua")
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.txt")
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.diff")
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.diff")
# 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.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}")
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}
string(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${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}")
set_source_files_properties(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
IF(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto because '${file}' is missing")
FILE(REMOVE ${PROJECT_PROTO_TMP_FILES})
BREAK()
ENDIF()
ENDFOREACH()
ADD_CUSTOM_COMMAND(
foreach(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
if(NOT EXISTS ${file})
# message("Resetting generate_proto because '${file}' is missing")
file(REMOVE ${PROJECT_PROTO_TMP_FILES})
break()
endif()
endforeach()
add_custom_command(
OUTPUT ${PROJECT_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/
-I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
@ -70,126 +70,126 @@ ADD_CUSTOM_COMMAND(
COMMENT "Generating plugin protobufs"
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)
TARGET_LINK_LIBRARIES(buildingplan-lib dfhack)
add_library(buildingplan-lib STATIC buildingplan-lib.cpp)
target_link_libraries(buildingplan-lib dfhack)
# Plugins
OPTION(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if (BUILD_SUPPORTED)
DFHACK_PLUGIN(3dveins 3dveins.cpp)
DFHACK_PLUGIN(add-spatter add-spatter.cpp)
#DFHACK_PLUGIN(advtools advtools.cpp)
DFHACK_PLUGIN(autochop autochop.cpp)
DFHACK_PLUGIN(autoclothing autoclothing.cpp)
DFHACK_PLUGIN(autodump autodump.cpp)
DFHACK_PLUGIN(autofarm autofarm.cpp)
DFHACK_PLUGIN(autogems autogems.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(autohauler autohauler.cpp)
DFHACK_PLUGIN(autolabor autolabor.cpp)
DFHACK_PLUGIN(automaterial automaterial.cpp)
DFHACK_PLUGIN(automelt automelt.cpp)
DFHACK_PLUGIN(autotrade autotrade.cpp)
DFHACK_PLUGIN(blueprint blueprint.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(burrows burrows.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(changeitem changeitem.cpp)
DFHACK_PLUGIN(changelayer changelayer.cpp)
DFHACK_PLUGIN(changevein changevein.cpp)
DFHACK_PLUGIN(cleanconst cleanconst.cpp)
DFHACK_PLUGIN(cleaners cleaners.cpp)
DFHACK_PLUGIN(cleanowned cleanowned.cpp)
DFHACK_PLUGIN(command-prompt command-prompt.cpp)
DFHACK_PLUGIN(confirm confirm.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(createitem createitem.cpp)
DFHACK_PLUGIN(cursecheck cursecheck.cpp)
DFHACK_PLUGIN(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(deramp deramp.cpp)
DFHACK_PLUGIN(debug debug.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(dig dig.cpp)
DFHACK_PLUGIN(digFlood digFlood.cpp)
option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if(BUILD_SUPPORTED)
dfhack_plugin(3dveins 3dveins.cpp)
dfhack_plugin(add-spatter add-spatter.cpp)
# dfhack_plugin(advtools advtools.cpp)
dfhack_plugin(autochop autochop.cpp)
dfhack_plugin(autoclothing autoclothing.cpp)
dfhack_plugin(autodump autodump.cpp)
dfhack_plugin(autofarm autofarm.cpp)
dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_lib_static)
dfhack_plugin(autohauler autohauler.cpp)
dfhack_plugin(autolabor autolabor.cpp)
dfhack_plugin(automaterial automaterial.cpp)
dfhack_plugin(automelt automelt.cpp)
dfhack_plugin(autotrade autotrade.cpp)
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
dfhack_plugin(burrows burrows.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(changeitem changeitem.cpp)
dfhack_plugin(changelayer changelayer.cpp)
dfhack_plugin(changevein changevein.cpp)
dfhack_plugin(cleanconst cleanconst.cpp)
dfhack_plugin(cleaners cleaners.cpp)
dfhack_plugin(cleanowned cleanowned.cpp)
dfhack_plugin(command-prompt command-prompt.cpp)
dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua)
dfhack_plugin(createitem createitem.cpp)
dfhack_plugin(cursecheck cursecheck.cpp)
dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
dfhack_plugin(deramp deramp.cpp)
dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_lib_static)
dfhack_plugin(dig dig.cpp)
dfhack_plugin(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders)
DFHACK_PLUGIN(dwarfvet dwarfvet.cpp)
DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
dfhack_plugin(dwarfvet dwarfvet.cpp)
dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
add_subdirectory(embark-assistant)
DFHACK_PLUGIN(embark-tools embark-tools.cpp)
DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(fix-armory fix-armory.cpp)
DFHACK_PLUGIN(fix-unit-occupancy fix-unit-occupancy.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
DFHACK_PLUGIN(flows flows.cpp)
DFHACK_PLUGIN(follow follow.cpp)
DFHACK_PLUGIN(forceequip forceequip.cpp)
DFHACK_PLUGIN(fortplan fortplan.cpp LINK_LIBRARIES buildingplan-lib)
DFHACK_PLUGIN(generated-creature-renamer generated-creature-renamer.cpp)
DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(hotkeys hotkeys.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
DFHACK_PLUGIN(jobutils jobutils.cpp)
dfhack_plugin(embark-tools embark-tools.cpp)
dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
dfhack_plugin(fastdwarf fastdwarf.cpp)
dfhack_plugin(filltraffic filltraffic.cpp)
dfhack_plugin(fix-armory fix-armory.cpp)
dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp)
dfhack_plugin(fixveins fixveins.cpp)
dfhack_plugin(flows flows.cpp)
dfhack_plugin(follow follow.cpp)
dfhack_plugin(forceequip forceequip.cpp)
dfhack_plugin(fortplan fortplan.cpp LINK_LIBRARIES buildingplan-lib)
dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp)
dfhack_plugin(getplants getplants.cpp)
dfhack_plugin(hotkeys hotkeys.cpp)
dfhack_plugin(infiniteSky infiniteSky.cpp)
dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
dfhack_plugin(jobutils jobutils.cpp)
add_subdirectory(labormanager)
DFHACK_PLUGIN(lair lair.cpp)
DFHACK_PLUGIN(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
DFHACK_PLUGIN(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread)
DFHACK_PLUGIN(manipulator manipulator.cpp)
DFHACK_PLUGIN(map-render map-render.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(misery misery.cpp)
DFHACK_PLUGIN(mode mode.cpp)
DFHACK_PLUGIN(mousequery mousequery.cpp)
DFHACK_PLUGIN(nestboxes nestboxes.cpp)
DFHACK_PLUGIN(orders orders.cpp LINK_LIBRARIES jsoncpp_lib_static)
DFHACK_PLUGIN(pathable pathable.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(petcapRemover petcapRemover.cpp)
DFHACK_PLUGIN(plants plants.cpp)
DFHACK_PLUGIN(probe probe.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(power-meter power-meter.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(regrass regrass.cpp)
dfhack_plugin(lair lair.cpp)
dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread)
dfhack_plugin(manipulator manipulator.cpp)
dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
dfhack_plugin(misery misery.cpp)
dfhack_plugin(mode mode.cpp)
dfhack_plugin(mousequery mousequery.cpp)
dfhack_plugin(nestboxes nestboxes.cpp)
dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_lib_static)
dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
dfhack_plugin(petcapRemover petcapRemover.cpp)
dfhack_plugin(plants plants.cpp)
dfhack_plugin(probe probe.cpp)
dfhack_plugin(prospector prospector.cpp)
dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
dfhack_plugin(regrass regrass.cpp)
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)
DFHACK_PLUGIN(resume resume.cpp)
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(search search.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(sort sort.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(steam-engine steam-engine.cpp)
DFHACK_PLUGIN(stockflow stockflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(resume resume.cpp)
dfhack_plugin(reveal reveal.cpp)
dfhack_plugin(search search.cpp)
dfhack_plugin(seedwatch seedwatch.cpp)
dfhack_plugin(showmood showmood.cpp)
dfhack_plugin(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
dfhack_plugin(sort sort.cpp LINK_LIBRARIES lua)
dfhack_plugin(steam-engine steam-engine.cpp)
dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua)
add_subdirectory(stockpiles)
DFHACK_PLUGIN(stocks stocks.cpp)
DFHACK_PLUGIN(strangemood strangemood.cpp)
DFHACK_PLUGIN(tailor tailor.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp Brushes.h)
DFHACK_PLUGIN(title-folder title-folder.cpp)
DFHACK_PLUGIN(title-version title-version.cpp)
DFHACK_PLUGIN(trackstop trackstop.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp)
dfhack_plugin(stocks stocks.cpp)
dfhack_plugin(strangemood strangemood.cpp)
dfhack_plugin(tailor tailor.cpp)
dfhack_plugin(tiletypes tiletypes.cpp Brushes.h)
dfhack_plugin(title-folder title-folder.cpp)
dfhack_plugin(title-version title-version.cpp)
dfhack_plugin(trackstop trackstop.cpp)
dfhack_plugin(tubefill tubefill.cpp)
add_subdirectory(tweak)
DFHACK_PLUGIN(workflow workflow.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(workNow workNow.cpp)
DFHACK_PLUGIN(zone zone.cpp LINK_LIBRARIES lua)
dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(workNow workNow.cpp)
dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
endif()
# 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)
add_subdirectory(skeleton)
endif()
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
# switch between branches that have also made modifications to it.
")
endif()
INCLUDE(CMakeLists.custom.txt)
include(CMakeLists.custom.txt)

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

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

@ -1,18 +1,18 @@
PROJECT (diggingInvaders)
project(diggingInvaders)
# A list of source files
SET(PROJECT_SRCS
set(PROJECT_SRCS
diggingInvaders.cpp
edgeCost.cpp
assignJob.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
edgeCost.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)
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
SET(PROJECT_SRCS
set(PROJECT_SRCS
embark-assistant.cpp
finder_ui.cpp
help_ui.cpp
@ -10,7 +10,7 @@ SET(PROJECT_SRCS
survey.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
defs.h
embark-assistant.h
finder_ui.h
@ -20,9 +20,9 @@ SET(PROJECT_HDRS
screen.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)
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
SET(PROJECT_SRCS
set(PROJECT_SRCS
labormanager.cpp
joblabormapper.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
labormanager.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)
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
SET(PROJECT_SRCS
set(PROJECT_SRCS
remotefortressreader.cpp
adventure_control.cpp
building_reader.cpp
@ -8,15 +8,15 @@ SET(PROJECT_SRCS
item_reader.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
adventure_control.h
building_reader.h
dwarf_control.h
item_reader.h
df_version_int.h
)
#proto files to include.
SET(PROJECT_PROTO
# proto files to include.
set(PROJECT_PROTO
RemoteFortressReader
AdventureControl
ItemdefInstrument
@ -24,23 +24,23 @@ SET(PROJECT_PROTO
ui_sidebar_mode
)
SET(PLUGIN_PROTOS)
FOREACH(pbuf ${PROJECT_PROTO})
LIST(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../proto/${pbuf}.proto)
ENDFOREACH()
set(PLUGIN_PROTOS)
foreach(pbuf ${PROJECT_PROTO})
list(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../proto/${pbuf}.proto)
endforeach()
STRING(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${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)
string(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${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( ${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)
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)
SET(PROJECT_LIBS ${PROJECT_LIBS} SDL)
ENDIF()
if(UNIX AND NOT APPLE)
set(PROJECT_LIBS ${PROJECT_LIBS} SDL)
endif()
# 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
SET(PROJECT_SRCS
set(PROJECT_SRCS
rendermax.cpp
renderer_light.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
renderer_opengl.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)
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
DFHACK_PLUGIN(rendermax ${PROJECT_SRCS} LINK_LIBRARIES lua dfhack-tinythread)
dfhack_plugin(rendermax ${PROJECT_SRCS} LINK_LIBRARIES lua dfhack-tinythread)
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.
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)
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
SET(RUBYLIB_INSTALL_NAME "libruby.dylib")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
# MESSAGE("No ruby lib for 64-bit OS X yet")
ELSE()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-libruby187.dylib.gz"
if(APPLE)
set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
set(RUBYLIB_INSTALL_NAME "libruby.dylib")
if(${DFHACK_BUILD_ARCH} STREQUAL 64)
# message("No ruby lib for 64-bit OS X yet")
else()
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-libruby187.dylib.gz"
"gz"
${RUBYLIB}.gz
"e9bc4263557e652121b055a46abb4f97"
${RUBYLIB}
"3ee5356759f764a440be5b5b44649826")
ENDIF()
ELSEIF(UNIX)
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/linux${DFHACK_BUILD_ARCH}/libruby.so)
SET(RUBYLIB_INSTALL_NAME "libruby.so")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux64-libruby187.so.gz"
endif()
elseif(UNIX)
set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/linux${DFHACK_BUILD_ARCH}/libruby.so)
set(RUBYLIB_INSTALL_NAME "libruby.so")
if(${DFHACK_BUILD_ARCH} STREQUAL 64)
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux64-libruby187.so.gz"
"gz"
${RUBYLIB}.gz
"8eb757bb9ada08608914d8ca8906c427"
${RUBYLIB}
"e8c36a06f031cfbf02def28169bb5f1f")
ELSE()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux32-libruby187.so.gz"
else()
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/linux32-libruby187.so.gz"
"gz"
${RUBYLIB}.gz
"2d06f5069ff07ea934ecd40db55a4ac5"
${RUBYLIB}
"b00d8d7086cb39f6fde793f9d89cb2d7")
ENDIF()
ELSE()
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/win${DFHACK_BUILD_ARCH}/libruby.dll)
SET(RUBYLIB_INSTALL_NAME "libruby.dll")
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-libruby200.dll.gz"
endif()
else()
set(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/win${DFHACK_BUILD_ARCH}/libruby.dll)
set(RUBYLIB_INSTALL_NAME "libruby.dll")
if(${DFHACK_BUILD_ARCH} STREQUAL 64)
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-libruby200.dll.gz"
"gz"
${RUBYLIB}.gz
"81db54a8b8b3090c94c6ae2147d30b8f"
${RUBYLIB}
"8a8564418aebddef3dfee1e96690e713")
ELSE()
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-libruby187.dll.gz"
else()
download_file_unzip("https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-libruby187.dll.gz"
"gz"
${RUBYLIB}.gz
"ffc0f1b5b33748e2a36128e90c97f6b2"
${RUBYLIB}
"482c1c418f4ee1a5f04203eee1cda0ef")
ENDIF()
ENDIF()
endif()
endif()
ENDIF()
endif()
IF (APPLE OR UNIX)
SET(RUBYAUTOGEN ruby-autogen-gcc.rb)
ELSE (APPLE OR UNIX)
SET(RUBYAUTOGEN ruby-autogen-win.rb)
ENDIF (APPLE OR UNIX)
if(APPLE OR UNIX)
set(RUBYAUTOGEN ruby-autogen-gcc.rb)
else(APPLE OR UNIX)
set(RUBYAUTOGEN ruby-autogen-win.rb)
endif(APPLE OR UNIX)
ADD_CUSTOM_COMMAND(
add_custom_command(
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}
# 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
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)
ADD_DEPENDENCIES(ruby ruby-autogen-rb)
dfhack_plugin(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread)
add_dependencies(ruby ruby-autogen-rb)
IF(EXISTS ${RUBYLIB})
INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME})
ELSE()
if(EXISTS ${RUBYLIB})
install(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME})
else()
# Only fire this warning if DOWNLOAD_RUBY was set.
IF(NOT(APPLE AND ${DFHACK_BUILD_ARCH} STREQUAL 64) AND DOWNLOAD_RUBY)
MESSAGE(WARNING "Ruby library not found at ${RUBYLIB} - will not be installed")
ENDIF()
ENDIF()
if(NOT(APPLE AND ${DFHACK_BUILD_ARCH} STREQUAL 64) AND DOWNLOAD_RUBY)
message(WARNING "Ruby library not found at ${RUBYLIB} - will not be installed")
endif()
endif()
INSTALL(DIRECTORY .
DESTINATION hack/ruby
FILES_MATCHING PATTERN "*.rb")
install(DIRECTORY .
DESTINATION hack/ruby
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
SET(PROJECT_SRCS
set(PROJECT_SRCS
skeleton.cpp
)
# A list of headers
SET(PROJECT_HDRS
set(PROJECT_HDRS
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)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
list(APPEND PROJECT_SRCS ${PROJECT_HDRS})
# option to use a thread for no particular reason
OPTION(SKELETON_THREAD "Use threads in the skeleton plugin." ON)
IF(UNIX)
IF(APPLE)
SET(PROJECT_LIBS
option(SKELETON_THREAD "Use threads in the skeleton plugin." ON)
if(UNIX)
if(APPLE)
set(PROJECT_LIBS
# add any extra mac libraries here
${PROJECT_LIBS}
)
ELSE()
SET(PROJECT_LIBS
else()
set(PROJECT_LIBS
# add any extra linux libraries here
${PROJECT_LIBS}
)
ENDIF()
ELSE()
SET(PROJECT_LIBS
endif()
else()
set(PROJECT_LIBS
# add any extra windows libraries here
${PROJECT_LIBS}
)
ENDIF()
endif()
# 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.
SET(PROJECT_HDRS
set(PROJECT_HDRS
StockpileUtils.h
OrganicMatLookup.h
StockpileSerializer.h
)
SET(PROJECT_SRCS
set(PROJECT_SRCS
OrganicMatLookup.cpp
StockpileSerializer.cpp
stockpiles.cpp
)
SET(PROJECT_PROTOS
set(PROJECT_PROTOS
stockpiles
)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
set_source_files_properties(${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
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)
SET(PROJECT_SRCS
project(tweak)
set(PROJECT_SRCS
tweak.cpp
)
DFHACK_PLUGIN(tweak ${PROJECT_SRCS})
dfhack_plugin(tweak ${PROJECT_SRCS})