From 4947ec1f93fec399c4b8a937ab773480ad9dfab0 Mon Sep 17 00:00:00 2001 From: "xiaolei.zl" Date: Mon, 18 Sep 2023 13:09:32 +0800 Subject: [PATCH] cmakelists --- flex/CMakeLists.txt | 101 +++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/flex/CMakeLists.txt b/flex/CMakeLists.txt index d2d6aeb35c18..abe74ef335b3 100644 --- a/flex/CMakeLists.txt +++ b/flex/CMakeLists.txt @@ -1,14 +1,14 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required (VERSION 3.5) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION FLEX_VERSION) - # Strip trailing newline string(REGEX REPLACE "\n$" "" FLEX_VERSION "${FLEX_VERSION}") -project( - Flex - VERSION ${FLEX_VERSION} - LANGUAGES CXX) +project ( + Flex + VERSION ${FLEX_VERSION} + LANGUAGES CXX) + option(BUILD_HQPS "Whether to build HighQPS Engine" ON) option(BUILD_TEST "Whether to build test" ON) @@ -21,13 +21,14 @@ set(DEFAULT_BUILD_TYPE "Release") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -mno-avx512f -fPIC") set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0") + add_compile_definitions(FLEX_VERSION="${FLEX_VERSION}") -if(APPLE) +if (APPLE) set(CMAKE_MACOSX_RPATH ON) -else() +else () set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Werror -Wl,-rpath,$ORIGIN") -endif() +endif () find_package(MPI REQUIRED) include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH}) @@ -42,59 +43,52 @@ find_package(Threads REQUIRED) # find glog--------------------------------------------------------------------- include("cmake/FindGlog.cmake") - -if(NOT GLOG_FOUND) +if (NOT GLOG_FOUND) message(FATAL_ERROR "glog not found, please install the glog library") -else() +else () include_directories(SYSTEM ${GLOG_INCLUDE_DIRS}) -endif() +endif () # find gflags------------------------------------------------------------------- include("cmake/FindGFlags.cmake") - -if(NOT GFLAGS_FOUND) +if (NOT GFLAGS_FOUND) message(STATUS "gflags not found, build without gflags") -else() +else () include_directories(SYSTEM ${GFLAGS_INCLUDE_DIRS}) -endif() +endif () -# find boost---------------------------------------------------------------------- +#find boost---------------------------------------------------------------------- find_package(Boost REQUIRED COMPONENTS system filesystem + # required by folly + context program_options regex thread) - # required by folly - context program_options regex thread) - -# find arrow---------------------------------------------------------------------- +#find arrow---------------------------------------------------------------------- include("cmake/FindArrow.cmake") - -if(NOT ARROW_FOUND) +if (NOT ARROW_FOUND) message(FATAL_ERROR "arrow not found, please install the arrow library") -else() +else () include_directories(SYSTEM ${ARROW_INCLUDE_DIRS}) - - if(TARGET arrow_shared) + if (TARGET arrow_shared) set(ARROW_SHARED_LIB arrow_shared) endif() - - if(TARGET arrow_static) + if (TARGET arrow_static) set(ARROW_STATIC_LIB arrow_static) endif() -endif() +endif () # Find Doxygen -if(BUILD_DOC) +if (BUILD_DOC) find_package(Doxygen) - # Add a target to generate the documentation if(DOXYGEN_FOUND) set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in) set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) add_custom_target(doc ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY .. - COMMENT "Generating API documentation with Doxygen" - VERBATIM) + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} + WORKING_DIRECTORY .. + COMMENT "Generating API documentation with Doxygen" + VERBATIM) endif(DOXYGEN_FOUND) endif() @@ -103,33 +97,31 @@ add_subdirectory(codegen) add_subdirectory(storages) add_subdirectory(engines) add_subdirectory(bin) - -if(BUILD_TEST) - add_subdirectory(tests) +if (BUILD_TEST) + add_subdirectory(tests) endif() + file(GLOB_RECURSE FILES_NEED_LINT - "engines/*.cc" - "engines/*.h" - "bin/*.cc" - "storages/*.h" - "storages/*.cc" - "test/*.h" - "test/*.cc" - "third_pary/*.h" - "third_pary/*.cc" EXCEPT "*.act.h" "*.actg.h" "*.autogen.h" "*.autogen.cc") + "engines/*.cc" + "engines/*.h" + "bin/*.cc" + "storages/*.h" + "storages/*.cc" + "test/*.h" + "test/*.cc" + "third_pary/*.h" + "third_pary/*.cc" EXCEPT "*.act.h" "*.actg.h" "*.autogen.h" "*.autogen.cc") list(FILTER FILES_NEED_LINT EXCLUDE REGEX ".*\.act.h$|.*\.actg.h$|.*\.autogen.h$|.*\.autogen.cc$") - # gsa_clformat add_custom_target(flex_clformat COMMAND clang-format --style=file -i ${FILES_NEED_LINT} COMMENT "Running clang-format, using clang-format-8 from https://github.com/muttleyxd/clang-tools-static-binaries/releases" VERBATIM) -if(NOT DEFINED CPACK_PACKAGE_NAME) - set(CPACK_PACKAGE_NAME "graphscope_flex") -endif() - +if (NOT DEFINED CPACK_PACKAGE_NAME) + set(CPACK_PACKAGE_NAME "graphscope_flex") +endif () set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Flex module of GraphScope") set(CPACK_PACKAGE_VENDOR "GraphScope") set(CPACK_PACKAGE_VERSION ${FLEX_VERSION}) @@ -141,7 +133,8 @@ set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) set(CPACK_DEB_COMPONENT_INSTALL YES) -# install CMakeLists.txt.template to resources/ + +#install CMakeLists.txt.template to resources/ install(FILES resources/hqps/CMakeLists.txt.template DESTINATION lib/flex/) include(CPack)