From f0a9f6d6f3a580588cf96569c2619998de3bb58b Mon Sep 17 00:00:00 2001 From: JaySon-Huang Date: Sun, 22 Mar 2020 06:18:19 +0800 Subject: [PATCH 1/2] Detect OS type and exit if not built in Linux Signed-off-by: JaySon-Huang --- CMakeLists.txt | 7 +++++++ cmake/LinkerConfig.cmake | 2 +- third-party/install-third-party.sh | 10 +++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d59b7c139ff..8340c4c836f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,13 @@ project("Nebula Graph" C CXX) # Set the project home dir set(NEBULA_HOME ${CMAKE_CURRENT_SOURCE_DIR}) + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + MESSAGE(FATAL_ERROR "Only Linux is supported") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + MESSAGE(FATAL_ERROR "Only Linux is supported") +endif () + # To include customized FindXXX.cmake modules set(CMAKE_MODULE_PATH "${NEBULA_HOME}/cmake" ${CMAKE_MODULE_PATH}) include(LinkerConfig) diff --git a/cmake/LinkerConfig.cmake b/cmake/LinkerConfig.cmake index 5b24ce49644..f0a51d0bbd5 100644 --- a/cmake/LinkerConfig.cmake +++ b/cmake/LinkerConfig.cmake @@ -9,7 +9,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) -if (${default_linker_type} STREQUAL "ld") +if ("${default_linker_type}" STREQUAL "ld") set(default_linker_type "bfd") endif() diff --git a/third-party/install-third-party.sh b/third-party/install-third-party.sh index 3110f40a8d3..5fc398f7d5b 100755 --- a/third-party/install-third-party.sh +++ b/third-party/install-third-party.sh @@ -7,6 +7,11 @@ # Usage: install-third-party.sh --prefix=/opt/vesoft/third-party +[[ $(uname) = Linux ]] || { + echo "Only Linux is supported" + exit 1 +} + # Always use bash shell=$(basename $(readlink /proc/$$/exe)) if [ ! x$shell = x"bash" ] @@ -15,11 +20,6 @@ then exit $? fi -[[ $(uname) = Linux ]] || { - echo "Only Linux is supported" - exit 1 -} - url_base=https://nebula-graph.oss-accelerate.aliyuncs.com/third-party this_dir=$(dirname $(readlink -f $0)) cxx_cmd=${CXX:-g++} From 02a33295c047b6de9164dc3d849f75cea58a25dc Mon Sep 17 00:00:00 2001 From: JaySon-Huang Date: Sun, 22 Mar 2020 08:36:07 +0800 Subject: [PATCH 2/2] Disable for FreeBSD Signed-off-by: JaySon-Huang --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8340c4c836f..596fb6edd9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,9 +31,7 @@ project("Nebula Graph" C CXX) # Set the project home dir set(NEBULA_HOME ${CMAKE_CURRENT_SOURCE_DIR}) -if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - MESSAGE(FATAL_ERROR "Only Linux is supported") -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +if(${CMAKE_SYSTEM_NAME} MATCHES "(Darwin|FreeBSD|Windows)") MESSAGE(FATAL_ERROR "Only Linux is supported") endif ()