mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
binpac: Remove submodule, adapt CMake configuration for Zeek build
This commit is contained in:
parent
79733d9390
commit
0377486637
7 changed files with 34 additions and 166 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,9 +1,6 @@
|
||||||
[submodule "auxil/zeek-aux"]
|
[submodule "auxil/zeek-aux"]
|
||||||
path = auxil/zeek-aux
|
path = auxil/zeek-aux
|
||||||
url = https://github.com/zeek/zeek-aux
|
url = https://github.com/zeek/zeek-aux
|
||||||
[submodule "auxil/binpac"]
|
|
||||||
path = auxil/binpac
|
|
||||||
url = https://github.com/zeek/binpac
|
|
||||||
[submodule "auxil/zeekctl"]
|
[submodule "auxil/zeekctl"]
|
||||||
path = auxil/zeekctl
|
path = auxil/zeekctl
|
||||||
url = https://github.com/zeek/zeekctl
|
url = https://github.com/zeek/zeekctl
|
||||||
|
|
|
@ -396,14 +396,14 @@ endfunction ()
|
||||||
|
|
||||||
add_zeek_dynamic_plugin_build_interface_include_directories(
|
add_zeek_dynamic_plugin_build_interface_include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/src/include
|
${PROJECT_SOURCE_DIR}/src/include
|
||||||
${PROJECT_SOURCE_DIR}/auxil/binpac/lib
|
${PROJECT_SOURCE_DIR}/tools/binpac/lib
|
||||||
${PROJECT_SOURCE_DIR}/auxil/broker/libbroker
|
${PROJECT_SOURCE_DIR}/auxil/broker/libbroker
|
||||||
${PROJECT_SOURCE_DIR}/auxil/paraglob/include
|
${PROJECT_SOURCE_DIR}/auxil/paraglob/include
|
||||||
${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include
|
${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include
|
||||||
${PROJECT_SOURCE_DIR}/auxil/expected-lite/include
|
${PROJECT_SOURCE_DIR}/auxil/expected-lite/include
|
||||||
${CMAKE_BINARY_DIR}/src
|
${CMAKE_BINARY_DIR}/src
|
||||||
${CMAKE_BINARY_DIR}/src/include
|
${CMAKE_BINARY_DIR}/src/include
|
||||||
${CMAKE_BINARY_DIR}/auxil/binpac/lib
|
${CMAKE_BINARY_DIR}/tools/binpac/lib
|
||||||
${CMAKE_BINARY_DIR}/auxil/broker/libbroker
|
${CMAKE_BINARY_DIR}/auxil/broker/libbroker
|
||||||
${CMAKE_BINARY_DIR}/auxil/prometheus-cpp/core/include)
|
${CMAKE_BINARY_DIR}/auxil/prometheus-cpp/core/include)
|
||||||
|
|
||||||
|
@ -892,12 +892,12 @@ if (BUILD_STATIC_BINPAC)
|
||||||
set(ENABLE_STATIC_ONLY true)
|
set(ENABLE_STATIC_ONLY true)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_subdirectory(auxil/binpac)
|
add_subdirectory(tools/binpac)
|
||||||
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
|
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
|
||||||
|
|
||||||
# FIXME: avoid hard-coding a path for multi-config generator support. See the
|
# FIXME: avoid hard-coding a path for multi-config generator support. See the
|
||||||
# TODO in ZeekPluginConfig.cmake.in.
|
# TODO in ZeekPluginConfig.cmake.in.
|
||||||
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
|
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/tools/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set(_binpac_exe_path "included")
|
set(_binpac_exe_path "included")
|
||||||
|
|
||||||
# Need to call find_package so it sets up the include paths used by plugin builds.
|
# Need to call find_package so it sets up the include paths used by plugin builds.
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 48f75b5f6415fe9d597e3e991cec635b1bc400dc
|
|
|
@ -1,86 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
|
|
||||||
project(BinPAC C CXX)
|
|
||||||
include(cmake/CommonCMakeConfig.cmake)
|
|
||||||
include(cmake/RequireCXXStd.cmake)
|
|
||||||
|
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" BINPAC_VERSION LIMIT_COUNT 1)
|
|
||||||
string(REPLACE "." " " _version_numbers ${BINPAC_VERSION})
|
|
||||||
separate_arguments(_version_numbers)
|
|
||||||
list(GET _version_numbers 0 BINPAC_VERSION_MAJOR)
|
|
||||||
list(GET _version_numbers 1 BINPAC_VERSION_MINOR)
|
|
||||||
string(REGEX REPLACE "-[0-9]*$" "" BINPAC_VERSION_MINOR ${BINPAC_VERSION_MINOR})
|
|
||||||
|
|
||||||
# The SO number shall increase only if binary interface changes.
|
|
||||||
set(BINPAC_SOVERSION 0)
|
|
||||||
|
|
||||||
set(ENABLE_SHARED true)
|
|
||||||
|
|
||||||
if (ENABLE_STATIC_ONLY)
|
|
||||||
set(ENABLE_STATIC true)
|
|
||||||
set(ENABLE_SHARED false)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Set default install paths
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# ##############################################################################
|
|
||||||
# Dependency Configuration
|
|
||||||
|
|
||||||
find_package(FLEX REQUIRED)
|
|
||||||
find_package(BISON REQUIRED)
|
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
add_compile_options(/J) # Similar to -funsigned-char on other platforms
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# ##############################################################################
|
|
||||||
# System Introspection
|
|
||||||
|
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
|
||||||
|
|
||||||
include_directories(BEFORE ${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
# Recurse on sub-directories
|
# Recurse on sub-directories
|
||||||
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
# ##############################################################################
|
|
||||||
# Build Summary
|
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE)
|
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
macro (display test desc summary)
|
|
||||||
if (${test})
|
|
||||||
set(${summary} ${desc})
|
|
||||||
else ()
|
|
||||||
set(${summary} no)
|
|
||||||
endif ()
|
|
||||||
endmacro ()
|
|
||||||
|
|
||||||
display(ENABLE_SHARED yes shared_summary)
|
|
||||||
display(ENABLE_STATIC yes static_summary)
|
|
||||||
|
|
||||||
message(
|
|
||||||
"\n==================| BinPAC Build Summary |===================="
|
|
||||||
"\nVersion: ${BINPAC_VERSION}"
|
|
||||||
"\nSO version: ${BINPAC_SOVERSION}"
|
|
||||||
"\n"
|
|
||||||
"\nBuild Type: ${CMAKE_BUILD_TYPE}"
|
|
||||||
"\nDebug mode: ${ENABLE_DEBUG}"
|
|
||||||
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}"
|
|
||||||
"\nShared libs: ${shared_summary}"
|
|
||||||
"\nStatic libs: ${static_summary}"
|
|
||||||
"\n"
|
|
||||||
"\nCC: ${CMAKE_C_COMPILER}"
|
|
||||||
"\nCFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}"
|
|
||||||
"\nCXX: ${CMAKE_CXX_COMPILER}"
|
|
||||||
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}"
|
|
||||||
"\nCPP: ${CMAKE_CXX_COMPILER}"
|
|
||||||
"\n"
|
|
||||||
"\n================================================================\n")
|
|
||||||
|
|
||||||
include(UserChangedWarning)
|
|
||||||
|
|
|
@ -10,23 +10,27 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set(binpac_headers ${CMAKE_CURRENT_BINARY_DIR}/binpac.h binpac_analyzer.h binpac_buffer.h
|
set(binpac_headers ${CMAKE_CURRENT_BINARY_DIR}/binpac.h binpac_analyzer.h binpac_buffer.h
|
||||||
binpac_bytestring.h binpac_exception.h binpac_regex.h)
|
binpac_bytestring.h binpac_exception.h binpac_regex.h)
|
||||||
|
|
||||||
set(binpac_lib_SRCS binpac_buffer.cc binpac_bytestring.cc binpac_regex.cc ${binpac_headers})
|
set(binpac_lib_SRCS binpac_buffer.cc binpac_bytestring.cc binpac_regex.cc)
|
||||||
|
|
||||||
if (ENABLE_SHARED)
|
if (BUILD_STATIC_BINPAC)
|
||||||
add_library(binpac_lib SHARED ${binpac_lib_SRCS})
|
add_library(binpac_static STATIC)
|
||||||
set_target_properties(
|
target_sources(binpac_static PRIVATE ${binpac_lib_SRCS})
|
||||||
binpac_lib
|
|
||||||
PROPERTIES SOVERSION ${BINPAC_SOVERSION}
|
|
||||||
VERSION ${BINPAC_VERSION_MAJOR}.${BINPAC_VERSION_MINOR}
|
|
||||||
MACOSX_RPATH true
|
|
||||||
OUTPUT_NAME binpac)
|
|
||||||
install(TARGETS binpac_lib DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (ENABLE_STATIC)
|
|
||||||
add_library(binpac_static STATIC ${binpac_lib_SRCS})
|
|
||||||
set_target_properties(binpac_static PROPERTIES OUTPUT_NAME binpac)
|
set_target_properties(binpac_static PROPERTIES OUTPUT_NAME binpac)
|
||||||
install(TARGETS binpac_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS binpac_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(binpac_static PRIVATE "/J")
|
||||||
|
endif ()
|
||||||
|
set(BinPAC_LIBRARY binpac_static CACHE STRING "BinPAC library" FORCE)
|
||||||
|
else ()
|
||||||
|
add_library(binpac_lib SHARED)
|
||||||
|
target_sources(binpac_lib PRIVATE ${binpac_lib_SRCS})
|
||||||
|
target_sources(binpac_lib INTERFACE ${binpac_headers})
|
||||||
|
set_target_properties(binpac_lib PROPERTIES MACOSX_RPATH true OUTPUT_NAME binpac)
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(binpac_lib PRIVATE "/J")
|
||||||
|
endif ()
|
||||||
|
install(TARGETS binpac_lib DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
set(BinPAC_LIBRARY binpac_lib CACHE STRING "BinPAC library" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ZEEK_ROOT_DIR)
|
if (ZEEK_ROOT_DIR)
|
||||||
|
@ -36,13 +40,5 @@ else ()
|
||||||
install(FILES ${binpac_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES ${binpac_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# This is set to assist superprojects that want to build BinPac from source and
|
|
||||||
# rely on it as a target
|
|
||||||
if (ENABLE_SHARED)
|
|
||||||
set(BinPAC_LIBRARY binpac_lib CACHE STRING "BinPAC library" FORCE)
|
|
||||||
else ()
|
|
||||||
set(BinPAC_LIBRARY binpac_static CACHE STRING "BinPAC library" FORCE)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(BinPAC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
set(BinPAC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
CACHE STRING "BinPAC header directories" FORCE)
|
CACHE STRING "BinPAC header directories" FORCE)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
bison_target(PACParser pac_parse.yy ${BinPAC_BINARY_DIR}/src/pac_parse.cc
|
find_package(FLEX REQUIRED)
|
||||||
DEFINES_FILE ${BinPAC_BINARY_DIR}/src/pac_parse.h COMPILE_FLAGS "--debug")
|
find_package(BISON REQUIRED)
|
||||||
flex_target(PACScanner pac_scan.ll ${BinPAC_BINARY_DIR}/pac_scan.cc)
|
|
||||||
|
bison_target(PACParser pac_parse.yy ${CMAKE_CURRENT_BINARY_DIR}/pac_parse.cc
|
||||||
|
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/pac_parse.h COMPILE_FLAGS "--debug")
|
||||||
|
flex_target(PACScanner pac_scan.ll ${CMAKE_CURRENT_BINARY_DIR}/pac_scan.cc)
|
||||||
add_flex_bison_dependency(PACScanner PACParser)
|
add_flex_bison_dependency(PACScanner PACParser)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "/wd4018")
|
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "/wd4018")
|
||||||
|
@ -8,8 +11,6 @@ else ()
|
||||||
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-sign-compare")
|
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-sign-compare")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
|
|
||||||
|
|
||||||
set(binpac_SRCS
|
set(binpac_SRCS
|
||||||
${BISON_PACParser_INPUT}
|
${BISON_PACParser_INPUT}
|
||||||
${FLEX_PACScanner_INPUT}
|
${FLEX_PACScanner_INPUT}
|
||||||
|
@ -52,62 +53,19 @@ set(binpac_SRCS
|
||||||
pac_output.cc
|
pac_output.cc
|
||||||
pac_utils.cc
|
pac_utils.cc
|
||||||
pac_exception.cc
|
pac_exception.cc
|
||||||
pac_main.cc
|
pac_main.cc)
|
||||||
pac_action.h
|
|
||||||
pac_analyzer.h
|
|
||||||
pac_array.h
|
|
||||||
pac_attr.h
|
|
||||||
pac_btype.h
|
|
||||||
pac_case.h
|
|
||||||
pac_cclass.h
|
|
||||||
pac_common.h
|
|
||||||
pac_conn.h
|
|
||||||
pac_context.h
|
|
||||||
pac_cstr.h
|
|
||||||
pac_ctype.h
|
|
||||||
pac_datadep.h
|
|
||||||
pac_dataptr.h
|
|
||||||
pac_dataunit.h
|
|
||||||
pac_dbg.h
|
|
||||||
pac_decl-inl.h
|
|
||||||
pac_decl.h
|
|
||||||
pac_embedded.h
|
|
||||||
pac_enum.h
|
|
||||||
pac_exception.h
|
|
||||||
pac_expr.h
|
|
||||||
pac_exttype.h
|
|
||||||
pac_field.h
|
|
||||||
pac_flow.h
|
|
||||||
pac_func.h
|
|
||||||
pac_id.h
|
|
||||||
pac_inputbuf.h
|
|
||||||
pac_let.h
|
|
||||||
pac_nullptr.h
|
|
||||||
pac_number.h
|
|
||||||
pac_output.h
|
|
||||||
pac_param.h
|
|
||||||
pac_paramtype.h
|
|
||||||
pac_primitive.h
|
|
||||||
pac_record.h
|
|
||||||
pac_redef.h
|
|
||||||
pac_regex.h
|
|
||||||
pac_state.h
|
|
||||||
pac_strtype.h
|
|
||||||
pac_type.h
|
|
||||||
pac_typedecl.h
|
|
||||||
pac_utils.h
|
|
||||||
pac_varfield.h
|
|
||||||
pac_withinput.h)
|
|
||||||
|
|
||||||
include(${PROJECT_SOURCE_DIR}/cmake/RequireCXXStd.cmake)
|
|
||||||
|
|
||||||
add_executable(binpac ${binpac_SRCS})
|
add_executable(binpac ${binpac_SRCS})
|
||||||
|
|
||||||
|
target_include_directories(binpac BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_include_directories(binpac BEFORE PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
target_compile_options(binpac PUBLIC "/J")
|
||||||
# If building separately from zeek, we need to add the libunistd subdirectory
|
# If building separately from zeek, we need to add the libunistd subdirectory
|
||||||
# so that linking doesn't fail.
|
# so that linking doesn't fail.
|
||||||
if ("${CMAKE_PROJECT_NAME}" STREQUAL "BinPAC")
|
if ("${CMAKE_PROJECT_NAME}" STREQUAL "BinPAC")
|
||||||
add_subdirectory(auxil/libunistd EXCLUDE_FROM_ALL)
|
add_subdirectory(${PROJECT_SOURCE_DIR}auxil/libunistd EXCLUDE_FROM_ALL)
|
||||||
endif ()
|
endif ()
|
||||||
target_link_libraries(binpac PRIVATE libunistd)
|
target_link_libraries(binpac PRIVATE libunistd)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "pac_common.h"
|
#include "pac_common.h"
|
||||||
#include "pac_decl.h"
|
#include "pac_decl.h"
|
||||||
#include "pac_exception.h"
|
#include "pac_exception.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue