sync cmake version with hardcoded version

This commit is contained in:
Stefano Sinigardi 2019-04-10 14:02:19 +02:00
parent e647a59f48
commit 1cbdd293f3
4 changed files with 19 additions and 7 deletions

View File

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.8)
set(Darknet_MAJOR_VERSION 1)
set(Darknet_MINOR_VERSION 0)
set(Darknet_PATCH_VERSION 0)
set(Darknet_MAJOR_VERSION 0)
set(Darknet_MINOR_VERSION 2)
set(Darknet_PATCH_VERSION 5)
set(Darknet_VERSION ${Darknet_MAJOR_VERSION}.${Darknet_MINOR_VERSION}.${Darknet_PATCH_VERSION})
set(CMAKE_VERBOSE_MAKEFILE "FALSE" CACHE BOOL "Create verbose makefile")
@ -41,6 +41,11 @@ foreach(p LIB BIN INCLUDE CMAKE)
endif()
endforeach()
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/src/version.h.in"
"${CMAKE_CURRENT_LIST_DIR}/src/version.h"
)
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA build")
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA build" FORCE)

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include "activation_layer.h"
#include "activations.h"
@ -32,8 +33,8 @@
#include "softmax_layer.h"
#include "utils.h"
#include "upsample_layer.h"
#include "version.h"
#include "yolo_layer.h"
#include <stdint.h>
typedef struct{
char *type;
@ -1038,9 +1039,9 @@ void save_weights_upto(network net, char *filename, int cutoff)
FILE *fp = fopen(filename, "wb");
if(!fp) file_error(filename);
int major = 0;
int minor = 2;
int revision = 5;
int major = MAJOR_VERSION;
int minor = MINOR_VERSION;
int revision = PATCH_VERSION;
fwrite(&major, sizeof(int), 1, fp);
fwrite(&minor, sizeof(int), 1, fp);
fwrite(&revision, sizeof(int), 1, fp);

3
src/version.h Normal file
View File

@ -0,0 +1,3 @@
#define MAJOR_VERSION 0
#define MINOR_VERSION 2
#define PATCH_VERSION 5

3
src/version.h.in Normal file
View File

@ -0,0 +1,3 @@
#define MAJOR_VERSION @Darknet_MAJOR_VERSION@
#define MINOR_VERSION @Darknet_MINOR_VERSION@
#define PATCH_VERSION @Darknet_PATCH_VERSION@