More fixes
This commit is contained in:
parent
33cffe95a2
commit
e4ddd9d8ca
@ -1,2 +1,2 @@
|
|||||||
vim.opt_global.makeprg = "./build.sh"
|
vim.opt_global.makeprg = "./build.sh --run=false"
|
||||||
vim.opt.errorformat = "%f(%l:%c)\\ %m"
|
vim.opt.errorformat = "%f(%l:%c)\\ %m"
|
||||||
|
@ -35,6 +35,24 @@ temp_path_join :: proc(paths: ..string) -> string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
when ODIN_OS == .Windows {
|
||||||
|
EXE_EXT :: ".exe"
|
||||||
|
DLL_EXT :: ".dll"
|
||||||
|
LIB_PREFIX :: ""
|
||||||
|
} else when ODIN_OS == .Linux {
|
||||||
|
EXE_EXT :: ".bin"
|
||||||
|
DLL_EXT :: ".so"
|
||||||
|
LIB_PREFIX :: "lib"
|
||||||
|
} else when ODIN_OS == .Darwin {
|
||||||
|
EXE_EXT :: ".bin"
|
||||||
|
DLL_EXT :: ".dylib"
|
||||||
|
LIB_PREFIX :: "lib"
|
||||||
|
} else {
|
||||||
|
EXE_EXT :: ""
|
||||||
|
DLL_EXT :: ""
|
||||||
|
LIB_PREFIX :: ""
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a list of shared dependencies that have to be copied to out dir
|
// Returns a list of shared dependencies that have to be copied to out dir
|
||||||
build_deps :: proc(opts: Options) -> []string {
|
build_deps :: proc(opts: Options) -> []string {
|
||||||
log.infof("build_deps")
|
log.infof("build_deps")
|
||||||
@ -67,14 +85,19 @@ build_deps :: proc(opts: Options) -> []string {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if shared {
|
if shared {
|
||||||
append(&out_libs, "./libs/raylib/zig-out-shared/lib/libraylib.so")
|
append(
|
||||||
|
&out_libs,
|
||||||
|
temp_path_join(
|
||||||
|
"./libs/raylib/zig-out-shared/lib",
|
||||||
|
LIB_PREFIX + "raylib" + DLL_EXT,
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Physfs
|
// Physfs
|
||||||
{
|
{
|
||||||
cwd := "./libs/physfs"
|
cwd := "./libs/physfs"
|
||||||
file_name := shared ? "libphysfs.so" : "libphysfs.a"
|
|
||||||
is_built := os.is_dir("./libs/physfs/build")
|
is_built := os.is_dir("./libs/physfs/build")
|
||||||
if force {
|
if force {
|
||||||
remove_all("./libs/physfs/build")
|
remove_all("./libs/physfs/build")
|
||||||
@ -120,7 +143,7 @@ build_deps :: proc(opts: Options) -> []string {
|
|||||||
TRACY_NAME_STATIC :: "tracy.a"
|
TRACY_NAME_STATIC :: "tracy.a"
|
||||||
}
|
}
|
||||||
|
|
||||||
file_path := fmt.tprintf("./libs/tracy/%s", shared ? TRACY_NAME_SHARED : TRACY_NAME_STATIC)
|
file_path := temp_path_join("./libs/tracy", shared ? TRACY_NAME_SHARED : TRACY_NAME_STATIC)
|
||||||
|
|
||||||
is_built := os.is_file(file_path)
|
is_built := os.is_file(file_path)
|
||||||
if is_built && force {
|
if is_built && force {
|
||||||
@ -154,7 +177,7 @@ build_deps :: proc(opts: Options) -> []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if shared {
|
if shared {
|
||||||
append(&out_libs, "./libs/tracy/tracy.so")
|
append(&out_libs, "./libs/tracy/tracy" + DLL_EXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,6 +240,7 @@ main :: proc() {
|
|||||||
tracy = true,
|
tracy = true,
|
||||||
debug = true,
|
debug = true,
|
||||||
optimize = true,
|
optimize = true,
|
||||||
|
run = true,
|
||||||
}
|
}
|
||||||
flags.parse_or_exit(&opts, os.args, .Unix, context.temp_allocator)
|
flags.parse_or_exit(&opts, os.args, .Unix, context.temp_allocator)
|
||||||
if opts.variant == .Web {
|
if opts.variant == .Web {
|
||||||
@ -236,7 +260,7 @@ main :: proc() {
|
|||||||
case .Hot_Reload:
|
case .Hot_Reload:
|
||||||
setup_bin_dir(opts, "./build/hotreload", shared_dep_paths)
|
setup_bin_dir(opts, "./build/hotreload", shared_dep_paths)
|
||||||
|
|
||||||
is_running := process_exists("game.bin")
|
is_running := process_exists("game" + EXE_EXT)
|
||||||
if !is_running {
|
if !is_running {
|
||||||
run_cmd(
|
run_cmd(
|
||||||
temp_concat(
|
temp_concat(
|
||||||
@ -244,7 +268,7 @@ main :: proc() {
|
|||||||
"odin",
|
"odin",
|
||||||
"build",
|
"build",
|
||||||
"main_hot_reload",
|
"main_hot_reload",
|
||||||
"-out:./build/hotreload/game.bin",
|
"-out:./build/hotreload/game" + EXE_EXT,
|
||||||
},
|
},
|
||||||
debug_flag,
|
debug_flag,
|
||||||
tracy_flag,
|
tracy_flag,
|
||||||
@ -262,7 +286,7 @@ main :: proc() {
|
|||||||
"-define:RAYLIB_SHARED=true",
|
"-define:RAYLIB_SHARED=true",
|
||||||
"-define:PHYSFS_SHARED=true",
|
"-define:PHYSFS_SHARED=true",
|
||||||
"-build-mode:dll",
|
"-build-mode:dll",
|
||||||
"-out:./build/hotreload/game_tmp.so",
|
"-out:./build/hotreload/game_tmp" + DLL_EXT,
|
||||||
},
|
},
|
||||||
tracy_flag,
|
tracy_flag,
|
||||||
debug_flag,
|
debug_flag,
|
||||||
@ -271,13 +295,17 @@ main :: proc() {
|
|||||||
),
|
),
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
rename("./build/hotreload/game_tmp.so", "./build/hotreload/game.so")
|
rename("./build/hotreload/game_tmp" + DLL_EXT, "./build/hotreload/game" + DLL_EXT)
|
||||||
|
|
||||||
|
if !is_running && opts.run {
|
||||||
|
run_cmd({"./build/hotreload/game" + EXE_EXT}, "")
|
||||||
|
}
|
||||||
case .Desktop:
|
case .Desktop:
|
||||||
setup_bin_dir(opts, "./build/desktop", shared_dep_paths)
|
setup_bin_dir(opts, "./build/desktop", shared_dep_paths)
|
||||||
|
|
||||||
cmd := slice.concatenate(
|
cmd := slice.concatenate(
|
||||||
[][]string {
|
[][]string {
|
||||||
[]string{"odin", "build", "main_release", "-out:./build/desktop/game.exe"},
|
[]string{"odin", "build", "main_release", "-out:./build/desktop/game" + EXE_EXT},
|
||||||
tracy_flag,
|
tracy_flag,
|
||||||
debug_flag,
|
debug_flag,
|
||||||
optimize_flag,
|
optimize_flag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user