Add CMakeLists.txt (#8)

* Add CMakeLists.txt

* Use CMake in CI

* Remove Makefile & update README.md
This commit is contained in:
Luke Street 2022-07-06 07:03:19 -04:00 committed by GitHub
parent 97c946fd86
commit 4ae7bba638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 37 deletions

View File

@ -10,26 +10,30 @@ jobs:
- name: Install GCC multilib
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
sudo apt-get install -y gcc-multilib g++-multilib ninja-build
- name: Configure
# Replace with RelWithDebInfo when -O2 crash is fixed
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
- name: Build
run: make -j
run: cmake --build build
- name: Test
run: |
wget https://cdn.discordapp.com/attachments/727918646525165659/917185027656286218/GC_WII_COMPILERS.zip
unzip GC_WII_COMPILERS.zip
MWCIncludes=. ./wibo GC/2.7/mwcceppc.exe -c test/test.c
MWCIncludes=. build/wibo GC/2.7/mwcceppc.exe -c test/test.c
file test.o
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: wibo
path: wibo
path: build/wibo
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: wibo
files: build/wibo

3
.gitignore vendored
View File

@ -3,3 +3,6 @@ build/
*.o
.vscode/
# CLion
.idea/
cmake-build-*/

16
CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(wibo LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -Wall")
add_executable(wibo
advapi32.cpp
files.cpp
kernel32.cpp
lmgr.cpp
loader.cpp
main.cpp
ole32.cpp
user32.cpp
version.cpp
)
install(PROGRAMS wibo DESTINATION bin)

View File

@ -4,11 +4,14 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
g++ \
g++-multilib \
make
cmake \
ninja-build
COPY . /wibo
RUN make -C /wibo
# Replace with RelWithDebInfo when -O2 crash is fixed
RUN cmake -S /wibo -B /wibo/build -G Ninja -DCMAKE_BUILD_TYPE=Debug
RUN cmake --build /wibo/build
FROM ubuntu:22.04
@ -18,6 +21,6 @@ RUN dpkg --add-architecture i386 \
&& apt-get install -y --no-install-recommends \
libstdc++6:i386
COPY --from=build /wibo/wibo /usr/local/sbin/wibo
COPY --from=build /wibo/build/wibo /usr/local/sbin/wibo
CMD /usr/local/sbin/wibo

View File

@ -1,27 +0,0 @@
all: wibo
CXXFLAGS = -Wall -g -m32 -std=c++17 -lstdc++ -MD
LDFLAGS = -lstdc++fs
BUILD_DIR := build
CPP_FILES := $(wildcard *.cpp)
O_FILES := $(foreach file,$(CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o))
DEP_FILES := $(O_FILES:.o=.d)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.cpp | $(BUILD_DIR)
$(CXX) -c $(CXXFLAGS) $< -o $@
wibo: $(O_FILES)
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
clean:
$(RM) -r $(BUILD_DIR) wibo
.PHONY: all clean
MAKEFLAGS += --no-builtin-rules
-include $(DEP_FILES)

View File

@ -4,7 +4,9 @@ A minimal, low-fuss wrapper that can run really simple command-line 32-bit Windo
Don't run this on any untrusted executables, I implore you. (Or probably just don't run it at all... :p)
make && ./wibo
cmake -B build
cmake --build build
build/wibo
---