mirror of https://github.com/libAthena/athena.git
Conformance with LLVM 3.9
This commit is contained in:
parent
ca09f732ba
commit
d9a03aa69c
|
@ -44,12 +44,14 @@ set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_BASE}/include
|
||||||
CACHE PATH "Clang include dir" FORCE)
|
CACHE PATH "Clang include dir" FORCE)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
list(APPEND PLAT_LIBS z pthread curses)
|
list(APPEND PLAT_LIBS z pthread curses)
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
list(APPEND PLAT_LIBS dl)
|
list(APPEND PLAT_LIBS dl)
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
list(APPEND PLAT_LIBS dl)
|
list(APPEND PLAT_LIBS dl)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(WIN32)
|
||||||
|
list(APPEND PLAT_LIBS Mincore)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Offer the user the choice of overriding the installation directories
|
# Offer the user the choice of overriding the installation directories
|
||||||
|
@ -83,7 +85,7 @@ include_directories(${LLVM_INCLUDE_DIRS})
|
||||||
link_directories(${LLVM_LIBRARY_DIRS})
|
link_directories(${LLVM_LIBRARY_DIRS})
|
||||||
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
||||||
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
||||||
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
||||||
"INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR};__STDC_LIMIT_MACROS=1;__STDC_CONSTANT_MACROS=1")
|
"INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR};__STDC_LIMIT_MACROS=1;__STDC_CONSTANT_MACROS=1")
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_target_properties(atdna PROPERTIES
|
set_target_properties(atdna PROPERTIES
|
||||||
|
@ -133,7 +135,7 @@ install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||||
#########
|
#########
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
||||||
"-I${ATHENA_INCLUDE_DIR}" -isystem "${CLANG_INCLUDE_DIR}"
|
"-I${ATHENA_INCLUDE_DIR}" -isystem "${CLANG_INCLUDE_DIR}"
|
||||||
${CMAKE_SOURCE_DIR}/test.hpp)
|
${CMAKE_SOURCE_DIR}/test.hpp)
|
||||||
|
|
||||||
|
@ -185,7 +187,7 @@ macro(atdna out)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Make target
|
# Make target
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out} ${cdefcli} ${inccli} "-I${ATHENA_INCLUDE_DIR}"
|
ARGS ${extraargs} -o ${out} ${cdefcli} ${inccli} "-I${ATHENA_INCLUDE_DIR}"
|
||||||
-isystem "${CLANG_INCLUDE_DIR}" ${ins}
|
-isystem "${CLANG_INCLUDE_DIR}" ${ins}
|
||||||
DEPENDS ${ins} COMMENT "Generating DNA ${out}")
|
DEPENDS ${ins} COMMENT "Generating DNA ${out}")
|
||||||
|
|
|
@ -33,7 +33,8 @@ if(WIN32)
|
||||||
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(llvm_config_names llvm-config-3.8 llvm-config38
|
set(llvm_config_names llvm-config-3.9 llvm-config39
|
||||||
|
llvm-config-3.8 llvm-config38
|
||||||
llvm-config-3.7 llvm-config37
|
llvm-config-3.7 llvm-config37
|
||||||
llvm-config-3.6 llvm-config36
|
llvm-config-3.6 llvm-config36
|
||||||
llvm-config-3.5 llvm-config35
|
llvm-config-3.5 llvm-config35
|
||||||
|
@ -54,7 +55,9 @@ if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
|
||||||
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
||||||
endif()
|
endif()
|
||||||
# We incorporate the CMake features provided by LLVM:
|
# We incorporate the CMake features provided by LLVM:
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||||
|
"${LLVM_ROOT_DIR}/share/llvm/cmake"
|
||||||
|
"${LLVM_ROOT_DIR}/lib/cmake/llvm")
|
||||||
include(LLVMConfig)
|
include(LLVMConfig)
|
||||||
# Set properties
|
# Set properties
|
||||||
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
||||||
|
|
|
@ -2323,22 +2323,22 @@ public:
|
||||||
|
|
||||||
class ATDNAConsumer : public clang::ASTConsumer
|
class ATDNAConsumer : public clang::ASTConsumer
|
||||||
{
|
{
|
||||||
|
std::unique_ptr<StreamOut> fileOut;
|
||||||
ATDNAEmitVisitor emitVisitor;
|
ATDNAEmitVisitor emitVisitor;
|
||||||
StreamOut& fileOut;
|
|
||||||
public:
|
public:
|
||||||
explicit ATDNAConsumer(clang::ASTContext& context, StreamOut& fo)
|
explicit ATDNAConsumer(clang::ASTContext& context, std::unique_ptr<StreamOut>&& fo)
|
||||||
: emitVisitor(context, fo),
|
: fileOut(std::move(fo)),
|
||||||
fileOut(fo) {}
|
emitVisitor(context, *fileOut) {}
|
||||||
void HandleTranslationUnit(clang::ASTContext& context)
|
void HandleTranslationUnit(clang::ASTContext& context)
|
||||||
{
|
{
|
||||||
/* Write file head */
|
/* Write file head */
|
||||||
fileOut << "/* Auto generated atdna implementation */\n"
|
*fileOut << "/* Auto generated atdna implementation */\n"
|
||||||
"#include <athena/Global.hpp>\n"
|
"#include <athena/Global.hpp>\n"
|
||||||
"#include <athena/IStreamReader.hpp>\n"
|
"#include <athena/IStreamReader.hpp>\n"
|
||||||
"#include <athena/IStreamWriter.hpp>\n\n";
|
"#include <athena/IStreamWriter.hpp>\n\n";
|
||||||
for (const std::string& inputf : InputFilenames)
|
for (const std::string& inputf : InputFilenames)
|
||||||
fileOut << "#include \"" << inputf << "\"\n";
|
*fileOut << "#include \"" << inputf << "\"\n";
|
||||||
fileOut << "\n";
|
*fileOut << "\n";
|
||||||
|
|
||||||
/* Emit file */
|
/* Emit file */
|
||||||
emitVisitor.TraverseDecl(context.getTranslationUnitDecl());
|
emitVisitor.TraverseDecl(context.getTranslationUnitDecl());
|
||||||
|
@ -2352,13 +2352,20 @@ public:
|
||||||
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance& compiler,
|
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance& compiler,
|
||||||
llvm::StringRef /*filename*/)
|
llvm::StringRef /*filename*/)
|
||||||
{
|
{
|
||||||
StreamOut* fileout;
|
std::unique_ptr<StreamOut> fileout;
|
||||||
|
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9)
|
||||||
if (OutputFilename.size())
|
if (OutputFilename.size())
|
||||||
fileout = compiler.createOutputFile(OutputFilename, false, true, "", "", true);
|
fileout = compiler.createOutputFile(OutputFilename, false, true, "", "", true);
|
||||||
else
|
else
|
||||||
fileout = compiler.createDefaultOutputFile(false, "a", "cpp");
|
fileout = compiler.createDefaultOutputFile(false, "a", "cpp");
|
||||||
|
#else
|
||||||
|
if (OutputFilename.size())
|
||||||
|
fileout.reset(compiler.createOutputFile(OutputFilename, false, true, "", "", true));
|
||||||
|
else
|
||||||
|
fileout.reset(compiler.createDefaultOutputFile(false, "a", "cpp"));
|
||||||
|
#endif
|
||||||
AthenaError = compiler.getASTContext().getDiagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error, "Athena error: %0");
|
AthenaError = compiler.getASTContext().getDiagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error, "Athena error: %0");
|
||||||
return std::unique_ptr<clang::ASTConsumer>(new ATDNAConsumer(compiler.getASTContext(), *fileout));
|
return std::unique_ptr<clang::ASTConsumer>(new ATDNAConsumer(compiler.getASTContext(), std::move(fileout)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2372,9 +2379,6 @@ int main(int argc, const char** argv)
|
||||||
"-fsyntax-only",
|
"-fsyntax-only",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-D__atdna__=1",
|
"-D__atdna__=1",
|
||||||
#if _WIN32
|
|
||||||
"-D__is_assignable(a,b)=false", /* HACK HACKITY HACK HACK: Microsoft, play nice with the other kids*/
|
|
||||||
#endif
|
|
||||||
"-I" XSTR(INSTALL_PREFIX) "/lib/clang/" CLANG_VERSION_STRING "/include",
|
"-I" XSTR(INSTALL_PREFIX) "/lib/clang/" CLANG_VERSION_STRING "/include",
|
||||||
"-I" XSTR(INSTALL_PREFIX) "/include/Athena"};
|
"-I" XSTR(INSTALL_PREFIX) "/include/Athena"};
|
||||||
for (int a=1 ; a<argc ; ++a)
|
for (int a=1 ; a<argc ; ++a)
|
||||||
|
|
|
@ -17,8 +17,8 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Jackoalan / Antidote"
|
VALUE "CompanyName", "Jackoalan / Antidote"
|
||||||
VALUE "FileDescription", "ATDNA"
|
VALUE "FileDescription", "ATDNA"
|
||||||
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2015 Jackoalan / Antidote"
|
VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote"
|
||||||
VALUE "InternalName", "atdna"
|
VALUE "InternalName", "atdna"
|
||||||
VALUE "OriginalFilename", "atdna.exe"
|
VALUE "OriginalFilename", "atdna.exe"
|
||||||
VALUE "ProductName", "ATDNA"
|
VALUE "ProductName", "ATDNA"
|
||||||
|
|
Loading…
Reference in New Issue