Compare commits
2 Commits
8d6775a480
...
4cb2893b85
Author | SHA1 | Date |
---|---|---|
DaniTheSkunk | 4cb2893b85 | |
DaniTheSkunk | c3e8c508ae |
|
@ -3,7 +3,7 @@
|
||||||
REM cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -GNinja .. && ninja && copy compile_commands.json .. && skunkworks.exe
|
REM cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -GNinja .. && ninja && copy compile_commands.json .. && skunkworks.exe
|
||||||
|
|
||||||
REM cd build && meson compile && copy compile_commands.json .. && cd .. && build\gsa.exe
|
REM cd build && meson compile && copy compile_commands.json .. && cd .. && build\gsa.exe
|
||||||
clang build.c src/str.c -Iinclude -Wno-everything -obuild.exe && build.exe && del build.exe
|
clang build.c src/str.c -Iinclude -Wno-everything -obuild.exe && build.exe && del build.exe && build\gsa_simple.exe
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
REM build\skip.exe c src && exit /b 1
|
REM build\skip.exe c src && exit /b 1
|
||||||
REM build\gsa.exe
|
REM build\gsa.exe
|
||||||
|
|
18
build.c
18
build.c
|
@ -33,8 +33,9 @@ int main(int argc, char *argv[]) {
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
|
||||||
sys("cl /c /MD /O2 /Za "
|
sys("cl /c /MD /O2 "
|
||||||
"../src/*.c "
|
"../src/*.c "
|
||||||
|
"../src/net/*.c "
|
||||||
"/I../include "
|
"/I../include "
|
||||||
"/I../subprojects/glew-2.1.0/include "
|
"/I../subprojects/glew-2.1.0/include "
|
||||||
"/I../subprojects/glfw-3.3.8/include "
|
"/I../subprojects/glfw-3.3.8/include "
|
||||||
|
@ -66,21 +67,26 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake(char *dep, char *libpath, char *lib, char *cmake_dir, char *params) {
|
void cmake(char *dep, char *libpath, char *lib, char *cmake_dir, char *params) {
|
||||||
if(file_exists(sw_concat("deps\\", lib))) {
|
if(file_exists(sw_str_concat("deps\\", lib))) {
|
||||||
printf("%s already exists, not compiling dependency\n", lib);
|
printf("%s already exists, not compiling dependency\n", lib);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("compiling %s", lib);
|
printf("compiling %s", lib);
|
||||||
|
|
||||||
sys(sw_concat("md ", dep));
|
sys(sw_str_concat("md ", dep));
|
||||||
chdir(dep);
|
chdir(dep);
|
||||||
sys(sw_concat4(
|
sys(sw_str_concat4(
|
||||||
"cmake ", params, " ../../subprojects/", sw_concat3(dep, "/", cmake_dir)
|
"cmake ",
|
||||||
|
params,
|
||||||
|
" ../../subprojects/",
|
||||||
|
sw_str_concat3(dep, "/", cmake_dir)
|
||||||
));
|
));
|
||||||
sys("cmake --build . --config Release");
|
sys("cmake --build . --config Release");
|
||||||
chdir("..");
|
chdir("..");
|
||||||
sys(sw_concat4(sw_concat3("copy ", dep, "\\"), libpath, " deps\\", lib));
|
sys(sw_str_concat4(
|
||||||
|
sw_str_concat3("copy ", dep, "\\"), libpath, " deps\\", lib
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool file_exists(char *dir) {
|
bool file_exists(char *dir) {
|
||||||
|
|
|
@ -5,4 +5,6 @@ void sw_debug(char *fmt, ...);
|
||||||
void sw_error(char *fmt, ...);
|
void sw_error(char *fmt, ...);
|
||||||
void sw_log(char *fmt, ...);
|
void sw_log(char *fmt, ...);
|
||||||
|
|
||||||
|
void sw_win32_error();
|
||||||
|
|
||||||
#endif /* GUARD_F07765349E6C37FAA98BC158D7119E65 */
|
#endif /* GUARD_F07765349E6C37FAA98BC158D7119E65 */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
#ifndef GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
||||||
#define GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
#define GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
||||||
|
|
||||||
char *sw_concat(char *a, char *b);
|
char *sw_str_concat(char *a, char *b);
|
||||||
char *sw_concat3(char *a, char *b, char *c);
|
char *sw_str_concat3(char *a, char *b, char *c);
|
||||||
char *sw_concat4(char *a, char *b, char *c, char *d);
|
char *sw_str_concat4(char *a, char *b, char *c, char *d);
|
||||||
char *sw_strdup(char *str);
|
char *sw_str_dup(char *str);
|
||||||
|
|
||||||
#endif /* GUARD_0941C997CB4D2297C8FEA1374912B5D1 */
|
#endif /* GUARD_0941C997CB4D2297C8FEA1374912B5D1 */
|
||||||
|
|
24
src/error.c
24
src/error.c
|
@ -4,6 +4,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
void sw_debug(char *fmt, ...) {
|
void sw_debug(char *fmt, ...) {
|
||||||
va_list argp;
|
va_list argp;
|
||||||
|
|
||||||
|
@ -37,3 +41,23 @@ void sw_log(char *fmt, ...) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sw_win32_error() {
|
||||||
|
u32 error;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
error = GetLastError();
|
||||||
|
|
||||||
|
FormatMessage(
|
||||||
|
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
0,
|
||||||
|
error,
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(char *)&str,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
sw_error("[win32] %s", str);
|
||||||
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ void sw_skip_add(struct sw_skip *skip, u8 *data, u32 data_size, char *name) {
|
||||||
skip->file_count += 1;
|
skip->file_count += 1;
|
||||||
skip->files =
|
skip->files =
|
||||||
realloc(skip->files, sizeof(skip->files[0]) * skip->file_count);
|
realloc(skip->files, sizeof(skip->files[0]) * skip->file_count);
|
||||||
skip->files[skip->file_count - 1].name = sw_strdup(name);
|
skip->files[skip->file_count - 1].name = sw_str_dup(name);
|
||||||
skip->files[skip->file_count - 1].offset = off;
|
skip->files[skip->file_count - 1].offset = off;
|
||||||
skip->files[skip->file_count - 1].size = data_size;
|
skip->files[skip->file_count - 1].size = data_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
char *sw_concat(char *a, char *b) {
|
char *sw_str_concat(char *a, char *b) {
|
||||||
char *str;
|
char *str;
|
||||||
u32 len_a, len_b;
|
u32 len_a, len_b;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ char *sw_concat(char *a, char *b) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *sw_concat3(char *a, char *b, char *c) {
|
char *sw_str_concat3(char *a, char *b, char *c) {
|
||||||
char *str;
|
char *str;
|
||||||
u32 len_a, len_b, len_c;
|
u32 len_a, len_b, len_c;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ char *sw_concat3(char *a, char *b, char *c) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *sw_concat4(char *a, char *b, char *c, char *d) {
|
char *sw_str_concat4(char *a, char *b, char *c, char *d) {
|
||||||
char *str;
|
char *str;
|
||||||
u32 len_a, len_b, len_c, len_d;
|
u32 len_a, len_b, len_c, len_d;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ char *sw_concat4(char *a, char *b, char *c, char *d) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *sw_strdup(char *str) {
|
char *sw_str_dup(char *str) {
|
||||||
char *out;
|
char *out;
|
||||||
u32 len;
|
u32 len;
|
||||||
|
|
||||||
|
|
11
tools/skip.c
11
tools/skip.c
|
@ -80,16 +80,17 @@ void crawl(char *dst, char *part_path) {
|
||||||
char *path;
|
char *path;
|
||||||
char *new_part_path;
|
char *new_part_path;
|
||||||
|
|
||||||
dir = sw_concat(dst, "/*.*");
|
dir = sw_str_concat(dst, "/*.*");
|
||||||
find = FindFirstFile(dir, &data);
|
find = FindFirstFile(dir, &data);
|
||||||
do {
|
do {
|
||||||
if(strcmp(data.cFileName, ".") != 0 &&
|
if(strcmp(data.cFileName, ".") != 0 &&
|
||||||
strcmp(data.cFileName, "..") != 0) {
|
strcmp(data.cFileName, "..") != 0) {
|
||||||
path = sw_concat3(dst, "/", data.cFileName);
|
path = sw_str_concat3(dst, "/", data.cFileName);
|
||||||
if(part_path) {
|
if(part_path) {
|
||||||
new_part_path = sw_concat3(part_path, "/", data.cFileName);
|
new_part_path =
|
||||||
|
sw_str_concat3(part_path, "/", data.cFileName);
|
||||||
} else {
|
} else {
|
||||||
new_part_path = sw_strdup(data.cFileName);
|
new_part_path = sw_str_dup(data.cFileName);
|
||||||
}
|
}
|
||||||
crawl(path, new_part_path);
|
crawl(path, new_part_path);
|
||||||
free(path);
|
free(path);
|
||||||
|
@ -132,7 +133,7 @@ int main(int argc, char *argv[]) {
|
||||||
sw_error("argument not a directory");
|
sw_error("argument not a directory");
|
||||||
}
|
}
|
||||||
crawl(argv[2], 0);
|
crawl(argv[2], 0);
|
||||||
filename = sw_concat(argv[2], ".skip");
|
filename = sw_str_concat(argv[2], ".skip");
|
||||||
sw_skip_save(skip, filename);
|
sw_skip_save(skip, filename);
|
||||||
printf("%s created\n", filename);
|
printf("%s created\n", filename);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
Loading…
Reference in New Issue