Skip to content
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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# LF everywhere, also on Windows checkouts: the shell scripts need it, and the
# unit tests compare docs/passes.md byte for byte.
* text=auto eol=lf
*.cmd text eol=crlf
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang llvm
- name: Configure
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build
- name: Test
# unit and clang integration tests; gta2_parse and vc6 need a gta2_re
# checkout and wine, and report as skipped
run: ctest --test-dir build --output-on-failure
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: cpp_permuter-linux-x64
path: |
build/cpp_permuter
examples/gta2/compile.sh
README.md
LICENSE

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Configure
run: cmake -S . -B build
- name: Build
run: cmake --build build --config Release
- name: Tools
shell: bash
run: |
# clang and llvm-objdump come with the runner's LLVM install
echo "C:\Program Files\LLVM\bin" >> "$GITHUB_PATH"
- name: Test
shell: bash
run: ctest --test-dir build -C Release --output-on-failure
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: cpp_permuter-windows-x64
path: |
build/Release/cpp_permuter.exe
examples/gta2/compile.cmd
README.md
LICENSE
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
permuter_out/
*.permuter[0-9]*.cpp
55 changes: 55 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.16)
# static MSVC runtime (CMAKE_MSVC_RUNTIME_LIBRARY): the .exe runs without the
# Visual C++ redistributable
cmake_policy(SET CMP0091 NEW)
project(cpp_permuter CXX)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

find_package(Threads REQUIRED)

add_library(permuter_core STATIC
src/lexer.cpp
src/parser.cpp
src/analysis.cpp
src/passes.cpp
src/passes_control.cpp
src/passes_more.cpp
src/scorer.cpp
src/runner.cpp
src/workspace.cpp
src/macros.cpp
src/examples.cpp
)
target_include_directories(permuter_core PUBLIC src)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(permuter_core PRIVATE -Wall -Wextra)
endif()

add_executable(cpp_permuter src/main.cpp)
target_link_libraries(cpp_permuter PRIVATE permuter_core Threads::Threads)

enable_testing()
add_executable(permuter_tests tests/tests.cpp)
target_link_libraries(permuter_tests PRIVATE permuter_core Threads::Threads)
target_compile_definitions(permuter_tests PRIVATE PERMUTER_SOURCE_DIR="${CMAKE_SOURCE_DIR}")
add_test(NAME unit COMMAND permuter_tests)
# integration: clang stand-in, runs anywhere clang and llvm-objdump are
# installed. gta2_parse and vc6 need GTA2_RE (and wine for vc6). Exit code 77
# means "skipped": the tools or the checkout aren't available here.
foreach(suite integration gta2_parse vc6)
if(suite STREQUAL "integration")
set(script run.sh)
else()
set(script ${suite}.sh)
endif()
add_test(NAME ${suite}
COMMAND ${CMAKE_COMMAND} -E env PERMUTER=$<TARGET_FILE:cpp_permuter>
sh ${CMAKE_SOURCE_DIR}/tests/integration/${script})
set_tests_properties(${suite} PROPERTIES SKIP_RETURN_CODE 77)
endforeach()
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 CriminalRETeam and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading