summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2021-03-17 16:39:41 -0700
committerlshprung <lshprung@yahoo.com>2021-03-17 16:39:41 -0700
commitb1e4742b8983aabdcd3fcd24d6623582c3b3d28c (patch)
treed64ce777a0fce1ae135e980c3dabf155b6a53a33
parent747a0033329875be91edaee6d1c4ccea65e594dc (diff)
Added Windows compile instructions
-rw-r--r--.gitignore11
-rw-r--r--Makefile4
-rw-r--r--docs/README.md2
-rw-r--r--docs/windows_compile_instructions.md49
4 files changed, 65 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8c1b636
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+*
+!.gitignore
+!*.c
+!docs
+!docs/*
+!include
+!include/*.h
+!unix
+!unix/*
+!windows
+!windows/*
diff --git a/Makefile b/Makefile
index 4afeb69..7518cd4 100644
--- a/Makefile
+++ b/Makefile
@@ -32,9 +32,11 @@ entry.o: entry.c include/entry.h include/group.h include/read_cfg.h
.PHONY: clean
clean:
- rm *.o $(NAME)
+ rm -f *.o
rm -f unix/*.o
rm -f windows/*.o
+ rm -f $(NAME)
+ rm -f $(NAME).exe
ifneq ($(OS),Windows_NT)
diff --git a/docs/README.md b/docs/README.md
index e5b8605..d48fd82 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,6 +4,8 @@
## Compiling and Running
+For Windows instructions, see [here](windows_compile_instructions.md)
+
tml can be compiled on any system with make, gcc, and the ncurses library (libncurses-dev) installed. It can be compiled and installed on any Linux distribution, and can also be compiled and run on Windows 10. To compile and run tml:
1. Clone the repository
diff --git a/docs/windows_compile_instructions.md b/docs/windows_compile_instructions.md
new file mode 100644
index 0000000..8966263
--- /dev/null
+++ b/docs/windows_compile_instructions.md
@@ -0,0 +1,49 @@
+# Windows Compilation Instructions
+
+Compiling on Windows requires access to the MinGW toolchain. The easiest way to get the necessary libraries is by installing [MSYS2](https://www.msys2.org/) which provides a package manager: pacman.
+
+1. Download the latest version of MSYS2 from [here](https://www.msys2.org/).
+
+2. Open the Start Menu and launch "MSYS2 MinGW 64-bit" to open a terminal window.
+
+3. Run `pacman -Syu` until all packages are up to date
+
+4. `pacman -S git mingw-w64-x86_64-gcc mingw-w64-x86_64-ncurses make` to install necessary packages
+
+5. `git clone https://github.com/lshprung/tml` to clone the repository
+
+6. `cd tml` to enter the repository
+
+7. `make` to compile
+
+If you did everything correctly, compilation should succeed. Open File Explorer in the current directory (can be done by running `explorer .` in MSYS2 terminal) and double click the generated executable (should be called tml.exe)
+
+## Resolving Missing .dll Files
+
+You may receive an error message upon trying to run the compiled executable that looks something like this:
+
+```
+The code execution cannot proceed because
+libwinpthread-1.dll was not found. Reinstalling the program
+may fix this problem
+```
+
+This is usually the result of the MSYS2 MinGW libraries not being in your PATH. There are generally two ways to fix this problem:
+
+### 1. Edit PATH (Recommended)
+
+Add the following entry to your PATH environment variable: `C:\msys64\mingw64\bin` (replace `C:\msys64` with the location that MSYS2 was installed to). This will help Windows to find the library it thinks it is missing and the program should now lauch without an error
+
+### 2. Compile with -static flag
+
+If you do not want to edit your PATH, you can simply compile statically. Keep in mind that this will increase the size of your executable.
+
+1. Run `make clean`
+
+2. Run `make CC="gcc -static"`
+
+The resulting executable should launch without an error
+
+---
+
+These instructions were written with 64-bit architecture in mind. Although I have not tested on a 32-bit architecture, I suppose these instructions would also work, as long as you replace every reference to `64` with `32`