Created
January 2, 2017 02:50
-
-
Save lighta/16a7ac6a40fd2130a3c6b1eb7c185cee to your computer and use it in GitHub Desktop.
grpc_crossCompile_v1.0.x
This file contains hidden or 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
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 8493559..93555fb 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -27,7 +27,7 @@ if (NOT GO_EXECUTABLE) | |
endif() | |
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |
- set(C_CXX_FLAGS "-Wall -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden") | |
+ set(C_CXX_FLAGS "-Wall -Wformat=2 -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden") | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS}") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ${C_CXX_FLAGS}") | |
elseif(MSVC) | |
@@ -75,9 +75,13 @@ elseif(MSVC) | |
${MSVC_DISABLED_WARNINGS_LIST}) | |
set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}") | |
set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}") | |
+endif() | |
+ | |
+if(WIN32) | |
add_definitions(-D_HAS_EXCEPTIONS=0) | |
add_definitions(-DWIN32_LEAN_AND_MEAN) | |
add_definitions(-DNOMINMAX) | |
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Allow use of fopen | |
endif() | |
if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.7.99") OR | |
@@ -165,8 +169,8 @@ add_custom_target(all_tests) | |
add_subdirectory(crypto) | |
add_subdirectory(ssl) | |
-add_subdirectory(ssl/test) | |
-add_subdirectory(tool) | |
+#add_subdirectory(ssl/test) | |
+#add_subdirectory(tool) | |
add_subdirectory(decrepit) | |
if(FUZZ) | |
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt | |
index 6651f29..d62a8e1 100644 | |
--- a/crypto/CMakeLists.txt | |
+++ b/crypto/CMakeLists.txt | |
@@ -23,14 +23,14 @@ elseif(UNIX) | |
set(ASM_EXT S) | |
enable_language(ASM) | |
else() | |
- if (CMAKE_CL_64) | |
+# if (CMAKE_CL_64) | |
message("Using nasm") | |
set(PERLASM_STYLE nasm) | |
- else() | |
- message("Using win32n") | |
- set(PERLASM_STYLE win32n) | |
- set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") | |
- endif() | |
+# else() | |
+# message("Using win32n") | |
+# set(PERLASM_STYLE win32n) | |
+# set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") | |
+# endif() | |
# On Windows, we use the NASM output, specifically built with Yasm. | |
set(ASM_EXT asm) | |
@@ -203,6 +203,13 @@ if(NOT MSVC AND NOT ANDROID) | |
target_link_libraries(crypto pthread) | |
endif() | |
+if(WIN32) | |
+message("Adding extra link target for crypto") | |
+target_link_libraries(crypto | |
+ ws2_32 | |
+) | |
+endif() | |
+ | |
add_executable( | |
constant_time_test | |
diff --git a/crypto/bio/CMakeLists.txt b/crypto/bio/CMakeLists.txt | |
index 7859b58..5597e6f 100644 | |
--- a/crypto/bio/CMakeLists.txt | |
+++ b/crypto/bio/CMakeLists.txt | |
@@ -18,16 +18,16 @@ add_library( | |
socket_helper.c | |
) | |
-add_executable( | |
- bio_test | |
+#add_executable( | |
+# bio_test | |
+# | |
+# bio_test.cc | |
+# | |
+# $<TARGET_OBJECTS:test_support> | |
+#) | |
- bio_test.cc | |
- | |
- $<TARGET_OBJECTS:test_support> | |
-) | |
- | |
-target_link_libraries(bio_test crypto) | |
-if (WIN32) | |
- target_link_libraries(bio_test ws2_32) | |
-endif() | |
-add_dependencies(all_tests bio_test) | |
+#target_link_libraries(bio_test crypto) | |
+#if (WIN32) | |
+# target_link_libraries(bio_test ws2_32) | |
+#endif() | |
+#add_dependencies(all_tests bio_test) |
This file contains hidden or 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
#!/bin/bash | |
#small script to fetch and compile grpc, (MM) | |
#goto script path | |
CALLPATH=$(pwd) | |
SCRIPT_PATH=$( dirname "$0" ) | |
cd $( dirname "$0" ) | |
echo "pwd=$(pwd)" | |
sudo dnf install -y go yasm nasm libtool autoconf cmake | |
#cross compile tool | |
if [ ! -d ../grpc ]; then | |
git clone -b v1.0.x --depth=1 https://github.com/grpc/grpc.git ../grpc | |
fi | |
cd ../grpc | |
git submodule update --init | |
#apply patch | |
git apply ../grpc_diff/grpc.diff | |
git apply ../grpc_diff/boringssl.diff | |
git apply ../grpc_diff/zlib.diff | |
#read -p "Appuyer sur une touche pour continuer ..." | |
#create cmake build dir then build | |
mkdir cbuild | |
cd cbuild | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=../Toolchain-Windows.cmake .. | |
make |
This file contains hidden or 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
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index e47fa55..aad4746 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -69,8 +69,9 @@ add_subdirectory(${BORINGSSL_ROOT_DIR} third_party/boringssl) | |
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf) | |
add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib) | |
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") | |
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
+set(CMAKE_CPPFLAGS "${CMAKE_CPPFLAGS} -D_WIN32_WINNT=0x602") | |
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CPPFLAGS} -std=c11") | |
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CPPFLAGS} -std=c++11") | |
add_library(gpr | |
@@ -130,7 +131,13 @@ target_include_directories(gpr | |
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib | |
) | |
- | |
+if(WIN32) | |
+message("Adding extra link target for gpr") | |
+target_link_libraries(gpr | |
+ ws2_32 | |
+ zlib | |
+) | |
+endif() | |
add_library(grpc | |
src/core/lib/surface/init.c |
This file contains hidden or 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
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 0c0247c..71cc92d 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -229,7 +229,7 @@ endif() | |
#============================================================================ | |
# Example binaries | |
#============================================================================ | |
- | |
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}) #because test is not in same dir | |
add_executable(example test/example.c) | |
target_link_libraries(example zlib) | |
add_test(example example) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment