commit 5a4e1699b39e1ddb522178965d096646c0afe62d Author: Max Amundsen Date: Tue Oct 8 09:55:52 2024 -0400 init diff --git a/.focus-config b/.focus-config new file mode 100644 index 0000000..87bb07d --- /dev/null +++ b/.focus-config @@ -0,0 +1,33 @@ +[6] # Version number. Do not delete. + +[[workspace]] +# These directories and files will be scanned when a workspace is opened so that search etc. works. +./ + +[ignore] +.git +build_debug +.build +.DS_Store +console3d.dSYM + +[[build commands]] +build_working_dir: ./ +open_panel_on_build: true +close_panel_on_success: false +clear_build_output_before_running: true +error_regex: ^(?P.*):(?P\d+),(?P\d+): (?PError|Warning|Info|...):* (?P.*)|^(?P.*error LNK.*) +auto_jump_to_error: false + +[Debug] +build_command: jai build.jai + +[Build Debug Macos] +build_command: arch -x86_64 /opt/jai/bin/jai-macos build.jai +run_command: build_debug/console3d +key_binding: Cmd-Shift-B + +[[settings]] +tab_size: 4 +insert_spaces_when_pressing_tab: true +strip_trailing_whitespace_on_save: except_lines_with_cursor # options: all, except_lines_with_cursor, disabled diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d0c0f49 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +.build +build_debug +build_release +.DS_Store + +*.obj +*.exe +*.pdb +*.lib +*.rdi +*.exp +*.bak diff --git a/build.jai b/build.jai new file mode 100644 index 0000000..b9fc5a8 --- /dev/null +++ b/build.jai @@ -0,0 +1,71 @@ +DEBUG := true; + +#run build(); + +build :: () { + w := compiler_create_workspace(); + if !w { + print("Compiler workspace creation failed.\n"); + return; + } + + assert(w != 0); + + options := get_build_options(); + options.output_executable_name = "console3d"; + options.minimum_os_version = .{10, 13}; + args := options.compile_time_command_line; + + build_dir := "build_debug"; + + set_build_options_dc(.{do_output=false}); + set_working_directory(#filepath); + + set_optimization(*options, .DEBUG); + + for arg: args { + if arg == { + case "release"; + DEBUG = false; + build_dir = "build_release"; + set_optimization(*options, .VERY_OPTIMIZED); + options.llvm_options.enable_split_modules = false; + options.array_bounds_check = .ON; + options.null_pointer_check = .ON; + options.arithmetic_overflow_check = .OFF; + case "debug"; + case "no_output"; + // useful if you want to compile to show errors, but not generate a build output + // which saves compile time + options.output_type = .NO_OUTPUT; + case; + compiler_report(tprint("Command-line argument #%, '%', is invalid. Valid options are: 'debug', 'release', 'no_output'.\n", it_index+1, arg)); + } + } + + make_directory_if_it_does_not_exist(build_dir); + + options.output_path = build_dir; + + set_build_options(options, w); + + import_path: [..] string; + array_add(*import_path, "modules"); + array_add(*import_path, ..options.import_path); + options.import_path = import_path; + + // allows main program to use: + // #if DEBUG + build_constants := tprint(#string STRING + DEBUG :: %; + STRING, + ifx DEBUG then "true" else "false", + ); + + add_build_string(build_constants, w); + add_build_file(tprint("%src/main.jai", #filepath), w); +} + +#import "Compiler"; +#import "Basic"; +#import "File"; diff --git a/src/main.jai b/src/main.jai new file mode 100644 index 0000000..245bfc9 --- /dev/null +++ b/src/main.jai @@ -0,0 +1,5 @@ +main :: () { + print("Hello, world!"); +} + +#import "Basic"; \ No newline at end of file