Add proper build system

This commit is contained in:
Jonathan Müller 2017-04-02 18:37:57 +02:00
commit e10a41fea8
14 changed files with 331 additions and 9 deletions

100
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,100 @@
# Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
# This file is subject to the license terms in the LICENSE file
# found in the top-level directory of this distribution.
set(detail_header
../include/cppast/detail/assert.hpp
../include/cppast/detail/intrusive_list.hpp)
set(header
../include/cppast/code_generator.hpp
../include/cppast/compile_config.hpp
../include/cppast/cpp_alias_template.hpp
../include/cppast/cpp_array_type.hpp
../include/cppast/cpp_class.hpp
../include/cppast/cpp_class_template.hpp
../include/cppast/cpp_decltype_type.hpp
../include/cppast/cpp_entity.hpp
../include/cppast/cpp_entity.hpp
../include/cppast/cpp_entity_container.hpp
../include/cppast/cpp_entity_index.hpp
../include/cppast/cpp_entity_kind.hpp
../include/cppast/cpp_entity_ref.hpp
../include/cppast/cpp_enum.hpp
../include/cppast/cpp_expression.hpp
../include/cppast/cpp_file.hpp
../include/cppast/cpp_forward_declarable.hpp
../include/cppast/cpp_function.hpp
../include/cppast/cpp_function_template.hpp
../include/cppast/cpp_function_type.hpp
../include/cppast/cpp_language_linkage.hpp
../include/cppast/cpp_member_function.hpp
../include/cppast/cpp_member_variable.hpp
../include/cppast/cpp_namespace.hpp
../include/cppast/cpp_preprocessor.hpp
../include/cppast/cpp_storage_class_specifiers.hpp
../include/cppast/cpp_template.hpp
../include/cppast/cpp_template_parameter.hpp
../include/cppast/cpp_type.hpp
../include/cppast/cpp_type_alias.hpp
../include/cppast/cpp_variable.hpp
../include/cppast/cpp_variable_base.hpp
../include/cppast/cpp_variable_template.hpp
../include/cppast/diagnostic.hpp
../include/cppast/libclang_parser.hpp
../include/cppast/parser.hpp
../include/cppast/visitor.hpp)
set(source
code_generator.cpp
cpp_alias_template.cpp
cpp_class.cpp
cpp_class_template.cpp
cpp_entity.cpp
cpp_entity_index.cpp
cpp_entity_kind.cpp
cpp_enum.cpp
cpp_expression.cpp
cpp_file.cpp
cpp_function.cpp
cpp_function_template.cpp
cpp_language_linkage.cpp
cpp_member_function.cpp
cpp_member_variable.cpp
cpp_namespace.cpp
cpp_preprocessor.cpp
cpp_template_parameter.cpp
cpp_type.cpp
cpp_type_alias.cpp
cpp_variable.cpp
cpp_variable_template.cpp
parser.cpp
visitor.cpp)
set(libclang_source
libclang/class_parser.cpp
libclang/debug_helper.cpp
libclang/debug_helper.hpp
libclang/enum_parser.cpp
libclang/expression_parser.cpp
libclang/function_parser.cpp
libclang/language_linkage_parser.cpp
libclang/libclang_parser.cpp
libclang/libclang_visitor.hpp
libclang/namespace_parser.cpp
libclang/parse_error.hpp
libclang/parse_functions.cpp
libclang/parse_functions.hpp
libclang/preprocessor.cpp
libclang/preprocessor.hpp
libclang/raii_wrapper.hpp
libclang/template_parser.cpp
libclang/tokenizer.cpp
libclang/tokenizer.hpp
libclang/type_parser.cpp
libclang/variable_parser.cpp)
add_library(cppast ${detail_header} ${header} ${source} ${libclang_source})
target_include_directories(cppast PUBLIC ../include)
target_link_libraries(cppast PUBLIC type_safe _cppast_tiny_process _cppast_libclang)
target_compile_definitions(cppast PUBLIC
CPPAST_LIBCLANG_SYSTEM_INCLUDE_DIR="${LIBCLANG_SYSTEM_INCLUDE_DIR}"
CPPAST_CLANG_BINARY="${CLANG_BINARY}")
set_target_properties(cppast PROPERTIES CXX_STANDARD 11)

View file

@ -30,8 +30,8 @@ const std::vector<std::string>& detail::libclang_compile_config_access::flags(
libclang_compile_config::libclang_compile_config() : compile_config({})
{
set_clang_binary("clang++");
add_include_dir(LIBCLANG_SYSTEM_INCLUDE_DIR);
set_clang_binary(CPPAST_CLANG_BINARY);
add_include_dir(CPPAST_LIBCLANG_SYSTEM_INCLUDE_DIR);
}
void libclang_compile_config::do_set_flags(cpp_standard standard,

View file

@ -80,7 +80,7 @@ std::unique_ptr<cpp_entity> detail::parse_entity(const detail::parse_context& co
case CXCursor_UnexposedDecl:
// go through all the try_parse_XXX functions
if (auto entity = try_parse_cpp_language_linkage(context, cur))
return std::move(entity);
return entity;
break;
case CXCursor_Namespace:

View file

@ -154,7 +154,7 @@ namespace
std::unique_ptr<cpp_type> make_cv_qualified(std::unique_ptr<cpp_type> entity, cpp_cv cv)
{
if (cv == cpp_cv_none)
return std::move(entity);
return entity;
return cpp_cv_qualified_type::build(std::move(entity), cv);
}
@ -285,7 +285,7 @@ namespace
std::unique_ptr<cpp_type> make_ref_qualified(std::unique_ptr<cpp_type> type, cpp_reference ref)
{
if (ref == cpp_ref_none)
return std::move(type);
return type;
return cpp_reference_type::build(std::move(type), ref);
}