Skip to content

Commit

Permalink
Transfer from original repository
Browse files Browse the repository at this point in the history
- False positives 3
- Mac build
- Multiplatform VSIX
- Readme update
  • Loading branch information
michalbali256 committed Jan 6, 2020
1 parent 875117f commit 2271454
Show file tree
Hide file tree
Showing 78 changed files with 1,180 additions and 282 deletions.
70 changes: 70 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "/home/balmi06/HlasmPlugin/build/bin/language_server",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/library_test",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
},
{
"name": "Attach to proccess",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/build/bin/language_server",
"processId":"${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/build/bin/HlasmLanguageServer",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin/",
"environment": [],
"externalConsole": true,
"preLaunchTask": "build"
}
]
}
101 changes: 101 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"files.associations": {
"*.g4": "antlr",
"algorithm": "cpp",
"atomic": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"condition_variable": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"set": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"xthread": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"array": "cpp",
"clocale": "cpp",
"forward_list": "cpp",
"numeric": "cpp",
"valarray": "cpp",
"cctype": "cpp",
"queue": "cpp",
"string_view": "cpp",
"filesystem": "cpp",
"regex": "cpp",
"*.ipp": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"strstream": "cpp",
"*.tcc": "cpp",
"cinttypes": "cpp",
"complex": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cwctype": "cpp",
"memory_resource": "cpp",
"optional": "cpp",
"random": "cpp",
"rope": "cpp",
"future": "cpp",
"cfenv": "cpp",
"typeindex": "cpp",
"variant": "cpp",
"charconv": "cpp"
}
}
48 changes: 48 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "gen",
"type": "shell",
"command": "cmake",
"args": [
// Ask msbuild to generate full paths for file names.
"-DCMAKE_BUILD_TYPE=Debug",
"../"
],
"options": {
"cwd": "${workspaceRoot}/build"
},
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "always"
}
},
{
"dependsOn": [
"gen"
],
"label": "build",
"type": "shell",
"command": "cmake",
"args": [
// Ask msbuild to generate full paths for file names.
"--build",
"."
],
"options": {
"cwd": "${workspaceRoot}/build"
},
"group": {
"kind": "build",
"isDefault": true,
},
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "always"
}
}
]
}
74 changes: 51 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ option(WITH_LIBCXX "Building with clang++ and libc++(in Linux). To enable with:
option(WITH_STATIC_CRT "(Visual C++) Enable to statically link CRT, which avoids requiring users to install the redistribution package.
To disable with: -DWITH_STATIC_CRT=Off" On)
option(DISCOVER_TESTS "Enables CTest by executing tests and discovering test cases. To disable with: -DDISCOVER_TESTS=Off" On)

option(FS_PATH "Provide path to libc++fs for installation on MacOS" "")
option(BUILD_VSIX "When disabled, the VS Code client is not built and it is not packaged into vsix." On)

if(BUILD_SHARED_LIBS AND WITH_STATIC_CRT AND MSVC)
message(WARNING "Building shared libraries with static CRT!")
Expand All @@ -61,19 +62,6 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(WITH_LIBCXX Off)
endif()

if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_VERSION VERSION_GREATER "3.0.0")
CMAKE_POLICY(SET CMP0026 NEW)
CMAKE_POLICY(SET CMP0054 OLD)
CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD)
endif()

if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR
CMAKE_VERSION VERSION_GREATER "3.3.0")
CMAKE_POLICY(SET CMP0059 OLD)
CMAKE_POLICY(SET CMP0054 OLD)
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(PkgConfig REQUIRED)
Expand Down Expand Up @@ -131,19 +119,56 @@ if(WITH_LIBCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()

if(APPLE)
if(WITH_STATIC_CRT)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++abi ${LLVM_PATH}/lib/libc++.a")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc++abi ${LLVM_PATH}/lib/libc++.a")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib++")
endif()
endif()

if(BUILD_SHARED_LIBS)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "@executable_path")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif()
endif()

set(CMAKE_FLAGS_PASS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS})
#indicates whether we have to link filesystem library explicitly
if(UNIX AND NOT APPLE)
set(FILESYSTEM_LINK On)
if(WITH_LIBCXX)
set(FILESYSTEM_LIBRARY c++fs)
else()
set(FILESYSTEM_LIBRARY stdc++fs)
if(UNIX)
try_run(TRY_LINK_RUN_RESULT TRY_LINK_COMPILE_RESULT ${CMAKE_BINARY_DIR}/try_filesystem_link ${CMAKE_SOURCE_DIR}/cmake/try_filesystem_link.cpp
CMAKE_FLAGS ${CMAKE_FLAGS_PASS}
)

#if the program ended with non-zero or a compile error occured
if(NOT (TRY_LINK_RUN_RESULT EQUAL "0") OR NOT ${TRY_LINK_COMPILE_RESULT})
set(FILESYSTEM_LINK On)
if(APPLE)
set(FILESYSTEM_LIBRARY "${LLVM_PATH}/lib/libc++fs.a")
elseif(WITH_LIBCXX)
set(FILESYSTEM_LIBRARY c++fs)
else()
set(FILESYSTEM_LIBRARY stdc++fs)
endif()
endif()

#test filesystem setup
set(TEST_LINK_LIBS "")
if(FILESYSTEM_LINK)
set(TEST_LINK_LIBS "-DLINK_LIBRARIES=${FILESYSTEM_LIBRARY}")
endif()

try_run(TEST_LINK_RUN_RESULT TEST_LINK_COMPILE_RESULT ${CMAKE_BINARY_DIR}/try_filesystem_link_test ${CMAKE_SOURCE_DIR}/cmake/try_filesystem_link.cpp
CMAKE_FLAGS ${CMAKE_FLAGS_PASS} ${TEST_LINK_LIBS}
)

if(NOT (TEST_LINK_RUN_RESULT EQUAL "0") OR NOT ${TEST_LINK_COMPILE_RESULT})
message(FATAL_ERROR "Filesystem link error: ${CMAKE_SOURCE_DIR}/cmake/try_filesystem_link.cpp could not be compiled.")
endif()
endif()

Expand Down Expand Up @@ -209,10 +234,13 @@ include_directories(parser_library/include)
# Applications
add_subdirectory(language_server)
add_subdirectory(dummy)
add_subdirectory(clients)
add_subdirectory(benchmark)

add_dependencies(vsix language_server parser_library)
if(BUILD_VSIX)
add_subdirectory(clients)
endif()



# Installation

Expand Down
Loading

0 comments on commit 2271454

Please sign in to comment.