Allow define PURPLE_NOT_RUNTIME
This commit is contained in:
parent
bbafb94d6f
commit
1fde5bad9d
4 changed files with 20 additions and 9 deletions
|
@ -12,6 +12,7 @@ message(STATUS "|- boost : -DBOOST_INCLUDEDIR, -DBOOST_LIBRARYDIR")
|
|||
message(STATUS "|- protobuf: -DPROTOBUF_INCLUDE_DIR, -DPROTOBUF_LIBRARY")
|
||||
message(STATUS "|- log4cxx : -DLOG4CXX_INCLUDE_DIR, -DLOG4CXX_LIBRARY")
|
||||
message(STATUS "|- purple : -DPURPLE_INCLUDE_DIR, -DPURPLE_LIBRARY")
|
||||
message(STATUS " : -DPURPLE_NOT_RUNTIME - enables compilation with libpurple.lib")
|
||||
message(STATUS "|- glib2 : -DGLIB2_INCLUDE_DIR, -DGLIB2_LIBRARIES")
|
||||
|
||||
if(NOT LIB_INSTALL_DIR)
|
||||
|
@ -54,6 +55,16 @@ else()
|
|||
find_package(purple)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (PURPLE_NOT_RUNTIME)
|
||||
add_definitions(-DPURPLE_RUNTIME=0)
|
||||
else(PURPLE_NOT_RUNTIME)
|
||||
add_definitions(-DPURPLE_RUNTIME=1)
|
||||
endif(PURPLE_NOT_RUNTIME)
|
||||
else()
|
||||
add_definitions(-DPURPLE_RUNTIME=0)
|
||||
endif()
|
||||
|
||||
# FIND GLIB
|
||||
if (GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
|
||||
set(GLIB2_FOUND TRUE)
|
||||
|
@ -77,7 +88,7 @@ set(event_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
|
|||
find_package(event)
|
||||
|
||||
# FIND SWIFTEN
|
||||
if( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )
|
||||
if(WIN32 AND SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )
|
||||
if (ZLIB_LIBRARY)
|
||||
set(SWIFTEN_LIBRARY ${SWIFTEN_LIBRARY} ${ZLIB_LIBRARY})
|
||||
endif()
|
||||
|
@ -126,9 +137,9 @@ endif(WIN32)
|
|||
message( STATUS "Found Boost: ${Boost_LIBRARIES}, ${Boost_INCLUDE_DIR}")
|
||||
|
||||
# FIND PROTOBUF
|
||||
if (PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY)
|
||||
if (WIN32 AND PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY)
|
||||
set(PROTOBUF_FOUND 1)
|
||||
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
|
||||
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR})
|
||||
message(STATUS "Using protobuf: ${PROTOBUF_INCLUDE_DIRS} ${PROTOBUF_LIBRARY}")
|
||||
else()
|
||||
if (WIN32)
|
||||
|
|
|
@ -132,7 +132,7 @@ def output():
|
|||
|
||||
header = open("purple_defs.h", "w")
|
||||
print >> header, "#pragma once"
|
||||
print >> header, "#ifdef WIN32"
|
||||
print >> header, "#if PURPLE_RUNTIME"
|
||||
|
||||
print >> header, """
|
||||
#include <Windows.h>
|
||||
|
@ -186,7 +186,7 @@ def output():
|
|||
cpp = open("purple_defs.cpp", "w")
|
||||
print >> cpp, "#include \"purple_defs.h\""
|
||||
print >> cpp, ""
|
||||
print >> cpp, "#ifdef WIN32"
|
||||
print >> cpp, "#if PURPLE_RUNTIME"
|
||||
print >> cpp, "static HMODULE f_hPurple = NULL;"
|
||||
for d in definitions:
|
||||
#purple_util_set_user_wrapped_fnc purple_util_set_user_wrapped = NULL;
|
||||
|
@ -195,7 +195,7 @@ def output():
|
|||
print >> cpp, "#endif"
|
||||
|
||||
print >> cpp, "bool resolvePurpleFunctions() {"
|
||||
print >> cpp, "#ifdef WIN32"
|
||||
print >> cpp, "#if PURPLE_RUNTIME"
|
||||
print >> cpp, "\tf_hPurple = LoadLibrary(\"libpurple.dll\");"
|
||||
print >> cpp, "\tif (!f_hPurple)"
|
||||
print >> cpp, "\t\t\treturn false;"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "purple_defs.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#if PURPLE_RUNTIME
|
||||
static HMODULE f_hPurple = NULL;
|
||||
purple_debug_set_ui_ops_wrapped_fnc purple_debug_set_ui_ops_wrapped = NULL;
|
||||
purple_debug_set_verbose_wrapped_fnc purple_debug_set_verbose_wrapped = NULL;
|
||||
|
@ -138,7 +138,7 @@ purple_account_option_get_setting_wrapped_fnc purple_account_option_get_setting_
|
|||
wpurple_g_io_channel_win32_new_socket_wrapped_fnc wpurple_g_io_channel_win32_new_socket_wrapped = NULL;
|
||||
#endif
|
||||
bool resolvePurpleFunctions() {
|
||||
#ifdef WIN32
|
||||
#if PURPLE_RUNTIME
|
||||
f_hPurple = LoadLibrary("libpurple.dll");
|
||||
if (!f_hPurple)
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#ifdef WIN32
|
||||
#if PURPLE_RUNTIME
|
||||
|
||||
#include <Windows.h>
|
||||
#include <purple.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue