Common base for all modules
parent
3c458f4701
commit
ec35663b62
@ -0,0 +1,45 @@
|
||||
|
||||
/*
|
||||
www.sourceforge.net/projects/dfhack
|
||||
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#ifndef MODULE_H_INCLUDED
|
||||
#define MODULE_H_INCLUDED
|
||||
|
||||
#include "DFExport.h"
|
||||
namespace DFHack
|
||||
{
|
||||
class Context;
|
||||
class DFHACK_EXPORT Module
|
||||
{
|
||||
public:
|
||||
~Module(){};
|
||||
virtual bool Start(){return true;};// default start...
|
||||
virtual bool Finish() = 0;// everything should have a Finish()
|
||||
virtual bool doFinishOnResume(){return true;}; // should Context call Finish when Resume is called?
|
||||
virtual bool doFinishOnMapChange(){return false;}; // Finish when map change is detected?
|
||||
virtual bool doFinishOnDetach(){return false;}; // Finish in Context::Detach?
|
||||
};
|
||||
}
|
||||
#endif //MODULE_H_INCLUDED
|
||||
|
@ -0,0 +1,56 @@
|
||||
################################################################################
|
||||
# DFCONNECT
|
||||
###
|
||||
SET(DFCONNECT_HDRS
|
||||
shms.h
|
||||
mod-core.h
|
||||
mod-maps.h
|
||||
)
|
||||
|
||||
SET(PROJECT_SRCS
|
||||
mod-core.cpp
|
||||
mod-maps.cpp
|
||||
#mod-creature40d.cpp
|
||||
)
|
||||
|
||||
SET(PROJECT_HDRS_LINUX
|
||||
)
|
||||
|
||||
SET(PROJECT_HDRS_WINDOWS
|
||||
)
|
||||
|
||||
SET(PROJECT_SRCS_LINUX
|
||||
shms-linux.cpp
|
||||
)
|
||||
|
||||
SET(PROJECT_SRCS_WINDOWS
|
||||
shms-windows.cpp
|
||||
)
|
||||
|
||||
IF(UNIX)
|
||||
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
|
||||
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
|
||||
ELSE(UNIX)
|
||||
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
|
||||
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
|
||||
|
||||
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
|
||||
|
||||
#IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
add_definitions(-DBUILD_SHM)
|
||||
IF(UNIX)
|
||||
add_definitions(-DLINUX_BUILD)
|
||||
SET(PROJECT_LIBS rt)
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
|
||||
ADD_LIBRARY(dfconnect SHARED ${PROJECT_SRCS})
|
||||
TARGET_LINK_LIBRARIES(dfconnect ${PROJECT_LIBS})
|
||||
ELSE(UNIX)
|
||||
# SET(PROJECT_LIBS psapi)
|
||||
ADD_LIBRARY(SDL SHARED ${PROJECT_SRCS})
|
||||
TARGET_LINK_LIBRARIES(SDL ${PROJECT_LIBS})
|
||||
ENDIF(UNIX)
|
||||
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
Loading…
Reference in New Issue