-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from pfnet-research/feature/libonnx
Switch to use libonnx directly
- Loading branch information
Showing
16 changed files
with
705 additions
and
127 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
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,44 @@ | ||
set(PROTOBUF_VERSION_STATIC "3.6.1") | ||
|
||
set(PROTOBUF_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${PROTOBUF_VERSION_STATIC}) | ||
set(PROTOBUF_URL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION_STATIC}/protobuf-cpp-${PROTOBUF_VERSION_STATIC}.tar.gz") | ||
set(PROTOBUF_HASH MD5=406d5b8636576b1c86730ca5cbd1e576) | ||
|
||
# Requires `-fPIC` for linking with a shared library | ||
set(PROTOBUF_CFLAGS -fPIC) | ||
set(PROTOBUF_CXXFLAGS -fPIC) | ||
if(USE_OLD_GLIBCXX_ABI) | ||
set(PROTOBUF_CXXFLAGS "${PROTOBUF_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") | ||
endif() | ||
|
||
ExternalProject_Add(Protobuf | ||
PREFIX ${PROTOBUF_DIR} | ||
URL ${PROTOBUF_URL} | ||
URL_HASH ${PROTOBUF_HASH} | ||
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}" | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND bash -ex ${CMAKE_MODULE_PATH}/configure-helper.sh ${CMAKE_C_COMPILER} ${CMAKE_CXX_COMPILER} ${PROTOBUF_DIR} ${PROTOBUF_CFLAGS} ${PROTOBUF_CXXFLAGS} | ||
BUILD_COMMAND make -j4 | ||
INSTALL_COMMAND make install | ||
) | ||
|
||
set(PROTOBUF_LIBRARY_STATIC ${PROTOBUF_DIR}/lib/libprotobuf.a) | ||
set(PROTOBUF_LIBRARY_SHARED ${PROTOBUF_DIR}/lib/libprotobuf.so) | ||
|
||
# Mimic the behavior of `FindProtobuf` module | ||
# Use the old variable names to ensure backward compatibility | ||
set(PROTOBUF_INCLUDE_DIR ${PROTOBUF_DIR}/include) | ||
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR}) | ||
set(PROTOBUF_LIBRARY ${PROTOBUF_LIBRARY_STATIC}) # use the static library | ||
set(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY}) | ||
set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_DIR}/bin/protoc) | ||
set(PROTOBUF_FOUND TRUE) | ||
|
||
add_library(protobuf::libprotobuf UNKNOWN IMPORTED) | ||
# Note: INTERFACE_INCLUDE_DIRECTORIES can't set in this place because include/ is | ||
# not installed during executing `cmake` | ||
set_target_properties(protobuf::libprotobuf PROPERTIES | ||
IMPORTED_LOCATION "${PROTOBUF_LIBRARY_STATIC}") | ||
add_executable(protobuf::protoc IMPORTED) | ||
set_target_properties(protobuf::protoc PROPERTIES | ||
IMPORTED_LOCATION "${PROTOBUF_PROTOC_EXECUTABLE}") |
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 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
Oops, something went wrong.