darwin support, parallelized build (~3x faster on macos)

This commit is contained in:
D4 2020-08-30 03:19:27 -07:00
parent a856ade925
commit 7f43db13ee
9 changed files with 24 additions and 34 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
./lite
./error.txt

View File

@ -1,8 +1,8 @@
#!/bin/bash
# -I/usr/local/include/SDL2
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -I/usr/local/include/SDL2 -D_THREAD_SAFE"
lflags="-L/usr/local/lib -lSDL2 -lm"
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc"
lflags="-lSDL2 -lm"
PIDS=()
if [[ $* == *windows* ]]; then
platform="windows"
@ -12,6 +12,12 @@ if [[ $* == *windows* ]]; then
lflags="$lflags -Lwinlib/SDL2-2.0.10/x86_64-w64-mingw32/lib"
lflags="-lmingw32 -lSDL2main $lflags -mwindows -o $outfile res.res"
x86_64-w64-mingw32-windres res.rc -O coff -o res.res
elif [[ "$OSTYPE" == "darwin"* ]]; then
platform="darwin"
outfile="lite"
compiler="gcc"
cflags="$cflags `pkg-config --cflags SDL2`/.. -DLUA_USE_POSIX"
lflags="$lflags `pkg-config --libs-only-L SDL2` -o $outfile"
else
platform="unix"
outfile="lite"
@ -27,10 +33,14 @@ fi
echo "compiling ($platform)..."
for f in `find src -name "*.c"`; do
$compiler -c $lflags $cflags $f -o "${f//\//_}.o"
$compiler -c $cflags $f -o "${f//\//_}.o" &
PIDS+=($!)
done
for pid in ${PIDS[@]}; do
wait "$pid";
if [[ $? -ne 0 ]]; then
echo "!?!?! " -c $cflags $f -o "${f//\//_}.o"
got_error=true
got_error=true
fi
done

View File

@ -41,14 +41,8 @@ local function project_scan_thread()
if info and info.size < size_limit then
info.filename = file
table.insert(info.type == "dir" and dirs or files, info)
-- if i < 10 then
-- table.insert(info.type == "dir" and dirs or files, info)
-- end
end
end
-- if i > 512 then
-- break
-- end
end
table.sort(dirs, compare_file)

View File

@ -12,9 +12,9 @@ style.big_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 34 * SCALE
style.icon_font = renderer.font.load(EXEDIR .. "/data/fonts/icons.ttf", 14 * SCALE)
style.code_font = renderer.font.load(EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE)
style.background = { common.color "#000000" } -- doc bg
style.background2 = { common.color "#151519" } -- left panel, tab bar deselected
style.background3 = { common.color "#212125" } -- pop up bg
style.background = { common.color "#2e2e32" } -- doc view
style.background2 = { common.color "#252529" } -- left view
style.background3 = { common.color "#252529" } -- popup view
style.text = { common.color "#97979c" }
style.caret = { common.color "#93DDFA" }
style.accent = { common.color "#e1e1e6" }

View File

@ -1,16 +0,0 @@
Error: /Users/isha/git/lite/data/plugins/treeview.lua:149: /Users/isha/git/lite/data/plugins/treeview.lua:32: attempt to index local 'item' (a nil value)
stack traceback:
[C]: in function 'for iterator'
/Users/isha/git/lite/data/plugins/treeview.lua:149: in function 'draw'
/Users/isha/git/lite/data/core/rootview.lua:369: in function '?'
/Users/isha/git/lite/data/core/rootview.lua:58: in function 'propagate'
/Users/isha/git/lite/data/core/rootview.lua:374: in function '?'
/Users/isha/git/lite/data/core/rootview.lua:58: in function 'propagate'
/Users/isha/git/lite/data/core/rootview.lua:374: in function 'draw'
/Users/isha/git/lite/data/core/rootview.lua:496: in function 'draw'
/Users/isha/git/lite/data/plugins/autocomplete.lua:236: in function 'draw'
/Users/isha/git/lite/data/core/init.lua:413: in function 'step'
/Users/isha/git/lite/data/core/init.lua:454: in function 'run'
[string "local core..."]:10: in function <[string "local core..."]:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk

BIN
lite

Binary file not shown.

View File

@ -1,4 +1,4 @@
#include <SDL.h>
#include <SDL2/SDL.h>
#include <stdbool.h>
#include <ctype.h>
#include <dirent.h>

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "api/api.h"
#include "renderer.h"

View File

@ -1,7 +1,7 @@
#ifndef RENDERER_H
#define RENDERER_H
#include <SDL.h>
#include <SDL2/SDL.h>
#include <stdint.h>
typedef struct RenImage RenImage;