-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bf1409
commit 1924d4a
Showing
8 changed files
with
131 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CMakeFiles/ | ||
cmake_install.cmake | ||
CMakeCache.txt | ||
Makefile | ||
grpc_node_plugin | ||
protoc | ||
deps/protobuf |
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,55 +1,60 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.7" CACHE STRING "Minimum OS X deployment version" FORCE) | ||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.7) | ||
PROJECT("grpc-tools") | ||
|
||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "11.7" CACHE STRING "Minimum OS X deployment version" FORCE) | ||
|
||
if(COMMAND CMAKE_POLICY) | ||
CMAKE_POLICY(SET CMP0003 NEW) | ||
ENDIF(COMMAND CMAKE_POLICY) | ||
|
||
# MSVC runtime library flags are selected by an abstraction. | ||
if(COMMAND cmake_policy AND POLICY CMP0091) | ||
cmake_policy(SET CMP0091 NEW) | ||
endif() | ||
if(COMMAND CMAKE_POLICY AND POLICY CMP0091) | ||
CMAKE_POLICY(SET CMP0091 NEW) | ||
ENDIF() | ||
|
||
SET(CMAKE_CXX_STANDARD 11) | ||
SET(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
SET(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
SET(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") | ||
SET(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") | ||
SET(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf) | ||
|
||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") | ||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") | ||
set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf) | ||
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf) | ||
ADD_SUBDIRECTORY(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf) | ||
|
||
set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector") | ||
SET(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector") | ||
|
||
add_executable(grpc_node_plugin | ||
src/node_generator.cc | ||
src/node_plugin.cc | ||
ADD_EXECUTABLE(grpc_node_plugin | ||
src/node_generator.cc | ||
src/node_plugin.cc | ||
) | ||
|
||
if (MSVC) | ||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15) | ||
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>) | ||
else () | ||
foreach (flag_var | ||
CMAKE_CXX_FLAGS | ||
CMAKE_CXX_FLAGS_DEBUG | ||
CMAKE_CXX_FLAGS_RELEASE | ||
CMAKE_CXX_FLAGS_MINSIZEREL | ||
CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||
if (${flag_var} MATCHES "/MD") | ||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | ||
endif (${flag_var} MATCHES "/MD") | ||
endforeach (flag_var) | ||
endif () | ||
endif (MVC) | ||
|
||
target_include_directories(grpc_node_plugin | ||
IF(MSVC) | ||
IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.15) | ||
SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>) | ||
ELSE() | ||
FOREACH(flag_var | ||
CMAKE_CXX_FLAGS | ||
CMAKE_CXX_FLAGS_DEBUG | ||
CMAKE_CXX_FLAGS_RELEASE | ||
CMAKE_CXX_FLAGS_MINSIZEREL | ||
CMAKE_CXX_FLAGS_RELWITHDEBINFO | ||
) | ||
IF(${flag_var} MATCHES "/MD") | ||
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | ||
ENDIF(${flag_var} MATCHES "/MD") | ||
ENDFOREACH(flag_var) | ||
ENDIF() | ||
ENDIF(MSVC) | ||
|
||
TARGET_INCLUDE_DIRECTORIES(grpc_node_plugin | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
PRIVATE ${PROTOBUF_ROOT_DIR}/include | ||
) | ||
|
||
target_link_libraries(grpc_node_plugin | ||
TARGET_LINK_LIBRARIES(grpc_node_plugin | ||
libprotoc | ||
libprotobuf | ||
) |
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,28 @@ | ||
IF(UNIX AND NOT APPLE) | ||
SET(CMAKE_COMPILER_PREFIX "") | ||
|
||
IF(GRPC_TOOLS_TARGET STREQUAL "x86_64") | ||
SET(CMAKE_COMPILER_PREFIX "x86_64-linux-gnu-") | ||
|
||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64") | ||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64") | ||
ENDIF() | ||
|
||
IF(GRPC_TOOLS_TARGET STREQUAL "i686") | ||
SET(CMAKE_COMPILER_PREFIX "i686-linux-gnu-") | ||
|
||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") | ||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") | ||
ENDIF() | ||
|
||
IF(GRPC_TOOLS_TARGET STREQUAL "aarch64") | ||
SET(CMAKE_COMPILER_PREFIX "aarch64-linux-gnu-") | ||
ENDIF() | ||
|
||
SET(CMAKE_C_COMPILER "${CMAKE_COMPILER_PREFIX}gcc") | ||
SET(CMAKE_CXX_COMPILER "${CMAKE_COMPILER_PREFIX}g++") | ||
ELSE() | ||
MESSAGE(WARNING "OS is not linux, not setting variables.") | ||
ENDIF() |
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