Kinda working build on windows, needs more work
This commit is contained in:
parent
1b3d2641e2
commit
1e91121244
@ -73,8 +73,8 @@ build_deps :: proc(opts: Options) {
|
||||
}
|
||||
build_cmd := []string{"cmake", "--build", "build", "--config", "MinSizeRel"}
|
||||
if opts.variant == .Web {
|
||||
run_cmd(temp_concat({"emcmake"}, prepare_cmd), cwd)
|
||||
run_cmd(temp_concat({"emmake"}, build_cmd), cwd)
|
||||
run_cmd(temp_concat({"emcmake.bat"}, prepare_cmd), cwd)
|
||||
run_cmd(temp_concat({"emmake.bat"}, build_cmd), cwd)
|
||||
} else {
|
||||
run_cmd(prepare_cmd, cwd)
|
||||
run_cmd(build_cmd, cwd)
|
||||
@ -88,7 +88,7 @@ build_deps :: proc(opts: Options) {
|
||||
cwd := "./libs/tracy"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
TRACY_NAME_SHARED :: "tracydll.lib"
|
||||
TRACY_NAME_SHARED :: "tracy.dll"
|
||||
TRACY_NAME_STATIC :: "tracy.lib"
|
||||
} else when ODIN_OS == .Linux {
|
||||
TRACY_NAME_SHARED :: "tracy.so"
|
||||
@ -116,7 +116,8 @@ build_deps :: proc(opts: Options) {
|
||||
"-DTRACY_ENABLE",
|
||||
"-O2",
|
||||
"vendor/tracy/public/TracyClient.cpp",
|
||||
"-fPIC",
|
||||
"-lws2_32",
|
||||
"-ldbghelp"
|
||||
},
|
||||
shared ? {"-shared", "-o", TRACY_NAME_SHARED} : {"-c", "-o", "tracy.o"},
|
||||
},
|
||||
@ -147,7 +148,7 @@ setup_emsdk_env :: proc() {
|
||||
PATH_ENV_DELIMITER :: ":"
|
||||
}
|
||||
|
||||
PATHS :: [2]string{"./libs/emsdk/upstream/bin", "./libs/emsdk/upstream/emscripten"}
|
||||
PATHS :: [3]string{"./libs/emsdk/upstream/bin", "./libs/emsdk/upstream/emscripten", "./libs/emsdk/ninja/git-release_64bit/bin"}
|
||||
|
||||
paths: [len(PATHS)]string
|
||||
for path, i in PATHS {
|
||||
@ -157,8 +158,8 @@ setup_emsdk_env :: proc() {
|
||||
set_env(
|
||||
"PATH",
|
||||
strings.join(
|
||||
{paths[0], paths[1], os.get_env("PATH", context.temp_allocator)},
|
||||
":",
|
||||
{paths[0], paths[1], paths[2], os.get_env("PATH", context.temp_allocator)},
|
||||
PATH_ENV_DELIMITER,
|
||||
context.temp_allocator,
|
||||
),
|
||||
)
|
||||
@ -218,7 +219,7 @@ main :: proc() {
|
||||
mkdir_all("./build/desktop")
|
||||
cmd := slice.concatenate(
|
||||
[][]string {
|
||||
[]string{"odin", "build", "main_release", "-out:./build/desktop/game"},
|
||||
[]string{"odin", "build", "main_release", "-out:./build/desktop/game.exe"},
|
||||
tracy_flag,
|
||||
debug_flag,
|
||||
optimize_flag,
|
||||
@ -252,7 +253,7 @@ main :: proc() {
|
||||
|
||||
run_cmd(
|
||||
{
|
||||
"emcc",
|
||||
"emcc.bat",
|
||||
"-g",
|
||||
"-o",
|
||||
"build/web/index.html",
|
||||
|
@ -58,6 +58,7 @@ run_cmd_internal :: proc(
|
||||
state: os.Process_State
|
||||
|
||||
b := strings.builder_make(context.temp_allocator)
|
||||
defer strings.builder_destroy(&b)
|
||||
|
||||
for {
|
||||
has_data, pipe_err := os.pipe_has_data(r)
|
||||
@ -69,6 +70,7 @@ run_cmd_internal :: proc(
|
||||
buf: [1024]u8
|
||||
if has_data {
|
||||
n = handle_error1(os.read(r, buf[:]))
|
||||
strings.write_bytes(&b, buf[0:n])
|
||||
handle_error1(os.write(os.stderr, buf[0:n]))
|
||||
}
|
||||
|
||||
@ -78,7 +80,7 @@ run_cmd_internal :: proc(
|
||||
|
||||
wait_for_kill := false
|
||||
if pipe_err == .Broken_Pipe {
|
||||
handle_error(os.process_kill(process))
|
||||
_ = os.process_kill(process)
|
||||
wait_for_kill = true
|
||||
}
|
||||
wait_err: os.Error
|
||||
@ -88,6 +90,8 @@ run_cmd_internal :: proc(
|
||||
}
|
||||
}
|
||||
|
||||
result = strings.to_string(b)
|
||||
|
||||
if !state.success {
|
||||
return "", .Crash
|
||||
}
|
||||
|
@ -440,20 +440,23 @@ get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_C
|
||||
skip_whitespase(&ctx)
|
||||
switch ctx.bytes[ctx.it] {
|
||||
case 'v':
|
||||
log.debugf("v line: %v", ctx.line)
|
||||
// vertex
|
||||
advance(&ctx) or_break
|
||||
log.debugf("after advance %v", ctx.bytes[ctx.it])
|
||||
|
||||
vertex: rl.Vector3
|
||||
|
||||
coord_idx := 0
|
||||
for ctx.bytes[ctx.it] != '\n' {
|
||||
for ctx.bytes[ctx.it] != '\n' && ctx.bytes[ctx.it] != '\r' {
|
||||
skip_whitespase(&ctx)
|
||||
s := string(ctx.bytes[ctx.it:])
|
||||
coord_val, nr, ok := strconv.parse_f32_prefix(s)
|
||||
if !ok {
|
||||
log.errorf("failed to parse float at line %d", ctx.line)
|
||||
log.errorf("failed to parse float %v %s at line %d", coord_idx, ctx.bytes[ctx.it:][:12], ctx.line)
|
||||
return
|
||||
}
|
||||
log.debugf("parsed float %v %v from %s", coord_idx, coord_val, ctx.bytes[ctx.it:][:nr])
|
||||
advance(&ctx, nr) or_break
|
||||
|
||||
vertex[coord_idx] = coord_val
|
||||
@ -463,6 +466,9 @@ get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_C
|
||||
min_pos = lg.min(vertex, min_pos)
|
||||
max_pos = lg.max(vertex, max_pos)
|
||||
|
||||
if ctx.bytes[ctx.it] == '\r' {
|
||||
advance(&ctx)
|
||||
}
|
||||
advance(&ctx)
|
||||
ctx.line += 1
|
||||
case 'f':
|
||||
@ -473,7 +479,7 @@ get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_C
|
||||
indices_buf: [MAX_FACE_VERTS]u16
|
||||
index_count := 0
|
||||
|
||||
for ctx.bytes[ctx.it] != '\n' {
|
||||
for ctx.bytes[ctx.it] != '\n' && ctx.bytes[ctx.it] != '\r' {
|
||||
skip_whitespase(&ctx)
|
||||
index_f, nr, ok := strconv.parse_f32_prefix(string(ctx.bytes[ctx.it:]))
|
||||
if !ok {
|
||||
@ -485,6 +491,9 @@ get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_C
|
||||
indices_buf[index_count] = u16(index)
|
||||
index_count += 1
|
||||
}
|
||||
if ctx.bytes[ctx.it] == '\r' {
|
||||
advance(&ctx)
|
||||
}
|
||||
advance(&ctx)
|
||||
ctx.line += 1
|
||||
|
||||
@ -566,6 +575,8 @@ get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_C
|
||||
}
|
||||
}
|
||||
|
||||
log.debugf("num verts: %v", len(vertices))
|
||||
|
||||
center := (max_pos + min_pos) * 0.5
|
||||
extent := (max_pos - min_pos) * 0.5
|
||||
|
||||
|
@ -32,13 +32,16 @@ destroy_spanpool :: proc(s: ^$T/Span_Pool($E)) {
|
||||
is_handle_valid :: proc(s: ^$T/Span_Pool($E), handle: Handle) -> bool {
|
||||
return(
|
||||
handle.gen != 0 &&
|
||||
int(handle.first) < len(s.elems) &&
|
||||
int(handle.first + handle.len) <= len(s.elems) &&
|
||||
s.generations[handle.first] == handle.gen \
|
||||
)
|
||||
}
|
||||
|
||||
resolve_slice :: proc(s: ^$T/Span_Pool($E), handle: Handle, loc := #caller_location) -> []E {
|
||||
assert(is_handle_valid(s, handle), "invalid spanpool handle", loc)
|
||||
if !is_handle_valid(s, handle) {
|
||||
return {}
|
||||
}
|
||||
|
||||
return s.elems[handle.first:handle.first + handle.len]
|
||||
}
|
||||
|
@ -4,7 +4,13 @@ import "core:c"
|
||||
|
||||
PHYSFS_SHARED :: #config(PHYSFS_SHARED, false)
|
||||
|
||||
when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||
when ODIN_OS == .Windows {
|
||||
when PHYSFS_SHARED {
|
||||
foreign import lib "build/MinSizeRel/physfs.lib"
|
||||
} else {
|
||||
foreign import lib {"build/MinSizeRel/physfs-static.lib", "system:Advapi32.lib"}
|
||||
}
|
||||
} else when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||
when PHYSFS_SHARED {
|
||||
foreign import lib "libphysfs.so"
|
||||
} else {
|
||||
|
@ -150,18 +150,19 @@ SecureFree :: #force_inline proc(
|
||||
depth,
|
||||
true,
|
||||
)} else {___tracy_emit_memory_free(ptr, true)}}}
|
||||
@(disabled = !TRACY_ENABLE)
|
||||
AllocN :: #force_inline proc(
|
||||
ptr: rawptr,
|
||||
size: c.size_t,
|
||||
name: cstring,
|
||||
depth: i32 = TRACY_CALLSTACK,
|
||||
) {
|
||||
when TRACY_ENABLE {
|
||||
when TRACY_HAS_CALLSTACK {
|
||||
when TRACY_ENABLE {
|
||||
___tracy_emit_memory_alloc_callstack_named(ptr, size, depth, false, name)
|
||||
}
|
||||
} else {
|
||||
__tracy_emit_memory_alloc_named(ptr, size, false, name)
|
||||
when TRACY_ENABLE {
|
||||
___tracy_emit_memory_alloc_named(ptr, size, false, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user