Add devtools utility set
This commit is contained in:
parent
628598ad8b
commit
5508a8e3c3
|
@ -0,0 +1,93 @@
|
|||
# Serene Programming Language
|
||||
#
|
||||
# Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if (SERENE_ENABLE_DEVTOOLS)
|
||||
|
||||
add_executable(slir-lsp-server slir-lsp-server.cpp)
|
||||
add_executable(Serene::SLIR::LSP ALIAS slir-lsp-server)
|
||||
|
||||
set_target_properties(slir-lsp-server PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
# Warn on unused libs
|
||||
LINK_WHAT_YOU_USE TRUE
|
||||
|
||||
# LTO support
|
||||
INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
if(SERENE_ENABLE_TIDY)
|
||||
set_target_properties(slir-lsp-server PROPERTIES CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
|
||||
endif()
|
||||
|
||||
if (CPP_20_SUPPORT)
|
||||
target_compile_features(slir-lsp-server PRIVATE cxx_std_20)
|
||||
else()
|
||||
target_compile_features(slir-lsp-server PRIVATE cxx_std_17)
|
||||
endif()
|
||||
|
||||
|
||||
target_link_libraries(slir-lsp-server
|
||||
PRIVATE
|
||||
Serene::lib
|
||||
MLIRLspServerLib
|
||||
)
|
||||
|
||||
target_include_directories(slir-lsp-server PRIVATE ${PROJECT_BINARY_DIR})
|
||||
target_include_directories(slir-lsp-server PRIVATE ${INCLUDE_DIR})
|
||||
|
||||
install(TARGETS slir-lsp-server
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
|
||||
# ========
|
||||
# slir-opt
|
||||
# ========
|
||||
add_executable(slir-opt slir-opt.cpp)
|
||||
add_executable(Serene::SLIR::Opt ALIAS slir-opt)
|
||||
|
||||
set_target_properties(slir-opt PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
# Warn on unused libs
|
||||
LINK_WHAT_YOU_USE TRUE
|
||||
|
||||
# LTO support
|
||||
INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
if(SERENE_ENABLE_TIDY)
|
||||
set_target_properties(slir-opt PROPERTIES CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
|
||||
endif()
|
||||
|
||||
if (CPP_20_SUPPORT)
|
||||
target_compile_features(slir-opt PRIVATE cxx_std_20)
|
||||
else()
|
||||
target_compile_features(slir-opt PRIVATE cxx_std_17)
|
||||
endif()
|
||||
|
||||
|
||||
target_link_libraries(slir-opt
|
||||
PRIVATE
|
||||
Serene::lib
|
||||
MLIROptLib
|
||||
)
|
||||
|
||||
target_include_directories(slir-opt PRIVATE ${PROJECT_BINARY_DIR})
|
||||
target_include_directories(slir-opt PRIVATE ${INCLUDE_DIR})
|
||||
|
||||
install(TARGETS slir-opt
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
endif()
|
|
@ -0,0 +1,31 @@
|
|||
/* -*- C++ -*-
|
||||
* Serene Programming Language
|
||||
*
|
||||
* Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "serene/slir/dialect.h"
|
||||
|
||||
#include <mlir/IR/Dialect.h>
|
||||
#include <mlir/Tools/mlir-lsp-server/MlirLspServerMain.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mlir::DialectRegistry registry;
|
||||
registry.insert<serene::slir::SereneDialect>();
|
||||
|
||||
// TODO: Register passes here
|
||||
return static_cast<int>(
|
||||
mlir::failed(mlir::MlirLspServerMain(argc, argv, registry)));
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* -*- C++ -*-
|
||||
* Serene Programming Language
|
||||
*
|
||||
* Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "serene/slir/dialect.h"
|
||||
|
||||
#include <mlir/IR/Dialect.h>
|
||||
#include <mlir/Tools/mlir-opt/MlirOptMain.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mlir::DialectRegistry registry;
|
||||
registry.insert<serene::slir::SereneDialect>();
|
||||
|
||||
// TODO: Register passes here
|
||||
return static_cast<int>(
|
||||
mlir::failed(mlir::MlirOptMain(argc, argv, registry)));
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module @some.ns {
|
||||
%1 = "serene.define"{}()
|
||||
}
|
Loading…
Reference in New Issue