Cleaned up the protobuf build a bit, and made git ignore files generated in doing so. Fixed building mapexport on Linux by forcing CMake to create a directory for protobuf output files.

develop
Mike Stewart 2012-01-20 09:17:08 -08:00
parent fb41e457c4
commit 941c643b5c
4 changed files with 16 additions and 11 deletions

@ -0,0 +1,2 @@
config.h
testHashMap.cpp

@ -196,8 +196,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
IF (CMAKE_COMPILER_IS_GNUCC AND ${HASH_NAMESPACE} MATCHES ".*tr1.*") IF (CMAKE_COMPILER_IS_GNUCC AND ${HASH_NAMESPACE} MATCHES ".*tr1.*")
SET(CMAKE_CXX_FLAGS "-std=gnu++98") SET(CMAKE_CXX_FLAGS "-std=gnu++98")
ENDIF() ENDIF()
ADD_LIBRARY(libprotobuf-lite ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS}) ADD_LIBRARY(protobuf-lite ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS})
ADD_LIBRARY(libprotobuf ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS}) ADD_LIBRARY(protobuf ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS})
ADD_LIBRARY(libprotoc ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS}) ADD_LIBRARY(protoc ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS})
ADD_EXECUTABLE(protoc google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h) ADD_EXECUTABLE(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h)
TARGET_LINK_LIBRARIES(protoc libprotoc libprotobuf ${CMAKE_THREAD_LIBS_INIT}) SET_TARGET_PROPERTIES(protoc-bin PROPERTIES OUTPUT_NAME protoc)
TARGET_LINK_LIBRARIES(protoc-bin protoc protobuf ${CMAKE_THREAD_LIBS_INIT})

@ -26,10 +26,12 @@ proto/Tile.pb.cc
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto)
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT proto/Tile.pb.cc proto/Tile.pb.h OUTPUT proto/Tile.pb.cc proto/Tile.pb.h
COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto --cpp_out=proto ${CMAKE_CURRENT_SOURCE_DIR}/proto/Tile.proto COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/proto ${CMAKE_CURRENT_SOURCE_DIR}/proto/Tile.proto
DEPENDS protoc ${CMAKE_CURRENT_SOURCE_DIR}/proto/Tile.proto DEPENDS protoc-bin ${CMAKE_CURRENT_SOURCE_DIR}/proto/Tile.proto
) )
DFHACK_PLUGIN(mapexport ${PROJECT_SRCS} ${PROJECT_HDRS} LINK_LIBRARIES libprotobuf-lite) DFHACK_PLUGIN(mapexport ${PROJECT_SRCS} ${PROJECT_HDRS} LINK_LIBRARIES protobuf-lite)