2009-09-13 18:02:46 -06:00
|
|
|
# main project file. use it from a build sub-folder, see COMPILE for details
|
2011-03-16 00:35:08 -06:00
|
|
|
|
|
|
|
## some generic CMake magic
|
2011-07-11 15:07:42 -06:00
|
|
|
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
2011-06-19 17:12:07 -06:00
|
|
|
project(dfhack)
|
2009-09-13 18:02:46 -06:00
|
|
|
|
2011-03-20 10:17:33 -06:00
|
|
|
SET(CMAKE_MODULE_PATH
|
|
|
|
${dfhack_SOURCE_DIR}/CMake/Modules
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
)
|
2010-08-16 01:09:33 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
2011-03-17 17:07:40 -06:00
|
|
|
message(FATAL_ERROR "In-source builds are not allowed.")
|
2011-03-16 00:35:08 -06:00
|
|
|
endif()
|
2009-09-13 18:02:46 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
set(DFHACK_VERSION_MAJOR "0")
|
|
|
|
set(DFHACK_VERSION_MINOR "31")
|
|
|
|
set(DFHACK_VERSION_PATCH "25")
|
2011-05-27 00:20:52 -06:00
|
|
|
set(DFHACK_REVISION "1")
|
2011-03-19 16:26:32 -06:00
|
|
|
|
2011-03-17 23:07:13 -06:00
|
|
|
set(DFHACK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
2011-03-16 00:35:08 -06:00
|
|
|
|
|
|
|
## setting the build type
|
2011-03-19 13:17:04 -06:00
|
|
|
IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Release RelWithDebInfo.")
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
2009-09-13 18:02:46 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(DFHACK_OUTPUT_DIR "${dfhack_BINARY_DIR}/bin" CACHE STRING "Where should be the produced libraries and binaries stored.")
|
2011-06-22 10:04:22 -06:00
|
|
|
SET(DFHACK_PLUGIN_OUTPUT_DIR "${DFHACK_OUTPUT_DIR}/plugins")
|
2011-06-19 17:12:07 -06:00
|
|
|
|
|
|
|
## where to put things during the build (force MSVC to behave)
|
2011-07-13 20:05:27 -06:00
|
|
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR})
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR})
|
|
|
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR})
|
|
|
|
|
|
|
|
## where to install things (after the build is done, classic 'make install' or package structure)
|
|
|
|
# the dfhack libraries will be installed here:
|
|
|
|
SET(DFHACK_LIBRARY_DESTINATION .)
|
|
|
|
# the dfhack tools will be installed here:
|
|
|
|
SET(DFHACK_BINARY_DESTINATION .)
|
|
|
|
# Memory.xml goes here:
|
|
|
|
SET(DFHACK_DATA_DESTINATION .)
|
2011-06-22 10:04:22 -06:00
|
|
|
# Plugins go here
|
|
|
|
SET(DFHACK_PLUGIN_DESTINATION plugins)
|
2011-06-19 17:12:07 -06:00
|
|
|
# Includes go here:
|
|
|
|
SET(DFHACK_INCLUDES_DESTINATION dev/include)
|
|
|
|
# the Windows .lib files go here:
|
2011-03-17 23:07:13 -06:00
|
|
|
IF(WIN32)
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(DFHACK_DEVLIB_DESTINATION dev)
|
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
|
2011-03-18 09:47:55 -06:00
|
|
|
ENDIF()
|
2011-05-21 12:32:53 -06:00
|
|
|
IF(UNIX)
|
2011-06-19 17:12:07 -06:00
|
|
|
SET(CMAKE_INSTALL_RPATH "$ORIGIN")
|
2011-05-21 12:32:53 -06:00
|
|
|
ENDIF()
|
2011-06-19 17:12:07 -06:00
|
|
|
# documentation goes here:
|
|
|
|
SET(DFHACK_USERDOC_DESTINATION .)
|
|
|
|
SET(DFHACK_DEVDOC_DESTINATION dev)
|
|
|
|
SET(DFHACK_DOXYGEN_DESTINATION dev/doxygen)
|
2011-05-21 12:32:53 -06:00
|
|
|
|
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
## some options for the user/developer to play with
|
|
|
|
OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON)
|
2011-07-11 16:07:59 -06:00
|
|
|
OPTION(BUILD_PLUGINS "Build the plugins." ON)
|
2011-05-21 12:32:53 -06:00
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
IF(BUILD_LIBRARY)
|
2011-03-18 09:47:55 -06:00
|
|
|
add_subdirectory (library)
|
|
|
|
## install the default documentation files
|
|
|
|
install(FILES LICENSE Readme.html DESTINATION ${DFHACK_USERDOC_DESTINATION})
|
|
|
|
endif()
|
2010-08-15 16:45:02 -06:00
|
|
|
|
2011-06-19 20:29:38 -06:00
|
|
|
IF(BUILD_PLUGINS)
|
|
|
|
add_subdirectory (plugins)
|
|
|
|
endif()
|
|
|
|
|
2011-06-19 17:12:07 -06:00
|
|
|
# Packaging with CPack!
|
|
|
|
IF(UNIX)
|
|
|
|
SET(CPACK_GENERATOR "TGZ")
|
2011-03-16 00:35:08 -06:00
|
|
|
ENDIF()
|
2011-06-19 17:12:07 -06:00
|
|
|
IF(WIN32)
|
|
|
|
SET(CPACK_GENERATOR "ZIP")
|
|
|
|
# this includes the MSVC C++ DLLs in the package. Doesn't work with Express versions in general.
|
|
|
|
# we should be fine with the stuff DF already has packaged... so, commenting out
|
|
|
|
# INCLUDE(InstallRequiredSystemLibraries)
|
2011-03-19 16:26:32 -06:00
|
|
|
ENDIF()
|
2011-06-19 17:12:07 -06:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${DFHACK_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
INCLUDE(CPack)
|
2011-03-19 16:26:32 -06:00
|
|
|
|
|
|
|
|