git-svn-id: svn://db.shs.com.ru/pip@644 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -37,6 +37,7 @@ set(PIP_SRC_USB "src_usb")
|
||||
set(PIP_SRC_FFTW "src_fftw")
|
||||
set(PIP_SRC_OPENCL "src_opencl")
|
||||
set(PIP_SRC_IO_UTILS "src_io_utils")
|
||||
set(PIP_SRC_DIRS "src_main" "src_crypt" "src_compress" "src_usb" "src_fftw" "src_opencl" "src_io_utils")
|
||||
set(PIP_LIBS_TARGETS pip)
|
||||
set(LIBS_MAIN)
|
||||
set(LIBS_STATUS)
|
||||
@@ -101,7 +102,9 @@ get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME)
|
||||
# Main lib
|
||||
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt")
|
||||
include_directories("${PIP_SRC_MAIN}")
|
||||
set(PIP_MAIN_FOLDERS)
|
||||
foreach(F ${PIP_FOLDERS})
|
||||
list(APPEND PIP_MAIN_FOLDERS "\"${PROJECT_SOURCE_DIR}/${PIP_SRC_MAIN}/${F}\"")
|
||||
include_directories("${PIP_SRC_MAIN}/${F}")
|
||||
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
|
||||
endforeach(F)
|
||||
@@ -523,3 +526,21 @@ endforeach()
|
||||
# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
|
||||
# endif()
|
||||
|
||||
include(PIPDocumentation.cmake)
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXY_PROJECT_NUMBER "${_PIP_FULL_VERSION}")
|
||||
set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
||||
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
||||
set(DOXY_EXAMPLE_PATH "\"${PROJECT_SOURCE_DIR}/doc/examples\"")
|
||||
set(DOXY_IMAGE_PATH "\"${PROJECT_SOURCE_DIR}/doc/images\"")
|
||||
set(DOXY_INPUT)
|
||||
foreach(F ${PIP_SRC_DIRS})
|
||||
list(APPEND DOXY_INPUT "\"${PROJECT_SOURCE_DIR}/${F}\"")
|
||||
endforeach(F)
|
||||
string(REPLACE ";" " " DOXY_INPUT "${DOXY_INPUT}")
|
||||
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}")
|
||||
add_documentation(doc Doxyfile.in)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -793,13 +793,7 @@ WARN_LOGFILE =
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = src_main \
|
||||
src_crypt \
|
||||
src_fftw \
|
||||
src_io_utils \
|
||||
src_compress \
|
||||
src_opencl \
|
||||
src_usb
|
||||
INPUT = src_main src_crypt src_fftw src_io_utils src_compress src_opencl src_usb
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@@ -2099,15 +2093,7 @@ SEARCH_INCLUDES = YES
|
||||
# preprocessor.
|
||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||
|
||||
INCLUDE_PATH = src_main/code \
|
||||
src_main/containers \
|
||||
src_main/core \
|
||||
src_main/math \
|
||||
src_main/system \
|
||||
src_main/thread \
|
||||
src_main/console \
|
||||
src_main/io_devices \
|
||||
src_main/io_utils
|
||||
INCLUDE_PATH = src_main/code src_main/containers src_main/core src_main/math src_main/system src_main/thread src_main/console src_main/io_devices src_main/io_utils
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
29
PIPDocumentation.cmake
Normal file
29
PIPDocumentation.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
macro(CONFIGURE_DOXYGEN_FILE DOXYGEN_CONFIG_FILE FILE_NAME_SUFFIX)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/${DOXYGEN_CONFIG_FILE})
|
||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${FILE_NAME_SUFFIX}")
|
||||
file(READ ${PROJECT_SOURCE_DIR}/${DOXYGEN_CONFIG_FILE} DOXYFILE_CONTENTS)
|
||||
string(REPLACE "\\\n" " " DOXYFILE_CONTENTS "${DOXYFILE_CONTENTS}")
|
||||
string(REPLACE "\n" ";" DOXYFILE_LINES "${DOXYFILE_CONTENTS}")
|
||||
foreach(LINE IN LISTS DOXYFILE_LINES)
|
||||
if(LINE STRGREATER "")
|
||||
string(REGEX MATCH "^[a-zA-Z]([^ ])+" DOXY_PARAM ${LINE})
|
||||
if(DEFINED DOXY_${DOXY_PARAM})
|
||||
STRING(REGEX REPLACE "=([^\n])+" "= ${DOXY_${DOXY_PARAM}}" LINE ${LINE})
|
||||
endif(DEFINED DOXY_${DOXY_PARAM})
|
||||
endif()
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${FILE_NAME_SUFFIX} "${LINE}\n")
|
||||
endforeach()
|
||||
else()
|
||||
MESSAGE(SEND_ERROR "Doxygen configuration file '${DOXYGEN_CONFIG_FILE}' not found, can`t generate documentation")
|
||||
endif()
|
||||
endmacro(CONFIGURE_DOXYGEN_FILE)
|
||||
|
||||
|
||||
macro(ADD_DOCUMENTATION TARGET DOXYGEN_CONFIG_FILE)
|
||||
if(DOXYGEN_FOUND)
|
||||
configure_doxygen_file(${DOXYGEN_CONFIG_FILE} ${TARGET})
|
||||
add_custom_target(${TARGET} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${TARGET})
|
||||
else(DOXYGEN_FOUND)
|
||||
message(STATUS "Doxygen not found, can`t generate documentation")
|
||||
endif(DOXYGEN_FOUND)
|
||||
endmacro(ADD_DOCUMENTATION)
|
||||
@@ -59,6 +59,7 @@ macro(pip_resources RESULT INPUT)
|
||||
#message(STATUS "options = \"${CCM_OPTS}\"")
|
||||
get_filename_component(RC_OUT "${INPUT}" NAME_WE)
|
||||
set(RC_FILE "pirc_${RC_OUT}.cpp")
|
||||
set(SRC_RC_OUT "${RC_OUT}")
|
||||
set(RC_OUT ${CMAKE_CURRENT_BINARY_DIR}/${RC_FILE})
|
||||
set(${RESULT} ${${RESULT}} ${RC_OUT})
|
||||
set(CCM_FILES)
|
||||
@@ -93,7 +94,7 @@ macro(pip_resources RESULT INPUT)
|
||||
#message("RC_DEPS: ${RC_DEPS}")
|
||||
add_custom_command(OUTPUT ${RC_OUT}
|
||||
COMMAND ${PIP_RC}
|
||||
ARGS -i ${RC_FILES} -o ${RC_OUT}
|
||||
ARGS -i ${RC_FILES} -o ${RC_OUT} -n ${SRC_RC_OUT}
|
||||
DEPENDS ${RC_DEPS}
|
||||
WORKING_DIRECTORY ${PIP_DLL_DIR}
|
||||
COMMENT "Generating ${RC_FILE}"
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "pistring.h"
|
||||
|
||||
#define INIT_RESOURCE(name) {extern void _pirc_##name##_init_(); _pirc_##name##_init_();}
|
||||
|
||||
class PIP_EXPORT PIResources {
|
||||
public:
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ void PIResourcesStorage::registerSection(const PIString & section_name, const PI
|
||||
|
||||
|
||||
void PIResourcesStorage::registerSection(const uchar * rc_data, const uchar * rc_desc, int rc_desc_size) {
|
||||
//piCout << "registerSection" << this;
|
||||
PIByteArray dba(rc_desc, rc_desc_size);
|
||||
PIVector<PIResourcesStorage::__RCEntry> el;
|
||||
dba >> el;
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
#include "piresourcesstorage.h"
|
||||
|
||||
|
||||
bool generate(PIFile & file, const PIVector<ParserSection> & files) {
|
||||
PIString initName(const PIString & n) {
|
||||
return PIFile::fileInfo(n).baseName().replaceAll(".", "_").replaceAll("/", "_")
|
||||
.replaceAll(":", "_").replaceAll("-", "_");
|
||||
}
|
||||
|
||||
|
||||
bool generate(const PIString & init_name, PIFile & file, const PIVector<ParserSection> & files) {
|
||||
if (!file.isOpened()) return false;
|
||||
PIString fcname = file.fileInfo().baseName().replaceAll(".", "_").replaceAll("/", "_")
|
||||
.replaceAll(":", "_").replaceAll("-", "_");//.toUpperCase() + "_H";
|
||||
PIString fcname = initName(file.path());
|
||||
PIString icname = "_PIRC_" + fcname + "_Initializer_";
|
||||
PIString dataname = "_pirc_" + fcname + "_data_";
|
||||
PIString descname = "_pirc_" + fcname + "_desc_";
|
||||
PIString funcname = "_pirc_" + init_name + "_init_";
|
||||
PIVector<PIResourcesStorage::__RCEntry> fv;
|
||||
piForeachC (ParserSection & s, files) {
|
||||
piForeachC (ParserEntry & p, s.files) {
|
||||
@@ -63,10 +69,16 @@ bool generate(PIFile & file, const PIVector<ParserSection> & files) {
|
||||
file << int(dba[i]);
|
||||
}
|
||||
file << "\n};\n";
|
||||
|
||||
file << "\nvoid " << funcname << "() {\n";
|
||||
file << "\tPIResourcesStorage::instance()->registerSection(" << dataname << ", " << descname << ", sizeof(" << descname << "));\n";
|
||||
file << "}\n";
|
||||
|
||||
file << "\nclass " << icname << " {\n";
|
||||
file << "public:\n\t" << icname << "() {\n";
|
||||
file << "\t\tPIResourcesStorage::instance()->registerSection(" << dataname << ", " << descname << ", sizeof(" << descname << "));\n";
|
||||
file << "\t\t" << funcname << "();\n";
|
||||
file << "\t}\n";
|
||||
file << "} _pirc_" << fcname << "_initializer_;\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "parser.h"
|
||||
|
||||
bool generate(PIFile & file, const PIVector<ParserSection> & files);
|
||||
PIString initName(const PIString & n);
|
||||
bool generate(const PIString & init_name, PIFile & file, const PIVector<ParserSection> & files);
|
||||
|
||||
#endif // PIRC_GENERATOR_H
|
||||
|
||||
@@ -8,9 +8,10 @@ using namespace PICoutManipulators;
|
||||
void usage() {
|
||||
piCout << Bold << "PIP Resources Compiler";
|
||||
piCout << Cyan << "Version" << Bold << PIPVersion() << NewLine;
|
||||
piCout << Green << Bold << "Usage:" << Default << "\"pirc [-hl] -i <in_file> -o <out_file>\"" << NewLine;
|
||||
piCout << Green << Bold << "Usage:" << Default << "\"pirc [-hl] [-n <name>] -i <in_file> -o <out_file>\"" << NewLine;
|
||||
piCout << Green << Bold << "Details:";
|
||||
piCout << "-h --help " << Green << "- display this message and exit";
|
||||
piCout << "-n --name <name> " << Green << "- name of initialize function, by default is <out_file> base name";
|
||||
piCout << "-i --input <in_file> " << Green << "- resources description file";
|
||||
piCout << "-o --out <out_file> " << Green << "- output .cpp file";
|
||||
piCout << "-l --list " << Green << "- print readed files from description and exit";
|
||||
@@ -21,6 +22,7 @@ int main (int argc, char * argv[]) {
|
||||
PICLI cli(argc, argv);
|
||||
cli.addArgument("input", true);
|
||||
cli.addArgument("out", true);
|
||||
cli.addArgument("name", true);
|
||||
cli.addArgument("help");
|
||||
cli.addArgument("list");
|
||||
|
||||
@@ -47,6 +49,8 @@ int main (int argc, char * argv[]) {
|
||||
}
|
||||
|
||||
PIString out_file = cli.argumentValue("out");
|
||||
PIString init_name = cli.argumentValue("name");
|
||||
init_name = initName(init_name.isEmpty() ? out_file : init_name);
|
||||
PIFile outf;
|
||||
if (!out_file.isEmpty()) {
|
||||
if (outf.open(out_file, PIIODevice::ReadWrite)) {
|
||||
@@ -58,7 +62,7 @@ int main (int argc, char * argv[]) {
|
||||
outf << "// \"" << _a << "\"\n";
|
||||
outf << "\n";
|
||||
//outf << "#include \"pivariant.h\"\n#include \"picodeinfo.h\"";
|
||||
if (!generate(outf, files)) {
|
||||
if (!generate(init_name, outf, files)) {
|
||||
piCout << "Error: generate fail";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user