diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile new file mode 100644 index 0000000..10160a5 --- /dev/null +++ b/.github/docker/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:24.04 + +RUN apt-get update && apt-get install -y \ + ninja-build \ + g++ \ + git \ + qt6-base-dev \ + qt6-tools-dev \ + qt6-tools-dev-tools \ + qt6-multimedia-dev \ + && rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b75f11e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,102 @@ +name: CI + +on: + push: + branches: [main] + tags: ['v*'] + pull_request: + branches: [main] + +jobs: + build-linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y ninja-build g++ qt6-base-dev qt6-tools-dev qt6-tools-dev-tools qt6-multimedia-dev + + - name: Build + run: | + cmake -B build -S editor -DCMAKE_BUILD_TYPE=Release -G Ninja + cmake --build build --parallel + + - name: Package + run: | + mkdir -p staging + cp build/waller staging/ + cp README.md MANUAL.md LICENSE staging/ + [ -d maps ] && cp -r maps staging/ + tar -czf waller-linux.tar.gz -C staging . + + - name: Upload tarball + uses: actions/upload-artifact@v4.6.2 + with: + name: waller-ubuntu + path: waller-linux.tar.gz + + build-windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Install Qt6 + uses: jurplel/install-qt-action@v4 + with: + version: '6.8.*' + arch: win64_msvc2022_64 + modules: 'qtmultimedia' + cache: true + + - name: Build + run: | + cmake -B build -S editor -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release --parallel + + - name: Deploy + run: | + mkdir deploy + copy build\Release\waller.exe deploy\ + windeployqt6 --no-quick-import --release --no-system-d3d-compiler --no-system-dxc-compiler --no-compiler-runtime --no-opengl-sw --no-translations deploy\waller.exe + copy README.md deploy\ + copy MANUAL.md deploy\ + copy LICENSE deploy\ + if (Test-Path maps) { Copy-Item -Recurse maps deploy\ } + + - name: Package + run: Compress-Archive -Path deploy\* -DestinationPath waller-windows.zip + + - name: Upload ZIP + uses: actions/upload-artifact@v4.6.2 + with: + name: waller-windows + path: waller-windows.zip + + release: + needs: [build-linux, build-windows] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + + steps: + - name: Download tarball + uses: actions/download-artifact@v4.2.1 + with: + name: waller-ubuntu + path: artifacts/ + + - name: Download ZIP + uses: actions/download-artifact@v4.2.1 + with: + name: waller-windows + path: artifacts/ + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + files: artifacts/* diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt new file mode 100644 index 0000000..a54a739 --- /dev/null +++ b/editor/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 3.16) +project(waller LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets SpatialAudio) + +set(SOURCES + main.cpp + editor.cpp + walker.cpp + mainwindow.cpp + renderwindow.cpp + wdgmapeditor.cpp + wdgmapview.cpp + wdgtexselector.cpp + wdgtexview.cpp + ../common/engine/renderer.cpp + ../common/engine/renderer_config.cpp + ../common/engine/audio.cpp + ../common/engine/map.cpp + ../common/engine/map_io.cpp + ../common/engine/tags.cpp + ../common/engine/env.cpp + ../common/engine/workerpool.cpp + ../common/engine/gamepad.cpp + mainwindow.ui + renderwindow.ui + resources.qrc +) + +if(WIN32) + list(APPEND SOURCES editor.rc) +endif() + +qt_add_executable(waller WIN32 ${SOURCES}) + +target_include_directories(waller PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ../common/engine + ../common/game +) + +target_link_libraries(waller PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Widgets + Qt6::SpatialAudio +) + +if(WIN32) + target_link_libraries(waller PRIVATE xinput winmm ws2_32) +endif() + +if(MSVC) + target_compile_options(waller PRIVATE /W4 /MP /WX-) + target_compile_options(waller PRIVATE $<$:/O2>) +else() + target_compile_options(waller PRIVATE -msse4 -save-temps -Wall -Wextra) + target_compile_options(waller PRIVATE $<$:-O2>) + target_link_options(waller PRIVATE $<$:-s>) +endif() diff --git a/editor/main.cpp b/editor/main.cpp index 71e453f..022a7ed 100644 --- a/editor/main.cpp +++ b/editor/main.cpp @@ -21,14 +21,24 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif /*****************************************************************************/ inline bool hasSSE41() { +#ifdef _MSC_VER + int cpuInfo[4]; + __cpuid(cpuInfo, 1); + return (cpuInfo[2] & (1 << 19)) != 0; // SSE4.1 is bit 19 of ECX +#else uint32_t eax, ebx, ecx, edx; __cpuid(1, eax, ebx, ecx, edx); return (ecx & (1 << 19)) != 0; // SSE4.1 is bit 19 of ECX +#endif } /*****************************************************************************/ diff --git a/editor/waller.pro b/editor/waller.pro index c05d58d..3e112b7 100644 --- a/editor/waller.pro +++ b/editor/waller.pro @@ -3,9 +3,15 @@ QT += core gui spatialaudio greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++17 -QMAKE_CXXFLAGS_RELEASE *= -O2 -QMAKE_LFLAGS_RELEASE *= -s -QMAKE_CXXFLAGS += -msse4 -save-temps -Wall -Wextra + +win32-msvc* { + QMAKE_CXXFLAGS_RELEASE *= /O2 + QMAKE_CXXFLAGS += /W4 /MP +} else { + QMAKE_CXXFLAGS_RELEASE *= -O2 + QMAKE_LFLAGS_RELEASE *= -s + QMAKE_CXXFLAGS += -msse4 -save-temps -Wall -Wextra +} #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000