Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cmakeproto3' of github.com:zilliqa/zilliqa into cmake3c…
…ontractmap
- Loading branch information
Showing
15 changed files
with
662 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
set(PROTOBUF_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/depends/protobuf/cmake) | ||
set(PROTOBUF_BINARY_DIR ${CMAKE_BINARY_DIR}/src/depends/protobuf) | ||
set(PROTOBUF_INSTALL_DIR ${CMAKE_BINARY_DIR}/protobuf) | ||
set(PROTOBUF_INSTALL_LOG ${CMAKE_BINARY_DIR}/install_protobuf.log) | ||
|
||
file(MAKE_DIRECTORY ${PROTOBUF_INSTALL_DIR}) | ||
file(MAKE_DIRECTORY ${PROTOBUF_BINARY_DIR}) | ||
|
||
message(STATUS "Building and installing protobuf") | ||
|
||
# download, check and untar | ||
execute_process( | ||
COMMAND git submodule update --init src/depends/protobuf | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
RESULT_VARIABLE PROTOBUF_INSTALL_RET | ||
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG} | ||
ERROR_FILE ${PROTOBUF_INSTALL_LOG} | ||
) | ||
|
||
if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0") | ||
message(FATAL_ERROR "Error when building and installing protobuf (1), see more in log ${PROTOBUF_INSTALL_LOG}") | ||
endif() | ||
|
||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") | ||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") | ||
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "") | ||
|
||
# generate build directory | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} | ||
-H${PROTOBUF_SOURCE_DIR} | ||
-B${PROTOBUF_BINARY_DIR} | ||
-Dprotobuf_BUILD_TESTS:BOOL=OFF | ||
-Dprotobuf_WITH_ZLIB:BOOL=OFF | ||
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF | ||
-Dprotobuf_MODULE_COMPATIBLE:BOOL=ON | ||
-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR} | ||
-DCMAKE_BUILD_TYPE:STRING=Release | ||
-Wno-dev | ||
RESULT_VARIABLE PROTOBUF_INSTALL_RET | ||
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG} | ||
ERROR_FILE ${PROTOBUF_INSTALL_LOG} | ||
) | ||
|
||
if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0") | ||
message(FATAL_ERROR "Error when building and installing protobuf (2), see more in log ${PROTOBUF_INSTALL_LOG}") | ||
endif() | ||
|
||
# build and install proto | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR} -- -j${N} | ||
RESULT_VARIABLE PROTOBUF_INSTALL_RET | ||
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG} | ||
ERROR_FILE ${PROTOBUF_INSTALL_LOG} | ||
) | ||
|
||
if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0") | ||
message(FATAL_ERROR "Error when building and installing protobuf (3), see more in log ${PROTOBUF_INSTALL_LOG}") | ||
endif() | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR} --target install | ||
RESULT_VARIABLE PROTOBUF_INSTALL_RET | ||
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG} | ||
ERROR_FILE ${PROTOBUF_INSTALL_LOG} | ||
) | ||
|
||
if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0") | ||
message(FATAL_ERROR "Error when building and installing protobuf (4), see more in log ${PROTOBUF_INSTALL_LOG}") | ||
endif() | ||
|
||
list(APPEND CMAKE_PREFIX_PATH ${PROTOBUF_INSTALL_DIR}) | ||
list(APPEND CMAKE_MODULE_PATH "${PROTOBUF_INSTALL_DIR}/lib/cmake/protobuf") | ||
link_directories(${PROTOBUF_INSTALL_DIR}/lib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER ZilliqaMessage.proto) | ||
|
||
add_library (Message ${PROTO_HEADER} ${PROTO_SRC} Messenger.cpp MessengerAccountStoreBase.cpp MessengerAccountStoreTrie.cpp) | ||
target_compile_options(Message PRIVATE "-Wno-unused-variable") | ||
target_compile_options(Message PRIVATE "-Wno-unused-parameter") | ||
#target_compile_options(Message PRIVATE "-Wno-unused-variable") | ||
#target_compile_options(Message PRIVATE "-Wno-unused-parameter") | ||
get_target_property(MESSAGE_COMPILE_FLAGS Message COMPILE_OPTIONS ) | ||
message(STATUS "Message compile flags old = ${MESSAGE_COMPILE_FLAGS}") | ||
list(REMOVE_ITEM MESSAGE_COMPILE_FLAGS -Wextra -Werror) | ||
message(STATUS "Message compile flags new = ${MESSAGE_COMPILE_FLAGS}") | ||
set_target_properties(Message PROPERTIES COMPILE_OPTIONS "${MESSAGE_COMPILE_FLAGS}") | ||
target_include_directories (Message PUBLIC ${PROJECT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) | ||
target_link_libraries (Message PUBLIC ${PROTOBUF_LIBRARY} AccountData Block BlockHeader MiningData Utils) | ||
target_link_libraries (Message PUBLIC protobuf AccountData Block BlockHeader MiningData Utils) | ||
|
||
add_library (MessageSWInfo ${PROTO_HEADER} ${PROTO_SRC} MessengerSWInfo.cpp) | ||
target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-variable") | ||
target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-parameter") | ||
#target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-variable") | ||
#target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-parameter") | ||
get_target_property(MESSAGESWINFO_COMPILE_FLAGS MessageSWInfo COMPILE_OPTIONS ) | ||
message(STATUS "MessageSWInfo compile flags old = ${MESSAGESWINFO_COMPILE_FLAGS}") | ||
list(REMOVE_ITEM MESSAGESWINFO_COMPILE_FLAGS -Wextra -Werror) | ||
message(STATUS "MessageSWInfo compile flags new = ${MESSAGESWINFO_COMPILE_FLAGS}") | ||
set_target_properties(MessageSWInfo PROPERTIES COMPILE_OPTIONS "${MESSAGESWINFO_COMPILE_FLAGS}") | ||
target_include_directories (MessageSWInfo PUBLIC ${PROJECT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) | ||
target_link_libraries (MessageSWInfo PUBLIC ${PROTOBUF_LIBRARY} Utils) | ||
target_link_libraries (MessageSWInfo PUBLIC protobuf Utils) |
Oops, something went wrong.