Got the thing to build using a vendored LLVM
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "vendor/llvm"]
|
||||
path = vendor/llvm
|
||||
url = https://github.com/llvm/llvm-project
|
||||
@@ -2,28 +2,42 @@ cmake_minimum_required(VERSION 3.10)
|
||||
project(Bluebell VERSION 0.1)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
include(FindPkgConfig)
|
||||
find_package(Boost 1.78
|
||||
COMPONENTS log)
|
||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
|
||||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/vendor/llvm/CMakeLists.txt")
|
||||
message(STATUS "Using vendored LLVM")
|
||||
set(LLVM_TARGETS_TO_BUILD "X86;ARM;AArch64")
|
||||
set(LLVM_INCLUDE_BENCHMARKS NO)
|
||||
add_subdirectory(vendor/llvm)
|
||||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/vendor/llvm/llvm/CMakeLists.txt")
|
||||
set(PATH_TO_LLVM "${CMAKE_CURRENT_LIST_DIR}/vendor/llvm/llvm")
|
||||
message(STATUS "Using vendored LLVM")
|
||||
set(LLVM_ENABLE_PROJECTS "" CACHE STRING "" FORCE)
|
||||
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "" FORCE)
|
||||
set(LLVM_BUILD_TOOLS NO CACHE BOOL "" FORCE)
|
||||
|
||||
set(LLVM_TARGETS_TO_BUILD "X86;ARM;AArch64" CACHE STRING "" FORCE)
|
||||
set(LLVM_INCLUDE_BENCHMARKS NO CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory(vendor/llvm/llvm llvm-build)
|
||||
|
||||
get_target_property(LLVM_INCLUDE_DIRS LLVMSupport INCLUDE_DIRECTORIES)
|
||||
list(APPEND CMAKE_MODULE_PATH "${PATH_TO_LLVM}/cmake/modules")
|
||||
|
||||
else()
|
||||
message(STATUS "Using system LLVM")
|
||||
find_package(LLVM 13 REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
include(AddLLVM)
|
||||
include(HandleLLVMOptions)
|
||||
endif()
|
||||
|
||||
|
||||
#pkg_check_modules(shaderc REQUIRED IMPORTED_TARGET shaderc)
|
||||
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
|
||||
|
||||
include_directories(${LLVM_INCLUDE_DIRS})
|
||||
add_definitions(${LLVM_DEFINITIONS})
|
||||
|
||||
@@ -31,10 +45,11 @@ add_executable(bluebell
|
||||
src/bluebell.cpp src/bluebell.hpp
|
||||
src/pre-compiler.cpp src/pre-compiler.hpp src/compiler.cpp src/compiler.hpp src/spv_meta.cpp src/spv_meta.hpp src/runtime.cpp src/runtime.hpp)
|
||||
|
||||
message(STATUS "Include dirs are ${LLVM_INCLUDE_DIRS}")
|
||||
#target_link_libraries(bluebell PkgConfig::shaderc)
|
||||
|
||||
#print(${LLVM_AVAILABLE_LIBS})
|
||||
llvm_map_components_to_libnames(llvm_libs core native passes nativecodegen OrcJIT)
|
||||
llvm_map_components_to_libnames(llvm_libs core native passes nativecodegen OrcJIT X86CodeGen X86Disassembler)
|
||||
|
||||
target_link_libraries(bluebell shaderc_shared Boost::boost Boost::log ${llvm_libs})
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ pkgs.clangStdenv.mkDerivation {
|
||||
|
||||
# keep this line if you use bash
|
||||
bashInteractive
|
||||
llvm_13
|
||||
#llvm_13
|
||||
shaderc
|
||||
spirv-headers
|
||||
spirv-tools
|
||||
boost178
|
||||
zlib
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <llvm/Target/TargetOptions.h>
|
||||
#include <llvm/Support/Host.h>
|
||||
#include <llvm/Support/TargetSelect.h>
|
||||
#include <llvm/Support/TargetRegistry.h>
|
||||
#include <llvm/MC/TargetRegistry.h>
|
||||
#include <llvm/IR/LegacyPassManager.h>
|
||||
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
|
||||
#include <llvm/Transforms/InstCombine/InstCombine.h>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
//
|
||||
|
||||
#include "runtime.hpp"
|
||||
|
||||
#include <llvm/IR/LegacyPassManager.h>
|
||||
#include <llvm/Pass.h>
|
||||
#include <llvm/Transforms/InstCombine/InstCombine.h>
|
||||
#include <llvm/Transforms/Scalar.h>
|
||||
#include <llvm/Transforms/Scalar/GVN.h>
|
||||
|
||||
1
vendor/llvm
vendored
Submodule
1
vendor/llvm
vendored
Submodule
Submodule vendor/llvm added at 29f1039a72
Reference in New Issue
Block a user