diff --git a/src/spicy/spicyz/CMakeLists.txt b/src/spicy/spicyz/CMakeLists.txt index e8a0b0f9f8..bbf3db9f1d 100644 --- a/src/spicy/spicyz/CMakeLists.txt +++ b/src/spicy/spicyz/CMakeLists.txt @@ -3,7 +3,7 @@ configure_file(config.h.in config.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/zeek/spicy/spicyz) -add_executable(spicyz driver.cc glue-compiler.cc main.cc) +add_executable(spicyz driver.cc glue-compiler.cc main.cc zeek-version.cc) target_compile_options(spicyz PRIVATE "-Wall") target_compile_features(spicyz PRIVATE "${ZEEK_CXX_STD}") set_target_properties(spicyz PROPERTIES CXX_EXTENSIONS OFF) diff --git a/src/spicy/spicyz/config.h.in b/src/spicy/spicyz/config.h.in index f1203734c4..6737049809 100644 --- a/src/spicy/spicyz/config.h.in +++ b/src/spicy/spicyz/config.h.in @@ -58,10 +58,7 @@ inline const auto CxxZeekIncludesDirectories() { // Version of Spicy that we are compiling against. #cmakedefine SPICY_VERSION_NUMBER ${SPICY_VERSION_NUMBER} -#cmakedefine ZEEK_VERSION_NUMBER ${ZEEK_VERSION_NUMBER} -inline const auto SpicyVersion = "${SPICY_VERSION_LONG}"; -inline const auto ZeekVersion = "${ZEEK_VERSION_FULL}"; inline const auto InstallPrefix = path("${CMAKE_INSTALL_PREFIX}"); } // namespace zeek::spicy::configuration diff --git a/src/spicy/spicyz/main.cc b/src/spicy/spicyz/main.cc index 015e37e2a3..38175f4431 100644 --- a/src/spicy/spicyz/main.cc +++ b/src/spicy/spicyz/main.cc @@ -8,6 +8,7 @@ #include "config.h" #include "driver.h" #include "glue-compiler.h" +#include "zeek-version.h" using namespace zeek::spicy; @@ -194,9 +195,9 @@ static hilti::Result parseOptions(int argc, char** argv, hilti::driver: compiler_options->keep_tmps = true; break; - case 'v': std::cout << configuration::ZeekVersion << std::endl; return Nothing(); + case 'v': std::cout << configuration::ZeekVersionString() << std::endl; return Nothing(); - case 'V': std::cout << ZEEK_VERSION_NUMBER << std::endl; return Nothing(); + case 'V': std::cout << configuration::ZeekVersionNumber() << std::endl; return Nothing(); case 'z': { if ( auto zcfg = getenv("ZEEK_CONFIG"); zcfg && *zcfg ) @@ -245,7 +246,8 @@ static hilti::Result parseOptions(int argc, char** argv, hilti::driver: } int main(int argc, char** argv) { - Driver driver(std::make_unique(), "", configuration::LibraryPath(), ZEEK_VERSION_NUMBER); + Driver driver(std::make_unique(), "", configuration::LibraryPath(), + configuration::ZeekVersionNumber()); hilti::driver::Options driver_options; driver_options.execute_code = true; diff --git a/src/spicy/spicyz/zeek-version.cc b/src/spicy/spicyz/zeek-version.cc new file mode 100644 index 0000000000..08ced4fdd5 --- /dev/null +++ b/src/spicy/spicyz/zeek-version.cc @@ -0,0 +1,11 @@ +// See the file "COPYING" in the main distribution directory for copyright. + +#include "zeek-version.h" + +#include "zeek/zeek-version.h" + +using namespace zeek::spicy; + +int configuration::ZeekVersionNumber() { return ZEEK_VERSION_NUMBER; } + +const char* configuration::ZeekVersionString() { return VERSION; } diff --git a/src/spicy/spicyz/zeek-version.h b/src/spicy/spicyz/zeek-version.h new file mode 100644 index 0000000000..2614eed6f3 --- /dev/null +++ b/src/spicy/spicyz/zeek-version.h @@ -0,0 +1,10 @@ +// See the file "COPYING" in the main distribution directory for copyright. + +#pragma once + +namespace zeek::spicy::configuration { + +int ZeekVersionNumber(); +const char* ZeekVersionString(); + +} // namespace zeek::spicy::configuration