2017-09-02 4 views
-1

現在、ビルドジェネレータとしてcmakeを使用するためにcプロジェクトを再編成しています。私はプロジェクトレイアウトのテンプレートとしてCmake-Initプロジェクト(https://github.com/cginternals/cmake-init)を使用しています。プロジェクトの再編成後に不明なタイプ名

私は整理部分を行ったと思いますが、cmake生成部分はこれまで成功していますが、コンパイルは失敗します。コンパイラは、このエラーがスローされます。

In file included from /home/simon/Documents/buffer/janus_oss_transition/source/ibis/include/ibis/ngramLM.h:48:0, 
      from /home/simon/Documents/buffer/janus_oss_transition/source/base/include/base/list.h:46, 
      from /home/simon/Documents/buffer/janus_oss_transition/source/stc/include/stc/cbn_parmat.h:45, 
      from /home/simon/Documents/buffer/janus_oss_transition/source/stc/include/stc/cbnew.h:53, 
      from /home/simon/Documents/buffer/janus_oss_transition/source/stc/source/cbn_common.c:40: 
/home/simon/Documents/buffer/janus_oss_transition/source/base/include/base/array.h:76:55: error: unknown type name ‘List’ 
extern int iarrayGetListItf(IArray* IA, char* value, List* L); 
                ^

array.hは一つだけ含まれています:

#define LIST(T) \ 
{ \ 
\ 
T*    itemA;  /* array of items      */ \ 
int    itemN;  /* number of items in the list   */ \ 
int    itemMax; /* max. number of items in the list */ \ 
int    itemSize; /* size of the indivual items   */ \ 
int    itemSizeCP; \ 
int    allocN;  /* number of allocated records in dsA */ \ 
int    blkSize; /* block size for allocation   */ \ 
int    compress; /* compress list when deleting items */ \ 
\ 
TypeInfo*  typeInfo; /* pointer to item type information */ \ 
\ 
int    sorted;  /* is array sorted      */ \ 
ListCmpFn*  sortCmp; /* compare two items in the list  */ \ 
int*   sortXA;  /* sorted index array     */ \ 
\ 
int*   hashTable; \ 
HashRec*  hashXA; \ 
int    hashSizeX; /* hash size as index of hashPrimes */ \ 
int    hashSizeY; /* hash size = hashPrimes(hashSIzeX) */ \ 
HashKeyFn*  hashKey; \ 
HashCmpFn*  hashCmp; \ 
ClientData  DataHolder;\ 
\ 
ListItemInit* init;  /* item initialization function  */ \ 
ListItemDeinit* deinit; \ 
ListItemLinkN* links; \ 
\ 
} 

typedef struct LIST(char*) List; 

これがためCMakeListsです:#include "base/list.h"

list.hは、このようなtypedefは構造体のリストを定義します配列とリストを含む "base"フォルダ:

# 
# External dependencies 
# 

# find_package(THIRDPARTY REQUIRED) 


# 
# Library name and options 
# 

# Target name 
set(target base) 

# Exit here if required dependencies are not met 
message(STATUS "Lib ${target}") 

# Set API export file and macro 
string(MAKE_C_IDENTIFIER ${target} target_id) 
string(TOUPPER ${target_id} target_id) 
set(feature_file   "include/${target}/${target}_features.h") 
set(export_file   "include/${target}/${target}_export.h") 
set(template_export_file "include/${target}/${target}_api.h") 
set(export_macro   "${target_id}_API") 


# 
# Sources 
# 

set(include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}") 
set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/source") 

set(headers 
    ${include_path}/array.h 
    ${include_path}/common.h 
    ${include_path}/dbase.h 
    ${include_path}/ffmat.h 
    ${include_path}/list.h 
    ${include_path}/mach_ind_io.h 
    ${include_path}/matrix.h 
) 

set(sources 
    ${source_path}/array.c 
    ${source_path}/common.c 
    ${source_path}/dbase.c 
    ${source_path}/ffmat.c 
    ${source_path}/list.c 
    ${source_path}/mach_ind_io.c 
    ${source_path}/matrix.c 
    ${source_path}/matrix-io.c 
    ${source_path}/melscale.c 

) 

# Group source files 
set(header_group "Header Files (API)") 
set(source_group "Source Files") 
source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$" 
    ${header_group} ${headers}) 
source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$" 
    ${source_group} ${sources}) 


# 
# Create library 
# 

# Build library 
add_library(${target} 
    ${sources} 
    ${headers} 
) 


# Create namespaced alias 
add_library(${META_PROJECT_NAME}::${target} ALIAS ${target}) 

# Export library for downstream projects 
export(TARGETS ${target} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${target}/${target}-export.cmake) 

# Create feature detection header 
# Compilers: https://cmake.org/cmake/help/v3.1/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID 
# Feature: https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html 

# Check for availability of module; use pre-generated version if not found 
if (WriterCompilerDetectionHeaderFound) 
    write_compiler_detection_header(
     FILE ${feature_file} 
     PREFIX ${target_id} 
     COMPILERS AppleClang Clang GNU MSVC 
     FEATURES cxx_alignas cxx_alignof cxx_constexpr cxx_final cxx_noexcept cxx_nullptr cxx_sizeof_member cxx_thread_local 
     VERSION 3.2 
    ) 
else() 
    file(
     COPY ${PROJECT_SOURCE_DIR}/source/codegeneration/${target}_features.h 
     DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/${target} 
     USE_SOURCE_PERMISSIONS 
    ) 
endif() 


# 
# Project options 
# 

set_target_properties(${target} 
    PROPERTIES 
    ${DEFAULT_PROJECT_OPTIONS} 
    FOLDER "${IDE_FOLDER}" 
    VERSION ${META_VERSION} 
    SOVERSION ${META_VERSION_MAJOR} 
) 


# 
# Include directories 
# 

target_include_directories(${target} 
    PRIVATE 
    ${PROJECT_BINARY_DIR}/source/include 
    ${CMAKE_CURRENT_SOURCE_DIR}/include 
    ${CMAKE_CURRENT_BINARY_DIR}/include 

    PUBLIC 
    ${DEFAULT_INCLUDE_DIRECTORIES} 

    INTERFACE 
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> 
    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> 
    $<INSTALL_INTERFACE:include> 
) 


# 
# Libraries 
# 

target_link_libraries(${target} 
    PRIVATE 
    ${DEFAULT_LIBRARIES} 
    ${META_PROJECT_NAME}::base 
    ${META_PROJECT_NAME}::features 
    ${META_PROJECT_NAME}::hmm 
    ${META_PROJECT_NAME}::ibis 
    ${META_PROJECT_NAME}::itf 
    ${META_PROJECT_NAME}::models 
    ${META_PROJECT_NAME}::stc 
) 


# 
# Compile definitions 
# 

target_compile_definitions(${target} 
    PRIVATE 

    PUBLIC 
    $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:${target_id}_STATIC_DEFINE> 
    ${DEFAULT_COMPILE_DEFINITIONS} 

    INTERFACE 
) 


# 
# Compile options 
# 

target_compile_options(${target} 
    PRIVATE 

    PUBLIC 
    ${DEFAULT_COMPILE_OPTIONS} 

    INTERFACE 
) 


# 
# Linker options 
# 

target_link_libraries(${target} 
    PRIVATE 

    PUBLIC 
    ${DEFAULT_LINKER_OPTIONS} 

    INTERFACE 
) 


# 
# Target Health 
# 

perform_health_checks(
    ${target} 
    ${sources} 
    ${headers} 
) 


# 
# Deployment 
# 

# Library 
install(TARGETS ${target} 
    EXPORT "${target}-export"   COMPONENT dev 
    RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT runtime 
    LIBRARY DESTINATION ${INSTALL_SHARED} COMPONENT runtime 
    ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT dev 
) 

# Header files 
install(DIRECTORY 
    ${CMAKE_CURRENT_SOURCE_DIR}/include/${target} DESTINATION ${INSTALL_INCLUDE} 
    COMPONENT dev 
) 

# Generated header files 
install(DIRECTORY 
    ${CMAKE_CURRENT_BINARY_DIR}/include/${target} DESTINATION ${INSTALL_INCLUDE} 
    COMPONENT dev 
) 

# CMake config 
install(EXPORT ${target}-export 
    NAMESPACE ${META_PROJECT_NAME}:: 
    DESTINATION ${INSTALL_CMAKE}/${target} 
    COMPONENT dev 
) 

これはCMakeListsです私の目標のために。私はヤナギを造ろうとしています。

# 
# External dependencies 
# 

# find_package(THIRDPARTY REQUIRED) 


# 
# Executable name and options 
# 

# Target name 
set(target janus) 
set(libTarget libjanus) 

# Exit here if required dependencies are not met 
message(STATUS "Example ${target}") 



# 
# Sources 
# 

set(sources 
    janusInit.c 
    janusMain.c 
) 

add_library(${libTarget} STATIC ${sources}) 
set_target_properties(${libTarget} PROPERTIES OUTPUT_NAME janus) 
target_compile_definitions(${libTarget} PUBLIC -DIBIS) 
target_include_directories(${libTarget} 
    PRIVATE 
    ${DEFAULT_INCLUDE_DIRECTORIES} 
    ${PROJECT_BINARY_DIR}/source/include 
) 
target_link_libraries(${libTarget} 
    PRIVATE 
    ${DEFAULT_LIBRARIES} 
    ${META_PROJECT_NAME}::base 
    ${META_PROJECT_NAME}::features 
    ${META_PROJECT_NAME}::hmm 
    ${META_PROJECT_NAME}::ibis 
    ${META_PROJECT_NAME}::itf 
    ${META_PROJECT_NAME}::models 
    ${META_PROJECT_NAME}::stc 
) 
target_compile_definitions(${libTarget} 
    PRIVATE 
    ${DEFAULT_COMPILE_DEFINITIONS} 
) 

# 
# Create executable 
# 

# Build executable 
add_executable(${target} 

    ${sources} 
) 


# Create namespaced alias 
add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 


# 
# Project options 
# 

set_target_properties(${target} 
    PROPERTIES 
    ${DEFAULT_PROJECT_OPTIONS} 
    FOLDER "${IDE_FOLDER}" 
) 


# 
# Include directories 
# 

target_include_directories(${target} 
    PRIVATE 
    ${DEFAULT_INCLUDE_DIRECTORIES} 
    ${PROJECT_BINARY_DIR}/source/include 
) 


# 
# Libraries 
# 

target_link_libraries(${target} 
    PRIVATE 
    ${DEFAULT_LIBRARIES} 
    ${META_PROJECT_NAME}::base 
    ${META_PROJECT_NAME}::features 
    ${META_PROJECT_NAME}::hmm 
    ${META_PROJECT_NAME}::ibis 
    ${META_PROJECT_NAME}::itf 
    ${META_PROJECT_NAME}::models 
    ${META_PROJECT_NAME}::stc 
) 


# 
# Compile definitions 
# 

target_compile_definitions(${target} 
    PRIVATE 
    ${DEFAULT_COMPILE_DEFINITIONS} 
    -DIBIS 
) 

if(NOT USE_TK) 
     target_compile_definitions(${target} PUBLIC -DDISABLE_TK) 
     target_compile_definitions(${libTarget} PUBLIC -DDISABLE_TK) 
endif() 


# 
# Compile options 
# 

target_compile_options(${target} 
    PRIVATE 
    ${DEFAULT_COMPILE_OPTIONS} 
) 


# 
# Linker options 
# 

target_link_libraries(${target} 
    PRIVATE 
    ${DEFAULT_LINKER_OPTIONS} 
) 


# 
# Target Health 
# 

perform_health_checks(
    ${target} 
    ${sources} 
) 


# 
# Deployment 
# 

# Executable 
install(TARGETS ${target} 
    RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT examples 
    BUNDLE DESTINATION ${INSTALL_BIN} COMPONENT examples 
) 

私はcmakeで何かを混乱させるかもしれませんか?ファイルは同じフォルダにあります。あなたの助け
ため

おかげサイモン

EDIT:
はCMakeListsを追加しました。

+1

ターゲットのCMakeに失敗している限り、間違ったことには何の手がかりもありません。 –

+0

こんにちはTorbjörn、興味のあるCMakeListを追加しました。私は今何かを把握するために知る必要があるすべての情報があることを願っています。 –

答えて

0

エラーの根源に思われる円形のインクルードが見つかりました。

関連する問題