Skip to content

Commit 4bbee67

Browse files
committed
Walking skeleton
0 parents  commit 4bbee67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1264
-0
lines changed

.clang-format

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
BasedOnStyle: LLVM
3+
Cpp11BracedListStyle: false
4+
AllowShortBlocksOnASingleLine: false
5+
AllowShortFunctionsOnASingleLine: Empty
6+
AllowShortLoopsOnASingleLine: false
7+
BinPackArguments: false
8+
ColumnLimit: 100

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target/*
2+
!target/.gitkeep

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "vendor/spdlog"]
2+
path = vendor/spdlog
3+
url = https://github.com/gabime/spdlog.git
4+
[submodule "vendor/LibEBC"]
5+
path = vendor/LibEBC
6+
url = https://github.com/AlexDenisov/LibEBC.git

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## [0.0.0] - 20 Feb 2020
2+
3+
- Walking skeleton

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
project(llvm2graphml
4+
VERSION 0.1.0
5+
LANGUAGES C CXX
6+
)
7+
8+
include(${CMAKE_CURRENT_LIST_DIR}/build-system/build-system.cmake)
9+
10+
add_subdirectory(src)
11+
add_subdirectory(tests)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# llvm2graphml
2+
3+
TODO

build-system/build-system.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
set (CMAKE_CXX_STANDARD 14)
2+
set (CMAKE_CXX_STANDARD_REQUIRED ON)
3+
set (CMAKE_CXX_EXTENSIONS OFF)
4+
5+
include(${CMAKE_CURRENT_LIST_DIR}/vendor/vendor.cmake)
6+
7+
set (LLVM2GRAPHML_INCLUDE_DIRS
8+
${CMAKE_SOURCE_DIR}/include
9+
)
10+
11+
set (LLVM2GRAPHML_CXX_FLAGS
12+
-std=c++14
13+
-Wall
14+
-Werror
15+
-fno-exceptions
16+
-fvisibility=hidden
17+
-fvisibility-inlines-hidden
18+
-fno-rtti
19+
)
20+
21+
include(${CMAKE_CURRENT_LIST_DIR}/version.cmake)

build-system/vendor/libebc.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(vendor/LibEBC)

build-system/vendor/llvm.cmake

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
if (NOT PATH_TO_LLVM)
2+
message(FATAL_ERROR "
3+
The cmake is supposed to be called with PATH_TO_LLVM pointing to
4+
a precompiled version of LLVM or to to the source code of LLVM
5+
Examples:
6+
cmake -G \"${CMAKE_GENERATOR}\" -DPATH_TO_LLVM=/opt/llvm-3.9.0 ${CMAKE_SOURCE_DIR}
7+
cmake -G \"${CMAKE_GENERATOR}\" -DPATH_TO_LLVM=/opt/llvm/source ${CMAKE_SOURCE_DIR}
8+
")
9+
endif()
10+
11+
if (NOT IS_ABSOLUTE ${PATH_TO_LLVM})
12+
# Convert relative path to absolute path
13+
get_filename_component(PATH_TO_LLVM
14+
"${PATH_TO_LLVM}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
15+
endif()
16+
17+
set (BUILD_AGAINST_PRECOMPILED_LLVM TRUE)
18+
if (EXISTS ${PATH_TO_LLVM}/CMakeLists.txt)
19+
set (BUILD_AGAINST_PRECOMPILED_LLVM FALSE)
20+
endif()
21+
22+
if (${BUILD_AGAINST_PRECOMPILED_LLVM})
23+
set (search_paths
24+
${PATH_TO_LLVM}
25+
${PATH_TO_LLVM}/lib/cmake
26+
${PATH_TO_LLVM}/lib/cmake/llvm
27+
${PATH_TO_LLVM}/lib/cmake/clang
28+
${PATH_TO_LLVM}/share/clang/cmake/
29+
${PATH_TO_LLVM}/share/llvm/cmake/
30+
)
31+
32+
find_package(LLVM REQUIRED CONFIG PATHS ${search_paths} NO_DEFAULT_PATH)
33+
else()
34+
macro(get_llvm_version_component input component)
35+
string(REGEX MATCH "${component} ([0-9]+)" match ${input})
36+
if (NOT match)
37+
message(FATAL_ERROR "Cannot find LLVM version component '${component}'")
38+
endif()
39+
set (${component} ${CMAKE_MATCH_1})
40+
endmacro()
41+
42+
file(READ ${PATH_TO_LLVM}/CMakeLists.txt LLVM_CMAKELISTS)
43+
get_llvm_version_component("${LLVM_CMAKELISTS}" LLVM_VERSION_MAJOR)
44+
get_llvm_version_component("${LLVM_CMAKELISTS}" LLVM_VERSION_MINOR)
45+
get_llvm_version_component("${LLVM_CMAKELISTS}" LLVM_VERSION_PATCH)
46+
set (LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
47+
48+
if (LIBIRM_BUILD_32_BITS)
49+
set (LLVM_BUILD_32_BITS ON CACHE BOOL "Forcing LLVM to be built for 32 bits as well" FORCE)
50+
endif()
51+
set (LLVM_ENABLE_PROJECTS "llvm" CACHE BOOL "Don't build anything besides LLVM core" FORCE)
52+
set (LLVM_TARGETS_TO_BUILD "host" CACHE STRING "Don't build " FORCE)
53+
54+
add_subdirectory(${PATH_TO_LLVM} llvm-build-dir)
55+
56+
# Normally, include paths provided by LLVMConfig.cmake
57+
# In this case we can 'steal' them from real targets
58+
get_target_property(LLVM_INCLUDE_DIRS LLVMSupport INCLUDE_DIRECTORIES)
59+
list(REMOVE_DUPLICATES LLVM_INCLUDE_DIRS)
60+
endif()

build-system/vendor/spdlog.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/spdlog)

0 commit comments

Comments
 (0)