Build libraries as static libraries

This commit is contained in:
Gunnar Beutner 2017-12-31 07:22:16 +01:00
parent 025abc3357
commit 90496b5456
239 changed files with 560 additions and 897 deletions

View File

@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software Foundation # along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8.8)
set(BOOST_MIN_VERSION "1.48.0") set(BOOST_MIN_VERSION "1.48.0")
project(icinga2) project(icinga2)
@ -139,6 +139,13 @@ set(HAVE_EDITLINE "${EDITLINE_FOUND}")
find_package(Termcap) find_package(Termcap)
set(HAVE_TERMCAP "${TERMCAP_FOUND}") set(HAVE_TERMCAP "${TERMCAP_FOUND}")
find_package(PostgreSQL)
if(PostgreSQL_FOUND)
link_directories(${PostgreSQL_LIBRARY_DIRS})
include_directories(${PostgreSQL_INCLUDE_DIRS})
endif()
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib
@ -172,12 +179,28 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpthread") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpthread")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -lpthread")
else() else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread")
endif() endif()
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
function(add_whole_static_library target library)
target_link_libraries(${target} -force_load ${library})
endfunction()
elseif(MSVC)
function(add_whole_static_library target library)
target_link_libraries(${target} ${library})
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "/wholearchive:${library} ")
endfunction()
else()
function(add_whole_static_library target library)
target_link_libraries(${target} -Wl,--whole-archive ${library} -Wl,--no-whole-archive)
endfunction()
endif()
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
function(check_cxx_linker_flag flag var) function(check_cxx_linker_flag flag var)
@ -238,26 +261,10 @@ if(ICINGA2_LTO_BUILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
endif() endif()
endif() endif()
include(CheckCCompilerFlag)
check_c_compiler_flag(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN)
if(HAVE_VISIBILITY_INLINES_HIDDEN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
endif()
check_c_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
if(HAVE_VISIBILITY_HIDDEN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
if(MSVC) if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif() endif()

View File

@ -21,10 +21,54 @@ else()
set(WindowsSources "") set(WindowsSources "")
endif() endif()
add_executable(icinga-app icinga.cpp ${WindowsSources}) set(icingaloader_SOURCES
icinga.cpp
${WindowsSources}
)
add_library(icingaloader OBJECT ${icingaloader_SOURCES})
add_dependencies(icingaloader base config cli)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(icinga-app ${Boost_LIBRARIES} base config cli)
add_executable(icinga-app $<TARGET_OBJECTS:icingaloader>)
add_whole_static_library(icinga-app base)
add_whole_static_library(icinga-app config)
add_whole_static_library(icinga-app remote)
add_whole_static_library(icinga-app cli)
if(ICINGA2_WITH_CHECKER)
add_whole_static_library(icinga-app checker)
endif()
if(ICINGA2_WITH_COMPAT)
add_whole_static_library(icinga-app compat)
endif()
if(ICINGA2_WITH_MYSQL)
add_whole_static_library(icinga-app db_ido_mysql)
endif()
if(ICINGA2_WITH_PGSQL)
add_whole_static_library(icinga-app db_ido_pgsql)
endif()
add_whole_static_library(icinga-app icinga)
if(ICINGA2_WITH_LIVESTATUS)
add_whole_static_library(icinga-app livestatus)
endif()
add_whole_static_library(icinga-app methods)
if(ICINGA2_WITH_NOTIFICATION)
add_whole_static_library(icinga-app notification)
endif()
if(ICINGA2_WITH_PERFDATA)
add_whole_static_library(icinga-app perfdata)
endif()
set_target_properties ( set_target_properties (
icinga-app PROPERTIES icinga-app PROPERTIES
@ -52,6 +96,27 @@ install(
RUNTIME DESTINATION ${InstallPath} RUNTIME DESTINATION ${InstallPath}
) )
if(ICINGA2_WITH_HELLO)
add_executable(hello-app $<TARGET_OBJECTS:icingaloader>)
add_whole_static_library(hello-app base)
add_whole_static_library(hello-app config)
add_whole_static_library(hello-app remote)
add_whole_static_library(hello-app cli)
add_whole_static_library(hello-app hello)
set_target_properties (
hello-app PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
FOLDER Bin
OUTPUT_NAME hello
)
install(
TARGETS hello-app
RUNTIME DESTINATION ${InstallPath}
)
endif()
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/icinga2\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2\")")

View File

@ -194,8 +194,6 @@ static int Main(void)
LogSeverity logLevel = Logger::GetConsoleLogSeverity(); LogSeverity logLevel = Logger::GetConsoleLogSeverity();
Logger::SetConsoleLogSeverity(LogWarning); Logger::SetConsoleLogSeverity(LogWarning);
Loader::LoadExtensionLibrary("cli");
po::options_description visibleDesc("Global options"); po::options_description visibleDesc("Global options");
visibleDesc.add_options() visibleDesc.add_options()
@ -205,8 +203,6 @@ static int Main(void)
("color", "use VT100 color codes even when stdout is not a terminal") ("color", "use VT100 color codes even when stdout is not a terminal")
#endif /* _WIN32 */ #endif /* _WIN32 */
("define,D", po::value<std::vector<std::string> >(), "define a constant") ("define,D", po::value<std::vector<std::string> >(), "define a constant")
("app,a", po::value<std::string>(), "application library name (default: icinga)")
("library,l", po::value<std::vector<std::string> >(), "load a library")
("include,I", po::value<std::vector<std::string> >(), "add include search directory") ("include,I", po::value<std::vector<std::string> >(), "add include search directory")
("log-level,x", po::value<std::string>(), "specify the log level for the console log.\n" ("log-level,x", po::value<std::string>(), "specify the log level for the console log.\n"
"The valid value is either debug, notice, information (default), warning, or critical") "The valid value is either debug, notice, information (default), warning, or critical")
@ -359,18 +355,6 @@ static int Main(void)
Logger::SetConsoleLogSeverity(logLevel); Logger::SetConsoleLogSeverity(logLevel);
} }
if (vm.count("library")) {
for (const String& libraryName : vm["library"].as<std::vector<std::string> >()) {
try {
(void) Loader::LoadExtensionLibrary(libraryName);
} catch (const std::exception& ex) {
Log(LogCritical, "icinga-app")
<< "Could not load library \"" << libraryName << "\": " << DiagnosticInformation(ex);
return EXIT_FAILURE;
}
}
}
if (!command || vm.count("help") || vm.count("version")) { if (!command || vm.count("help") || vm.count("version")) {
String appName; String appName;
@ -544,16 +528,6 @@ static int Main(void)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
LogSeverity logLevel = Logger::GetConsoleLogSeverity();
Logger::SetConsoleLogSeverity(LogWarning);
if (vm.count("app"))
Loader::LoadExtensionLibrary(vm["app"].as<std::string>());
else
Loader::LoadExtensionLibrary("icinga");
Logger::SetConsoleLogSeverity(logLevel);
rc = command->Run(vm, args); rc = command->Run(vm, args);
} }

View File

@ -30,7 +30,9 @@ add_executable(icinga-studio MACOSX_BUNDLE WIN32 icinga-studio.cpp
icinga.icns ${WindowsSources}) icinga.icns ${WindowsSources})
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(icinga-studio ${Boost_LIBRARIES} ${wxWidgets_LIBRARIES} base remote) target_link_libraries(icinga-studio ${Boost_LIBRARIES} ${wxWidgets_LIBRARIES})
add_whole_static_library(icinga-studio base)
add_whole_static_library(icinga-studio remote)
if(APPLE) if(APPLE)
set_source_files_properties(icinga.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) set_source_files_properties(icinga.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

View File

@ -49,7 +49,7 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(base base base_SOURCES) mkunity_target(base base base_SOURCES)
endif() endif()
add_library(base SHARED ${base_SOURCES}) add_library(base STATIC ${base_SOURCES})
target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${YAJL_LIBRARIES} mmatch socketpair) target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${YAJL_LIBRARIES} mmatch socketpair)
@ -76,26 +76,10 @@ endif()
set_target_properties ( set_target_properties (
base PROPERTIES base PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_BASE_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
) )
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/crash\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/crash\")")
install(
TARGETS base
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)
if(APPLE)
install(
TARGETS base
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/icinga-studio.app/Contents
)
endif()
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE) set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)

View File

@ -35,7 +35,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Application : public ObjectImpl<Application> { class Application : public ObjectImpl<Application> {
public: public:
DECLARE_OBJECT(Application); DECLARE_OBJECT(Application);

View File

@ -35,7 +35,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Array : public Object class Array : public Object
{ {
public: public:
DECLARE_OBJECT(Array); DECLARE_OBJECT(Array);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup remote * @ingroup remote
*/ */
struct I2_BASE_API Base64 struct Base64
{ {
static String Decode(const String& data); static String Decode(const String& data);
static String Encode(const String& data); static String Encode(const String& data);

View File

@ -30,7 +30,7 @@ class Value;
/** /**
* Boolean class. * Boolean class.
*/ */
class I2_BASE_API Boolean class Boolean
{ {
public: public:
static Object::Ptr GetPrototype(void); static Object::Ptr GetPrototype(void);

View File

@ -37,7 +37,7 @@ class ConfigType;
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ConfigObject : public ObjectImpl<ConfigObject> class ConfigObject : public ObjectImpl<ConfigObject>
{ {
public: public:
DECLARE_OBJECT(ConfigObject); DECLARE_OBJECT(ConfigObject);

View File

@ -32,7 +32,7 @@ enum HAMode
HARunEverywhere HARunEverywhere
}; };
class I2_BASE_API NameComposer class NameComposer
{ {
public: public:
virtual ~NameComposer(void); virtual ~NameComposer(void);
@ -46,7 +46,7 @@ abstract class ConfigObjectBase
{ }; { };
code {{{ code {{{
class I2_BASE_API ConfigObjectBase : public ObjectImpl<ConfigObjectBase> class ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
{ {
public: public:
inline DebugInfo GetDebugInfo(void) const inline DebugInfo GetDebugInfo(void) const

View File

@ -30,7 +30,7 @@ namespace icinga
class ConfigObject; class ConfigObject;
class I2_BASE_API ConfigType class ConfigType
{ {
public: public:
virtual ~ConfigType(void); virtual ~ConfigType(void);

View File

@ -33,7 +33,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ConfigIdentifier : public Object class ConfigIdentifier : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(ConfigIdentifier); DECLARE_PTR_TYPEDEFS(ConfigIdentifier);
@ -51,7 +51,7 @@ private:
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ConfigWriter class ConfigWriter
{ {
public: public:
static void EmitBoolean(std::ostream& fp, bool val); static void EmitBoolean(std::ostream& fp, bool val);

View File

@ -66,26 +66,26 @@ enum ConsoleType
#endif /* _WIN32 */ #endif /* _WIN32 */
}; };
class I2_BASE_API ConsoleColorTag class ConsoleColorTag
{ {
public: public:
ConsoleColorTag(int color, ConsoleType consoleType = Console_Autodetect); ConsoleColorTag(int color, ConsoleType consoleType = Console_Autodetect);
friend I2_BASE_API std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct); friend std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct);
private: private:
int m_Color; int m_Color;
int m_ConsoleType; int m_ConsoleType;
}; };
I2_BASE_API std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct); std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct);
/** /**
* Console utilities. * Console utilities.
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Console class Console
{ {
public: public:
static void DetectType(void); static void DetectType(void);

View File

@ -27,7 +27,7 @@
namespace icinga namespace icinga
{ {
class I2_BASE_API ContextTrace class ContextTrace
{ {
public: public:
ContextTrace(void); ContextTrace(void);
@ -40,14 +40,14 @@ private:
std::list<String> m_Frames; std::list<String> m_Frames;
}; };
I2_BASE_API std::ostream& operator<<(std::ostream& stream, const ContextTrace& trace); std::ostream& operator<<(std::ostream& stream, const ContextTrace& trace);
/** /**
* A context frame. * A context frame.
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ContextFrame class ContextFrame
{ {
public: public:
ContextFrame(const String& message); ContextFrame(const String& message);

View File

@ -32,7 +32,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Convert class Convert
{ {
public: public:
template<typename T> template<typename T>

View File

@ -33,7 +33,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API DateTime : public ObjectImpl<DateTime> class DateTime : public ObjectImpl<DateTime>
{ {
public: public:
DECLARE_OBJECT(DateTime); DECLARE_OBJECT(DateTime);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup config * @ingroup config
*/ */
struct I2_BASE_API DebugInfo struct DebugInfo
{ {
String Path; String Path;
@ -44,11 +44,11 @@ struct I2_BASE_API DebugInfo
DebugInfo(void); DebugInfo(void);
}; };
I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val); std::ostream& operator<<(std::ostream& out, const DebugInfo& val);
I2_BASE_API DebugInfo DebugInfoRange(const DebugInfo& start, const DebugInfo& end); DebugInfo DebugInfoRange(const DebugInfo& start, const DebugInfo& end);
I2_BASE_API void ShowCodeLocation(std::ostream& out, const DebugInfo& di, bool verbose = true); void ShowCodeLocation(std::ostream& out, const DebugInfo& di, bool verbose = true);
} }

View File

@ -31,7 +31,7 @@ namespace icinga {
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API DependencyGraph class DependencyGraph
{ {
public: public:
static void AddDependency(Object *parent, Object *child); static void AddDependency(Object *parent, Object *child);

View File

@ -35,7 +35,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Dictionary : public Object class Dictionary : public Object
{ {
public: public:
DECLARE_OBJECT(Dictionary); DECLARE_OBJECT(Dictionary);

View File

@ -88,7 +88,7 @@ typedef void (*DestCallback)(void *);
static boost::thread_specific_ptr<DestCallback> l_LastExceptionDest; static boost::thread_specific_ptr<DestCallback> l_LastExceptionDest;
# endif /* !__GLIBCXX__ && !_WIN32 */ # endif /* !__GLIBCXX__ && !_WIN32 */
extern "C" I2_EXPORT void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *)); extern "C" void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *));
#endif /* HAVE_CXXABI_H */ #endif /* HAVE_CXXABI_H */
void icinga::RethrowUncaughtException(void) void icinga::RethrowUncaughtException(void)

View File

@ -42,13 +42,13 @@
namespace icinga namespace icinga
{ {
class I2_BASE_API user_error : virtual public std::exception, virtual public boost::exception class user_error : virtual public std::exception, virtual public boost::exception
{ }; { };
/* /*
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ScriptError : virtual public user_error class ScriptError : virtual public user_error
{ {
public: public:
ScriptError(const String& message); ScriptError(const String& message);
@ -73,7 +73,7 @@ private:
/* /*
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ValidationError : virtual public user_error class ValidationError : virtual public user_error
{ {
public: public:
ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& attributePath, const String& message); ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& attributePath, const String& message);
@ -96,13 +96,13 @@ private:
Dictionary::Ptr m_DebugHint; Dictionary::Ptr m_DebugHint;
}; };
I2_BASE_API StackTrace *GetLastExceptionStack(void); StackTrace *GetLastExceptionStack(void);
I2_BASE_API void SetLastExceptionStack(const StackTrace& trace); void SetLastExceptionStack(const StackTrace& trace);
I2_BASE_API ContextTrace *GetLastExceptionContext(void); ContextTrace *GetLastExceptionContext(void);
I2_BASE_API void SetLastExceptionContext(const ContextTrace& context); void SetLastExceptionContext(const ContextTrace& context);
I2_BASE_API void RethrowUncaughtException(void); void RethrowUncaughtException(void);
typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo; typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo;
@ -120,10 +120,10 @@ inline std::string to_string(const ContextTraceErrorInfo& e)
return msgbuf.str(); return msgbuf.str();
} }
I2_BASE_API String DiagnosticInformation(const std::exception& ex, bool verbose = true, StackTrace *stack = nullptr, ContextTrace *context = nullptr); String DiagnosticInformation(const std::exception& ex, bool verbose = true, StackTrace *stack = nullptr, ContextTrace *context = nullptr);
I2_BASE_API String DiagnosticInformation(boost::exception_ptr eptr, bool verbose = true); String DiagnosticInformation(boost::exception_ptr eptr, bool verbose = true);
class I2_BASE_API posix_error : virtual public std::exception, virtual public boost::exception { class posix_error : virtual public std::exception, virtual public boost::exception {
public: public:
posix_error(void); posix_error(void);
virtual ~posix_error(void) throw(); virtual ~posix_error(void) throw();
@ -135,7 +135,7 @@ private:
}; };
#ifdef _WIN32 #ifdef _WIN32
class I2_BASE_API win32_error : virtual public std::exception, virtual public boost::exception { }; class win32_error : virtual public std::exception, virtual public boost::exception { };
struct errinfo_win32_error_; struct errinfo_win32_error_;
typedef boost::error_info<struct errinfo_win32_error_, int> errinfo_win32_error; typedef boost::error_info<struct errinfo_win32_error_, int> errinfo_win32_error;

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API FIFO : public Stream class FIFO : public Stream
{ {
public: public:
DECLARE_PTR_TYPEDEFS(FIFO); DECLARE_PTR_TYPEDEFS(FIFO);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API FileLogger : public ObjectImpl<FileLogger> class FileLogger : public ObjectImpl<FileLogger>
{ {
public: public:
DECLARE_OBJECT(FileLogger); DECLARE_OBJECT(FileLogger);

View File

@ -35,7 +35,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Function : public ObjectImpl<Function> class Function : public ObjectImpl<Function>
{ {
public: public:
DECLARE_OBJECT(Function); DECLARE_OBJECT(Function);

View File

@ -89,14 +89,6 @@
# pragma GCC diagnostic ignored "-Wdeprecated-declarations" # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#include "base/visibility.hpp"
#ifdef I2_BASE_BUILD
# define I2_BASE_API I2_EXPORT
#else /* I2_BASE_BUILD */
# define I2_BASE_API I2_IMPORT
#endif /* I2_BASE_BUILD */
#if defined(__GNUC__) #if defined(__GNUC__)
# define likely(x) __builtin_expect(!!(x), 1) # define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0) # define unlikely(x) __builtin_expect(!!(x), 0)

View File

@ -30,16 +30,16 @@ namespace icinga
#define I2_UNIQUE_NAME(prefix) I2_TOKENPASTE2(prefix, __COUNTER__) #define I2_UNIQUE_NAME(prefix) I2_TOKENPASTE2(prefix, __COUNTER__)
I2_BASE_API bool InitializeOnceHelper(void (*func)(void), int priority = 0); bool InitializeOnceHelper(void (*func)(void), int priority = 0);
#define INITIALIZE_ONCE(func) \ #define INITIALIZE_ONCE(func) \
namespace { namespace I2_UNIQUE_NAME(io) { \ namespace { namespace I2_UNIQUE_NAME(io) { \
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func)); \ bool l_InitializeOnce(icinga::InitializeOnceHelper(func)); \
} } } }
#define INITIALIZE_ONCE_WITH_PRIORITY(func, priority) \ #define INITIALIZE_ONCE_WITH_PRIORITY(func, priority) \
namespace { namespace I2_UNIQUE_NAME(io) { \ namespace { namespace I2_UNIQUE_NAME(io) { \
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func, priority)); \ bool l_InitializeOnce(icinga::InitializeOnceHelper(func, priority)); \
} } } }
} }

View File

@ -28,8 +28,8 @@ namespace icinga
class String; class String;
class Value; class Value;
I2_BASE_API String JsonEncode(const Value& value, bool pretty_print = false); String JsonEncode(const Value& value, bool pretty_print = false);
I2_BASE_API Value JsonDecode(const String& data); Value JsonDecode(const String& data);
} }

View File

@ -18,51 +18,9 @@
******************************************************************************/ ******************************************************************************/
#include "base/loader.hpp" #include "base/loader.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
#include "base/application.hpp"
using namespace icinga; using namespace icinga;
/**
* Loads the specified library.
*
* @param library The name of the library.
*/
void Loader::LoadExtensionLibrary(const String& library)
{
String path;
#if defined(_WIN32)
path = library + ".dll";
#elif defined(__APPLE__)
path = "lib" + library + "." + Application::GetAppSpecVersion() + ".dylib";
#else /* __APPLE__ */
path = "lib" + library + ".so." + Application::GetAppSpecVersion();
#endif /* _WIN32 */
Log(LogNotice, "Loader")
<< "Loading library '" << path << "'";
#ifdef _WIN32
HMODULE hModule = LoadLibrary(path.CStr());
if (!hModule) {
BOOST_THROW_EXCEPTION(win32_error()
<< boost::errinfo_api_function("LoadLibrary")
<< errinfo_win32_error(GetLastError())
<< boost::errinfo_file_name(path));
}
#else /* _WIN32 */
void *hModule = dlopen(path.CStr(), RTLD_NOW | RTLD_GLOBAL);
if (!hModule) {
BOOST_THROW_EXCEPTION(std::runtime_error("Could not load library '" + path + "': " + dlerror()));
}
#endif /* _WIN32 */
ExecuteDeferredInitializers();
}
boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> >& Loader::GetDeferredInitializers(void) boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> >& Loader::GetDeferredInitializers(void)
{ {
static boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> > initializers; static boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> > initializers;

View File

@ -55,11 +55,9 @@ private:
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Loader class Loader
{ {
public: public:
static void LoadExtensionLibrary(const String& library);
static void AddDeferredInitializer(const std::function<void(void)>& callback, int priority = 0); static void AddDeferredInitializer(const std::function<void(void)>& callback, int priority = 0);
static void ExecuteDeferredInitializers(void); static void ExecuteDeferredInitializers(void);

View File

@ -59,7 +59,7 @@ struct LogEntry {
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Logger : public ObjectImpl<Logger> class Logger : public ObjectImpl<Logger>
{ {
public: public:
DECLARE_OBJECT(Logger); DECLARE_OBJECT(Logger);
@ -104,7 +104,7 @@ private:
static LogSeverity m_ConsoleLogSeverity; static LogSeverity m_ConsoleLogSeverity;
}; };
I2_BASE_API void IcingaLog(LogSeverity severity, const String& facility, const String& message); void IcingaLog(LogSeverity severity, const String& facility, const String& message);
class Log class Log
{ {

View File

@ -35,7 +35,7 @@ class String;
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API NetString class NetString
{ {
public: public:
static StreamReadStatus ReadStringFromStream(const Stream::Ptr& stream, String *message, StreamReadContext& context, bool may_wait = false); static StreamReadStatus ReadStringFromStream(const Stream::Ptr& stream, String *message, StreamReadContext& context, bool may_wait = false);

View File

@ -32,7 +32,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API NetworkStream : public Stream class NetworkStream : public Stream
{ {
public: public:
DECLARE_PTR_TYPEDEFS(NetworkStream); DECLARE_PTR_TYPEDEFS(NetworkStream);

View File

@ -30,7 +30,7 @@ class Value;
/** /**
* Number class. * Number class.
*/ */
class I2_BASE_API Number class Number
{ {
public: public:
static Object::Ptr GetPrototype(void); static Object::Ptr GetPrototype(void);

View File

@ -41,7 +41,7 @@ class String;
struct DebugInfo; struct DebugInfo;
class ValidationUtils; class ValidationUtils;
extern I2_BASE_API Value Empty; extern Value Empty;
#define DECLARE_PTR_TYPEDEFS(klass) \ #define DECLARE_PTR_TYPEDEFS(klass) \
typedef intrusive_ptr<klass> Ptr typedef intrusive_ptr<klass> Ptr
@ -105,7 +105,7 @@ struct TypeHelper<T, true>
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Object class Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Object); DECLARE_PTR_TYPEDEFS(Object);
@ -160,10 +160,10 @@ private:
friend void intrusive_ptr_release(Object *object); friend void intrusive_ptr_release(Object *object);
}; };
I2_BASE_API Value GetPrototypeField(const Value& context, const String& field, bool not_found_error, const DebugInfo& debugInfo); Value GetPrototypeField(const Value& context, const String& field, bool not_found_error, const DebugInfo& debugInfo);
I2_BASE_API void TypeAddObject(Object *object); void TypeAddObject(Object *object);
I2_BASE_API void TypeRemoveObject(Object *object); void TypeRemoveObject(Object *object);
inline void intrusive_ptr_add_ref(Object *object) inline void intrusive_ptr_add_ref(Object *object)
{ {

View File

@ -31,7 +31,7 @@ namespace icinga
/** /**
* A scoped lock for Objects. * A scoped lock for Objects.
*/ */
struct I2_BASE_API ObjectLock struct ObjectLock
{ {
public: public:
ObjectLock(void) ObjectLock(void)

View File

@ -27,7 +27,7 @@
namespace icinga namespace icinga
{ {
class I2_BASE_API ObjectType : public Type class ObjectType : public Type
{ {
public: public:
ObjectType(void); ObjectType(void);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API PerfdataValue : public ObjectImpl<PerfdataValue> class PerfdataValue : public ObjectImpl<PerfdataValue>
{ {
public: public:
DECLARE_OBJECT(PerfdataValue); DECLARE_OBJECT(PerfdataValue);

View File

@ -27,7 +27,7 @@
namespace icinga namespace icinga
{ {
class I2_BASE_API PrimitiveType : public Type class PrimitiveType : public Type
{ {
public: public:
PrimitiveType(const String& name, const String& base, const ObjectFactory& factory = ObjectFactory()); PrimitiveType(const String& name, const String& base, const ObjectFactory& factory = ObjectFactory());

View File

@ -49,7 +49,7 @@ struct ProcessResult
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Process : public Object class Process : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Process); DECLARE_PTR_TYPEDEFS(Process);

View File

@ -32,7 +32,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API RingBuffer : public Object class RingBuffer : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(RingBuffer); DECLARE_PTR_TYPEDEFS(RingBuffer);

View File

@ -29,7 +29,7 @@
namespace icinga namespace icinga
{ {
struct I2_BASE_API ScriptFrame struct ScriptFrame
{ {
Dictionary::Ptr Locals; Dictionary::Ptr Locals;
Value Self; Value Self;

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ScriptGlobal class ScriptGlobal
{ {
public: public:
static Value Get(const String& name, const Value *defaultValue = nullptr); static Value Get(const String& name, const Value *defaultValue = nullptr);

View File

@ -33,7 +33,7 @@ namespace icinga
/** /**
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ScriptUtils class ScriptUtils
{ {
public: public:
static void StaticInitialize(void); static void StaticInitialize(void);

View File

@ -27,9 +27,9 @@
namespace icinga namespace icinga
{ {
I2_BASE_API Value Serialize(const Value& value, int attributeTypes = FAState); Value Serialize(const Value& value, int attributeTypes = FAState);
I2_BASE_API Value Deserialize(const Value& value, bool safe_mode = false, int attributeTypes = FAState); Value Deserialize(const Value& value, bool safe_mode = false, int attributeTypes = FAState);
I2_BASE_API Value Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode = false, int attributeTypes = FAState); Value Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode = false, int attributeTypes = FAState);
} }

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Socket : public Object class Socket : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Socket); DECLARE_PTR_TYPEDEFS(Socket);

View File

@ -36,7 +36,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API SocketEvents class SocketEvents
{ {
public: public:
~SocketEvents(void); ~SocketEvents(void);
@ -93,7 +93,7 @@ struct EventDescription
Object::Ptr LifesupportReference; Object::Ptr LifesupportReference;
}; };
class I2_BASE_API SocketEventEngine class SocketEventEngine
{ {
public: public:
void Start(void); void Start(void);
@ -119,7 +119,7 @@ protected:
friend class SocketEvents; friend class SocketEvents;
}; };
class I2_BASE_API SocketEventEnginePoll : public SocketEventEngine class SocketEventEnginePoll : public SocketEventEngine
{ {
public: public:
virtual void Register(SocketEvents *se, Object *lifesupportObject); virtual void Register(SocketEvents *se, Object *lifesupportObject);
@ -132,7 +132,7 @@ protected:
}; };
#ifdef __linux__ #ifdef __linux__
class I2_BASE_API SocketEventEngineEpoll : public SocketEventEngine class SocketEventEngineEpoll : public SocketEventEngine
{ {
public: public:
virtual void Register(SocketEvents *se, Object *lifesupportObject); virtual void Register(SocketEvents *se, Object *lifesupportObject);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API StackTrace class StackTrace
{ {
public: public:
StackTrace(void); StackTrace(void);
@ -48,7 +48,7 @@ private:
int m_Count; int m_Count;
}; };
I2_BASE_API std::ostream& operator<<(std::ostream& stream, const StackTrace& trace); std::ostream& operator<<(std::ostream& stream, const StackTrace& trace);
} }

View File

@ -26,7 +26,7 @@
namespace icinga { namespace icinga {
class I2_BASE_API StdioStream : public Stream class StdioStream : public Stream
{ {
public: public:
DECLARE_PTR_TYPEDEFS(StdioStream); DECLARE_PTR_TYPEDEFS(StdioStream);

View File

@ -36,7 +36,7 @@ enum ConnectionRole
RoleServer RoleServer
}; };
struct I2_BASE_API StreamReadContext struct StreamReadContext
{ {
StreamReadContext(void) StreamReadContext(void)
: Buffer(nullptr), Size(0), MustRead(true), Eof(false) : Buffer(nullptr), Size(0), MustRead(true), Eof(false)
@ -68,7 +68,7 @@ enum StreamReadStatus
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Stream : public Object class Stream : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Stream); DECLARE_PTR_TYPEDEFS(Stream);

View File

@ -33,7 +33,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API StreamLogger : public ObjectImpl<StreamLogger> class StreamLogger : public ObjectImpl<StreamLogger>
{ {
public: public:
DECLARE_OBJECT(StreamLogger); DECLARE_OBJECT(StreamLogger);

View File

@ -41,7 +41,7 @@ class Value;
* Rationale for having this: The std::string class has an ambiguous assignment * Rationale for having this: The std::string class has an ambiguous assignment
* operator when used in conjunction with the Value class. * operator when used in conjunction with the Value class.
*/ */
class I2_BASE_API String class String
{ {
public: public:
typedef std::string::iterator Iterator; typedef std::string::iterator Iterator;

View File

@ -32,7 +32,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API SyslogLogger : public ObjectImpl<SyslogLogger> class SyslogLogger : public ObjectImpl<SyslogLogger>
{ {
public: public:
DECLARE_OBJECT(SyslogLogger); DECLARE_OBJECT(SyslogLogger);

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API TcpSocket : public Socket class TcpSocket : public Socket
{ {
public: public:
DECLARE_PTR_TYPEDEFS(TcpSocket); DECLARE_PTR_TYPEDEFS(TcpSocket);

View File

@ -43,7 +43,7 @@ enum SchedulerPolicy
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API ThreadPool class ThreadPool
{ {
public: public:
typedef std::function<void ()> WorkFunction; typedef std::function<void ()> WorkFunction;

View File

@ -33,7 +33,7 @@ class TimerHolder;
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Timer : public Object class Timer : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Timer); DECLARE_PTR_TYPEDEFS(Timer);

View File

@ -29,8 +29,8 @@
using namespace icinga; using namespace icinga;
int I2_EXPORT TlsStream::m_SSLIndex; int TlsStream::m_SSLIndex;
bool I2_EXPORT TlsStream::m_SSLIndexInitialized = false; bool TlsStream::m_SSLIndexInitialized = false;
/** /**
* Constructor for the TlsStream class. * Constructor for the TlsStream class.

View File

@ -43,7 +43,7 @@ enum TlsAction
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API TlsStream : public Stream, private SocketEvents class TlsStream : public Stream, private SocketEvents
{ {
public: public:
DECLARE_PTR_TYPEDEFS(TlsStream); DECLARE_PTR_TYPEDEFS(TlsStream);

View File

@ -36,27 +36,27 @@
namespace icinga namespace icinga
{ {
void I2_BASE_API InitializeOpenSSL(void); void InitializeOpenSSL(void);
std::shared_ptr<SSL_CTX> I2_BASE_API MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String()); std::shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String());
void I2_BASE_API AddCRLToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& crlPath); void AddCRLToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& crlPath);
void I2_BASE_API SetCipherListToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& cipherList); void SetCipherListToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& cipherList);
void I2_BASE_API SetTlsProtocolminToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin); void SetTlsProtocolminToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin);
String I2_BASE_API GetCertificateCN(const std::shared_ptr<X509>& certificate); String GetCertificateCN(const std::shared_ptr<X509>& certificate);
std::shared_ptr<X509> I2_BASE_API GetX509Certificate(const String& pemfile); std::shared_ptr<X509> GetX509Certificate(const String& pemfile);
int I2_BASE_API MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile = String(), const String& certfile = String(), bool ca = false); int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile = String(), const String& certfile = String(), bool ca = false);
std::shared_ptr<X509> I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca); std::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca);
String I2_BASE_API GetIcingaCADir(void); String GetIcingaCADir(void);
String I2_BASE_API CertificateToString(const std::shared_ptr<X509>& cert); String CertificateToString(const std::shared_ptr<X509>& cert);
std::shared_ptr<X509> I2_BASE_API StringToCertificate(const String& cert); std::shared_ptr<X509> StringToCertificate(const String& cert);
std::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject); std::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject);
std::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(const std::shared_ptr<X509>& cert); std::shared_ptr<X509> CreateCertIcingaCA(const std::shared_ptr<X509>& cert);
String I2_BASE_API PBKDF2_SHA1(const String& password, const String& salt, int iterations); String PBKDF2_SHA1(const String& password, const String& salt, int iterations);
String I2_BASE_API SHA1(const String& s, bool binary = false); String SHA1(const String& s, bool binary = false);
String I2_BASE_API SHA256(const String& s); String SHA256(const String& s);
String I2_BASE_API RandomString(int length); String RandomString(int length);
bool I2_BASE_API VerifyCertificate(const std::shared_ptr<X509>& caCertificate, const std::shared_ptr<X509>& certificate); bool VerifyCertificate(const std::shared_ptr<X509>& caCertificate, const std::shared_ptr<X509>& certificate);
class I2_BASE_API openssl_error : virtual public std::exception, virtual public boost::exception { }; class openssl_error : virtual public std::exception, virtual public boost::exception { };
struct errinfo_openssl_error_; struct errinfo_openssl_error_;
typedef boost::error_info<struct errinfo_openssl_error_, unsigned long> errinfo_openssl_error; typedef boost::error_info<struct errinfo_openssl_error_, unsigned long> errinfo_openssl_error;

View File

@ -70,7 +70,7 @@ public:
virtual bool ValidateName(const String& type, const String& name) const = 0; virtual bool ValidateName(const String& type, const String& name) const = 0;
}; };
class I2_BASE_API Type : public Object class Type : public Object
{ {
public: public:
DECLARE_OBJECT(Type); DECLARE_OBJECT(Type);
@ -114,7 +114,7 @@ private:
Object::Ptr m_Prototype; Object::Ptr m_Prototype;
}; };
class I2_BASE_API TypeType : public Type class TypeType : public Type
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Type); DECLARE_PTR_TYPEDEFS(Type);
@ -133,7 +133,7 @@ protected:
}; };
template<typename T> template<typename T>
class I2_BASE_API TypeImpl class TypeImpl
{ {
}; };

View File

@ -26,7 +26,7 @@
namespace icinga namespace icinga
{ {
class I2_BASE_API UnixSocket : public Socket class UnixSocket : public Socket
{ {
public: public:
DECLARE_PTR_TYPEDEFS(UnixSocket); DECLARE_PTR_TYPEDEFS(UnixSocket);

View File

@ -56,7 +56,7 @@ enum GlobType
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Utility class Utility
{ {
public: public:
static String DemangleSymbolName(const String& sym); static String DemangleSymbolName(const String& sym);

View File

@ -49,7 +49,7 @@ enum ValueType
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API Value class Value
{ {
public: public:
Value(void) Value(void)
@ -293,100 +293,100 @@ private:
boost::variant<boost::blank, double, bool, String, Object::Ptr> m_Value; boost::variant<boost::blank, double, bool, String, Object::Ptr> m_Value;
}; };
extern I2_BASE_API Value Empty; extern Value Empty;
I2_BASE_API Value operator+(const Value& lhs, const char *rhs); Value operator+(const Value& lhs, const char *rhs);
I2_BASE_API Value operator+(const char *lhs, const Value& rhs); Value operator+(const char *lhs, const Value& rhs);
I2_BASE_API Value operator+(const Value& lhs, const String& rhs); Value operator+(const Value& lhs, const String& rhs);
I2_BASE_API Value operator+(const String& lhs, const Value& rhs); Value operator+(const String& lhs, const Value& rhs);
I2_BASE_API Value operator+(const Value& lhs, const Value& rhs); Value operator+(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator+(const Value& lhs, double rhs); Value operator+(const Value& lhs, double rhs);
I2_BASE_API Value operator+(double lhs, const Value& rhs); Value operator+(double lhs, const Value& rhs);
I2_BASE_API Value operator+(const Value& lhs, int rhs); Value operator+(const Value& lhs, int rhs);
I2_BASE_API Value operator+(int lhs, const Value& rhs); Value operator+(int lhs, const Value& rhs);
I2_BASE_API Value operator-(const Value& lhs, const Value& rhs); Value operator-(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator-(const Value& lhs, double rhs); Value operator-(const Value& lhs, double rhs);
I2_BASE_API Value operator-(double lhs, const Value& rhs); Value operator-(double lhs, const Value& rhs);
I2_BASE_API Value operator-(const Value& lhs, int rhs); Value operator-(const Value& lhs, int rhs);
I2_BASE_API Value operator-(int lhs, const Value& rhs); Value operator-(int lhs, const Value& rhs);
I2_BASE_API Value operator*(const Value& lhs, const Value& rhs); Value operator*(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator*(const Value& lhs, double rhs); Value operator*(const Value& lhs, double rhs);
I2_BASE_API Value operator*(double lhs, const Value& rhs); Value operator*(double lhs, const Value& rhs);
I2_BASE_API Value operator*(const Value& lhs, int rhs); Value operator*(const Value& lhs, int rhs);
I2_BASE_API Value operator*(int lhs, const Value& rhs); Value operator*(int lhs, const Value& rhs);
I2_BASE_API Value operator/(const Value& lhs, const Value& rhs); Value operator/(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator/(const Value& lhs, double rhs); Value operator/(const Value& lhs, double rhs);
I2_BASE_API Value operator/(double lhs, const Value& rhs); Value operator/(double lhs, const Value& rhs);
I2_BASE_API Value operator/(const Value& lhs, int rhs); Value operator/(const Value& lhs, int rhs);
I2_BASE_API Value operator/(int lhs, const Value& rhs); Value operator/(int lhs, const Value& rhs);
I2_BASE_API Value operator%(const Value& lhs, const Value& rhs); Value operator%(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator%(const Value& lhs, double rhs); Value operator%(const Value& lhs, double rhs);
I2_BASE_API Value operator%(double lhs, const Value& rhs); Value operator%(double lhs, const Value& rhs);
I2_BASE_API Value operator%(const Value& lhs, int rhs); Value operator%(const Value& lhs, int rhs);
I2_BASE_API Value operator%(int lhs, const Value& rhs); Value operator%(int lhs, const Value& rhs);
I2_BASE_API Value operator^(const Value& lhs, const Value& rhs); Value operator^(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator^(const Value& lhs, double rhs); Value operator^(const Value& lhs, double rhs);
I2_BASE_API Value operator^(double lhs, const Value& rhs); Value operator^(double lhs, const Value& rhs);
I2_BASE_API Value operator^(const Value& lhs, int rhs); Value operator^(const Value& lhs, int rhs);
I2_BASE_API Value operator^(int lhs, const Value& rhs); Value operator^(int lhs, const Value& rhs);
I2_BASE_API Value operator&(const Value& lhs, const Value& rhs); Value operator&(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator&(const Value& lhs, double rhs); Value operator&(const Value& lhs, double rhs);
I2_BASE_API Value operator&(double lhs, const Value& rhs); Value operator&(double lhs, const Value& rhs);
I2_BASE_API Value operator&(const Value& lhs, int rhs); Value operator&(const Value& lhs, int rhs);
I2_BASE_API Value operator&(int lhs, const Value& rhs); Value operator&(int lhs, const Value& rhs);
I2_BASE_API Value operator|(const Value& lhs, const Value& rhs); Value operator|(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator|(const Value& lhs, double rhs); Value operator|(const Value& lhs, double rhs);
I2_BASE_API Value operator|(double lhs, const Value& rhs); Value operator|(double lhs, const Value& rhs);
I2_BASE_API Value operator|(const Value& lhs, int rhs); Value operator|(const Value& lhs, int rhs);
I2_BASE_API Value operator|(int lhs, const Value& rhs); Value operator|(int lhs, const Value& rhs);
I2_BASE_API Value operator<<(const Value& lhs, const Value& rhs); Value operator<<(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator<<(const Value& lhs, double rhs); Value operator<<(const Value& lhs, double rhs);
I2_BASE_API Value operator<<(double lhs, const Value& rhs); Value operator<<(double lhs, const Value& rhs);
I2_BASE_API Value operator<<(const Value& lhs, int rhs); Value operator<<(const Value& lhs, int rhs);
I2_BASE_API Value operator<<(int lhs, const Value& rhs); Value operator<<(int lhs, const Value& rhs);
I2_BASE_API Value operator>>(const Value& lhs, const Value& rhs); Value operator>>(const Value& lhs, const Value& rhs);
I2_BASE_API Value operator>>(const Value& lhs, double rhs); Value operator>>(const Value& lhs, double rhs);
I2_BASE_API Value operator>>(double lhs, const Value& rhs); Value operator>>(double lhs, const Value& rhs);
I2_BASE_API Value operator>>(const Value& lhs, int rhs); Value operator>>(const Value& lhs, int rhs);
I2_BASE_API Value operator>>(int lhs, const Value& rhs); Value operator>>(int lhs, const Value& rhs);
I2_BASE_API bool operator<(const Value& lhs, const Value& rhs); bool operator<(const Value& lhs, const Value& rhs);
I2_BASE_API bool operator<(const Value& lhs, double rhs); bool operator<(const Value& lhs, double rhs);
I2_BASE_API bool operator<(double lhs, const Value& rhs); bool operator<(double lhs, const Value& rhs);
I2_BASE_API bool operator<(const Value& lhs, int rhs); bool operator<(const Value& lhs, int rhs);
I2_BASE_API bool operator<(int lhs, const Value& rhs); bool operator<(int lhs, const Value& rhs);
I2_BASE_API bool operator>(const Value& lhs, const Value& rhs); bool operator>(const Value& lhs, const Value& rhs);
I2_BASE_API bool operator>(const Value& lhs, double rhs); bool operator>(const Value& lhs, double rhs);
I2_BASE_API bool operator>(double lhs, const Value& rhs); bool operator>(double lhs, const Value& rhs);
I2_BASE_API bool operator>(const Value& lhs, int rhs); bool operator>(const Value& lhs, int rhs);
I2_BASE_API bool operator>(int lhs, const Value& rhs); bool operator>(int lhs, const Value& rhs);
I2_BASE_API bool operator<=(const Value& lhs, const Value& rhs); bool operator<=(const Value& lhs, const Value& rhs);
I2_BASE_API bool operator<=(const Value& lhs, double rhs); bool operator<=(const Value& lhs, double rhs);
I2_BASE_API bool operator<=(double lhs, const Value& rhs); bool operator<=(double lhs, const Value& rhs);
I2_BASE_API bool operator<=(const Value& lhs, int rhs); bool operator<=(const Value& lhs, int rhs);
I2_BASE_API bool operator<=(int lhs, const Value& rhs); bool operator<=(int lhs, const Value& rhs);
I2_BASE_API bool operator>=(const Value& lhs, const Value& rhs); bool operator>=(const Value& lhs, const Value& rhs);
I2_BASE_API bool operator>=(const Value& lhs, double rhs); bool operator>=(const Value& lhs, double rhs);
I2_BASE_API bool operator>=(double lhs, const Value& rhs); bool operator>=(double lhs, const Value& rhs);
I2_BASE_API bool operator>=(const Value& lhs, int rhs); bool operator>=(const Value& lhs, int rhs);
I2_BASE_API bool operator>=(int lhs, const Value& rhs); bool operator>=(int lhs, const Value& rhs);
I2_BASE_API std::ostream& operator<<(std::ostream& stream, const Value& value); std::ostream& operator<<(std::ostream& stream, const Value& value);
I2_BASE_API std::istream& operator>>(std::istream& stream, Value& value); std::istream& operator>>(std::istream& stream, Value& value);
} }

View File

@ -1,32 +0,0 @@
/******************************************************************************
* Icinga 2 *
* Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software Foundation *
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#ifndef VISIBILITY_H
#define VISIBILITY_H
#ifndef _WIN32
# define I2_EXPORT __attribute__ ((visibility("default")))
# define I2_IMPORT __attribute__ ((visibility("default")))
#else /* _WIN32 */
# define I2_EXPORT __declspec(dllexport)
# define I2_IMPORT __declspec(dllimport)
# define I2_HIDDEN
#endif /* _WIN32 */
#endif /* VISIBILITY_H */

View File

@ -76,7 +76,7 @@ inline bool operator<(const Task& a, const Task& b)
* *
* @ingroup base * @ingroup base
*/ */
class I2_BASE_API WorkQueue class WorkQueue
{ {
public: public:
typedef std::function<void (boost::exception_ptr)> ExceptionCallback; typedef std::function<void (boost::exception_ptr)> ExceptionCallback;

View File

@ -25,16 +25,13 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(checker checker checker_SOURCES) mkunity_target(checker checker checker_SOURCES)
endif() endif()
add_library(checker SHARED ${checker_SOURCES}) add_library(checker STATIC ${checker_SOURCES})
target_link_libraries(checker ${Boost_LIBRARIES} base config icinga remote) target_link_libraries(checker ${Boost_LIBRARIES} base config icinga remote)
set_target_properties ( set_target_properties (
checker PROPERTIES checker PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CHECKER_BUILD
FOLDER Components FOLDER Components
VERSION ${SPEC_VERSION}
) )
install_if_not_exists( install_if_not_exists(
@ -49,10 +46,4 @@ else()
install_if_not_exists(${PROJECT_SOURCE_DIR}/etc/icinga2/features-enabled/checker.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-enabled) install_if_not_exists(${PROJECT_SOURCE_DIR}/etc/icinga2/features-enabled/checker.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-enabled)
endif() endif()
install(
TARGETS checker
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE) set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)

View File

@ -33,7 +33,7 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(cli cli cli_SOURCES) mkunity_target(cli cli cli_SOURCES)
endif() endif()
add_library(cli SHARED ${cli_SOURCES}) add_library(cli STATIC ${cli_SOURCES})
target_link_libraries(cli ${Boost_LIBRARIES} base config remote) target_link_libraries(cli ${Boost_LIBRARIES} base config remote)
@ -49,14 +49,5 @@ endif()
set_target_properties ( set_target_properties (
cli PROPERTIES cli PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CLI_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(
TARGETS cli
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
) )

View File

@ -34,7 +34,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API ApiSetupUtility class ApiSetupUtility
{ {
public: public:
static bool SetupMaster(const String& cn, bool prompt_restart = false); static bool SetupMaster(const String& cn, bool prompt_restart = false);

View File

@ -32,8 +32,8 @@
namespace icinga namespace icinga
{ {
std::vector<String> I2_CLI_API GetBashCompletionSuggestions(const String& type, const String& word); std::vector<String> GetBashCompletionSuggestions(const String& type, const String& word);
std::vector<String> I2_CLI_API GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word); std::vector<String> GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word);
enum ImpersonationLevel enum ImpersonationLevel
{ {
@ -47,7 +47,7 @@ enum ImpersonationLevel
* *
* @ingroup base * @ingroup base
*/ */
class I2_CLI_API CLICommand : public Object class CLICommand : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(CLICommand); DECLARE_PTR_TYPEDEFS(CLICommand);

View File

@ -31,7 +31,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API DaemonUtility class DaemonUtility
{ {
public: public:
static bool ValidateConfigFiles(const std::vector<std::string>& configs, const String& objectsFile = String()); static bool ValidateConfigFiles(const std::vector<std::string>& configs, const String& objectsFile = String());

View File

@ -32,7 +32,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API FeatureUtility class FeatureUtility
{ {
public: public:
static String GetFeaturesAvailablePath(void); static String GetFeaturesAvailablePath(void);

View File

@ -28,10 +28,4 @@
#include "base/i2-base.hpp" #include "base/i2-base.hpp"
#ifdef I2_CLI_BUILD
# define I2_CLI_API I2_EXPORT
#else /* I2_REMOTE_BUILD */
# define I2_CLI_API I2_IMPORT
#endif /* I2_REMOTE_BUILD */
#endif /* I2CLI_H */ #endif /* I2CLI_H */

View File

@ -34,7 +34,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API NodeUtility class NodeUtility
{ {
public: public:
static String GetConstantsConfPath(void); static String GetConstantsConfPath(void);

View File

@ -33,7 +33,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API ObjectListUtility class ObjectListUtility
{ {
public: public:
static bool PrintObject(std::ostream& fp, bool& first, const String& message, std::map<String, int>& type_count, const String& name_filter, const String& type_filter); static bool PrintObject(std::ostream& fp, bool& first, const String& message, std::map<String, int>& type_count, const String& name_filter, const String& type_filter);

View File

@ -32,7 +32,7 @@ namespace icinga
/** /**
* @ingroup cli * @ingroup cli
*/ */
class I2_CLI_API VariableUtility class VariableUtility
{ {
public: public:
static Value GetVariable(const String& name); static Value GetVariable(const String& name);

View File

@ -30,16 +30,13 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(compat compat compat_SOURCES) mkunity_target(compat compat compat_SOURCES)
endif() endif()
add_library(compat SHARED ${compat_SOURCES}) add_library(compat STATIC ${compat_SOURCES})
target_link_libraries(compat ${Boost_LIBRARIES} base config icinga) target_link_libraries(compat ${Boost_LIBRARIES} base config icinga)
set_target_properties ( set_target_properties (
compat PROPERTIES compat PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_COMPAT_BUILD
FOLDER Components FOLDER Components
VERSION ${SPEC_VERSION}
) )
install_if_not_exists( install_if_not_exists(
@ -57,8 +54,6 @@ install_if_not_exists(
${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available
) )
install(TARGETS compat RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2)
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/compat/archives\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/compat/archives\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/icinga2\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2/cmd\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2/cmd\")")

View File

@ -44,27 +44,11 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(config config config_SOURCES) mkunity_target(config config config_SOURCES)
endif() endif()
add_library(config SHARED ${config_SOURCES}) add_library(config STATIC ${config_SOURCES})
target_link_libraries(config ${Boost_LIBRARIES} base) target_link_libraries(config ${Boost_LIBRARIES} base)
set_target_properties ( set_target_properties (
config PROPERTIES config PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CONFIG_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
) )
install(
TARGETS config
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)
if(APPLE)
install(
TARGETS config
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/icinga-studio.app/Contents
)
endif()

View File

@ -28,7 +28,7 @@
namespace icinga namespace icinga
{ {
class I2_CONFIG_API ActivationContext : public Object class ActivationContext : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(ActivationContext); DECLARE_PTR_TYPEDEFS(ActivationContext);
@ -46,7 +46,7 @@ private:
friend class ActivationScope; friend class ActivationScope;
}; };
class I2_CONFIG_API ActivationScope class ActivationScope
{ {
public: public:
ActivationScope(const ActivationContext::Ptr& context = nullptr); ActivationScope(const ActivationContext::Ptr& context = nullptr);

View File

@ -30,7 +30,7 @@ namespace icinga
/** /**
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ApplyRule class ApplyRule
{ {
public: public:
typedef std::map<String, std::vector<String> > TypeMap; typedef std::map<String, std::vector<String> > TypeMap;

View File

@ -83,7 +83,7 @@ struct ZoneFragment
* *
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ConfigCompiler class ConfigCompiler
{ {
public: public:
explicit ConfigCompiler(const String& path, std::istream *input, explicit ConfigCompiler(const String& path, std::istream *input,

View File

@ -31,7 +31,7 @@ namespace icinga
/* /*
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ConfigCompilerContext class ConfigCompilerContext
{ {
public: public:
ConfigCompilerContext(void); ConfigCompilerContext(void);

View File

@ -36,7 +36,7 @@ namespace icinga
* *
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ConfigItem : public Object { class ConfigItem : public Object {
public: public:
DECLARE_PTR_TYPEDEFS(ConfigItem); DECLARE_PTR_TYPEDEFS(ConfigItem);

View File

@ -34,7 +34,7 @@ namespace icinga
* *
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ConfigItemBuilder : public Object class ConfigItemBuilder : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(ConfigItemBuilder); DECLARE_PTR_TYPEDEFS(ConfigItemBuilder);

View File

@ -840,7 +840,9 @@ ExpressionResult LibraryExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dh
ExpressionResult libres = m_Operand->Evaluate(frame, dhint); ExpressionResult libres = m_Operand->Evaluate(frame, dhint);
CHECK_RESULT(libres); CHECK_RESULT(libres);
Loader::LoadExtensionLibrary(libres.GetValue()); Log(LogNotice, "config")
<< "Ignoring explicit load request for library \"" << libres << "\".";
//Loader::LoadExtensionLibrary(libres.GetValue());
return Empty; return Empty;
} }

View File

@ -195,7 +195,7 @@ private:
/** /**
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API Expression class Expression
{ {
public: public:
Expression(void) = default; Expression(void) = default;
@ -215,9 +215,9 @@ public:
static void ScriptBreakpoint(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di); static void ScriptBreakpoint(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di);
}; };
I2_CONFIG_API std::unique_ptr<Expression> MakeIndexer(ScopeSpecifier scopeSpec, const String& index); std::unique_ptr<Expression> MakeIndexer(ScopeSpecifier scopeSpec, const String& index);
class I2_CONFIG_API OwnedExpression : public Expression class OwnedExpression : public Expression
{ {
public: public:
OwnedExpression(const std::shared_ptr<Expression>& expression) OwnedExpression(const std::shared_ptr<Expression>& expression)
@ -239,7 +239,7 @@ private:
std::shared_ptr<Expression> m_Expression; std::shared_ptr<Expression> m_Expression;
}; };
class I2_CONFIG_API LiteralExpression : public Expression class LiteralExpression : public Expression
{ {
public: public:
LiteralExpression(const Value& value = Value()); LiteralExpression(const Value& value = Value());
@ -266,7 +266,7 @@ inline std::unique_ptr<LiteralExpression> MakeLiteral(const Value& literal = Val
return std::unique_ptr<LiteralExpression>(MakeLiteralRaw(literal)); return std::unique_ptr<LiteralExpression>(MakeLiteralRaw(literal));
} }
class I2_CONFIG_API DebuggableExpression : public Expression class DebuggableExpression : public Expression
{ {
public: public:
DebuggableExpression(const DebugInfo& debugInfo = DebugInfo()) DebuggableExpression(const DebugInfo& debugInfo = DebugInfo())
@ -279,7 +279,7 @@ protected:
DebugInfo m_DebugInfo; DebugInfo m_DebugInfo;
}; };
class I2_CONFIG_API UnaryExpression : public DebuggableExpression class UnaryExpression : public DebuggableExpression
{ {
public: public:
UnaryExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo()) UnaryExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo())
@ -290,7 +290,7 @@ protected:
std::unique_ptr<Expression> m_Operand; std::unique_ptr<Expression> m_Operand;
}; };
class I2_CONFIG_API BinaryExpression : public DebuggableExpression class BinaryExpression : public DebuggableExpression
{ {
public: public:
BinaryExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) BinaryExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -302,7 +302,7 @@ protected:
std::unique_ptr<Expression> m_Operand2; std::unique_ptr<Expression> m_Operand2;
}; };
class I2_CONFIG_API VariableExpression : public DebuggableExpression class VariableExpression : public DebuggableExpression
{ {
public: public:
VariableExpression(const String& variable, const DebugInfo& debugInfo = DebugInfo()) VariableExpression(const String& variable, const DebugInfo& debugInfo = DebugInfo())
@ -321,10 +321,10 @@ protected:
private: private:
String m_Variable; String m_Variable;
friend I2_CONFIG_API void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };
class I2_CONFIG_API NegateExpression : public UnaryExpression class NegateExpression : public UnaryExpression
{ {
public: public:
NegateExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo()) NegateExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo())
@ -335,7 +335,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API LogicalNegateExpression : public UnaryExpression class LogicalNegateExpression : public UnaryExpression
{ {
public: public:
LogicalNegateExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo()) LogicalNegateExpression(std::unique_ptr<Expression> operand, const DebugInfo& debugInfo = DebugInfo())
@ -346,7 +346,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API AddExpression : public BinaryExpression class AddExpression : public BinaryExpression
{ {
public: public:
AddExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) AddExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -357,7 +357,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API SubtractExpression : public BinaryExpression class SubtractExpression : public BinaryExpression
{ {
public: public:
SubtractExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) SubtractExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -368,7 +368,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API MultiplyExpression : public BinaryExpression class MultiplyExpression : public BinaryExpression
{ {
public: public:
MultiplyExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) MultiplyExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -379,7 +379,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API DivideExpression : public BinaryExpression class DivideExpression : public BinaryExpression
{ {
public: public:
DivideExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) DivideExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -390,7 +390,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API ModuloExpression : public BinaryExpression class ModuloExpression : public BinaryExpression
{ {
public: public:
ModuloExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) ModuloExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -401,7 +401,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API XorExpression : public BinaryExpression class XorExpression : public BinaryExpression
{ {
public: public:
XorExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) XorExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -412,7 +412,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API BinaryAndExpression : public BinaryExpression class BinaryAndExpression : public BinaryExpression
{ {
public: public:
BinaryAndExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) BinaryAndExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -423,7 +423,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API BinaryOrExpression : public BinaryExpression class BinaryOrExpression : public BinaryExpression
{ {
public: public:
BinaryOrExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) BinaryOrExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -434,7 +434,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API ShiftLeftExpression : public BinaryExpression class ShiftLeftExpression : public BinaryExpression
{ {
public: public:
ShiftLeftExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) ShiftLeftExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -445,7 +445,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API ShiftRightExpression : public BinaryExpression class ShiftRightExpression : public BinaryExpression
{ {
public: public:
ShiftRightExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) ShiftRightExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -456,7 +456,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API EqualExpression : public BinaryExpression class EqualExpression : public BinaryExpression
{ {
public: public:
EqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) EqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -467,7 +467,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API NotEqualExpression : public BinaryExpression class NotEqualExpression : public BinaryExpression
{ {
public: public:
NotEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) NotEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -478,7 +478,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API LessThanExpression : public BinaryExpression class LessThanExpression : public BinaryExpression
{ {
public: public:
LessThanExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) LessThanExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -489,7 +489,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API GreaterThanExpression : public BinaryExpression class GreaterThanExpression : public BinaryExpression
{ {
public: public:
GreaterThanExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) GreaterThanExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -500,7 +500,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API LessThanOrEqualExpression : public BinaryExpression class LessThanOrEqualExpression : public BinaryExpression
{ {
public: public:
LessThanOrEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) LessThanOrEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -511,7 +511,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API GreaterThanOrEqualExpression : public BinaryExpression class GreaterThanOrEqualExpression : public BinaryExpression
{ {
public: public:
GreaterThanOrEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) GreaterThanOrEqualExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -522,7 +522,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API InExpression : public BinaryExpression class InExpression : public BinaryExpression
{ {
public: public:
InExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) InExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -533,7 +533,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API NotInExpression : public BinaryExpression class NotInExpression : public BinaryExpression
{ {
public: public:
NotInExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) NotInExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -544,7 +544,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API LogicalAndExpression : public BinaryExpression class LogicalAndExpression : public BinaryExpression
{ {
public: public:
LogicalAndExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) LogicalAndExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -555,7 +555,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API LogicalOrExpression : public BinaryExpression class LogicalOrExpression : public BinaryExpression
{ {
public: public:
LogicalOrExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) LogicalOrExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -566,7 +566,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API FunctionCallExpression : public DebuggableExpression class FunctionCallExpression : public DebuggableExpression
{ {
public: public:
FunctionCallExpression(std::unique_ptr<Expression> fname, std::vector<std::unique_ptr<Expression> >&& args, const DebugInfo& debugInfo = DebugInfo()) FunctionCallExpression(std::unique_ptr<Expression> fname, std::vector<std::unique_ptr<Expression> >&& args, const DebugInfo& debugInfo = DebugInfo())
@ -581,7 +581,7 @@ public:
std::vector<std::unique_ptr<Expression> > m_Args; std::vector<std::unique_ptr<Expression> > m_Args;
}; };
class I2_CONFIG_API ArrayExpression : public DebuggableExpression class ArrayExpression : public DebuggableExpression
{ {
public: public:
ArrayExpression(std::vector<std::unique_ptr<Expression > >&& expressions, const DebugInfo& debugInfo = DebugInfo()) ArrayExpression(std::vector<std::unique_ptr<Expression > >&& expressions, const DebugInfo& debugInfo = DebugInfo())
@ -595,7 +595,7 @@ private:
std::vector<std::unique_ptr<Expression> > m_Expressions; std::vector<std::unique_ptr<Expression> > m_Expressions;
}; };
class I2_CONFIG_API DictExpression : public DebuggableExpression class DictExpression : public DebuggableExpression
{ {
public: public:
DictExpression(std::vector<std::unique_ptr<Expression> >&& expressions = {}, const DebugInfo& debugInfo = DebugInfo()) DictExpression(std::vector<std::unique_ptr<Expression> >&& expressions = {}, const DebugInfo& debugInfo = DebugInfo())
@ -611,10 +611,10 @@ private:
std::vector<std::unique_ptr<Expression> > m_Expressions; std::vector<std::unique_ptr<Expression> > m_Expressions;
bool m_Inline; bool m_Inline;
friend I2_CONFIG_API void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };
class I2_CONFIG_API SetExpression : public BinaryExpression class SetExpression : public BinaryExpression
{ {
public: public:
SetExpression(std::unique_ptr<Expression> operand1, CombinedSetOp op, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) SetExpression(std::unique_ptr<Expression> operand1, CombinedSetOp op, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -627,10 +627,10 @@ protected:
private: private:
CombinedSetOp m_Op; CombinedSetOp m_Op;
friend I2_CONFIG_API void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };
class I2_CONFIG_API ConditionalExpression : public DebuggableExpression class ConditionalExpression : public DebuggableExpression
{ {
public: public:
ConditionalExpression(std::unique_ptr<Expression> condition, std::unique_ptr<Expression> true_branch, std::unique_ptr<Expression> false_branch, const DebugInfo& debugInfo = DebugInfo()) ConditionalExpression(std::unique_ptr<Expression> condition, std::unique_ptr<Expression> true_branch, std::unique_ptr<Expression> false_branch, const DebugInfo& debugInfo = DebugInfo())
@ -646,7 +646,7 @@ private:
std::unique_ptr<Expression> m_FalseBranch; std::unique_ptr<Expression> m_FalseBranch;
}; };
class I2_CONFIG_API WhileExpression : public DebuggableExpression class WhileExpression : public DebuggableExpression
{ {
public: public:
WhileExpression(std::unique_ptr<Expression> condition, std::unique_ptr<Expression> loop_body, const DebugInfo& debugInfo = DebugInfo()) WhileExpression(std::unique_ptr<Expression> condition, std::unique_ptr<Expression> loop_body, const DebugInfo& debugInfo = DebugInfo())
@ -662,7 +662,7 @@ private:
}; };
class I2_CONFIG_API ReturnExpression : public UnaryExpression class ReturnExpression : public UnaryExpression
{ {
public: public:
ReturnExpression(std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo()) ReturnExpression(std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
@ -673,7 +673,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API BreakExpression : public DebuggableExpression class BreakExpression : public DebuggableExpression
{ {
public: public:
BreakExpression(const DebugInfo& debugInfo = DebugInfo()) BreakExpression(const DebugInfo& debugInfo = DebugInfo())
@ -684,7 +684,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API ContinueExpression : public DebuggableExpression class ContinueExpression : public DebuggableExpression
{ {
public: public:
ContinueExpression(const DebugInfo& debugInfo = DebugInfo()) ContinueExpression(const DebugInfo& debugInfo = DebugInfo())
@ -695,7 +695,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API GetScopeExpression : public Expression class GetScopeExpression : public Expression
{ {
public: public:
GetScopeExpression(ScopeSpecifier scopeSpec) GetScopeExpression(ScopeSpecifier scopeSpec)
@ -709,7 +709,7 @@ private:
ScopeSpecifier m_ScopeSpec; ScopeSpecifier m_ScopeSpec;
}; };
class I2_CONFIG_API IndexerExpression : public BinaryExpression class IndexerExpression : public BinaryExpression
{ {
public: public:
IndexerExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo()) IndexerExpression(std::unique_ptr<Expression> operand1, std::unique_ptr<Expression> operand2, const DebugInfo& debugInfo = DebugInfo())
@ -720,12 +720,12 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
virtual bool GetReference(ScriptFrame& frame, bool init_dict, Value *parent, String *index, DebugHint **dhint) const override; virtual bool GetReference(ScriptFrame& frame, bool init_dict, Value *parent, String *index, DebugHint **dhint) const override;
friend I2_CONFIG_API void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };
I2_CONFIG_API void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
class I2_CONFIG_API ThrowExpression : public DebuggableExpression class ThrowExpression : public DebuggableExpression
{ {
public: public:
ThrowExpression(std::unique_ptr<Expression> message, bool incompleteExpr, const DebugInfo& debugInfo = DebugInfo()) ThrowExpression(std::unique_ptr<Expression> message, bool incompleteExpr, const DebugInfo& debugInfo = DebugInfo())
@ -740,7 +740,7 @@ private:
bool m_IncompleteExpr; bool m_IncompleteExpr;
}; };
class I2_CONFIG_API ImportExpression : public DebuggableExpression class ImportExpression : public DebuggableExpression
{ {
public: public:
ImportExpression(std::unique_ptr<Expression> name, const DebugInfo& debugInfo = DebugInfo()) ImportExpression(std::unique_ptr<Expression> name, const DebugInfo& debugInfo = DebugInfo())
@ -754,7 +754,7 @@ private:
std::unique_ptr<Expression> m_Name; std::unique_ptr<Expression> m_Name;
}; };
class I2_CONFIG_API ImportDefaultTemplatesExpression : public DebuggableExpression class ImportDefaultTemplatesExpression : public DebuggableExpression
{ {
public: public:
ImportDefaultTemplatesExpression(const DebugInfo& debugInfo = DebugInfo()) ImportDefaultTemplatesExpression(const DebugInfo& debugInfo = DebugInfo())
@ -765,7 +765,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API FunctionExpression : public DebuggableExpression class FunctionExpression : public DebuggableExpression
{ {
public: public:
FunctionExpression(const String& name, const std::vector<String>& args, FunctionExpression(const String& name, const std::vector<String>& args,
@ -783,7 +783,7 @@ private:
std::shared_ptr<Expression> m_Expression; std::shared_ptr<Expression> m_Expression;
}; };
class I2_CONFIG_API ApplyExpression : public DebuggableExpression class ApplyExpression : public DebuggableExpression
{ {
public: public:
ApplyExpression(const String& type, const String& target, std::unique_ptr<Expression> name, ApplyExpression(const String& type, const String& target, std::unique_ptr<Expression> name,
@ -813,7 +813,7 @@ private:
std::shared_ptr<Expression> m_Expression; std::shared_ptr<Expression> m_Expression;
}; };
class I2_CONFIG_API ObjectExpression : public DebuggableExpression class ObjectExpression : public DebuggableExpression
{ {
public: public:
ObjectExpression(bool abstract, std::unique_ptr<Expression> type, std::unique_ptr<Expression> name, std::unique_ptr<Expression> filter, ObjectExpression(bool abstract, std::unique_ptr<Expression> type, std::unique_ptr<Expression> name, std::unique_ptr<Expression> filter,
@ -840,7 +840,7 @@ private:
std::shared_ptr<Expression> m_Expression; std::shared_ptr<Expression> m_Expression;
}; };
class I2_CONFIG_API ForExpression : public DebuggableExpression class ForExpression : public DebuggableExpression
{ {
public: public:
ForExpression(const String& fkvar, const String& fvvar, std::unique_ptr<Expression> value, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo()) ForExpression(const String& fkvar, const String& fvvar, std::unique_ptr<Expression> value, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
@ -857,7 +857,7 @@ private:
std::unique_ptr<Expression> m_Expression; std::unique_ptr<Expression> m_Expression;
}; };
class I2_CONFIG_API LibraryExpression : public UnaryExpression class LibraryExpression : public UnaryExpression
{ {
public: public:
LibraryExpression(std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo()) LibraryExpression(std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
@ -875,7 +875,7 @@ enum IncludeType
IncludeZones IncludeZones
}; };
class I2_CONFIG_API IncludeExpression : public DebuggableExpression class IncludeExpression : public DebuggableExpression
{ {
public: public:
IncludeExpression(const String& relativeBase, std::unique_ptr<Expression> path, std::unique_ptr<Expression> pattern, std::unique_ptr<Expression> name, IncludeExpression(const String& relativeBase, std::unique_ptr<Expression> path, std::unique_ptr<Expression> pattern, std::unique_ptr<Expression> name,
@ -898,7 +898,7 @@ private:
String m_Package; String m_Package;
}; };
class I2_CONFIG_API BreakpointExpression : public DebuggableExpression class BreakpointExpression : public DebuggableExpression
{ {
public: public:
BreakpointExpression(const DebugInfo& debugInfo = DebugInfo()) BreakpointExpression(const DebugInfo& debugInfo = DebugInfo())
@ -909,7 +909,7 @@ protected:
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
}; };
class I2_CONFIG_API UsingExpression : public DebuggableExpression class UsingExpression : public DebuggableExpression
{ {
public: public:
UsingExpression(std::unique_ptr<Expression> name, const DebugInfo& debugInfo = DebugInfo()) UsingExpression(std::unique_ptr<Expression> name, const DebugInfo& debugInfo = DebugInfo())
@ -923,7 +923,7 @@ private:
std::unique_ptr<Expression> m_Name; std::unique_ptr<Expression> m_Name;
}; };
class I2_CONFIG_API TryExceptExpression : public DebuggableExpression class TryExceptExpression : public DebuggableExpression
{ {
public: public:
TryExceptExpression(std::unique_ptr<Expression> tryBody, std::unique_ptr<Expression> exceptBody, const DebugInfo& debugInfo = DebugInfo()) TryExceptExpression(std::unique_ptr<Expression> tryBody, std::unique_ptr<Expression> exceptBody, const DebugInfo& debugInfo = DebugInfo())

View File

@ -30,10 +30,4 @@
#include "base/i2-base.hpp" #include "base/i2-base.hpp"
#ifdef I2_CONFIG_BUILD
# define I2_CONFIG_API I2_EXPORT
#else /* I2_CONFIG_BUILD */
# define I2_CONFIG_API I2_IMPORT
#endif /* I2_CONFIG_BUILD */
#endif /* I2CONFIG_H */ #endif /* I2CONFIG_H */

View File

@ -31,7 +31,7 @@ namespace icinga
/** /**
* @ingroup config * @ingroup config
*/ */
class I2_CONFIG_API ObjectRule class ObjectRule
{ {
public: public:
typedef std::set<String> TypeSet; typedef std::set<String> TypeSet;

View File

@ -32,21 +32,12 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(db_ido db_ido db_ido_SOURCES) mkunity_target(db_ido db_ido db_ido_SOURCES)
endif() endif()
add_library(db_ido SHARED ${db_ido_SOURCES}) add_library(db_ido STATIC ${db_ido_SOURCES})
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(db_ido ${Boost_LIBRARIES} base config icinga remote) target_link_libraries(db_ido ${Boost_LIBRARIES} base config icinga remote)
set_target_properties ( set_target_properties (
db_ido PROPERTIES db_ido PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(
TARGETS db_ido
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
) )

View File

@ -40,7 +40,7 @@ namespace icinga
* *
* @ingroup db_ido * @ingroup db_ido
*/ */
class I2_DB_IDO_API DbConnection : public ObjectImpl<DbConnection> class DbConnection : public ObjectImpl<DbConnection>
{ {
public: public:
DECLARE_OBJECT(DbConnection); DECLARE_OBJECT(DbConnection);

View File

@ -59,7 +59,7 @@ enum DbObjectType
* *
* @ingroup ido * @ingroup ido
*/ */
class I2_DB_IDO_API DbObject : public Object class DbObject : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(DbObject); DECLARE_PTR_TYPEDEFS(DbObject);

View File

@ -60,7 +60,7 @@ enum DbQueryCategory
class DbObject; class DbObject;
struct I2_DB_IDO_API DbQuery struct DbQuery
{ {
int Type; int Type;
DbQueryCategory Category; DbQueryCategory Category;

View File

@ -30,7 +30,7 @@ namespace icinga
* *
* @ingroup ido * @ingroup ido
*/ */
struct I2_DB_IDO_API DbReference struct DbReference
{ {
public: public:
DbReference(void); DbReference(void);

View File

@ -36,7 +36,7 @@ class DbObject;
* *
* @ingroup ido * @ingroup ido
*/ */
class I2_DB_IDO_API DbType : public Object class DbType : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(DbType); DECLARE_PTR_TYPEDEFS(DbType);
@ -79,7 +79,7 @@ private:
* *
* @ingroup ido * @ingroup ido
*/ */
class I2_DB_IDO_API DbTypeRegistry : public Registry<DbTypeRegistry, DbType::Ptr> class DbTypeRegistry : public Registry<DbTypeRegistry, DbType::Ptr>
{ {
public: public:
static DbTypeRegistry *GetInstance(void); static DbTypeRegistry *GetInstance(void);

View File

@ -39,7 +39,7 @@ enum DbValueType
* *
* @ingroup ido * @ingroup ido
*/ */
struct I2_DB_IDO_API DbValue : public Object struct DbValue : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(DbValue); DECLARE_PTR_TYPEDEFS(DbValue);

View File

@ -28,10 +28,4 @@
#include "base/i2-base.hpp" #include "base/i2-base.hpp"
#ifdef I2_DB_IDO_BUILD
# define I2_DB_IDO_API I2_EXPORT
#else /* I2_DB_IDO_BUILD */
# define I2_DB_IDO_API I2_IMPORT
#endif /* I2_DB_IDO_BUILD */
#endif /* I2DB_IDO_H */ #endif /* I2DB_IDO_H */

View File

@ -28,17 +28,14 @@ if(MYSQL_FOUND)
mkunity_target(db_ido_mysql db_ido_mysql db_ido_mysql_SOURCES) mkunity_target(db_ido_mysql db_ido_mysql db_ido_mysql_SOURCES)
endif() endif()
add_library(db_ido_mysql SHARED ${db_ido_mysql_SOURCES}) add_library(db_ido_mysql STATIC ${db_ido_mysql_SOURCES})
include_directories(${MYSQL_INCLUDE_DIR}) include_directories(${MYSQL_INCLUDE_DIR})
target_link_libraries(db_ido_mysql ${Boost_LIBRARIES} ${MYSQL_CLIENT_LIBS} base config icinga db_ido) target_link_libraries(db_ido_mysql ${Boost_LIBRARIES} ${MYSQL_LIB} base config icinga db_ido)
set_target_properties ( set_target_properties (
db_ido_mysql PROPERTIES db_ido_mysql PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_MYSQL_BUILD
FOLDER Components FOLDER Components
VERSION ${SPEC_VERSION}
) )
install_if_not_exists( install_if_not_exists(
@ -46,12 +43,6 @@ if(MYSQL_FOUND)
${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available
) )
install(
TARGETS db_ido_mysql
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
)
install( install(
DIRECTORY schema DIRECTORY schema
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-mysql DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-mysql

View File

@ -15,14 +15,9 @@
# along with this program; if not, write to the Free Software Foundation # along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
find_package(PostgreSQL)
if(PostgreSQL_FOUND) if(PostgreSQL_FOUND)
mkclass_target(idopgsqlconnection.ti idopgsqlconnection.tcpp idopgsqlconnection.thpp) mkclass_target(idopgsqlconnection.ti idopgsqlconnection.tcpp idopgsqlconnection.thpp)
link_directories(${PostgreSQL_LIBRARY_DIRS})
include_directories(${PostgreSQL_INCLUDE_DIRS})
set(db_ido_pgsql_SOURCES set(db_ido_pgsql_SOURCES
idopgsqlconnection.cpp idopgsqlconnection.thpp idopgsqlconnection.cpp idopgsqlconnection.thpp
) )
@ -31,16 +26,13 @@ if(PostgreSQL_FOUND)
mkunity_target(db_ido_pgsql db_ido_pgsql db_ido_pgsql_SOURCES) mkunity_target(db_ido_pgsql db_ido_pgsql db_ido_pgsql_SOURCES)
endif() endif()
add_library(db_ido_pgsql SHARED ${db_ido_pgsql_SOURCES}) add_library(db_ido_pgsql STATIC ${db_ido_pgsql_SOURCES})
target_link_libraries(db_ido_pgsql ${Boost_LIBRARIES} ${PostgreSQL_LIBRARIES} base config icinga db_ido) target_link_libraries(db_ido_pgsql ${Boost_LIBRARIES} ${PostgreSQL_LIBRARIES} base config icinga db_ido)
set_target_properties ( set_target_properties (
db_ido_pgsql PROPERTIES db_ido_pgsql PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_PGSQL_BUILD
FOLDER Components FOLDER Components
VERSION ${SPEC_VERSION}
) )
install_if_not_exists( install_if_not_exists(
@ -48,12 +40,6 @@ if(PostgreSQL_FOUND)
${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available
) )
install(
TARGETS db_ido_pgsql
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
)
install( install(
DIRECTORY schema DIRECTORY schema
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql

View File

@ -25,21 +25,11 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(demo demo demo_SOURCES) mkunity_target(demo demo demo_SOURCES)
endif() endif()
add_library(demo SHARED ${demo_SOURCES}) add_library(demo STATIC ${demo_SOURCES})
target_link_libraries(demo ${Boost_LIBRARIES} base config icinga remote) target_link_libraries(demo ${Boost_LIBRARIES} base config icinga remote)
set_target_properties ( set_target_properties (
demo PROPERTIES demo PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DEMO_BUILD
FOLDER Components FOLDER Components
VERSION ${SPEC_VERSION}
) )
install(
TARGETS demo
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)

View File

@ -25,21 +25,11 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(hello hello hello_SOURCES) mkunity_target(hello hello hello_SOURCES)
endif() endif()
add_library(hello SHARED ${hello_SOURCES}) add_library(hello STATIC ${hello_SOURCES})
target_link_libraries(hello ${Boost_LIBRARIES} base config) target_link_libraries(hello ${Boost_LIBRARIES} base config)
set_target_properties ( set_target_properties (
hello PROPERTIES hello PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_HELLO_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
) )
install(
TARGETS hello
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)

View File

@ -56,22 +56,11 @@ if(ICINGA2_UNITY_BUILD)
mkunity_target(icinga icinga icinga_SOURCES) mkunity_target(icinga icinga icinga_SOURCES)
endif() endif()
add_library(icinga SHARED ${icinga_SOURCES}) add_library(icinga STATIC ${icinga_SOURCES})
target_link_libraries(icinga ${Boost_LIBRARIES} base config remote) target_link_libraries(icinga ${Boost_LIBRARIES} base config remote)
set_target_properties ( set_target_properties (
icinga PROPERTIES icinga PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_ICINGA_BUILD
FOLDER Lib FOLDER Lib
VERSION ${SPEC_VERSION}
) )
install(
TARGETS icinga
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
)

Some files were not shown because too many files have changed in this diff Show More