@ -1,37 +1,37 @@
# 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 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 )
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 ( )
endif ( )
# S e t u p b u i l d t y p e s
# S e t u p b u i l d t y p e s
if ( CMAKE_CONFIGURATION_TYPES )
if ( CMAKE_CONFIGURATION_TYPES )
SET ( CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE )
set ( CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE )
else ( CMAKE_CONFIGURATION_TYPES )
else ( CMAKE_CONFIGURATION_TYPES )
set ( DFHACK_TYPE_HELP "Choose the type of build, options are: Release and RelWithDebInfo" )
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
# 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 )
if ( NOT CMAKE_BUILD_TYPE )
SET ( CMAKE_BUILD_TYPE "Release" CACHE STRING "${DFHACK_TYPE_HELP}" )
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "${DFHACK_TYPE_HELP}" )
else ( NOT CMAKE_BUILD_TYPE )
else ( NOT CMAKE_BUILD_TYPE )
SET ( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "${DFHACK_TYPE_HELP}" )
set ( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "${DFHACK_TYPE_HELP}" )
endif ( NOT CMAKE_BUILD_TYPE )
endif ( NOT CMAKE_BUILD_TYPE )
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;RelWithDebInfo" )
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;RelWithDebInfo" )
endif ( CMAKE_CONFIGURATION_TYPES )
endif ( CMAKE_CONFIGURATION_TYPES )
OPTION ( BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF )
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 )
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 )
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 ( )
endif ( )
macro ( CHECK_GCC COMPILER_PATH )
macro ( CHECK_GCC compiler_path )
execute_process ( COMMAND ${ COMPILER_PATH } -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
execute_process ( COMMAND ${ compiler_path } -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
string ( STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT )
string ( STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT )
if ( ${ GCC_VERSION_OUT } VERSION_LESS "4.8" )
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")
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" )
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 .
# 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 .
# 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 .
@ -42,12 +42,12 @@ 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 ( )
@ -70,7 +70,7 @@ 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
@ -86,33 +86,33 @@ if(MSVC)
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 ) {
@ -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 )
# # 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
@ -225,28 +226,28 @@ IF(UNIX)
# 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 )
@ -281,7 +282,6 @@ if(WIN32)
file ( COPY ${ ZLIB_DOWNLOAD_DIR } /zlib.lib
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 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 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 )
# ( 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 } )
set ( SDLREAL_DOWNLOAD_DIR ${ CMAKE_SOURCE_DIR } /package/windows/win ${ DFHACK_BUILD_ARCH } )
@ -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,7 +403,7 @@ 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 ( )
@ -415,7 +415,7 @@ 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 ( )
@ -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 } )
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 "" )
@ -497,48 +496,46 @@ 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 )