Add appveyor.yml

This commit is contained in:
Jonathan Müller 2017-04-20 20:33:58 +02:00
commit d1fafdaa92
10 changed files with 40 additions and 24 deletions

View file

@ -56,6 +56,9 @@ If you don't have a proper clang version installed, it can also be downloaded.
For that you need to set `LLVM_DOWNLOAD_OS_NAME`. For that you need to set `LLVM_DOWNLOAD_OS_NAME`.
This is the name of the operating system used on the [LLVM pre-built binary archive](http://releases.llvm.org/download.html#4.0.0), e.g. `x86_64-linux-gnu-ubuntu-16.10` for Ubuntu 16.10. This is the name of the operating system used on the [LLVM pre-built binary archive](http://releases.llvm.org/download.html#4.0.0), e.g. `x86_64-linux-gnu-ubuntu-16.10` for Ubuntu 16.10.
If you don't have `llvm-config`, you need to pass the locations explictly.
For that set the option `LLVM_VERSION_EXPLICIT` to the version you're using, `LIBCLANG_LIBRARY` to the location of the libclang library file, `LIBCLANG_INCLUDE_DIR` to the directory where the header files are located (so they can be included with `clang-c/Index.h`), `LIBCLANG_SYSTEM_INCLUDE_DIR` where the system header files are located (i.e. `stddef.h` etc, usually under `prefix/lib/clang/<version>/include`) and `CLANG_BINARY` to the full path of the `clang++` exectuable.
The other dependencies like [type_safe](http://type_safe.foonathan.net) are installed automatically with git submodules, if they're not installed already. The other dependencies like [type_safe](http://type_safe.foonathan.net) are installed automatically with git submodules, if they're not installed already.
If you run into any issues with the installation, please report them. If you run into any issues with the installation, please report them.

11
appveyor.yml Normal file
View file

@ -0,0 +1,11 @@
version: '{build}'
build_script:
- cmd: mkdir build\ && cd build\
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
- cmd: clang++ --version
- cmd: cmake -G"Visual Studio 14 2015 Win64" -DLLVM_VERSION_EXPLICIT=4.0.0 -DLIBCLANG_LIBRARY="C:/Program Files/LLVM/lib/libclang.lib" -DLIBCLANG_INCLUDE_DIR="C:/Program Files/LLVM/include" -DLIBCLANG_SYSTEM_INCLUDE_DIR="C:/"Program Files"/LLVM/lib/clang/4.0.0/include" -DCLANG_BINARY="C:/Program Files/LLVM/bin/clang++.exe" ../
- cmd: cmake --build . -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
test_script:
- cmd: test\Debug\cppast_test.exe

View file

@ -150,19 +150,16 @@ function(_cppast_find_libclang config_tool min_version force)
endif() endif()
endfunction() endfunction()
# create libclang target
# target: _cppast_libclang
function(_cppast_create_libclang_target library_path include_path)
add_library(_cppast_libclang SHARED IMPORTED)
set_target_properties(_cppast_libclang PROPERTIES
IMPORTED_LOCATION ${library_path}
INTERFACE_INCLUDE_DIRECTORIES ${include_path})
endfunction()
set(llvm_min_version 3.9.1) set(llvm_min_version 3.9.1)
set(LLVM_PREFERRED_VERSION 4.0.0 CACHE STRING "the preferred LLVM version") set(LLVM_PREFERRED_VERSION 4.0.0 CACHE STRING "the preferred LLVM version")
if(NOT LLVM_CONFIG_BINARY) if(DEFINED LLVM_VERSION_EXPLICIT)
if(LLVM_VERSION_EXPLICIT VERSION_LESS llvm_min_version)
message(FATAL_ERROR "Outdated LLVM version ${LLVM_VERSION_EXPLICIT}, minimal supported is ${llvm_min_version}")
endif()
set(LLVM_VERSION ${LLVM_VERSION_EXPLICIT} CACHE INTERNAL "")
message(STATUS "Using manually specified LLVM version ${LLVM_VERSION}")
elseif(NOT LLVM_CONFIG_BINARY)
if(DEFINED LLVM_DOWNLOAD_OS_NAME) if(DEFINED LLVM_DOWNLOAD_OS_NAME)
_cppast_download_llvm(${LLVM_PREFERRED_VERSION} ${LLVM_DOWNLOAD_OS_NAME}) _cppast_download_llvm(${LLVM_PREFERRED_VERSION} ${LLVM_DOWNLOAD_OS_NAME})
endif() endif()
@ -172,4 +169,10 @@ else()
_cppast_find_libclang(${LLVM_CONFIG_BINARY} ${llvm_min_version} 0) _cppast_find_libclang(${LLVM_CONFIG_BINARY} ${llvm_min_version} 0)
endif() endif()
_cppast_create_libclang_target(${LIBCLANG_LIBRARY} ${LIBCLANG_INCLUDE_DIR}) add_library(_cppast_libclang INTERFACE)
target_link_libraries(_cppast_libclang INTERFACE ${LIBCLANG_LIBRARY})
target_include_directories(_cppast_libclang INTERFACE ${LIBCLANG_INCLUDE_DIR})
target_compile_definitions(_cppast_libclang INTERFACE
CPPAST_LIBCLANG_SYSTEM_INCLUDE_DIR="${LIBCLANG_SYSTEM_INCLUDE_DIR}"
CPPAST_CLANG_BINARY="${CLANG_BINARY}"
CPPAST_CLANG_VERSION_STRING="${LLVM_VERSION}")

View file

@ -109,19 +109,13 @@ namespace cppast
using token_seq = detail::semantic_string_view<struct token_seq_tag>; using token_seq = detail::semantic_string_view<struct token_seq_tag>;
/// Tag type to represent an end-of-line character. /// Tag type to represent an end-of-line character.
constexpr struct newl_t const struct newl_t
{ {
constexpr newl_t() noexcept
{
}
} newl; } newl;
/// Tag type to represent a single space character. /// Tag type to represent a single space character.
constexpr struct whitespace_t const struct whitespace_t
{ {
constexpr whitespace_t() noexcept
{
}
} whitespace; } whitespace;
/// Base class to control the code generation. /// Base class to control the code generation.

View file

@ -54,7 +54,7 @@ namespace cppast
/// \notes This may include template parameters. /// \notes This may include template parameters.
std::string semantic_scope() const noexcept std::string semantic_scope() const noexcept
{ {
return semantic_parent_.map(&cpp_entity_ref::name).value_or(""); return type_safe::copy(semantic_parent_.map(&cpp_entity_ref::name)).value_or("");
} }
protected: protected:

View file

@ -101,9 +101,6 @@ add_library(cppast ${detail_header} ${header} ${source} ${libclang_source})
target_include_directories(cppast PUBLIC ../include) target_include_directories(cppast PUBLIC ../include)
target_link_libraries(cppast PUBLIC type_safe _cppast_tiny_process _cppast_libclang) target_link_libraries(cppast PUBLIC type_safe _cppast_tiny_process _cppast_libclang)
target_compile_definitions(cppast PUBLIC target_compile_definitions(cppast PUBLIC
CPPAST_LIBCLANG_SYSTEM_INCLUDE_DIR="${LIBCLANG_SYSTEM_INCLUDE_DIR}"
CPPAST_CLANG_BINARY="${CLANG_BINARY}"
CPPAST_CLANG_VERSION_STRING="${LLVM_VERSION}"
CPPAST_VERSION_STRING="${cppast_VERSION}") CPPAST_VERSION_STRING="${cppast_VERSION}")
if(CPPAST_ENABLE_ASSERTIONS) if(CPPAST_ENABLE_ASSERTIONS)
target_compile_definitions(cppast PUBLIC CPPAST_ENABLE_ASSERTIONS) target_compile_definitions(cppast PUBLIC CPPAST_ENABLE_ASSERTIONS)

View file

@ -28,7 +28,10 @@ namespace cppast
return CXChildVisit_Recurse; return CXChildVisit_Recurse;
}; };
clang_visitChildren(parent, recurse ? recurse_lambda : continue_lambda, &f); if (recurse)
clang_visitChildren(parent, recurse_lambda, &f);
else
clang_visitChildren(parent, continue_lambda, &f);
} }
// visits a translation unit // visits a translation unit

View file

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
#include <cctype>
#include <process.hpp> #include <process.hpp>

View file

@ -4,6 +4,8 @@
#include "tokenizer.hpp" #include "tokenizer.hpp"
#include <cctype>
#include "libclang_visitor.hpp" #include "libclang_visitor.hpp"
#include "parse_error.hpp" #include "parse_error.hpp"

View file

@ -4,6 +4,8 @@
#include "parse_functions.hpp" #include "parse_functions.hpp"
#include <cctype>
#include <cppast/cpp_array_type.hpp> #include <cppast/cpp_array_type.hpp>
#include <cppast/cpp_decltype_type.hpp> #include <cppast/cpp_decltype_type.hpp>
#include <cppast/cpp_expression.hpp> #include <cppast/cpp_expression.hpp>