Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix README and build system #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,32 @@ SOFTWARE.

# Build Instructions

1. Create an empty folder named "4ed" to contain the codebase.
2. Clone the repository
3. Rename the folder containing the repository to "code"
4. At the same level as the "4ed" folder, clone the "4coder-non-source" repository
5. A. On windows setup the visual studio command line magic sauce so that "cl" works
B. On linux setup g++
C. On mac setup clang
6. Navigate to the "4ed/code" folder.
7. A. On windows run "bin\build.bat"
B. On linux run "bin\build-linux.sh"
C. On linux run "bin\build-mac.sh"
## Download required repositories

1. Create an empty folder for the source.
2. Clone this repository there to a folder named "code".
- `git clone <url> code`
3. At the same level as the "code" folder, clone the "4coder-non-source" repository.

Result should be like this:

```
root_dir
- code <this repo>
- 4coder-non-source
```

## Compile

1. Setup compiler.
- On windows setup the visual studio command line magic sauce so that "cl" works
- On linux setup g++
- On mac setup clang
6. Navigate to the "code" folder.
7. Run build script.
- On windows run `bin\build.bat`
- On linux run `./bin/build-linux.sh`
- On mac run `./bin/build-mac.sh`


# Notes on Major Issues
Expand Down
19 changes: 19 additions & 0 deletions bin/4ed_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
# error gcc options not set for this platform
#endif

char *native_includes[] = { "freetype2", 0 };
char *native_include_dir = "/usr/include";

internal void
build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
Build_Line line;
Expand Down Expand Up @@ -347,6 +350,16 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
}
}

if (native_includes != 0){
for (u32 i = 0; native_includes[i] != 0; ++i){
char *str = fm_str(arena,
native_include_dir,
"/",
native_includes[i]);
fm_add_to_line(line, "-I%s", str);
}
}

if (flags & DEBUG_INFO){
fm_add_to_line(line, "-g -O0");
}
Expand Down Expand Up @@ -569,6 +582,12 @@ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch
fm_clear_folder(themes_folder);
fm_make_folder_if_missing(arena, themes_folder);
fm_copy_all(source_themes_folder, themes_folder);

char *fonts_folder = fm_str(arena, "../build/fonts");
char *source_fonts_folder = fm_str(arena, "../4coder-non-source/dist_files/fonts");
fm_clear_folder(fonts_folder);
fm_make_folder_if_missing(arena, fonts_folder);
fm_copy_all(source_fonts_folder, fonts_folder);
}

fflush(stdout);
Expand Down