@ -1,23 +1,15 @@
# d o n ' t u s e t h i s f i l e d i r e c t l y . u s e t h e o n e i n t h e r o o t f o l d e r o f t h e p r o j e c t
# d o n ' t u s e t h i s f i l e d i r e c t l y . u s e t h e o n e i n t h e r o o t f o l d e r o f t h e p r o j e c t
PROJECT ( dfhack-library )
PROJECT ( dfhack-library )
cmake_minimum_required ( VERSION 2. 6 )
cmake_minimum_required ( VERSION 2. 8 )
SET ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /CMake/Modules )
SET ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /CMake/Modules )
# d i s a b l e w a r n i n g , a u t o s e a r c h
if ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
endif ( COMMAND cmake_policy )
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
message ( SEND_ERROR "In-source builds are not allowed." )
message ( SEND_ERROR "In-source builds are not allowed." )
endif ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
endif ( )
IF ( NOT DEFINED CMAKE_BUILD_TYPE )
IF ( NOT DEFINED CMAKE_BUILD_TYPE )
SET ( CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." )
SET ( CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." )
ENDIF ( NOT DEFINED CMAKE_BUILD_TYPE )
ENDIF ( )
SET ( LIBRARY_OUTPUT_PATH ${ CMAKE_SOURCE_DIR } /output CACHE PATH "Output directory for the dfhack library" )
SET ( EXECUTABLE_OUTPUT_PATH ${ CMAKE_SOURCE_DIR } /output CACHE PATH "Output directory for the dfhack tools" )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/include/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/include/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/shm/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/shm/ )
@ -159,31 +151,28 @@ modules/WindowIO-windows.cpp
IF ( UNIX )
IF ( UNIX )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_LINUX } )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_LINUX } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_LINUX } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_LINUX } )
ELSE ( UNIX )
ELSE ( )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_WINDOWS } )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_WINDOWS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_WINDOWS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_WINDOWS } )
ENDIF ( UNIX )
ENDIF ( )
IF ( BUILD_DFHACK_C_BINDINGS )
IF ( BUILD_DFHACK_C_BINDINGS )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_C_HDRS } )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_C_HDRS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_C_SRCS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_C_SRCS } )
ENDIF ( BUILD_DFHACK_C_BINDINGS )
ENDIF ( )
SET_SOURCE_FILES_PROPERTIES ( ${ PROJECT_HDRS } PROPERTIES HEADER_FILE_ONLY TRUE )
SET_SOURCE_FILES_PROPERTIES ( ${ PROJECT_HDRS } PROPERTIES HEADER_FILE_ONLY TRUE )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_HDRS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_HDRS } )
SET ( MEMXML_DATA_PATH . CACHE PATH "search path for Memory.xml" )
SET ( MEMXML_DATA_PATH . CACHE PATH "search path for Memory.xml" )
# OPTION ( VARIABLE "Description" Initial state )
# OPTION ( WITH_FOO "Enable FOO support" ON )
# OPTION ( WITH_BAR "Enable BAR component" OFF )
# A r e w e 6 4 b i t ? ( D a m n y o u , ptrace ( ) ! )
# A r e w e 6 4 b i t ? ( D a m n y o u , ptrace ( ) ! )
IF ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
IF ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET ( HAVE_64_BIT 0 )
SET ( HAVE_64_BIT 0 )
ELSE ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
ELSE ( )
SET ( HAVE_64_BIT 1 )
SET ( HAVE_64_BIT 1 )
ENDIF ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
ENDIF ( )
CONFIGURE_FILE ( ${ CMAKE_SOURCE_DIR } /library/config.h.cmake ${ CMAKE_SOURCE_DIR } /library/private/config.h )
CONFIGURE_FILE ( ${ CMAKE_SOURCE_DIR } /library/config.h.cmake ${ CMAKE_SOURCE_DIR } /library/private/config.h )
@ -197,14 +186,13 @@ IF(UNIX)
SET ( CMAKE_CXX_FLAGS "-fvisibility=hidden" )
SET ( CMAKE_CXX_FLAGS "-fvisibility=hidden" )
SET ( PROJECT_LIBS ${ X11_LIBRARY } rt ) # d f h a c k - m d 5 d f h a c k - t i x m l
SET ( PROJECT_LIBS ${ X11_LIBRARY } rt ) # d f h a c k - m d 5 d f h a c k - t i x m l
ELSE ( UNIX )
ELSE ( )
IF ( MSVC )
IF ( MSVC )
SET ( PROJECT_LIBS psapi ${ CMAKE_SOURCE_DIR } /library/depends/ntdll/ntdll.lib )
SET ( PROJECT_LIBS psapi ${ CMAKE_SOURCE_DIR } /library/depends/ntdll/ntdll.lib )
ELSE ( MSVC )
ELSE ( )
SET ( PROJECT_LIBS psapi ntdll )
SET ( PROJECT_LIBS psapi ntdll )
ENDIF ( MSVC )
ENDIF ( )
ENDIF ( )
ENDIF ( UNIX )
ADD_LIBRARY ( dfhack SHARED ${ PROJECT_SRCS } )
ADD_LIBRARY ( dfhack SHARED ${ PROJECT_SRCS } )
@ -212,38 +200,41 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
TARGET_LINK_LIBRARIES ( dfhack ${ PROJECT_LIBS } )
TARGET_LINK_LIBRARIES ( dfhack ${ PROJECT_LIBS } )
if ( MSVC )
ADD_CUSTOM_COMMAND ( TARGET dfhack POST_BUILD
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / M e m o r y . x m l $ { C M A K E _ B I N A R Y _ D I R } / b i n / $ { C M A K E _ C F G _ I N T D I R } / )
# if ( MSVC )
# T h i s i s a MSVC h a c k u s e d f o r c o p y i n g f i l e s i n t o t h e t a r g e t d i r e c t o r y
# T h i s i s a MSVC h a c k u s e d f o r c o p y i n g f i l e s i n t o t h e t a r g e t d i r e c t o r y
# o f b u i l d t a r g e t s e t i n MSVC .
# o f b u i l d t a r g e t s e t i n MSVC .
# I t e x p l o i t s t h e f a c t t h a t MSVC h a s s o m e v a r i a b l e s i n . v c p r o j f i l e s , m u c h l i k e c m a k e d o e s h e r e .
# I t e x p l o i t s t h e f a c t t h a t MSVC h a s s o m e v a r i a b l e s i n . v c p r o j f i l e s , m u c h l i k e c m a k e d o e s h e r e .
#
#
# S o , $ ( T a r g e t D i r ) i s i g n o r e d b y c m a k e , a n d r e p l a c e d w i t h t h e a c t u a l o u t p u t d i r e c t o r y b y MSVC
# S o , $ ( T a r g e t D i r ) i s i g n o r e d b y c m a k e , a n d r e p l a c e d w i t h t h e a c t u a l o u t p u t d i r e c t o r y b y MSVC
ADD_CUSTOM_COMMAND ( TARGET dfhack
# ADD_CUSTOM_COMMAND ( TARGET dfhack
CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / d a t a / M e m o r y - n g . x m l " $ ( T a r g e t D i r ) / M e m o r y . x m l "
# CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / d a t a / M e m o r y - n g . x m l " $ ( T a r g e t D i r ) / M e m o r y . x m l "
MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / d a t a / M e m o r y - n g . x m l
# MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / d a t a / M e m o r y - n g . x m l
)
# )
ADD_CUSTOM_COMMAND ( TARGET dfhack
# ADD_CUSTOM_COMMAND ( TARGET dfhack
CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / C o m p i l e . h t m l " $ ( T a r g e t D i r ) / C o m p i l e . h t m l "
# CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / C o m p i l e . h t m l " $ ( T a r g e t D i r ) / C o m p i l e . h t m l "
MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / C o m p i l e . h t m l
# MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / C o m p i l e . h t m l
)
# )
ADD_CUSTOM_COMMAND ( TARGET dfhack
# ADD_CUSTOM_COMMAND ( TARGET dfhack
CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / R e a d m e . h t m l " $ ( T a r g e t D i r ) / R e a d m e . h t m l "
# CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / R e a d m e . h t m l " $ ( T a r g e t D i r ) / R e a d m e . h t m l "
MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / R e a d m e . h t m l
# MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / R e a d m e . h t m l
)
# )
ADD_CUSTOM_COMMAND ( TARGET dfhack
# ADD_CUSTOM_COMMAND ( TARGET dfhack
CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / L I C E N S E " $ ( T a r g e t D i r ) / L I C E N S E . t x t "
# CO M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ S O U R C E _ D I R } / L I C E N S E " $ ( T a r g e t D i r ) / L I C E N S E . t x t "
MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / L I C E N S E
# MA I N _ D E P E N D E N C Y $ { C M A K E _ S O U R C E _ D I R } / L I C E N S E
)
# )
else ( MSVC )
# else ( MSVC )
# J u s t p u t t h e f i l e i n t h e o u t p u t d i r e c t o r y o n L i n u x a n d M a c
# J u s t p u t t h e f i l e i n t h e o u t p u t d i r e c t o r y o n L i n u x a n d M a c
configure_file ( ${ CMAKE_SOURCE_DIR } /data/Memory-ng.xml ${ DATA_OUTPUT_PATH } /Memory.xml COPYONLY )
# configure_file ( ${ CMAKE_SOURCE_DIR } /data/Memory-ng.xml ${ DATA_OUTPUT_PATH } /Memory.xml COPYONLY )
configure_file ( ${ CMAKE_SOURCE_DIR } /Compile.html ${ DATA_OUTPUT_PATH } /Compile.html COPYONLY )
# configure_file ( ${ CMAKE_SOURCE_DIR } /Compile.html ${ DATA_OUTPUT_PATH } /Compile.html COPYONLY )
configure_file ( ${ CMAKE_SOURCE_DIR } /Readme.html ${ DATA_OUTPUT_PATH } /Readme.html COPYONLY )
# configure_file ( ${ CMAKE_SOURCE_DIR } /Readme.html ${ DATA_OUTPUT_PATH } /Readme.html COPYONLY )
configure_file ( ${ CMAKE_SOURCE_DIR } /LICENSE ${ DATA_OUTPUT_PATH } /LICENSE.txt COPYONLY )
# configure_file ( ${ CMAKE_SOURCE_DIR } /LICENSE ${ DATA_OUTPUT_PATH } /LICENSE.txt COPYONLY )
endif ( MSVC )
# endif ( MSVC )
IF ( UNIX )
# IF ( UNIX )
install ( TARGETS dfhack LIBRARY DESTINATION lib )
# install ( TARGETS dfhack LIBRARY DESTINATION lib )
install ( FILES ${ CMAKE_SOURCE_DIR } /output/Memory.xml DESTINATION share/dfhack )
# install ( FILES ${ CMAKE_SOURCE_DIR } /output/Memory.xml DESTINATION share/dfhack )
install ( DIRECTORY ${ CMAKE_SOURCE_DIR } /library/include/ DESTINATION include FILES_MATCHING PATTERN "*.h" )
# install ( DIRECTORY ${ CMAKE_SOURCE_DIR } /library/include/ DESTINATION include FILES_MATCHING PATTERN "*.h" )
ENDIF ( UNIX )
# ENDIF ( UNIX )