Skip to content

Commit

Permalink
meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Apr 4, 2024
1 parent ece8cfd commit 50f0828
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 20 deletions.
Empty file.
Empty file.
10 changes: 0 additions & 10 deletions offlineASL-cpp/cmake/llvm.cmake

This file was deleted.

8 changes: 0 additions & 8 deletions offlineASL-cpp/cmake/prelude.cmake

This file was deleted.

6 changes: 6 additions & 0 deletions offlineASL-cpp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project('offlineasl', 'cpp',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20'])

subproject('aslp-lifter-gen')
subproject('aslp-lifter-instantiate')
14 changes: 14 additions & 0 deletions offlineASL-cpp/subprojects/aslp-lifter-gen/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
project('aslp-lifter-gen', 'cpp',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20'])

incdir = 'include'

install_subdir(incdir, install_dir : get_option('includedir'), strip_directory : true)
dep = declare_dependency(include_directories : incdir)

pkg = import('pkgconfig')
pkg.generate(
name: meson.project_name(),
description: 'offline asl lifter library (template headers)',
subdirs: 'aslp')
22 changes: 22 additions & 0 deletions offlineASL-cpp/subprojects/aslp-lifter-instantiate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.20)

project(offlineasl)

include(../cmake/prelude.cmake)
include(../cmake/llvm.cmake)

### aslp-lifter-llvm ###
# instantiates the aslp-lifter with a LLVM target

pkg_check_modules(aslp-lifter-gen REQUIRED aslp-lifter-gen)

file(GLOB GEN_INSTANTIATE src/generated/*.cpp)
add_library(aslp-lifter-llvm ${GEN_INSTANTIATE})
target_include_directories(aslp-lifter-llvm PUBLIC include)

target_link_libraries(aslp-lifter-llvm ${aslp-lifter-gen_LIBRARIES})
target_include_directories(aslp-lifter-llvm PUBLIC ${aslp-lifter-gen_INCLUDE_DIRS})
target_compile_options(aslp-lifter-llvm PUBLIC ${aslp-lifter-gen_CFLAGS_OTHER})

target_compile_options(aslp-lifter-llvm PRIVATE "-includellvm_lifter_traits.hpp")
target_compile_definitions(aslp-lifter-llvm PRIVATE "ASLP_LIFTER_INSTANTIATE=llvm_lifter_traits")
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <memory>
#include <variant>

#include "interface.hpp"
#include <aslp/interface.hpp>
#include "llvm_lifter_traits.hpp"

namespace aslp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <interface.hpp>
#include <aslp/interface.hpp>

#include <llvm/ADT/APInt.h>
#include <llvm/IR/IRBuilder.h>
Expand Down
32 changes: 32 additions & 0 deletions offlineASL-cpp/subprojects/aslp-lifter-instantiate/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project('aslp-lifter-instantiate', 'cpp',
version : '0.1',
default_options : [ 'warning_level=3', 'cpp_std=c++20' ])

llvm_dep = dependency('llvm')

gen_name = 'aslp-lifter-gen'
gen_proj = subproject(gen_name, version: meson.project_version())
gen_dep = gen_proj.get_variable('dep')
# gen_pc = gen_proj.get_variable('pc')

incdir = 'include'
install_subdir(incdir, install_dir : get_option('includedir'), strip_directory : true)

find = run_command('find', 'src', '-name', '*.cpp', check : true)
srcfiles = find.stdout().strip().split('\n')[0] # XXX for meson testing

lib = library(
'aslp-lifter-instantiate',
srcfiles,
include_directories : incdir,
dependencies: [ llvm_dep, gen_dep ],
cpp_args: [
'-Wno-unused-parameter',
'-includeaslp/llvm_lifter_traits.hpp',
'-DASLP_LIFTER_INSTANTIATE=llvm_lifter_traits'],
install : true)

dep = declare_dependency(link_with: lib, dependencies: gen_dep)

pkg = import('pkgconfig')
pkg.generate(lib, subdirs: 'aslp', requires: gen_name)

0 comments on commit 50f0828

Please sign in to comment.