use bundled protobuf for windows builds

This commit is contained in:
Vitaly Takmazov 2012-03-21 17:42:29 +04:00
parent c47ff469f5
commit bda35a459e
7 changed files with 18 additions and 3 deletions

View file

@ -47,8 +47,12 @@ endif()
find_package(Boost COMPONENTS program_options date_time system filesystem regex signals REQUIRED) find_package(Boost COMPONENTS program_options date_time system filesystem regex signals REQUIRED)
message( STATUS "Found Boost: ${Boost_LIBRARIES}, ${Boost_INCLUDE_DIR}") message( STATUS "Found Boost: ${Boost_LIBRARIES}, ${Boost_INCLUDE_DIR}")
if (NOT WIN32)
set(Protobuf_DIR "${CMAKE_SOURCE_DIR}/cmake_modules") set(Protobuf_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
else()
set(PROTOBUF_FOUND TRUE)
endif()
set(Communi_DIR "${CMAKE_SOURCE_DIR}/cmake_modules") set(Communi_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
find_package(Communi) find_package(Communi)

View file

@ -6,7 +6,8 @@ ADD_EXECUTABLE(spectrum2_libpurple_backend ${SRC})
if(NOT WIN32) if(NOT WIN32)
target_link_libraries(spectrum2_libpurple_backend ${PURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${EVENT_LIBRARIES} transport-plugin pthread) target_link_libraries(spectrum2_libpurple_backend ${PURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${EVENT_LIBRARIES} transport-plugin pthread)
else() else()
target_link_libraries(spectrum2_libpurple_backend ${PURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${EVENT_LIBRARIES} transport-plugin) include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/protobuf/libprotobuf")
target_link_libraries(spectrum2_libpurple_backend ${PURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${EVENT_LIBRARIES} transport-plugin libprotobuf)
endif() endif()
INSTALL(TARGETS spectrum2_libpurple_backend RUNTIME DESTINATION bin) INSTALL(TARGETS spectrum2_libpurple_backend RUNTIME DESTINATION bin)

View file

@ -7,7 +7,8 @@ ADD_EXECUTABLE(spectrum2_template_backend ${SRC})
if (NOT WIN32) if (NOT WIN32)
target_link_libraries(spectrum2_template_backend transport pthread ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES}) target_link_libraries(spectrum2_template_backend transport pthread ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
else() else()
target_link_libraries(spectrum2_template_backend transport ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES}) include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/protobuf/libprotobuf")
target_link_libraries(spectrum2_template_backend transport libprotobuf ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
endif() endif()
#INSTALL(TARGETS spectrum2_template_backend RUNTIME DESTINATION bin) #INSTALL(TARGETS spectrum2_template_backend RUNTIME DESTINATION bin)

View file

@ -1,4 +1,7 @@
if (PROTOBUF_FOUND) if (PROTOBUF_FOUND)
if (WIN32)
set (PROTOBUF_PROTOC_EXECUTABLE protoc)
endif()
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protocol.pb.cc ${CMAKE_CURRENT_BINARY_DIR}/protocol.pb.h OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protocol.pb.cc ${CMAKE_CURRENT_BINARY_DIR}/protocol.pb.h
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --cpp_out ${CMAKE_CURRENT_BINARY_DIR} --proto_path ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/protocol.proto COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --cpp_out ${CMAKE_CURRENT_BINARY_DIR} --proto_path ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/protocol.proto

View file

@ -8,7 +8,9 @@ set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/../../include/tra
if (NOT WIN32) if (NOT WIN32)
ADD_LIBRARY(transport-plugin SHARED ${HEADERS} ${SRC} ${PROTOBUF_SRC} ${PROTOBUF_HDRS} ${EXTRA_SOURCES}) ADD_LIBRARY(transport-plugin SHARED ${HEADERS} ${SRC} ${PROTOBUF_SRC} ${PROTOBUF_HDRS} ${EXTRA_SOURCES})
else() else()
ADD_LIBRARY(transport-plugin STATIC ${HEADERS} ${SRC} ${PROTOBUF_SRC} ${PROTOBUF_HDRS} ${EXTRA_SOURCES}) ADD_LIBRARY(transport-plugin STATIC ${HEADERS} ${SRC} ${EXTRA_SOURCES})
include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/protobuf/libprotobuf")
ADD_DEPENDENCIES(transport-plugin libprotobuf)
endif() endif()
ADD_DEPENDENCIES(transport-plugin pb) ADD_DEPENDENCIES(transport-plugin pb)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/../../include/transport/protocol.pb.cc PROPERTIES GENERATED 1) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/../../include/transport/protocol.pb.cc PROPERTIES GENERATED 1)

View file

@ -7,6 +7,9 @@ ADD_DEPENDENCIES(spectrum2 spectrum2_libpurple_backend)
ADD_DEPENDENCIES(spectrum2 spectrum2_libircclient-qt_backend) ADD_DEPENDENCIES(spectrum2 spectrum2_libircclient-qt_backend)
target_link_libraries(spectrum2 transport ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES}) target_link_libraries(spectrum2 transport ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
if (WIN32)
target_link_libraries(spectrum2 libprotobuf)
endif()
INSTALL(TARGETS spectrum2 RUNTIME DESTINATION bin) INSTALL(TARGETS spectrum2 RUNTIME DESTINATION bin)

View file

@ -41,6 +41,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
if (WIN32) if (WIN32)
include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/protobuf/libprotobuf")
TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES}) TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES})
else (WIN32) else (WIN32)
TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ${POPT_LIBRARY}) TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ${POPT_LIBRARY})