2009-09-13 18:02:46 -06:00
# main project file. use it from a build sub-folder, see COMPILE for details
2010-01-03 22:20:28 -07:00
PROJECT ( dfhack )
2009-09-13 18:02:46 -06:00
cmake_minimum_required ( VERSION 2.6 )
2010-03-23 14:35:14 -06:00
SET ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /CMake/Modules )
2011-02-28 23:50:56 -07:00
SET ( DFHACK_VERSION "0.5.2" )
2009-09-13 18:02:46 -06:00
2010-08-16 01:09:33 -06:00
# Set this to project source dir. When dfhack is used
# as a submodule, CMAKE_SOURCE_DIR is not pointing to
# the root where this particular CMakeLists.txt file sits.
SET ( CMAKE_SOURCE_DIR ${ PROJECT_SOURCE_DIR } )
2009-09-13 18:02:46 -06:00
# disable warning, autosearch
if ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
endif ( COMMAND cmake_policy )
2010-05-26 04:24:45 -06:00
if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
2009-09-13 18:02:46 -06:00
message ( SEND_ERROR "In-source builds are not allowed." )
2010-05-26 04:24:45 -06:00
endif ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
2009-09-13 18:02:46 -06:00
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 )
2010-05-26 04:24:45 -06:00
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" )
2010-08-12 18:23:38 -06:00
SET ( DATA_OUTPUT_PATH ${ CMAKE_SOURCE_DIR } /output CACHE PATH "Output directory for the dfhack data (offset files)" )
2009-09-13 18:02:46 -06:00
2010-06-23 16:34:35 -06:00
OPTION ( BUILD_DFHACK_DOCUMENTATION "Create doxygen documentation for developers" OFF )
2010-07-08 14:58:01 -06:00
OPTION ( BUILD_DFHACK_EXAMPLES "Build example tools" OFF )
OPTION ( BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF )
2010-08-30 11:48:58 -06:00
OPTION ( BUILD_DFHACK_C_BINDINGS "Build the C portion of the library" ON )
2010-08-14 12:22:59 -06:00
OPTION ( BUILD_OFFSET_EDITOR "Build the Offset GUI editor (not ready for use)." OFF )
2010-08-15 16:45:02 -06:00
OPTION ( BUILD_DFHACK_SUPPORTED "Build the supported toold." ON )
OPTION ( BUILD_DFHACK_SHM "Build the SHM." OFF )
2010-06-23 16:34:35 -06:00
2010-05-25 22:48:23 -06:00
include_directories ( ${ CMAKE_SOURCE_DIR } /library/include/ )
include_directories ( ${ CMAKE_SOURCE_DIR } /library/shm/ )
2011-03-06 14:20:08 -07:00
include_directories ( ${ CMAKE_SOURCE_DIR } /library/depends/argstream/ )
2009-09-13 18:02:46 -06:00
2010-05-25 22:48:23 -06:00
add_subdirectory ( library )
2010-08-14 12:22:59 -06:00
2010-08-15 16:45:02 -06:00
IF ( BUILD_DFHACK_SUPPORTED )
add_subdirectory ( tools/supported )
ENDIF ( BUILD_DFHACK_SUPPORTED )
2010-08-14 12:22:59 -06:00
IF ( BUILD_OFFSET_EDITOR )
add_subdirectory ( offsetedit )
ENDIF ( BUILD_OFFSET_EDITOR )
2010-08-15 16:45:02 -06:00
IF ( BUILD_DFHACK_SHM )
add_subdirectory ( library/shm )
ENDIF ( BUILD_DFHACK_SHM )
IF ( BUILD_DFHACK_EXAMPLES )
add_subdirectory ( tools/examples )
ENDIF ( BUILD_DFHACK_EXAMPLES )
IF ( BUILD_DFHACK_PLAYGROUND )
add_subdirectory ( tools/playground )
ENDIF ( BUILD_DFHACK_PLAYGROUND )
IF ( BUILD_DFHACK_DOCUMENTATION )
add_subdirectory ( doc )
2010-08-28 14:47:38 -06:00
ENDIF ( BUILD_DFHACK_DOCUMENTATION )