No more generated config files.

develop
Petr Mrázek 2011-03-20 06:20:23 +01:00
parent c06df18ea7
commit fe92edfb4e
10 changed files with 20 additions and 40 deletions

@ -163,19 +163,16 @@ SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
# Are we 64bit? (Damn you, ptrace()!)
IF( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET( HAVE_64_BIT 0 )
ELSE()
SET( HAVE_64_BIT 1 )
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 )
#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)
IF(UNIX)
add_definitions(-DLINUX_BUILD)
add_definitions(-DUSE_CONFIG_H)
find_library(X11_LIBRARY X11)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")

@ -116,7 +116,7 @@ Context * BadContexts::operator[](uint32_t index)
ContextManager::ContextManager (const string path_to_xml) : d (new Private())
{
d->xml = QUOT (MEMXML_DATA_PATH);
d->xml = MEMXML_DATA_PATH;
d->xml += "/";
d->xml += path_to_xml;
d->pEnum = new ProcessEnumerator(d->xml);

@ -83,21 +83,24 @@ void LinuxProcessBase::getMemRanges( vector<t_memrange> & ranges )
sprintf(buffer, "/proc/%lu/maps", (long unsigned)my_pid);
FILE *mapFile = ::fopen(buffer, "r");
uint64_t offset, device1, device2, node;
size_t start, end, offset, device1, device2, node;
while (fgets(buffer, 1024, mapFile))
{
t_memrange temp;
temp.name[0] = 0;
sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s",
&temp.start,
&temp.end,
&start,
&end,
(char*)&permissions,
&offset, &device1, &device2, &node,
(char*)&temp.name);
temp.start = start;
temp.end = end;
temp.read = permissions[0] == 'r';
temp.write = permissions[1] == 'w';
temp.execute = permissions[2] == 'x';
temp.shared = permissions[3] == 's';
temp.valid = true;
ranges.push_back(temp);
}

@ -1,7 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine MEMXML_DATA_PATH @MEMXML_DATA_PATH@
#cmakedefine HAVE_64_BIT
#endif // CONFIG_H

@ -74,6 +74,8 @@ namespace DFHack
bool write : 1;
// permission to execute
bool execute : 1;
// is a shared region
bool shared : 1;
inline bool isInRange( uint64_t address)
{
if (address >= start && address < end) return true;

@ -185,7 +185,7 @@ FIXME: Japa said that he had to do this with the time stuff he got from here
World::ReadCurrentMonth and World::ReadCurrentDay
« Sent to: peterix on: June 04, 2010, 04:44:30 »
« You have forwarded or responded to this message. »
ReplyQuoteRemove
Shouldn't these be /28 and %28 instead of 24? There're 28 days in a DF month.
Using 28 and doing the calculation on the value stored at the memory location
specified by memory.xml gets me the current month/date.

@ -30,16 +30,10 @@ distribution.
#define BUILD_DFHACK_LIB
#endif
// wizardry for the cmake-generated config.h
// wizardry for adding quotes to macros
#define _QUOTEME(x) #x
#define QUOT(x) _QUOTEME(x)
#ifdef USE_CONFIG_H // set by cmake for Linux builds
#include "config.h"
#else
#define MEMXML_DATA_PATH .
#endif
// one file for globals
#include "dfhack/DFGlobal.h"

@ -70,7 +70,7 @@ DFHACK_TOOL(dfweather weather.cpp)
#DFHACK_TOOL(dfautosearch autosearch.cpp)
DFHACK_TOOL(dfincremental incrementalsearch.cpp)
# veinlook - look at the map... sort of
IF(UNIX)
SET(VEINLOOK_BUILT "NO")
SET(CURSES_NEED_WIDE "YES")
@ -87,13 +87,8 @@ IF(UNIX)
SET(NCURSES_H "cursesw.h")
endif(CURSES_HAVE_NCURSESW_NCURSES_H)
IF(NCURSES_H)
# OPTION( VARIABLE "Description" Initial state)
#OPTION( WITH_FOO "Enable FOO support" ON )
#OPTION( WITH_BAR "Enable BAR component" OFF )
#SET( BAZ 18 )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/fake-curses.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/fake-curses.h )
# veinlook - look at the map... sort of
ADD_EXECUTABLE(dfveinlook veinlook.cpp)
set_property( TARGET dfveinlook PROPERTY COMPILE_DEFINITIONS NCURSES_H=${NCURSES_H} )
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(dfveinlook dfhack ${CURSES_LIBRARIES})
install(TARGETS

@ -1,6 +0,0 @@
#ifndef CURSES_FAKE_H
#define CURSES_FAKE_H
#include <@NCURSES_H@>
#endif // CURSES_FAKE_H

@ -9,7 +9,9 @@
using namespace std;
#include <sstream>
#include "fake-curses.h"
// the header name comes from the build system.
#define INCLUDE_NAME() <NCURSES_H>
#include INCLUDE_NAME()
#include <stdlib.h>
#include <signal.h>
#include <locale.h>