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

use zig cc to compile c #60

Merged
merged 6 commits into from
Apr 14, 2023
Merged
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
22 changes: 6 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,16 @@ jobs:
with:
fetch-depth: 1

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.10.1

- name: Get the build metadata
shell: bash
run: |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Setup MSVC
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64

- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64

- name: Configure
shell: cmd
run: configure.cmd

- name: Build
shell: cmd
run: build.cmd
Expand All @@ -50,6 +40,6 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: build/dwm-win32.exe
files: dwm-win32.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*.o
*.exe
*.ilk
*.pdb

config.h
Expand All @@ -10,7 +8,7 @@ tags
*.orig

.clangd/
build/
compile_commands.json

dwm-win32.log
zig-cache/
86 changes: 0 additions & 86 deletions CMakeLists.txt

This file was deleted.

17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,29 +133,16 @@ dll because it will be loaded into each process address space.
COMPILING
=========

dwm-win32 requires `cmake`, `make`, `clang` and `Visual Studio 2019`. You can install the tools by using
[scoop](https://scoop.sh) as `scoop install cmake make llvm`.

To compile debug version of dwm-win32 use the following command:
dwm-win32 requires [zig](https://ziglang.org/) to compile. Source code for dwm-win32 is written in C and uses `zig cc` to compile C to native code.
You can install the compiler by using [scoop](https://scoop.sh) as `scoop install zig`.

```cmd
configure.cmd
build.cmd
```

Other examples:

```cmake
cmake -G "Visual Studio 16 2019" -A Win32 -S . -B "build\32bit" -DCMAKE_BUILD_TYPE=Release
cmake -G "Visual Studio 16 2019" -A x64 -S . -B "build\64bit" -DCMAKE_BUILD_TYPE=Release
cmake --build build\32bit --config Release
cmake --build build\64bit --config Release
```

TODO
====

- support clang compiler
- support luajit
- show/hide child windows upon tag switch, in theory this should already
work but in practice we need to tweak ismanageable() so that it
Expand Down
12 changes: 10 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
cmake --build build -j %NUMBER_OF_PROCESSORS% || exit /b
:: cmake --build build || exit /b
IF NOT EXIST src\\config.h COPY config.h.in src\\config.h
zig cc ^
-o dwm-win32.exe src/dwm-win32.c src/win32_utf8.c ^
src/mods/client.c src/mods/display.c src/mods/dwm.c src/mods/eventemitter.c src/mods/hotkey.c ^
-Iextern/lua/src ^
extern/lua/src/lapi.c extern/lua/src/lauxlib.c extern/lua/src/lbaselib.c extern/lua/src/lcode.c extern/lua/src/ldblib.c extern/lua/src/ldebug.c extern/lua/src/ldo.c extern/lua/src/ldump.c extern/lua/src/lfunc.c extern/lua/src/lgc.c extern/lua/src/linit.c extern/lua/src/liolib.c extern/lua/src/llex.c extern/lua/src/lmathlib.c extern/lua/src/lmem.c extern/lua/src/loadlib.c extern/lua/src/lobject.c extern/lua/src/lopcodes.c extern/lua/src/loslib.c extern/lua/src/lparser.c extern/lua/src/lstate.c extern/lua/src/lstring.c extern/lua/src/lstrlib.c extern/lua/src/ltable.c extern/lua/src/ltablib.c extern/lua/src/ltm.c extern/lua/src/lundump.c extern/lua/src/lvm.c extern/lua/src/lzio.c ^
-Iextern/lua-compat-5.3 ^
extern/lua-compat-5.3/compat-5.3.c ^
-DNDEBUG -DPROJECT_NAME='"dwm-win32"' -DPROJECT_VER='"i0.1.0"' -DPROJECT_VER_MAJOR=0 -DPROJECT_VER_MINOR=1 -DPROJECT_VER_PATCH=0 ^
-target x86_64-windows-msvc -std=c99 -pedantic -Wall -O2 -s
2 changes: 0 additions & 2 deletions cmake/luajit/.gitignore

This file was deleted.

179 changes: 0 additions & 179 deletions cmake/luajit/Bundle.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/luajit/CMakeLists.txt

This file was deleted.

Loading