@ -1,62 +1,62 @@
# 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
# 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
# # 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 )
cmake_minimum_required ( VERSION 2.8.12 FATAL_ERROR )
project ( dfhack )
project ( dfhack )
if ( "${CMAKE_GENERATOR}" STREQUAL Ninja )
if ( "${CMAKE_GENERATOR}" STREQUAL Ninja )
if ( "${CMAKE_VERSION}" VERSION_LESS 3.9 )
if ( "${CMAKE_VERSION}" VERSION_LESS 3.9 )
message ( WARNING "You are using an old version of CMake (${CMAKE_VERSION}) with Ninja. This may result in ninja errors - see docs/Compile.rst for more details. Upgrading your CMake version is recommended." )
message ( WARNING "You are using an old version of CMake (${CMAKE_VERSION}) with Ninja. This may result in ninja errors - see docs/Compile.rst for more details. Upgrading your CMake version is recommended." )
endif ( )
endif ( )
endif ( )
endif ( )
macro ( CHECK_GCC COMPILER_PATH )
# S e t u p b u i l d t y p e s
execute_process ( COMMAND ${ COMPILER_PATH } -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
if ( CMAKE_CONFIGURATION_TYPES )
string ( STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT )
set ( CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE )
if ( ${ GCC_VERSION_OUT } VERSION_LESS "4.8" )
else ( CMAKE_CONFIGURATION_TYPES )
message ( SEND_ERROR "${COMPILER_PATH} version ${GCC_VERSION_OUT} cannot be used - use GCC 4.8 or later" )
set ( DFHACK_TYPE_HELP "Choose the type of build, options are: Release and RelWithDebInfo" )
elseif ( ${ GCC_VERSION_OUT } VERSION_GREATER "4.9.9" )
# 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
# 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 .
if ( NOT CMAKE_BUILD_TYPE )
# 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 .
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "${DFHACK_TYPE_HELP}" )
# 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 /
else ( NOT CMAKE_BUILD_TYPE )
add_definitions ( -D_GLIBCXX_USE_CXX11_ABI=0 )
set ( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "${DFHACK_TYPE_HELP}" )
endif ( )
endif ( NOT CMAKE_BUILD_TYPE )
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;RelWithDebInfo" )
endif ( CMAKE_CONFIGURATION_TYPES )
option ( BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF )
option ( REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON )
macro ( CHECK_GCC compiler_path )
execute_process ( COMMAND ${ compiler_path } -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
string ( STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT )
if ( ${ GCC_VERSION_OUT } VERSION_LESS "4.8" )
message ( SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 4.8 or later" )
elseif ( ${ GCC_VERSION_OUT } VERSION_GREATER "4.9.9" )
# 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 /
add_definitions ( -D_GLIBCXX_USE_CXX11_ABI=0 )
endif ( )
endmacro ( )
endmacro ( )
if ( UNIX )
if ( UNIX )
if ( CMAKE_COMPILER_IS_GNUCC )
if ( CMAKE_COMPILER_IS_GNUCC )
CHECK_GCC ( ${ CMAKE_C_COMPILER } )
check_gcc ( ${ CMAKE_C_COMPILER } )
else ( )
else ( )
message ( SEND_ERROR "C compiler is not GCC" )
message ( SEND_ERROR "C compiler is not GCC" )
endif ( )
endif ( )
if ( CMAKE_COMPILER_IS_GNUCXX )
if ( CMAKE_COMPILER_IS_GNUCXX )
CHECK_GCC ( ${ CMAKE_CXX_COMPILER } )
check_gcc ( ${ CMAKE_CXX_COMPILER } )
else ( )
else ( )
message ( SEND_ERROR "C++ compiler is not GCC" )
message ( SEND_ERROR "C++ compiler is not GCC" )
endif ( )
endif ( )
endif ( )
endif ( )
if ( WIN32 )
if ( WIN32 )
if ( ( NOT MSVC ) OR ( MSVC_VERSION LESS 1900 ) OR ( MSVC_VERSION GREATER 1919 ) )
if ( ( NOT MSVC ) OR ( MSVC_VERSION LESS 1900 ) OR ( MSVC_VERSION GREATER 1919 ) )
message ( SEND_ERROR "MSVC 2015 or 2017 is required" )
message ( SEND_ERROR "MSVC 2015 or 2017 is required" )
endif ( )
endif ( )
endif ( )
endif ( )
# A s k f o r C + + 1 1 s t a n d a r d f r o m c o m p i l e r s
# A s k f o r C + + 1 1 s t a n d a r d f r o m c o m p i l e r s
@ -67,52 +67,52 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set ( CMAKE_CXX_EXTENSIONS OFF )
set ( CMAKE_CXX_EXTENSIONS OFF )
if ( MSVC )
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
# 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
# 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" )
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
# 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
# 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
# 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
# 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
# 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
# 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 .
# 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 ( )
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
# 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 ( MSVC AND NOT DEFINED DFHACK_BUILD_ARCH )
IF ( ${ CMAKE_GENERATOR } MATCHES "Win64" )
if ( ${ CMAKE_GENERATOR } MATCHES "Win64" )
SET ( DFHACK_BUILD_ARCH "64" )
set ( DFHACK_BUILD_ARCH "64" )
ELSE ( )
else ( )
SET ( DFHACK_BUILD_ARCH "32" )
set ( DFHACK_BUILD_ARCH "32" )
ENDIF ( )
endif ( )
ELSE ( )
else ( )
SET ( DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')" )
set ( DFHACK_BUILD_ARCH "64" CACHE STRING "Architecture to build ('32' or '64')" )
ENDIF ( )
endif ( )
IF ( "${DFHACK_BUILD_ARCH}" STREQUAL "32" )
if ( "${DFHACK_BUILD_ARCH}" STREQUAL "32" )
SET ( DFHACK_BUILD_32 1 )
set ( DFHACK_BUILD_32 1 )
SET ( DFHACK_BUILD_64 0 )
set ( DFHACK_BUILD_64 0 )
set ( DFHACK_SETARCH "i386" )
set ( DFHACK_SETARCH "i386" )
ELSEIF ( "${DFHACK_BUILD_ARCH}" STREQUAL "64" )
elseif ( "${DFHACK_BUILD_ARCH}" STREQUAL "64" )
SET ( DFHACK_BUILD_32 0 )
set ( DFHACK_BUILD_32 0 )
SET ( DFHACK_BUILD_64 1 )
set ( DFHACK_BUILD_64 1 )
set ( DFHACK_SETARCH "x86_64" )
set ( DFHACK_SETARCH "x86_64" )
ADD_DEFINITIONS ( -DDFHACK64 )
add_definitions ( -DDFHACK64 )
ELSE ( )
else ( )
MESSAGE ( SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}" )
message ( SEND_ERROR "Invalid build architecture (should be 32/64): ${DFHACK_BUILD_ARCH}" )
ENDIF ( )
endif ( )
IF ( CMAKE_CROSSCOMPILING )
if ( CMAKE_CROSSCOMPILING )
SET ( DFHACK_NATIVE_BUILD_DIR "DFHACK_NATIVE_BUILD_DIR-NOTFOUND" CACHE FILEPATH "Path to a native build directory" )
set ( DFHACK_NATIVE_BUILD_DIR "DFHACK_NATIVE_BUILD_DIR-NOTFOUND" CACHE FILEPATH "Path to a native build directory" )
INCLUDE ( "${DFHACK_NATIVE_BUILD_DIR}/ImportExecutables.cmake" )
include ( "${DFHACK_NATIVE_BUILD_DIR}/ImportExecutables.cmake" )
ENDIF ( )
endif ( )
find_package ( Perl REQUIRED )
find_package ( Perl REQUIRED )
@ -121,34 +121,34 @@ find_package(Perl REQUIRED)
# C h e c k f o r M F C !
# C h e c k f o r M F C !
find_package ( MFC QUIET )
find_package ( MFC QUIET )
if ( MFC_FOUND OR ( NOT MSVC ) )
if ( MFC_FOUND OR ( NOT MSVC ) )
OPTION ( CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON )
option ( CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON )
else ( )
else ( )
OPTION ( CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF )
option ( CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF )
endif ( )
endif ( )
if ( CMAKE_USE_FOLDERS )
if ( CMAKE_USE_FOLDERS )
SET_PROPERTY ( GLOBAL PROPERTY USE_FOLDERS ON )
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
else ( )
else ( )
SET_PROPERTY ( GLOBAL PROPERTY USE_FOLDERS OFF )
set_property ( GLOBAL PROPERTY USE_FOLDERS OFF )
endif ( )
endif ( )
# 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
# 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 )
macro ( IDE_FOLDER target folder )
if ( CMAKE_USE_FOLDERS )
if ( CMAKE_USE_FOLDERS )
SET_PROPERTY ( TARGET ${ target } PROPERTY FOLDER ${ folder } )
set_property ( TARGET ${ target } PROPERTY FOLDER ${ folder } )
endif ( )
endif ( )
ENDMACRO ( )
endmacro ( )
SET ( CMAKE_MODULE_PATH
set ( CMAKE_MODULE_PATH
$ { 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
$ { 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 }
$ { 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
# 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 )
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 s t d l i b >
# i n c l u d e < c u c h a r >
# i n c l u d e < c u c h a r >
i n t main ( void ) {
i n t main ( void ) {
@ -164,11 +164,11 @@ endif()
# m i x i n g t h e b u i l d s y s t e m w i t h t h e s o u r c e c o d e i s u g l y a n d s t u p i d . e n f o r c e t h e o p p o s i t e : )
# m i x i n g t h e b u i l d s y s t e m w i t h t h e s o u r c e c o d e i s u g l y a n d s t u p i d . e n f o r c e t h e o p p o s i t e : )
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
message ( FATAL_ERROR "In-source builds are not allowed." )
message ( FATAL_ERROR "In-source builds are not allowed." )
endif ( )
endif ( )
# 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
# 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)" )
message ( SEND_ERROR "One or more required submodules could not be found! Run 'git submodule update --init' from the root DFHack directory. (See the section 'Getting the Code' in docs/Compile.rst)" )
endif ( )
endif ( )
@ -185,68 +185,69 @@ set(DFHACK_BUILD_ID "" CACHE STRING "Build ID (should be specified on command li
# # 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 )
# # 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 :
# 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
# 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_LIBRARY_DESTINATION hack )
SET ( DFHACK_EGGY_DESTINATION libs )
set ( DFHACK_EGGY_DESTINATION libs )
ELSE ( )
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 . . .
# 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_LIBRARY_DESTINATION . )
SET ( DFHACK_EGGY_DESTINATION . )
set ( DFHACK_EGGY_DESTINATION . )
ENDIF ( )
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 :
# 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 :
# 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 :
# 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 :
# 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 :
# 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 :
# 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 :
# 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 :
# 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
# 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_LIBRARY "Build the library that goes into DF." ON )
OPTION ( BUILD_PLUGINS "Build the plugins." ON )
option ( BUILD_PLUGINS "Build the plugins." ON )
SET ( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
set ( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
IF ( UNIX )
if ( UNIX )
# # f l a g s f o r G C C
# # 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
# 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
# b u i l d 3 2 b i t
# e n s u r e c o m p a t i b i l i t y w i t h o l d e r C P U s
# e n s u r e c o m p a t i b i l i t y w i t h o l d e r C P U s
# e n a b l e C + + 1 1 f e a t u r e s
# e n a b l e C + + 1 1 f e a t u r e s
add_definitions ( -DLINUX_BUILD )
add_definitions ( -DLINUX_BUILD )
add_definitions ( -D_GLIBCXX_USE_C99 )
add_definitions ( -D_GLIBCXX_USE_C99 )
SET ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable" )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic" )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic" )
IF ( DFHACK_BUILD_64 )
if ( DFHACK_BUILD_64 )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx" )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx" )
ELSE ( )
else ( )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i686" )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i686" )
ENDIF ( )
endif ( )
STRING ( REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
string ( REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
ELSEIF ( MSVC )
elseif ( MSVC )
# 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
# 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 "${CMAKE_CXX_FLAGS} /vmg /vmm /MP" )
SET ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od" )
STRING ( REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
string ( REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
STRING ( REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
string ( REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
ENDIF ( )
endif ( )
# 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
# 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 ( -DPROTOBUF_USE_DLLS )
ADD_DEFINITIONS ( -DLUA_BUILD_AS_DLL )
add_definitions ( -DLUA_BUILD_AS_DLL )
if ( APPLE )
if ( APPLE )
add_definitions ( -D_DARWIN )
add_definitions ( -D_DARWIN )
@ -262,92 +263,91 @@ endif()
include ( CMake/DownloadFile.cmake )
include ( CMake/DownloadFile.cmake )
if ( WIN32 )
if ( WIN32 )
# D o w n l o a d z l i b o n W i n d o w s
# D o w n l o a d z l i b o n W i n d o w s
set ( ZLIB_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /depends/zlib/lib/win ${ DFHACK_BUILD_ARCH } )
set ( ZLIB_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /depends/zlib/lib/win ${ DFHACK_BUILD_ARCH } )
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib"
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-zlib.lib"
$ { Z L I B _ D O W N L O A D _ D I R } / z l i b . l i b
$ { Z L I B _ D O W N L O A D _ D I R } / z l i b . l i b
" a 3 b 2 f c 6 b 6 8 e f a f a 8 9 b 0 8 8 2 e 3 5 4 f c 8 4 1 8 " )
" a 3 b 2 f c 6 b 6 8 e f a f a 8 9 b 0 8 8 2 e 3 5 4 f c 8 4 1 8 " )
else ( )
else ( )
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib"
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-zlib.lib"
$ { Z L I B _ D O W N L O A D _ D I R } / z l i b . l i b
$ { Z L I B _ D O W N L O A D _ D I R } / z l i b . l i b
" f 4 e b a a 2 1 d 9 d e 2 8 5 6 6 e 8 8 b 1 e d f c d f f 9 0 1 " )
" f 4 e b a a 2 1 d 9 d e 2 8 5 6 6 e 8 8 b 1 e d f c d f f 9 0 1 " )
endif ( )
endif ( )
# M o v e z l i b t o t h e b u i l d f o l d e r s o p o s s i b l e 3 2 a n d 6 4 - b i t b u i l d s
# i n t h e s a m e s o u r c e t r e e d o n ' t c o n f l i c t
file ( COPY ${ CMAKE_SOURCE_DIR } /depends/zlib
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 / )
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 } )
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-SDL.dll"
$ { S D L R E A L _ D O W N L O A D _ D I R } / S D L r e a l . d l l
" 1 a e 2 4 2 c 4 b 9 4 c b 0 3 7 5 6 a 1 2 8 8 1 2 2 a 6 6 f a f " )
else ( )
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-SDL.dll"
$ { S D L R E A L _ D O W N L O A D _ D I R } / S D L r e a l . d l l
" 5 a 0 9 6 0 4 d a c a 6 b 2 b 5 c e 0 4 9 d 7 9 a f 9 3 5 d 6 a " )
endif ( )
endif ( )
if ( APPLE )
# M o v e z l i b t o t h e b u i l d f o l d e r s o p o s s i b l e 3 2 a n d 6 4 - b i t b u i l d s
# l i b s t d c + + ( G C C 4 . 8 . 5 f o r O S X 1 0 . 6 )
# i n t h e s a m e s o u r c e t r e e d o n ' t c o n f l i c t
# f i x e s c r a s h - o n - u n w i n d b u g i n D F ' s l i b s t d c + +
file ( COPY ${ CMAKE_SOURCE_DIR } /depends/zlib
set ( LIBSTDCXX_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /package/darwin/osx ${ DFHACK_BUILD_ARCH } )
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 / )
file ( COPY ${ ZLIB_DOWNLOAD_DIR } /zlib.lib
if ( ${ GCC_VERSION_OUT } VERSION_LESS "4.9" )
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 / )
set ( LIBSTDCXX_GCC_VER "48" )
else ( )
# D o t h e s a m e f o r S D L r e a l . d l l
set ( LIBSTDCXX_GCC_VER "7" )
# ( 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 ( LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7" )
set ( SDLREAL_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /package/windows/win ${ DFHACK_BUILD_ARCH } )
endif ( )
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win64-SDL.dll"
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
$ { S D L R E A L _ D O W N L O A D _ D I R } / S D L r e a l . d l l
if ( ${ LIBSTDCXX_GCC_VER } STREQUAL "48" )
" 1 a e 2 4 2 c 4 b 9 4 c b 0 3 7 5 6 a 1 2 8 8 1 2 2 a 6 6 f a f " )
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc48-libstdcxx.6.dylib.gz"
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" c f 2 6 e d 5 8 8 b e 8 e 8 3 c 8 e 3 a 4 9 9 1 9 7 9 3 b 4 1 6 "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" 1 6 d c 6 d b d 4 e c d e 7 f 9 b 9 5 b b 6 d c 9 1 f 0 7 4 0 4 " )
else ( )
else ( )
# G C C 7
download_file ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/win32-SDL.dll"
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc7-libstdcxx.6.dylib.gz"
$ { S D L R E A L _ D O W N L O A D _ D I R } / S D L r e a l . d l l
" g z "
" 5 a 0 9 6 0 4 d a c a 6 b 2 b 5 c e 0 4 9 d 7 9 a f 9 3 5 d 6 a " )
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" 8 1 3 1 4 b 7 8 4 6 f 9 e 8 8 0 6 4 0 9 b e f 2 1 6 0 c 7 6 e 6 "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" 9 3 b 6 c f 4 b 0 1 e 9 a 9 0 8 4 a 5 0 8 f d 6 a 4 a 8 8 9 9 2 " )
endif ( )
endif ( )
endif ( )
else ( ) # 3 2 - b i t
if ( APPLE )
# l i b s t d c + + ( G C C 4 . 8 . 5 f o r O S X 1 0 . 6 )
# f i x e s c r a s h - o n - u n w i n d b u g i n D F ' s l i b s t d c + +
set ( LIBSTDCXX_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /package/darwin/osx ${ DFHACK_BUILD_ARCH } )
if ( ${ LIBSTDCXX_GCC_VER } STREQUAL "48" )
if ( ${ GCC_VERSION_OUT } VERSION_LESS "4.9" )
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc48-libstdcxx.6.dylib.gz"
set ( LIBSTDCXX_GCC_VER "48" )
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" 4 0 f 3 d 8 3 8 7 1 b 1 1 4 f 0 2 7 9 2 4 0 6 2 6 3 1 1 6 2 1 b "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" c 3 f 5 6 7 8 b 8 2 0 4 9 1 7 e 0 3 8 7 0 8 3 4 9 0 2 c 3 e 8 b " )
else ( )
else ( )
# G C C 7
set ( LIBSTDCXX_GCC_VER "7" )
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc7-libstdcxx.6.dylib.gz"
set ( LIBSTDCXX_DOWNLOAD_DIR "${LIBSTDCXX_DOWNLOAD_DIR}-gcc7" )
" g z "
endif ( )
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" d b d 2 1 3 1 7 1 f 6 6 e d b 9 0 d 2 0 4 d 5 2 5 f 1 0 c 9 6 9 "
if ( ${ DFHACK_BUILD_ARCH } STREQUAL "64" )
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
if ( ${ LIBSTDCXX_GCC_VER } STREQUAL "48" )
" b 1 4 c 8 5 7 e 7 e 4 8 5 a 0 9 7 c 7 0 a 9 c c d 3 1 3 2 d a 7 " )
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc48-libstdcxx.6.dylib.gz"
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" c f 2 6 e d 5 8 8 b e 8 e 8 3 c 8 e 3 a 4 9 9 1 9 7 9 3 b 4 1 6 "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" 1 6 d c 6 d b d 4 e c d e 7 f 9 b 9 5 b b 6 d c 9 1 f 0 7 4 0 4 " )
else ( )
# G C C 7
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx64-gcc7-libstdcxx.6.dylib.gz"
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" 8 1 3 1 4 b 7 8 4 6 f 9 e 8 8 0 6 4 0 9 b e f 2 1 6 0 c 7 6 e 6 "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" 9 3 b 6 c f 4 b 0 1 e 9 a 9 0 8 4 a 5 0 8 f d 6 a 4 a 8 8 9 9 2 " )
endif ( )
else ( ) # 3 2 - b i t
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"
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" 4 0 f 3 d 8 3 8 7 1 b 1 1 4 f 0 2 7 9 2 4 0 6 2 6 3 1 1 6 2 1 b "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" c 3 f 5 6 7 8 b 8 2 0 4 9 1 7 e 0 3 8 7 0 8 3 4 9 0 2 c 3 e 8 b " )
else ( )
# G C C 7
download_file_unzip ( "https://github.com/DFHack/dfhack-bin/releases/download/0.44.09/osx32-gcc7-libstdcxx.6.dylib.gz"
" g z "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b . g z
" d b d 2 1 3 1 7 1 f 6 6 e d b 9 0 d 2 0 4 d 5 2 5 f 1 0 c 9 6 9 "
$ { L I B S T D C X X _ D O W N L O A D _ D I R } / l i b s t d c + + . 6 . d y l i b
" b 1 4 c 8 5 7 e 7 e 4 8 5 a 0 9 7 c 7 0 a 9 c c d 3 1 3 2 d a 7 " )
endif ( )
endif ( )
endif ( )
endif ( )
install ( PROGRAMS ${ LIBSTDCXX_DOWNLOAD_DIR } /libstdc++.6.dylib
install ( PROGRAMS ${ LIBSTDCXX_DOWNLOAD_DIR } /libstdc++.6.dylib
D E S T I N A T I O N . / h a c k / )
D E S T I N A T I O N . / h a c k / )
endif ( )
endif ( )
@ -386,10 +386,10 @@ if(EXTERNAL_TINYXML)
if ( NOT TinyXML_FOUND )
if ( NOT TinyXML_FOUND )
message ( SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF." )
message ( SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF." )
endif ( )
endif ( )
SET ( DFHACK_TINYXML "tinyxml" )
set ( DFHACK_TINYXML "tinyxml" )
else ( )
else ( )
include_directories ( depends/tinyxml )
include_directories ( depends/tinyxml )
SET ( DFHACK_TINYXML "dfhack-tinyxml" )
set ( DFHACK_TINYXML "dfhack-tinyxml" )
endif ( )
endif ( )
include_directories ( depends/tthread )
include_directories ( depends/tthread )
@ -403,8 +403,8 @@ if(NOT GIT_FOUND)
endif ( )
endif ( )
# b u i l d t h e l i b i t s e l f
# b u i l d t h e l i b i t s e l f
IF ( BUILD_LIBRARY )
if ( BUILD_LIBRARY )
add_subdirectory ( library )
add_subdirectory ( library )
install ( FILES LICENSE.rst docs/changelog.txt DESTINATION ${ DFHACK_USERDOC_DESTINATION } )
install ( FILES LICENSE.rst docs/changelog.txt DESTINATION ${ DFHACK_USERDOC_DESTINATION } )
endif ( )
endif ( )
@ -414,131 +414,128 @@ install(FILES "${CMAKE_BINARY_DIR}/dfhack_setarch.txt" DESTINATION "${DFHACK_DAT
install ( DIRECTORY dfhack-config/ DESTINATION dfhack-config/default )
install ( DIRECTORY dfhack-config/ DESTINATION dfhack-config/default )
install ( DIRECTORY test DESTINATION "${DFHACK_DATA_DESTINATION}" )
install ( DIRECTORY test DESTINATION "${DFHACK_DATA_DESTINATION}" )
# b u i l d t h e p l u g i n s
# b u i l d t h e p l u g i n s
IF ( BUILD_PLUGINS )
if ( BUILD_PLUGINS )
add_subdirectory ( plugins )
add_subdirectory ( plugins )
endif ( )
endif ( )
add_subdirectory ( scripts )
add_subdirectory ( scripts )
find_package ( Sphinx QUIET )
find_package ( Sphinx QUIET )
if ( BUILD_DOCS )
if ( BUILD_DOCS )
if ( NOT SPHINX_FOUND )
if ( NOT SPHINX_FOUND )
message ( SEND_ERROR "Sphinx not found but BUILD_DOCS enabled" )
message ( SEND_ERROR "Sphinx not found but BUILD_DOCS enabled" )
endif ( )
endif ( )
file ( GLOB SPHINX_DEPS
file ( GLOB SPHINX_DEPS
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / * . r s t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / * . r s t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / c h a n g e l o g . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / c h a n g e l o g . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / g e n _ c h a n g e l o g . p y "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / g e n _ c h a n g e l o g . p y "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / i m a g e s / * . p n g "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / i m a g e s / * . p n g "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / s t y l e s / * "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / s t y l e s / * "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c o n f . p y "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c o n f . p y "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / a b o u t . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / a b o u t . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * / a b o u t . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * / a b o u t . t x t "
)
)
file ( GLOB_RECURSE SPHINX_SCRIPT_DEPS
file ( GLOB_RECURSE SPHINX_SCRIPT_DEPS
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * . l u a "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * . l u a "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * . r b "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s c r i p t s / * . r b "
)
)
set ( SPHINX_DEPS ${ SPHINX_DEPS } ${ SPHINX_SCRIPT_DEPS }
set ( SPHINX_DEPS ${ SPHINX_DEPS } ${ SPHINX_SCRIPT_DEPS }
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / L I C E N S E . r s t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / L I C E N S E . r s t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C M a k e L i s t s . t x t "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C M a k e L i s t s . t x t "
)
)
set ( SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo" )
set ( SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo" )
set_source_files_properties ( ${ SPHINX_OUTPUT } PROPERTIES GENERATED TRUE )
set_source_files_properties ( ${ SPHINX_OUTPUT } PROPERTIES GENERATED TRUE )
add_custom_command ( OUTPUT ${ SPHINX_OUTPUT }
add_custom_command ( OUTPUT ${ SPHINX_OUTPUT }
C O M M A N D $ { S P H I N X _ E X E C U T A B L E }
C O M M A N D $ { S P H I N X _ E X E C U T A B L E }
- a - E - q - b h t m l
- a - E - q - b h t m l
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / h t m l "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / h t m l "
- w " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / _ s p h i n x - w a r n i n g s . t x t "
- w " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d o c s / _ s p h i n x - w a r n i n g s . t x t "
- j 2
- j 2
D E P E N D S $ { S P H I N X _ D E P S }
D E P E N D S $ { S P H I N X _ D E P S }
C O M M E N T " B u i l d i n g H T M L d o c u m e n t a t i o n w i t h S p h i n x "
C O M M E N T " B u i l d i n g H T M L d o c u m e n t a t i o n w i t h S p h i n x "
)
)
add_custom_target ( dfhack_docs ALL
add_custom_target ( dfhack_docs ALL
D E P E N D S $ { S P H I N X _ O U T P U T }
D E P E N D S $ { S P H I N X _ O U T P U T }
)
)
# S p h i n x d o e s n ' t t o u c h t h i s f i l e i f i t d i d n ' t m a k e c h a n g e s ,
# S p h i n x d o e s n ' t t o u c h t h i s f i l e i f i t d i d n ' t m a k e c h a n g e s ,
# w h i c h m a k e s C M a k e t h i n k i t d i d n ' t c o m p l e t e
# w h i c h m a k e s C M a k e t h i n k i t d i d n ' t c o m p l e t e
add_custom_command ( TARGET dfhack_docs POST_BUILD
add_custom_command ( TARGET dfhack_docs POST_BUILD
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 } )
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/
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 docs/_auto/news.rst docs/_auto/news-dev.rst DESTINATION ${ DFHACK_USERDOC_DESTINATION } )
install ( FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}" )
install ( FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}" )
endif ( )
endif ( )
# P a c k a g i n g w i t h C P a c k !
# P a c k a g i n g w i t h C P a c k !
SET ( DFHACK_PACKAGE_SUFFIX "" )
set ( DFHACK_PACKAGE_SUFFIX "" )
IF ( UNIX )
if ( UNIX )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } -dumpversion OUTPUT_VARIABLE GCC_VERSION )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } -dumpversion OUTPUT_VARIABLE GCC_VERSION )
string ( STRIP ${ GCC_VERSION } GCC_VERSION )
string ( STRIP ${ GCC_VERSION } GCC_VERSION )
SET ( DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}" )
set ( DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}" )
SET ( CPACK_GENERATOR "TBZ2" )
set ( CPACK_GENERATOR "TBZ2" )
ELSEIF ( WIN32 )
elseif ( WIN32 )
SET ( CPACK_GENERATOR "ZIP" )
set ( CPACK_GENERATOR "ZIP" )
ENDIF ( )
endif ( )
set ( CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0 )
set ( CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0 )
IF ( APPLE )
if ( APPLE )
set ( DFHACK_PACKAGE_PLATFORM_NAME OSX )
set ( DFHACK_PACKAGE_PLATFORM_NAME OSX )
ELSE ( )
else ( )
set ( DFHACK_PACKAGE_PLATFORM_NAME ${ CMAKE_SYSTEM_NAME } )
set ( DFHACK_PACKAGE_PLATFORM_NAME ${ CMAKE_SYSTEM_NAME } )
ENDIF ( )
endif ( )
# s e t o n c o m m a n d l i n e
# s e t o n c o m m a n d l i n e
if ( DFHACK_BUILD_ID STREQUAL "" )
if ( DFHACK_BUILD_ID STREQUAL "" )
set ( DFHACK_BUILD_ID_PACKAGE "" )
set ( DFHACK_BUILD_ID_PACKAGE "" )
else ( )
else ( )
set ( DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-" )
set ( DFHACK_BUILD_ID_PACKAGE "${DFHACK_BUILD_ID}-" )
endif ( )
endif ( )
set ( CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}" )
set ( CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}" )
INCLUDE ( CPack )
include ( CPack )
OPTION ( DFHACK_INCLUDE_CORE "Download and include Dwarf Fortress core files in DFHack. Useful for local testing, but should not be used in releases." OFF )
option ( DFHACK_INCLUDE_CORE "Download and include Dwarf Fortress core files in DFHack. Useful for local testing, but should not be used in releases." OFF )
IF ( DFHACK_INCLUDE_CORE )
if ( DFHACK_INCLUDE_CORE )
STRING ( REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}" )
string ( REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}" )
STRING ( REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}" )
string ( REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}" )
IF ( UNIX )
if ( UNIX )
IF ( APPLE )
if ( APPLE )
STRING ( APPEND DF_CORE_FILENAME "_osx" )
string ( APPEND DF_CORE_FILENAME "_osx" )
ELSE ( )
else ( )
STRING ( APPEND DF_CORE_FILENAME "_linux" )
string ( APPEND DF_CORE_FILENAME "_linux" )
ENDIF ( )
endif ( )
IF ( DFHACK_BUILD_32 )
if ( DFHACK_BUILD_32 )
STRING ( APPEND DF_CORE_FILENAME "32" )
string ( APPEND DF_CORE_FILENAME "32" )
ENDIF ( )
endif ( )
STRING ( APPEND DF_CORE_FILENAME ".tar.bz2" )
string ( APPEND DF_CORE_FILENAME ".tar.bz2" )
ELSE ( )
else ( )
STRING ( APPEND DF_CORE_FILENAME "_win" )
string ( APPEND DF_CORE_FILENAME "_win" )
IF ( DFHACK_BUILD_32 )
if ( DFHACK_BUILD_32 )
STRING ( APPEND DF_CORE_FILENAME "32" )
string ( APPEND DF_CORE_FILENAME "32" )
ENDIF ( )
endif ( )
STRING ( APPEND DF_CORE_FILENAME ".zip" )
string ( APPEND DF_CORE_FILENAME ".zip" )
ENDIF ( )
endif ( )
SET ( DF_CORE_URL "http://bay12games.com/dwarves/${DF_CORE_FILENAME}" )
set ( DF_CORE_URL "http://bay12games.com/dwarves/${DF_CORE_FILENAME}" )
IF ( NOT EXISTS "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" )
if ( NOT EXISTS "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" )
FILE ( DOWNLOAD "${DF_CORE_URL}" "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" SHOW_PROGRESS )
file ( DOWNLOAD "${DF_CORE_URL}" "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" SHOW_PROGRESS )
ENDIF ( )
endif ( )
FILE ( REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core" )
file ( REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core" )
FILE ( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core" )
file ( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core" )
IF ( UNIX )
if ( UNIX )
execute_process ( COMMAND ${ CMAKE_COMMAND } -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1
execute_process ( COMMAND ${ CMAKE_COMMAND } -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1
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 " )
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
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 " )
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" )
file ( REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll" )
ENDIF ( )
endif ( )
INSTALL ( DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
install ( DIRECTORY "${CMAKE_BINARY_DIR}/df-core/"
D E S T I N A T I O N . )
D E S T I N A T I O N . )
ENDIF ( )
endif ( )
# INCLUDE ( FindSphinx.cmake )
# S t o r e o l d b u i l d a r c h
# 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 )