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
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
software-properties-common fish

RUN add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
clang-19 clang++-19 llvm-19-dev libmlir-19-dev mlir-19-tools \
rake python3-pip libzstd-dev

RUN pip install lit filecheck==0.0.24 pre-commit --break-system-packages
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Lightstorm",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
// Switch to the "official" version as soon as
// https://github.com/devcontainers-community/features-cmake/pull/2
// merged
"ghcr.io/alexdenisov/features/feature-cmake": {
"version": "3.29.3"
}
},
"postCreateCommand": "sh .devcontainer/post_create.sh"
}
4 changes: 4 additions & 0 deletions .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -e

pre-commit install
git submodule update --init --recursive
22 changes: 22 additions & 0 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Linux CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: devcontainers/[email protected]
with:
imageName: ghcr.io/dragonruby/internal-lightstorm-ci
runCmd: |
cmake --preset lightstorm
cmake --build ./build.debug.dir/build -t run-integration-tests
8 changes: 2 additions & 6 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ on:
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
build-and-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Output
build*dir
*.lit_test_times.txt
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "third_party/mruby"]
path = third_party/mruby
url = git@github.com:mruby/mruby.git
url = https://github.com/mruby/mruby.git
19 changes: 19 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 8,
"configurePresets": [
{
"name": "lightstorm",
"displayName": "lightstorm",
"description": "Sets Ninja generator, build and install directory",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build.debug.dir/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang-19",
"CMAKE_CXX_COMPILER": "clang++-19",
"CMAKE_PREFIX_PATH": "/usr/lib/llvm-19/lib/cmake",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build.debug.dir/install"
}
}
]
}
6 changes: 4 additions & 2 deletions cmake/mruby.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ ExternalProject_Add(
mruby
SOURCE_DIR ${MRUBY_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E env CFLAGS="${LIGHTSTORM_CFLAGS}"
LDFLAGS="${LIGHTSTORM_CFLAGS}" rake all --verbose
BUILD_COMMAND
${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CPP=${CMAKE_CXX_COMPILER}
CFLAGS="${LIGHTSTORM_CFLAGS}" LDFLAGS="${LIGHTSTORM_CFLAGS}" rake all
--verbose
BUILD_IN_SOURCE ON
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${MRUBY_STATIC} ${MRUBY_BINARY} ${MRBC_BINARY}
Expand Down
3 changes: 2 additions & 1 deletion lib/conversion/c_conversion.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "lightstorm/conversion/conversion.h"
#include "lightstorm/dialect/rite.h"
#include <ctype.h>
#include <mlir/Conversion/ArithToEmitC/ArithToEmitC.h>
#include <mlir/Conversion/FuncToEmitC/FuncToEmitC.h>
#include <mlir/Dialect/Arith/IR/Arith.h>
Expand Down Expand Up @@ -55,7 +56,7 @@ static std::string cCompatibleSymName(const std::string &sym) {
std::string s;
std::stringstream ss(s);
for (auto c : sym) {
if (isalpha(c) || isnumber(c)) {
if (isalpha(c) || isdigit(c)) {
ss << c;
continue;
}
Expand Down
1 change: 1 addition & 0 deletions lib/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ target_include_directories(
${CMAKE_SOURCE_DIR}/third_party/mruby/build/host/include)
target_compile_options(lightstorm_runtime_main PRIVATE ${LIGHTSTORM_CFLAGS})
target_link_options(lightstorm_runtime_main PRIVATE ${LIGHTSTORM_CFLAGS})
target_link_libraries(lightstorm_runtime_main PUBLIC m)
add_dependencies(lightstorm_runtime_main mruby_static)
2 changes: 1 addition & 1 deletion tests/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function(add_bench_executable ruby)
PRIVATE ${CMAKE_SOURCE_DIR}/third_party/mruby/include
${CMAKE_SOURCE_DIR}/third_party/mruby/build/host/include)
target_compile_options(${target_name} PRIVATE -g)
target_link_libraries(${target_name} PRIVATE mruby_static)
target_link_libraries(${target_name} PRIVATE mruby_static m)
add_dependencies(${target_name} mruby_static)
endfunction()

Expand Down