Use proper paths in build system.

develop
Petr Mrázek 2011-03-20 17:17:33 +01:00
parent fe92edfb4e
commit 0a35afb16a
8 changed files with 51 additions and 57 deletions

@ -4,16 +4,17 @@
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
PROJECT (dfhack)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# 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})
SET(CMAKE_MODULE_PATH
${dfhack_SOURCE_DIR}/CMake/Modules
${CMAKE_MODULE_PATH}
)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
if("${dfhack_SOURCE_DIR}" STREQUAL "${dfhack_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
SET(DFHACK_CONSISTENCY 1)
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "5")
set(CPACK_PACKAGE_VERSION_PATCH "8")
@ -41,9 +42,9 @@ IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
ENDIF()
## put everything in one big ugly directory to make MSVC and KDevelop debuggers happy
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
IF(WIN32)
set (DFHACK_INST_DEFAULT "portable")
@ -143,9 +144,9 @@ OPTION(BUILD_DFHACK_SUPPORTED "Build the supported tools." ON)
OPTION(BUILD_DFHACK_EXAMPLES "Build example tools" OFF)
OPTION(BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF)
include_directories (${CMAKE_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
include_directories (${dfhack_SOURCE_DIR}/library/include/)
include_directories (${dfhack_SOURCE_DIR}/library/shm/)
include_directories (${dfhack_SOURCE_DIR}/library/depends/argstream/)
# macro to save on typing in the tool subdirs
# builds a tool, links it to the dfhack lib and makes sure the dependency

@ -35,16 +35,12 @@ IF(DOXYGEN_FOUND)
# with DOXYGEN_SOURCE_DIR we fill a list of directories and later we write it into
# the Doxyfile with a REGEX REPLACE (see below)
SET( DOXYGEN_SOURCE_DIR
# "${CMAKE_SOURCE_DIR}/library"
"${CMAKE_SOURCE_DIR}/doc/index.dxgen"
"${CMAKE_SOURCE_DIR}/library/include"
"${CMAKE_SOURCE_DIR}/library/include/dfhack"
"${CMAKE_SOURCE_DIR}/library/include/dfhack/modules"
"${CMAKE_SOURCE_DIR}/library/include/dfhack-c"
"${CMAKE_SOURCE_DIR}/library/include/dfhack-c/modules"
# "${CMAKE_SOURCE_DIR}/library/modules"
# "${CMAKE_SOURCE_DIR}/library/shm"
# "${CMAKE_SOURCE_DIR}/library/private"
"${dfhack_SOURCE_DIR}/doc/index.dxgen"
"${dfhack_SOURCE_DIR}/library/include"
"${dfhack_SOURCE_DIR}/library/include/dfhack"
"${dfhack_SOURCE_DIR}/library/include/dfhack/modules"
"${dfhack_SOURCE_DIR}/library/include/dfhack-c"
"${dfhack_SOURCE_DIR}/library/include/dfhack-c/modules"
)
STRING(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${DOXYGEN_SOURCE_DIR}")

@ -1,22 +1,15 @@
# don't use this file directly. use the one in the root folder of the project
if(NOT DEFINED DFHACK_CONSISTENCY)
MESSAGE(FATAL_ERROR "Please build the whole thing, not parts. You can turn parts on/off using options.")
ENDIF()
PROJECT (dfhack-library)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
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()
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/)
include_directories (include)
include_directories (depends/md5)
include_directories (depends/tinyxml)
include_directories (depends/argstream)
include_directories (private)
SET(PROJECT_HDRS_INTERNAL
private/ContextShared.h
@ -167,7 +160,6 @@ IF( CMAKE_SIZEOF_VOID_P MATCHES 8 )
ADD_DEFINITIONS(-DHAVE_64_BIT)
ENDIF()
#CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h )
ADD_DEFINITIONS(-DMEMXML_DATA_PATH="${MEMXML_DATA_PATH}")
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL)
@ -180,7 +172,7 @@ IF(UNIX)
SET(PROJECT_LIBS ${X11_LIBRARY} rt )
ELSE()
IF(MSVC)
SET(PROJECT_LIBS psapi ${CMAKE_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)
SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)
ELSE()
SET(PROJECT_LIBS psapi ntdll)
ENDIF()
@ -193,12 +185,12 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/)
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${dfhack_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/)
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) #linux: lib
install(FILES ${CMAKE_SOURCE_DIR}/Memory.xml
install(FILES ${dfhack_SOURCE_DIR}/Memory.xml
DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack
if(BUILD_DFHACK_DEVEL)
@ -206,7 +198,7 @@ if(BUILD_DFHACK_DEVEL)
install(TARGETS dfhack
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/library/include/
install(DIRECTORY include
DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" ) #linux: include
endif()

@ -1,4 +1,6 @@
# don't use this file directly. use the one in the root folder of the project
if(NOT DEFINED DFHACK_CONSISTENCY)
MESSAGE(FATAL_ERROR "Please build the whole thing, not parts. You can turn parts on/off using options.")
ENDIF()
# this is required to ensure we use the right configuration for the system.
IF(UNIX)
@ -7,7 +9,7 @@ ENDIF(UNIX)
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-examples
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
)
set(LOCAL_DEPNAME memxml-for-examples)

@ -1,4 +1,6 @@
# don't use this file directly. use the one in the root folder of the project
if(NOT DEFINED DFHACK_CONSISTENCY)
MESSAGE(FATAL_ERROR "Please build the whole thing, not parts. You can turn parts on/off using options.")
ENDIF()
# this is required to ensure we use the right configuration for the system.
IF(UNIX)
@ -8,7 +10,7 @@ ENDIF(UNIX)
# deep magic. make sure it runs to be able to do debug runs for MSVC projects out of the box
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-playground
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
)
set(LOCAL_DEPNAME memxml-for-playground)

@ -1,4 +1,6 @@
# don't use this file directly. use the one in the root folder of the project
if(NOT DEFINED DFHACK_CONSISTENCY)
MESSAGE(FATAL_ERROR "Please build the whole thing, not parts. You can turn parts on/off using options.")
ENDIF()
# this is required to ensure we use the right configuration for the system.
IF(UNIX)
@ -7,7 +9,7 @@ ENDIF()
IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-supported
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}")
set(LOCAL_DEPNAME memxml-for-supported)
ENDIF()
@ -23,6 +25,9 @@ DFHACK_TOOL(dfprospector prospector.cpp)
# vdig - dig the vein under the cursor
DFHACK_TOOL(dfvdig vdig.cpp)
IF(WIN32)
INSTALL(PROGRAMS dfXvdig.bat DESTINATION ${DFHACK_BINARY_DESTINATION})
ENDIF()
# cleanmap - removes mud, snow, blood and similar stuff from a map. farmers beware
DFHACK_TOOL(dfcleanmap cleanmap.cpp)

@ -65,11 +65,7 @@ int main (int argc, const char* argv[])
showhidden = true;
#endif
uint32_t x_max,y_max,z_max;
/*
DFHack::tiletypes40d tiletypes;
DFHack::designations40d designations;
DFHack::biome_indices40d regionoffsets;
*/
DFHack::mapblock40d Block;
map <int16_t, uint32_t> materials;
materials.clear();