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) cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
PROJECT (dfhack) PROJECT (dfhack)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) SET(CMAKE_MODULE_PATH
# Set this to project source dir. When dfhack is used ${dfhack_SOURCE_DIR}/CMake/Modules
# as a submodule, CMAKE_SOURCE_DIR is not pointing to ${CMAKE_MODULE_PATH}
# the root where this particular CMakeLists.txt file sits. )
SET(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
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.") message(FATAL_ERROR "In-source builds are not allowed.")
endif() endif()
SET(DFHACK_CONSISTENCY 1)
set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "5") set(CPACK_PACKAGE_VERSION_MINOR "5")
set(CPACK_PACKAGE_VERSION_PATCH "8") set(CPACK_PACKAGE_VERSION_PATCH "8")
@ -41,9 +42,9 @@ IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
ENDIF() ENDIF()
## put everything in one big ugly directory to make MSVC and KDevelop debuggers happy ## 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_RUNTIME_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${dfhack_BINARY_DIR}/bin")
IF(WIN32) IF(WIN32)
set (DFHACK_INST_DEFAULT "portable") 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_EXAMPLES "Build example tools" OFF)
OPTION(BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF) OPTION(BUILD_DFHACK_PLAYGROUND "Build tools from the playground folder" OFF)
include_directories (${CMAKE_SOURCE_DIR}/library/include/) include_directories (${dfhack_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/) include_directories (${dfhack_SOURCE_DIR}/library/shm/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/) include_directories (${dfhack_SOURCE_DIR}/library/depends/argstream/)
# macro to save on typing in the tool subdirs # macro to save on typing in the tool subdirs
# builds a tool, links it to the dfhack lib and makes sure the dependency # 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 # with DOXYGEN_SOURCE_DIR we fill a list of directories and later we write it into
# the Doxyfile with a REGEX REPLACE (see below) # the Doxyfile with a REGEX REPLACE (see below)
SET( DOXYGEN_SOURCE_DIR SET( DOXYGEN_SOURCE_DIR
# "${CMAKE_SOURCE_DIR}/library" "${dfhack_SOURCE_DIR}/doc/index.dxgen"
"${CMAKE_SOURCE_DIR}/doc/index.dxgen" "${dfhack_SOURCE_DIR}/library/include"
"${CMAKE_SOURCE_DIR}/library/include" "${dfhack_SOURCE_DIR}/library/include/dfhack"
"${CMAKE_SOURCE_DIR}/library/include/dfhack" "${dfhack_SOURCE_DIR}/library/include/dfhack/modules"
"${CMAKE_SOURCE_DIR}/library/include/dfhack/modules" "${dfhack_SOURCE_DIR}/library/include/dfhack-c"
"${CMAKE_SOURCE_DIR}/library/include/dfhack-c" "${dfhack_SOURCE_DIR}/library/include/dfhack-c/modules"
"${CMAKE_SOURCE_DIR}/library/include/dfhack-c/modules"
# "${CMAKE_SOURCE_DIR}/library/modules"
# "${CMAKE_SOURCE_DIR}/library/shm"
# "${CMAKE_SOURCE_DIR}/library/private"
) )
STRING(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${DOXYGEN_SOURCE_DIR}") 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) PROJECT (dfhack-library)
cmake_minimum_required(VERSION 2.8) 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 (include)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/) include_directories (depends/md5)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/md5/) include_directories (depends/tinyxml)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/tinyxml/) include_directories (depends/argstream)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/) include_directories (private)
include_directories (${CMAKE_SOURCE_DIR}/library/private/)
SET(PROJECT_HDRS_INTERNAL SET(PROJECT_HDRS_INTERNAL
private/ContextShared.h private/ContextShared.h
@ -167,7 +160,6 @@ IF( CMAKE_SIZEOF_VOID_P MATCHES 8 )
ADD_DEFINITIONS(-DHAVE_64_BIT) ADD_DEFINITIONS(-DHAVE_64_BIT)
ENDIF() 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(-DMEMXML_DATA_PATH="${MEMXML_DATA_PATH}")
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL) ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL)
@ -180,7 +172,7 @@ IF(UNIX)
SET(PROJECT_LIBS ${X11_LIBRARY} rt ) SET(PROJECT_LIBS ${X11_LIBRARY} rt )
ELSE() ELSE()
IF(MSVC) 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() ELSE()
SET(PROJECT_LIBS psapi ntdll) SET(PROJECT_LIBS psapi ntdll)
ENDIF() ENDIF()
@ -193,12 +185,12 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS}) TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD 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 install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) #linux: lib 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 DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack
if(BUILD_DFHACK_DEVEL) if(BUILD_DFHACK_DEVEL)
@ -206,7 +198,7 @@ if(BUILD_DFHACK_DEVEL)
install(TARGETS dfhack install(TARGETS dfhack
ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION}) ARCHIVE DESTINATION ${DFHACK_DEVLIB_DESTINATION})
endif() endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/library/include/ install(DIRECTORY include
DESTINATION ${DFHACK_INCLUDES_DESTINATION} DESTINATION ${DFHACK_INCLUDES_DESTINATION}
FILES_MATCHING PATTERN "*.h" ) #linux: include FILES_MATCHING PATTERN "*.h" ) #linux: include
endif() endif()

@ -1,13 +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()
# this is required to ensure we use the right configuration for the system. # this is required to ensure we use the right configuration for the system.
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF(UNIX) ENDIF(UNIX)
IF(MSVC) IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-examples 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}" COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
) )
set(LOCAL_DEPNAME memxml-for-examples) set(LOCAL_DEPNAME memxml-for-examples)

@ -1,14 +1,16 @@
# 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. # this is required to ensure we use the right configuration for the system.
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF(UNIX) ENDIF(UNIX)
# deep magic. make sure it runs to be able to do debug runs for MSVC projects out of the box # deep magic. make sure it runs to be able to do debug runs for MSVC projects out of the box
IF(MSVC) IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-playground 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}" COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}"
) )
set(LOCAL_DEPNAME memxml-for-playground) set(LOCAL_DEPNAME memxml-for-playground)

@ -1,13 +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()
# this is required to ensure we use the right configuration for the system. # this is required to ensure we use the right configuration for the system.
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
ADD_CUSTOM_TARGET( memxml-for-supported 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}") COMMENT "Copying Memory.xml to ${CMAKE_CURRENT_BINARY_DIR}")
set(LOCAL_DEPNAME memxml-for-supported) set(LOCAL_DEPNAME memxml-for-supported)
ENDIF() ENDIF()
@ -23,6 +25,9 @@ DFHACK_TOOL(dfprospector prospector.cpp)
# vdig - dig the vein under the cursor # vdig - dig the vein under the cursor
DFHACK_TOOL(dfvdig vdig.cpp) 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 # cleanmap - removes mud, snow, blood and similar stuff from a map. farmers beware
DFHACK_TOOL(dfcleanmap cleanmap.cpp) DFHACK_TOOL(dfcleanmap cleanmap.cpp)

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