ncnn阅读 - CMakeLists.txt
Posted Key_Ky
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ncnn阅读 - CMakeLists.txt相关的知识,希望对你有一定的参考价值。
CMAKE_TOOLCHAIN_FILE
This variable is specified on the command line when cross-compiling with CMake. It is the path to a file which is read early in the CMake run and which specifies locations for compilers and toolchain utilities, and other target platform and compiler related information. 指定编译器,toolchain utilities的路径,其他目标平台和编译器的相关信息。
toolchain utilities 一套编译工具的集合
比如:make, 编译器,汇编器,链接器等等。
set 将一个CMAKE变量设置为给定值。
set(<variable> <value> [[CACHE <type> <docstring> [FORCE]] | PARENT_SCOPE])
将变量<variable>的值设置为<value>。在<variable>被设置之前,<value>会被展开。如果有CACHE选项,那么<variable>就会添加到cache中;这时<type>和<docstring>是必需的。<type>被CMake GUI用来选择一个窗口,让用户设置值。<type>可以是下述值中的一个:
FILEPATH = 文件选择对话框。
PATH = 路径选择对话框。
STRING = 任意的字符串。
BOOL = 布尔值选择复选框。
INTERNAL = 不需要GUI输入端。(适用于永久保存的变量)。
CMAKE_BINARY_DIR
This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
养成喜欢进行外部编译(out-of-source build) 而不是in-source build
out-of-source build一般在源文件的顶层目录中 新建build目录
对于命令行可以 cd build
然后 cmake .. -G"MinGW Makefiles"即可
这样所有的临时文件 都会放在build目录下不会和source有任何的瓜噶。
get_filename_component
Get a specific component of a full filename.
get_filename_component(<VAR> <FileName> <COMP> [CACHE])
Set <VAR> to a component of <FileName>, where <COMP> is one of: 将var设置为filename的某一部分
DIRECTORY = Directory without file name
NAME = File name without directory
EXT = File name longest extension (.b.c from d/a.b.c)
NAME_WE = File name without directory or longest extension
ABSOLUTE = Full path to file
REALPATH = Full path to existing file with symlinks resolved
PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)
find_file
https://cmake.org/cmake/help/v3.4/command/find_file.html
message
Display a message to the user.
message([<mode>] "message to display" ...)
The optional <mode> keyword determines the type of message:
(none) = Important information
STATUS = Incidental information 对STATUS的信息用stdout输出,其他的用stderr数据
WARNING = CMake Warning, continue processing
AUTHOR_WARNING = CMake Warning (dev), continue processing
SEND_ERROR = CMake Error, continue processing,
but skip generation
FATAL_ERROR = CMake Error, stop processing and generation
DEPRECATION = CMake Deprecation Error or Warning if variable
CMAKE_ERROR_DEPRECATED or CMAKE_WARN_DEPRECATED
is enabled, respectively, else no message.
The CMake command-line tool displays STATUS messages on stdout and all other message types on stderr. The CMake GUI displays all messages in its log area. The interactive dialogs (ccmake and CMakeSetup) show STATUS messages one at a time on a status line and other messages in interactive pop-up boxes.
CMake Warning and Error message text displays using a simple markup language. Non-indented text is formatted in line-wrapped paragraphs delimited by newlines. Indented text is considered pre-formatted.
以上是关于ncnn阅读 - CMakeLists.txt的主要内容,如果未能解决你的问题,请参考以下文章
在Android上部署深度学习模型之CMakeLists文件