mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 04:04:39 +00:00
add version
This commit is contained in:
parent
afec45954c
commit
ca98b075c3
20
.clang-format
Normal file
20
.clang-format
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
# $Id: .clang-format 16 2025-01-30 10:59:29Z nishi $
|
||||
Language: Cpp
|
||||
UseTab: Always
|
||||
TabWidth: 8
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
IndentWidth: 8
|
||||
PointerAlignment: Left
|
||||
ColumnLimit: 1024
|
||||
AllowShortIfStatementsOnASingleLine: Always
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
SpaceBeforeParens: Never
|
||||
AlignEscapedNewlines: DontAlign
|
||||
SortIncludes: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
#IndentPPDirectives: AfterHash
|
7
Makefile
7
Makefile
@ -8,16 +8,19 @@ GL_LIBS = `pkg-config --libs gl`
|
||||
|
||||
AR = $(TARGET_PREFIX)ar
|
||||
CC = $(TARGET_PREFIX)gcc
|
||||
CFLAGS = -D_DEFAULT_SOURCE $(ODE_CFLAGS) $(AMX_CFLAGS) $(GL_CFLAGS)
|
||||
CFLAGS = -D_DEFAULT_SOURCE -I../engine $(ODE_CFLAGS) $(AMX_CFLAGS) $(GL_CFLAGS)
|
||||
LDFLAGS =
|
||||
LIBS = $(ODE_LIBS) $(AMX_LIBS) $(GL_LIBS)
|
||||
|
||||
EXEC =
|
||||
|
||||
.PHONY: all clean ./engine ./src
|
||||
.PHONY: all format clean ./engine ./src
|
||||
|
||||
all: ./src
|
||||
|
||||
format:
|
||||
clang-format --verbose -i `find ./src ./engine -name "*.c" -or -name "*.h"`
|
||||
|
||||
./engine::
|
||||
$(MAKE) -C $@
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = libnishbox.a
|
||||
OBJS =
|
||||
OBJS = version.o
|
||||
|
||||
include ../common.mk
|
||||
|
||||
|
13
engine/nb_version.h
Normal file
13
engine/nb_version.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __NB_VERSION_H__
|
||||
#define __NB_VERSION_H__
|
||||
|
||||
typedef struct nb_version {
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
char full[64];
|
||||
} nb_version_t;
|
||||
|
||||
void nb_get_version(nb_version_t* version);
|
||||
|
||||
#endif
|
32
engine/version.c
Normal file
32
engine/version.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include "nb_version.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NB_VERSION "1.0.0"
|
||||
|
||||
void nb_get_version(nb_version_t* version) {
|
||||
char* cpstr = malloc(strlen(NB_VERSION) + 1);
|
||||
int i;
|
||||
int incr = 0;
|
||||
int old = 0;
|
||||
strcpy(cpstr, NB_VERSION);
|
||||
strcpy(version->full, NB_VERSION);
|
||||
for(i = 0;; i++) {
|
||||
if(cpstr[i] == '.' || cpstr[i] == 0) {
|
||||
int num;
|
||||
cpstr[i] = 0;
|
||||
num = atoi(cpstr + old);
|
||||
if(incr == 0) {
|
||||
version->major = num;
|
||||
} else if(incr == 1) {
|
||||
version->minor = num;
|
||||
} else if(incr == 2) {
|
||||
version->patch = num;
|
||||
}
|
||||
old = i + 1;
|
||||
incr++;
|
||||
if(incr == 3) break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv){
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char** argv) { return 0; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user