Fix zlib, protobuf.

Zlib is now found using CMake on linux and set to harcoded paths
on windows, yet uniform in use throughout the build system.

protobuf-lite now compiles under MSVC properly.
develop
Petr Mrázek 2012-03-10 15:31:46 +01:00
parent c260aca3f1
commit 50b7db982f
7 changed files with 16 additions and 10 deletions

@ -78,6 +78,15 @@ IF(UNIX)
SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic")
ENDIF()
# find and make available libz
if(NOT UNIX)
SET(ZLIB_INCLUDE_DIRS ${dfhack_SOURCE_DIR}/library/depends/zlib/include/)
SET(ZLIB_LIBRARIES ${dfhack_SOURCE_DIR}/library/depends/zlib/lib/zlib.lib)
else()
find_package(ZLIB REQUIRED)
endif()
include_directories(${ZLIB_INCLUDE_DIRS})
#add depends to include path
INCLUDE_DIRECTORIES ( library/depends )
INCLUDE_DIRECTORIES ( library/depends/protobuf/ )

@ -140,6 +140,7 @@ google/protobuf/dynamic_message.cc
google/protobuf/extension_set_heavy.cc
google/protobuf/generated_message_reflection.cc
google/protobuf/compiler/importer.cc
google/protobuf/io/gzip_stream.cc
google/protobuf/message.cc
google/protobuf/compiler/parser.cc
google/protobuf/io/printer.cc
@ -152,6 +153,7 @@ google/protobuf/text_format.cc
google/protobuf/io/tokenizer.cc
google/protobuf/unknown_field_set.cc
google/protobuf/wire_format.cc
google/protobuf/io/zero_copy_stream_impl.cc
)
SET(LIBPROTOC_HDRS
@ -199,7 +201,7 @@ google/protobuf/compiler/zip_writer.cc
LIST(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${dfhack_SOURCE_DIR}/library/depends/zlib)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
# Protobuf shared libraries
@ -209,13 +211,8 @@ ADD_LIBRARY(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDR
SET_TARGET_PROPERTIES(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
SET_TARGET_PROPERTIES(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
IF(WIN32)
TARGET_LINK_LIBRARIES(protobuf ${CMAKE_THREAD_LIBS_INIT} zlib)
TARGET_LINK_LIBRARIES(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} zlib)
ELSE()
TARGET_LINK_LIBRARIES(protobuf ${CMAKE_THREAD_LIBS_INIT} z)
TARGET_LINK_LIBRARIES(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} z)
ENDIF()
TARGET_LINK_LIBRARIES(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
TARGET_LINK_LIBRARIES(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
install(TARGETS protobuf-lite
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}/deplibs

@ -305,7 +305,7 @@ class LIBPROTOBUF_EXPORT StringTypeHandlerBase {
static void Merge(const string& from, string* to) { *to = from; }
};
class LIBPROTOBUF_EXPORT StringTypeHandler : public StringTypeHandlerBase {
class StringTypeHandler : public StringTypeHandlerBase {
public:
static int SpaceUsed(const string& value) {
return sizeof(value) + StringSpaceUsedExcludingSelf(value);

@ -1 +1 @@
Subproject commit 5199ad9c64393ec3007d716d3b6f73ffeb12d1fa
Subproject commit e30ae15012547b8dfd44f41c66e17be06f608e30