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.*")
SET(CMAKE_CXX_FLAGS "-std=gnu++98")
ENDIF()
ADD_LIBRARY(libprotobuf-lite ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS})
ADD_LIBRARY(libprotobuf ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS})
ADD_LIBRARY(libprotoc ${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)
TARGET_LINK_LIBRARIES(protoc libprotoc libprotobuf ${CMAKE_THREAD_LIBS_INIT})
ADD_LIBRARY(protobuf-lite ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS})
ADD_LIBRARY(protobuf ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS})
ADD_LIBRARY(protoc ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS})
ADD_EXECUTABLE(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h)
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)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto)
ADD_CUSTOM_COMMAND(
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
DEPENDS protoc ${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-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)

@ -14,7 +14,7 @@ DFhackCExport const char * plugin_name ( void )
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
GOOGLE_PROTOBUF_VERIFY_VERSION;
commands.clear();
commands.push_back(PluginCommand("mapexport", "Starts up and shuts down protobufs.", mapexport, true));
return CR_OK;
@ -22,7 +22,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
DFhackCExport command_result plugin_shutdown ( Core * c )
{
google::protobuf::ShutdownProtobufLibrary();
google::protobuf::ShutdownProtobufLibrary();
return CR_OK;
}
@ -38,7 +38,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
}
c->Suspend();
dfproto::Tile tile;
dfproto::Tile tile;
c->con.print("Hold on, I'm working on it!\n");
c->Resume();
return CR_OK;