Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Feb 2, 2024
1 parent 9e0d51a commit d5c577e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
runs-on: ${{ matrix.os }}

name: "${{ matrix.cpp_compiler }}-${{ matrix.os }}-${{ matrix.build_type }}"
name: "${{ matrix.os }}(${{ matrix.build_type }}, LLVM: ${{ matrix.llvm_backend }})"

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
Expand All @@ -31,6 +31,7 @@ jobs:
matrix:
os: [ubuntu-latest]
build_type: [RelWithDebInfo]
llvm_backend: [ON,OFF]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-18
-DCMAKE_C_COMPILER=clang-18
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DENDO_USE_LLVM=${{ matrix.llvm_backend }}
-GNinja
-S ${{ github.workspace }}
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


option(ENDO_USE_LLVM "Use llvm as a backend for the shell" ON)

if(NOT DEFINED ENDO_TRACE_VM)
Expand Down
31 changes: 15 additions & 16 deletions src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ target_sources(Shell
ASTPrinter.cpp
IRGenerator.cpp
Parser.cpp
llvm_executor.cpp
)

find_package(Threads REQUIRED)
Expand All @@ -35,24 +34,24 @@ set(shell_libs


if(ENDO_USE_LLVM)
find_package(LLVM)
if(LLVM_FOUND)
find_package(LLVM REQUIRED)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include("${LLVM_DIR}/AddLLVM.cmake")

message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include("${LLVM_DIR}/AddLLVM.cmake")

include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs analysis core executionengine instcombine object orcjit runtimedyld scalaropts support native)
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs analysis core executionengine instcombine object orcjit runtimedyld scalaropts support native)
# Link against LLVM libraries
set(shell_libs
${shell_libs}
${llvm_libs})
set(shell_libs
${shell_libs}
${llvm_libs})

target_compile_definitions(Shell PUBLIC ENDO_USE_LLVM)
endif()
else()
target_sources(Shell
PUBLIC
FILE_SET CXX_MODULES FILES
llvm_executor.cpp)
target_compile_definitions(Shell PUBLIC ENDO_USE_LLVM)
endif()


Expand Down
11 changes: 10 additions & 1 deletion src/shell/Shell.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
module;
#include <shell/ProcessGroup.h>

#include <crispy/assert.h>
#include <crispy/utils.h>

Expand All @@ -21,7 +22,9 @@ import IRGenerator;
import Parser;
import CoreVM;

#if defined(ENDO_USE_LLVM)
import LLVMBackend;
#endif

export module Shell;

Expand Down Expand Up @@ -171,7 +174,13 @@ export class SystemEnvironment: public Environment
export class Shell final: public CoreVM::Runtime
{
public:
Shell(): Shell(RealTTY::instance(), SystemEnvironment::instance()) {}
Shell(): Shell(RealTTY::instance(), SystemEnvironment::instance())
{

#if defined(ENDO_USE_LLVM)
LLVMBackend::init();
#endif
}

Shell(TTY& tty, Environment& env): _env { env }, _tty { tty }
{
Expand Down
3 changes: 1 addition & 2 deletions src/shell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using namespace std::string_literals;

import Shell;
import LLVMBackend;


std::string_view getEnvironment(std::string_view name, std::string_view defaultValue)
{
Expand All @@ -18,7 +18,6 @@ int main(int argc, char const* argv[])

setsid();

LLVMBackend::init();

if (argc == 2)
// This here only exists for early-development debugging purposes.
Expand Down

0 comments on commit d5c577e

Please sign in to comment.