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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- "**"
- "!main"
pull_request:
branches:
- "**"

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget lsb-release software-properties-common gnupg catch2

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22

echo "LLVM_DIR=/usr/lib/llvm-22/lib/cmake/llvm" >> $GITHUB_ENV

- name: Build and Test
run: |
cmake .
make
./bin/tests
74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.31.6)

project(alpha)


set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include_directories(${CMAKE_SOURCE_DIR}/src)

find_package(LLVM REQUIRED CONFIG)

add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs
core
support
irreader
codegen
asmprinter
target
native
TargetParser
)


file(GLOB_RECURSE ALL_SRC_CPP CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
list(FILTER ALL_SRC_CPP EXCLUDE REGEX ".*main\\.cpp$")

file(GLOB_RECURSE ALL_SRC_HPP CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")

add_library(alpha_lib STATIC ${ALL_SRC_CPP} ${ALL_SRC_HPP})

target_include_directories(alpha_lib PUBLIC
${CMAKE_SOURCE_DIR}/src
${LLVM_INCLUDE_DIRS}
)
target_link_libraries(alpha_lib PUBLIC ${llvm_libs})

# Main compiler

add_executable(main src/main.cpp)

target_link_libraries(main PRIVATE alpha_lib)

set_target_properties(main PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
)

# Tests
find_package(Catch2 3 REQUIRED)

enable_testing()
file(GLOB_RECURSE ALL_TEST_CPP CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp")


add_executable(tests
${ALL_TEST_CPP}
)

target_link_libraries(tests PRIVATE
alpha_lib
Catch2::Catch2WithMain
)

get_target_property(Catch2_INCLUDE_DIR Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(tests PRIVATE ${Catch2_INCLUDE_DIR})

include(Catch)
catch_discover_tests(tests)

set_target_properties(tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
)
1 change: 1 addition & 0 deletions src/syntax_analyser/statement/addition/addition.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <memory>

#include "syntax_analyser/statement/statement.hpp"
#include "syntax_analyser/statement/value/identifier/identifier.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/syntax_analyser/statement/print/print.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include <memory>

#include "syntax_analyser/statement/assignment/assignment_type.hpp"
#include "syntax_analyser/statement/statement.hpp"
#include "syntax_analyser/statement/value/identifier/identifier.hpp"
#include "syntax_analyser/statement/value/value.hpp"

class PrintStatement : public Statement {
public:
Expand Down
Loading