@ -1,22 +1,5 @@
# m a i n p r o j e c t f i l e . u s e i t f r o m a b u i l d s u b - f o l d e r , s e e C O M P I L E f o r d e t a i l s
# S e t u p b u i l d t y p e s
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" )
# P r e v e n t c m a k e C m o d u l e a t t e m p t s t o o v e r w r i t e o u r h e l p s t r i n g
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 )
# # s o m e g e n e r i c C M a k e m a g i c
cmake_minimum_required ( VERSION 2.8.12 FATAL_ERROR )
project ( dfhack )
@ -27,12 +10,29 @@ if("${CMAKE_GENERATOR}" STREQUAL Ninja)
endif ( )
endif ( )
macro ( CHECK_GCC COMPILER_PATH )
execute_process ( COMMAND ${ COMPILER_PATH } -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
# S e t u p b u i l d t y p e s
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" )
# P r e v e n t c m a k e C m o d u l e a t t e m p t s t o o v e r w r i t e o u r h e l p s t r i n g
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" )
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" )
# G C C 5 c h a n g e s A B I n a m e m a n g l i n g t o e n a b l e C + + 1 1 c h a n g e s .
# T h i s m u s t b e d i s a b l e d t o e n a b l e l i n k i n g a g a i n s t D F .
# h t t p : / / d e v e l o p e r b l o g . r e d h a t . c o m / 2 0 1 5 / 0 2 / 0 5 / g c c 5 - a n d - t h e - c 1 1 - a b i /
@ -42,12 +42,12 @@ endmacro()
if ( UNIX )
if ( CMAKE_COMPILER_IS_GNUCC )
CHECK_GCC ( ${ CMAKE_C_COMPILER } )
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 } )
check_gcc ( ${ CMAKE_CXX_COMPILER } )
else ( )
message ( SEND_ERROR "C++ compiler is not GCC" )
endif ( )
@ -68,51 +68,51 @@ set(CMAKE_CXX_EXTENSIONS OFF)
if ( MSVC )
# d i s a b l e C 4 8 1 9 c o d e - p a g e w a r n i n g
add_definitions ( "/wd4819" )
add_definitions ( "/wd4819" )
# D i s a b l e u s e o f P O S I X n a m e w a r n i n g s
add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS" )
# d i s a b l e u s e o f P O S I X n a m e w a r n i n g s
add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS" )
# s u p r e s s C 4 5 0 3 - V C + + d i s l i k e s i f a n a m e i s t o o l o n g . I f y o u g e t
# w e i r d a n d m y s t e r i o u s l i n k i n g e r r o r s , y o u c a n d i s a b l e t h i s , b u t y o u ' l l h a v e t o
# d e a l w i t h a L O T o f c o m p i l e r n o i s e o v e r i t
# s e e h t t p s : / / m s d n . m i c r o s o f t . c o m / e n - u s / l i b r a r y / 0 7 4 a f 4 b 6 . a s p x
add_definitions ( "/wd4503" )
add_definitions ( "/wd4503" )
# s u p p r e s s C 4 2 6 7 - V C + + c o m p l a i n s w h e n e v e r w e i m p l i c i t l y c o n v e r t a n i n t e g e r t o
# a s m a l l e r t y p e , a n d m o s t o f t h e t i m e t h i s i s j u s t c o n v e r s i o n f r o m 6 4 t o 3 2 b i t s
# f o r t h i n g s l i k e v e c t o r s i z e s , w h i c h a r e n e v e r t h a t b i g a n y w a y .
add_definitions ( "/wd4267" )
add_definitions ( "/wd4267" )
endif ( )
# A u t o m a t i c a l l y d e t e c t a r c h i t e c t u r e b a s e d o n V i s u a l S t u d i o g e n e r a t o r
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 )
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 )
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 ( )
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 ( 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)
# C h e c k f o r M F C !
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 ( )
# m a c r o f o r s e t t i n g u p I D E f o l d e r s w i t h o u t n a s t y IF ( ) s e v e r y w h e r e
MACRO ( IDE_FOLDER target folder )
# m a c r o f o r s e t t i n g u p I D E f o l d e r s w i t h o u t n a s t y if ( ) s e v e r y w h e r e
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
$ { d f h a c k _ S O U R C E _ D I R } / C M a k e / M o d u l e s
$ { C M A K E _ M O D U L E _ P A T H }
set ( CMAKE_MODULE_PATH
$ { d f h a c k _ S O U R C E _ D I R } / C M a k e / M o d u l e s
$ { C M A K E _ M O D U L E _ P A T H }
)
# g e n e r a t e s c o m p i l e _ c o m m a n d s . j s o n , u s e d f o r a u t o c o m p l e t i o n b y s o m e e d i t o r s
SET ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
include ( CheckCXXSourceCompiles )
CHECK_CXX_SOURCE_COMPILES ( "
check_cxx_source_compiles ( "
# i n c l u d e < c s t d l i b >
# i n c l u d e < c u c h a r >
i n t main ( void ) {
@ -168,7 +168,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
endif ( )
# m a k e s u r e a l l t h e n e c e s s a r y s u b m o d u l e s h a v e b e e n s e t u p
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,39 +185,40 @@ set(DFHACK_BUILD_ID "" CACHE STRING "Build ID (should be specified on command li
# # w h e r e t o i n s t a l l things ( after the build is done, classic 'make install' or package structure )
# t h e d f h a c k l i b r a r i e s w i l l b e i n s t a l l e d h e r e :
IF ( UNIX )
if ( UNIX )
# p u t t h e l i b i n t o D F / h a c k
SET ( DFHACK_LIBRARY_DESTINATION hack )
SET ( DFHACK_EGGY_DESTINATION libs )
ELSE ( )
set ( DFHACK_LIBRARY_DESTINATION hack )
set ( DFHACK_EGGY_DESTINATION libs )
else ( )
# w i n d o w s i s c r a p , t h e r e f o r e w e c a n ' t d o n i c e t h i n g s w i t h i t . l e a v e t h e l i b s o n a n a s t y p i l e . . .
SET ( DFHACK_LIBRARY_DESTINATION . )
SET ( DFHACK_EGGY_DESTINATION . )
ENDIF ( )
set ( DFHACK_LIBRARY_DESTINATION . )
set ( DFHACK_EGGY_DESTINATION . )
endif ( )
# e x t e r n a l t o o l s w i l l b e i n s t a l l e d h e r e :
SET ( DFHACK_BINARY_DESTINATION . )
set ( DFHACK_BINARY_DESTINATION . )
# d f h a c k d a t a g o e s h e r e :
SET ( DFHACK_DATA_DESTINATION hack )
set ( DFHACK_DATA_DESTINATION hack )
# p l u g i n l i b s g o h e r e :
SET ( DFHACK_PLUGIN_DESTINATION hack/plugins )
set ( DFHACK_PLUGIN_DESTINATION hack/plugins )
# d f h a c k h e a d e r f i l e s g o h e r e :
SET ( DFHACK_INCLUDES_DESTINATION hack/include )
set ( DFHACK_INCLUDES_DESTINATION hack/include )
# d f h a c k l u a f i l e s g o h e r e :
SET ( DFHACK_LUA_DESTINATION hack/lua )
set ( DFHACK_LUA_DESTINATION hack/lua )
# t h e w i n d o w s . l i b f i l e g o e s h e r e :
SET ( DFHACK_DEVLIB_DESTINATION hack )
set ( DFHACK_DEVLIB_DESTINATION hack )
# u s e r d o c u m e n t a t i o n g o e s h e r e :
SET ( DFHACK_USERDOC_DESTINATION hack )
set ( DFHACK_USERDOC_DESTINATION hack )
# d e v e l o p e r d o c u m e n t a t i o n g o e s h e r e :
SET ( DFHACK_DEVDOC_DESTINATION hack )
set ( DFHACK_DEVDOC_DESTINATION hack )
# # s o m e o p t i o n s f o r t h e u s e r / d e v e l o p e r t o p l a y w i t h
OPTION ( BUILD_LIBRARY "Build the library that goes into DF." ON )
OPTION ( BUILD_PLUGINS "Build the plugins." ON )
# s o m e o p t i o n s f o r t h e u s e r / d e v e l o p e r t o p l a y w i t h
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 )
set ( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
if ( UNIX )
# # f l a g s f o r G C C
# d e f a u l t t o h i d d e n s y m b o l s
# b u i l d 3 2 b i t
@ -225,28 +226,28 @@ IF(UNIX)
# e n a b l e C + + 1 1 f e a t u r e s
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 )
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 )
# f o r m s v c , t e l l i t t o a l w a y s u s e 8 - b y t e p o i n t e r s t o m e m b e r f u n c t i o n s t o a v o i d c o n f u s i o n
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 ( 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 ( )
# u s e s h a r e d l i b r a r i e s f o r p r o t o b u f
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 )
@ -281,7 +282,6 @@ if(WIN32)
file ( COPY ${ ZLIB_DOWNLOAD_DIR } /zlib.lib
D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / d e p e n d s / z l i b / l i b / )
# D o t h e s a m e f o r S D L r e a l . d l l
# ( D F H a c k d o e s n ' t r e q u i r e t h i s a t b u i l d t i m e , s o n o n e e d t o m o v e i t t o t h e b u i l d f o l d e r )
set ( SDLREAL_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /package/windows/win ${ DFHACK_BUILD_ARCH } )
@ -386,10 +386,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 )
@ -403,8 +403,8 @@ if(NOT GIT_FOUND)
endif ( )
# b u i l d t h e l i b i t s e l f
IF ( BUILD_LIBRARY )
add_subdirectory ( library )
if ( BUILD_LIBRARY )
add_subdirectory ( library )
install ( FILES LICENSE.rst docs/changelog.txt DESTINATION ${ DFHACK_USERDOC_DESTINATION } )
endif ( )
@ -414,16 +414,16 @@ 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}" )
# b u i l d t h e p l u g i n s
IF ( BUILD_PLUGINS )
add_subdirectory ( plugins )
# b u i l d t h e p l u g i n s
if ( BUILD_PLUGINS )
add_subdirectory ( plugins )
endif ( )
add_subdirectory ( scripts )
find_package ( Sphinx QUIET )
if ( BUILD_DOCS )
if ( NOT SPHINX_FOUND )
if ( BUILD_DOCS )
if ( NOT SPHINX_FOUND )
message ( SEND_ERROR "Sphinx not found but BUILD_DOCS enabled" )
endif ( )
@ -468,28 +468,27 @@ if (BUILD_DOCS)
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h $ { S P H I N X _ O U T P U T } )
install ( DIRECTORY ${ dfhack_SOURCE_DIR } /docs/html/
D E S T I N A T I O N $ { D F H A C K _ U S E R D O C _ D E S T I N A T I O N } / d o c s
)
D E S T I N A T I O N $ { D F H A C K _ U S E R D O C _ D E S T I N A T I O N } / d o c s )
install ( FILES docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${ DFHACK_USERDOC_DESTINATION } )
install ( FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}" )
endif ( )
# P a c k a g i n g w i t h C P a c k !
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 ( )
# s e t o n c o m m a n d l i n e
if ( DFHACK_BUILD_ID STREQUAL "" )
set ( DFHACK_BUILD_ID_PACKAGE "" )
@ -497,48 +496,46 @@ else()
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
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } / d f - c o r e " )
ELSE ( )
else ( )
execute_process ( COMMAND ${ CMAKE_COMMAND } -E tar xf "../${DF_CORE_FILENAME}" --format=zip
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } / d f - c o r e " )
FILE ( REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll" )
ENDIF ( )
INSTALL ( DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
file ( REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll" )
endif ( )
install ( DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
D E S T I N A T I O N . )
ENDIF ( )
# INCLUDE ( FindSphinx.cmake )
endif ( )
# S t o r e o l d b u i l d a r c h
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 )