diff --git a/CMakeLists.txt b/CMakeLists.txt index ec4a89d75..4959a8025 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,13 @@ option(BUILD_VIDEO2X_CLI "Build the video2x executable" ON) option(USE_SYSTEM_SPDLOG "Use system spdlog library" ON) option(USE_SYSTEM_NCNN "Use system ncnn library" ON) +# Generate the version header file +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/include/libvideo2x/version.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/libvideo2x/version.h" + @ONLY +) + # Find the required packages set(ALL_INCLUDE_DIRS) set(ALL_LIBRARIES) @@ -234,7 +241,9 @@ add_dependencies(libvideo2x realesrgan) # Include directories for the shared library target_include_directories(libvideo2x PRIVATE ${ALL_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/include/libvideo2x ${PROJECT_SOURCE_DIR}/third_party/libreal_esrgan_ncnn_vulkan/src ) @@ -272,6 +281,7 @@ if (BUILD_VIDEO2X_CLI) # Include directories for the executable target_include_directories(video2x PRIVATE ${ALL_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/include ) diff --git a/include/conversions.h b/include/libvideo2x/conversions.h similarity index 100% rename from include/conversions.h rename to include/libvideo2x/conversions.h diff --git a/include/decoder.h b/include/libvideo2x/decoder.h similarity index 100% rename from include/decoder.h rename to include/libvideo2x/decoder.h diff --git a/include/encoder.h b/include/libvideo2x/encoder.h similarity index 100% rename from include/encoder.h rename to include/libvideo2x/encoder.h diff --git a/include/filter.h b/include/libvideo2x/filter.h similarity index 100% rename from include/filter.h rename to include/libvideo2x/filter.h diff --git a/include/fsutils.h b/include/libvideo2x/fsutils.h similarity index 100% rename from include/fsutils.h rename to include/libvideo2x/fsutils.h diff --git a/include/libplacebo.h b/include/libvideo2x/libplacebo.h similarity index 100% rename from include/libplacebo.h rename to include/libvideo2x/libplacebo.h diff --git a/include/libplacebo_filter.h b/include/libvideo2x/libplacebo_filter.h similarity index 100% rename from include/libplacebo_filter.h rename to include/libvideo2x/libplacebo_filter.h diff --git a/include/libvideo2x.h b/include/libvideo2x/libvideo2x.h similarity index 100% rename from include/libvideo2x.h rename to include/libvideo2x/libvideo2x.h diff --git a/include/realesrgan_filter.h b/include/libvideo2x/realesrgan_filter.h similarity index 100% rename from include/realesrgan_filter.h rename to include/libvideo2x/realesrgan_filter.h diff --git a/include/libvideo2x/version.h.in b/include/libvideo2x/version.h.in new file mode 100644 index 000000000..5cd7f54e1 --- /dev/null +++ b/include/libvideo2x/version.h.in @@ -0,0 +1,6 @@ +#ifndef VERSION_H +#define VERSION_H + +#define LIBVIDEO2X_VERSION_STRING "@PROJECT_VERSION@" + +#endif // VERSION_H diff --git a/src/video2x.c b/src/video2x.c index 86a967cfe..9d7baa472 100644 --- a/src/video2x.c +++ b/src/video2x.c @@ -17,12 +17,11 @@ #include #include -#include +#include +#include #include "getopt.h" -const char *VIDEO2X_VERSION = "6.0.0"; - // Set UNIX terminal input to non-blocking mode #ifndef _WIN32 void set_nonblocking_input(bool enable) { @@ -279,7 +278,7 @@ void parse_arguments(int argc, char **argv, struct arguments *arguments) { } break; case 'v': - printf("Video2X v%s\n", VIDEO2X_VERSION); + printf("Video2X version %s\n", LIBVIDEO2X_VERSION_STRING); exit(0); case 0: // Long-only options without short equivalents if (strcmp(long_options[option_index].name, "loglevel") == 0) {