2009-09-13 18:02:46 -06:00
# don't use this file directly. use the one in the root folder of the project
2010-05-26 04:24:45 -06:00
PROJECT ( dfhack-library )
cmake_minimum_required ( VERSION 2.6 )
SET ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /CMake/Modules )
# disable warning, autosearch
if ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
endif ( COMMAND cmake_policy )
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
message ( SEND_ERROR "In-source builds are not allowed." )
endif ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
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." )
ENDIF ( NOT DEFINED CMAKE_BUILD_TYPE )
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/shm/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/depends/md5/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/depends/tinyxml/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/depends/argstream/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/private/ )
2009-09-13 18:02:46 -06:00
2009-10-26 15:50:08 -06:00
SET ( PROJECT_HDRS
2010-05-25 22:48:23 -06:00
i n c l u d e / d f h a c k / D F E r r o r . h
i n c l u d e / d f h a c k / D F M e m I n f o . h
i n c l u d e / d f h a c k / D F M e m I n f o M a n a g e r . h
i n c l u d e / d f h a c k / D F P r o c e s s E n u m e r a t o r . h
i n c l u d e / d f h a c k / D F P r o c e s s . h
i n c l u d e / d f h a c k / D F T i l e T y p e s . h
i n c l u d e / d f h a c k / D F T y p e s . h
i n c l u d e / d f h a c k / D F V e c t o r . h
i n c l u d e / d f h a c k - c / D F T y p e s _ C . h
i n c l u d e / d f h a c k - c / D F C o n t e x t _ C . h
i n c l u d e / d f h a c k / D F I n t e g e r s . h
2010-05-26 04:24:45 -06:00
i n c l u d e / d f h a c k / m o d u l e s / B u i l d i n g s . h
i n c l u d e / d f h a c k / m o d u l e s / C o n s t r u c t i o n s . h
i n c l u d e / d f h a c k / m o d u l e s / C r e a t u r e s . h
i n c l u d e / d f h a c k / m o d u l e s / G u i . h
i n c l u d e / d f h a c k / m o d u l e s / I t e m s . h
i n c l u d e / d f h a c k / m o d u l e s / M a p s . h
i n c l u d e / d f h a c k / m o d u l e s / M a t e r i a l s . h
i n c l u d e / d f h a c k / m o d u l e s / P o s i t i o n . h
i n c l u d e / d f h a c k / m o d u l e s / T r a n s l a t i o n . h
i n c l u d e / d f h a c k / m o d u l e s / V e g e t a t i o n . h
i n c l u d e / d f h a c k / m o d u l e s / W i n d o w I O . h
i n c l u d e / d f h a c k / m o d u l e s / W o r l d . h
2009-10-26 15:50:08 -06:00
)
2009-09-13 18:02:46 -06:00
SET ( PROJECT_SRCS
D F M e m I n f o . c p p
2009-11-17 19:33:17 -07:00
D F M e m I n f o M a n a g e r . c p p
2010-05-23 15:06:10 -06:00
D F C o n t e x t M a n a g e r . c p p
D F C o n t e x t . c p p
2010-05-26 04:24:45 -06:00
C o n t e x t S h a r e d . c p p
2010-05-25 14:40:24 -06:00
D F C o n t e x t _ C . c p p
D F T y p e s _ C . c p p
2010-04-02 19:52:46 -06:00
d e p e n d s / m d 5 / m d 5 . c p p
d e p e n d s / m d 5 / m d 5 w r a p p e r . c p p
d e p e n d s / t i n y x m l / t i n y s t r . c p p
d e p e n d s / t i n y x m l / t i n y x m l . c p p
d e p e n d s / t i n y x m l / t i n y x m l e r r o r . c p p
d e p e n d s / t i n y x m l / t i n y x m l p a r s e r . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / B u i l d i n g s . c p p
m o d u l e s / C o n s t r u c t i o n s . c p p
2010-04-02 19:52:46 -06:00
m o d u l e s / C r e a t u r e s . c p p
m o d u l e s / G u i . c p p
2010-05-02 02:35:23 -06:00
m o d u l e s / I t e m s . c p p
2010-04-02 19:52:46 -06:00
m o d u l e s / M a p s . c p p
m o d u l e s / M a t e r i a l s . c p p
m o d u l e s / P o s i t i o n . c p p
2010-04-06 09:11:58 -06:00
m o d u l e s / T r a n s l a t i o n . c p p
2010-04-07 04:49:37 -06:00
m o d u l e s / V e g e t a t i o n . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / W o r l d . c p p
2010-04-30 15:04:17 -06:00
2010-05-25 14:40:24 -06:00
m o d u l e s / B u i l d i n g s _ C . c p p
m o d u l e s / C o n s t r u c t i o n s _ C . c p p
m o d u l e s / C r e a t u r e s _ C . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / G u i _ C . c p p
2010-05-25 14:40:24 -06:00
m o d u l e s / I t e m s _ C . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / M a p s _ C . c p p
m o d u l e s / P o s i t i o n _ C . c p p
m o d u l e s / M a t e r i a l s _ C . c p p
m o d u l e s / T r a n s l a t i o n _ C . c p p
m o d u l e s / V e g e t a t i o n _ C . c p p
2010-05-26 13:51:39 -06:00
m o d u l e s / W i n d o w I O _ C . c p p
m o d u l e s / W o r l d _ C . c p p
2009-09-13 18:02:46 -06:00
)
2009-11-16 20:19:13 -07:00
SET ( PROJECT_HDRS_LINUX
)
SET ( PROJECT_HDRS_WINDOWS
2010-05-26 00:42:09 -06:00
i n c l u d e / d f h a c k / D F s t d i n t _ w i n . h
2009-11-16 20:19:13 -07:00
)
SET ( PROJECT_SRCS_LINUX
D F P r o c e s s - l i n u x . c p p
2009-12-22 14:19:39 -07:00
D F P r o c e s s - l i n u x - S H M . c p p
2010-02-15 16:04:15 -07:00
D F P r o c e s s - l i n u x - w i n e . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / W i n d o w I O - l i n u x . c p p
2009-11-17 19:33:17 -07:00
D F P r o c e s s E n u m e r a t o r - l i n u x . c p p
2009-11-16 20:19:13 -07:00
)
SET ( PROJECT_SRCS_WINDOWS
D F P r o c e s s - w i n d o w s . c p p
2010-01-10 23:27:59 -07:00
D F P r o c e s s - w i n d o w s - S H M . c p p
2010-05-26 04:24:45 -06:00
m o d u l e s / W i n d o w I O - w i n d o w s . c p p
2009-11-17 19:33:17 -07:00
D F P r o c e s s E n u m e r a t o r - w i n d o w s . c p p
2009-11-16 20:19:13 -07:00
)
IF ( UNIX )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_LINUX } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_LINUX } )
ELSE ( UNIX )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_WINDOWS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_WINDOWS } )
ENDIF ( UNIX )
2009-10-26 15:50:08 -06:00
SET_SOURCE_FILES_PROPERTIES ( ${ PROJECT_HDRS } PROPERTIES HEADER_FILE_ONLY TRUE )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_HDRS } )
2009-10-31 12:18:59 -06:00
SET ( MEMXML_DATA_PATH . CACHE PATH "search path for Memory.xml" )
2009-10-29 18:56:40 -06:00
# OPTION( VARIABLE "Description" Initial state)
#OPTION( WITH_FOO "Enable FOO support" ON )
#OPTION( WITH_BAR "Enable BAR component" OFF )
2010-04-26 16:12:22 -06:00
# Are we 64bit? (Damn you, ptrace()!)
IF ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET ( HAVE_64_BIT 0 )
ELSE ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET ( HAVE_64_BIT 1 )
ENDIF ( CMAKE_SIZEOF_VOID_P MATCHES 4 )
2009-10-29 18:56:40 -06:00
2010-05-26 04:24:45 -06:00
CONFIGURE_FILE ( ${ CMAKE_SOURCE_DIR } /library/config.h.cmake ${ CMAKE_SOURCE_DIR } /library/private/config.h )
2009-10-29 18:56:40 -06:00
2010-04-30 14:25:12 -06:00
ADD_DEFINITIONS ( -DBUILD_DFHACK_LIB )
2009-10-29 18:56:40 -06:00
2009-09-13 18:02:46 -06:00
IF ( UNIX )
add_definitions ( -DLINUX_BUILD )
2009-10-29 18:56:40 -06:00
add_definitions ( -DUSE_CONFIG_H )
2009-12-12 12:52:30 -07:00
find_library ( X11_LIBRARY X11 )
2010-05-01 18:38:18 -06:00
SET ( CMAKE_CXX_FLAGS_DEBUG "-g -Wall" )
2010-02-25 15:43:37 -07:00
SET ( CMAKE_CXX_FLAGS "-fvisibility=hidden" )
2009-12-13 14:03:19 -07:00
2010-04-02 19:52:46 -06:00
SET ( PROJECT_LIBS ${ X11_LIBRARY } rt ) #dfhack-md5 dfhack-tixml
2009-09-13 18:02:46 -06:00
ELSE ( UNIX )
2010-04-02 19:52:46 -06:00
SET ( PROJECT_LIBS psapi )
2009-09-13 18:02:46 -06:00
ENDIF ( UNIX )
ADD_LIBRARY ( dfhack SHARED ${ PROJECT_SRCS } )
2009-10-23 12:05:42 -06:00
2009-12-12 12:52:30 -07:00
SET_TARGET_PROPERTIES ( dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
2009-10-23 12:05:42 -06:00
2009-10-29 18:56:40 -06:00
TARGET_LINK_LIBRARIES ( dfhack ${ PROJECT_LIBS } )
IF ( UNIX )
install ( TARGETS dfhack LIBRARY DESTINATION lib )
install ( FILES ${ CMAKE_SOURCE_DIR } /output/Memory.xml DESTINATION share/dfhack )
ENDIF ( UNIX )
2010-05-26 00:42:09 -06:00
################################################################################
# DFCONNECT
###
SET ( DFCONNECT_HDRS
s h m / s h m s . h
s h m / m o d - c o r e . h
s h m / m o d - m a p s . h
)
SET ( PROJECT_SRCS
s h m / m o d - c o r e . c p p
s h m / m o d - m a p s . c p p
#mod-creature40d.cpp
)
SET ( PROJECT_HDRS_LINUX
)
SET ( PROJECT_HDRS_WINDOWS
)
SET ( PROJECT_SRCS_LINUX
s h m / s h m s - l i n u x . c p p
)
SET ( PROJECT_SRCS_WINDOWS
s h m / s h m s - w i n d o w s . c p p
)
IF ( UNIX )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_LINUX } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_LINUX } )
ELSE ( UNIX )
LIST ( APPEND PROJECT_HDRS ${ PROJECT_HDRS_WINDOWS } )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_SRCS_WINDOWS } )
ENDIF ( UNIX )
SET_SOURCE_FILES_PROPERTIES ( ${ PROJECT_HDRS } PROPERTIES HEADER_FILE_ONLY TRUE )
LIST ( APPEND PROJECT_SRCS ${ PROJECT_HDRS } )
#IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
IF ( UNIX )
add_definitions ( -DLINUX_BUILD )
SET ( PROJECT_LIBS rt )
SET ( CMAKE_CXX_FLAGS "-fvisibility=hidden" )
ADD_LIBRARY ( dfconnect SHARED ${ PROJECT_SRCS } )
TARGET_LINK_LIBRARIES ( dfconnect ${ PROJECT_LIBS } )
ELSE ( UNIX )
# SET(PROJECT_LIBS psapi)
ADD_LIBRARY ( SDL SHARED ${ PROJECT_SRCS } )
TARGET_LINK_LIBRARIES ( SDL ${ PROJECT_LIBS } )
ENDIF ( UNIX )
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)