From: Eduardo Ramos Testillano Date: Tue, 6 Jun 2017 16:40:57 +0000 (+0200) Subject: First cmake commit. Still coexisting with scons. X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=4b79e398beb48eaa5c96b914b84e9fe77dea9da4 First cmake commit. Still coexisting with scons. --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7acd9b1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,226 @@ +# See more at: https://cmake.org/Wiki/CMake_Useful_Variables + +# Stop if cmake version below 2.8 +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +# Project name +project(anna) + +# Enable c++ language +enable_language(C CXX) + +# Project version +set(VERSION_MAJOR 1) +set(VERSION_MINOR 0) +set(VERSION_PATCH 0) + +# Build type: +if(NOT CMAKE_BUILD_TYPE) + message(WARNING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +# Build output directory: +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/lib) +message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY is ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY is ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message(STATUS "CMAKE_ARCHIVE_OUTPUT_DIRECTORY is ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") + +# http://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir +#set_target_properties( targets... +# PROPERTIES +# ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" +# LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" +# RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" +#) + +# Location of additional cmake modules +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake + ) + +# Detect operating system +message(STATUS "This is a ${CMAKE_SYSTEM_NAME} system") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + add_definitions(-DSYSTEM_LINUX) +endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + add_definitions(-DSYSTEM_DARWIN) +endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "AIX") + add_definitions(-DSYSTEM_AIX) +endif() + +# Detect host processor +message(STATUS "The host processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}") +message(STATUS "The c compiler is ${CMAKE_C_COMPILER}") +message(STATUS "The c++ compiler is ${CMAKE_CXX_COMPILER}") +message(STATUS "The build type is ${CMAKE_BUILD_TYPE}") + +# Example how to set c++ compiler flags for GNU +if(CMAKE_CXX_COMPILER_ID MATCHES GNU) + #execute_process(COMMAND g++ --version >/dev/null 2>/dev/null) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3") + set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang) + #execute_process(COMMAND clang++ --version >/dev/null 2>/dev/null) + add_definitions(-DIS_CLANG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused -Wno-parentheses-equality") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3") + set(CMAKE_CXX_FLAGS_RELEASE "-O3") +endif() + + +if (CMAKE_BUILD_TYPE STREQUAL Debug) + set(BUILD_POSTFIX "_d") +else(CMAKE_BUILD_TYPE STREQUAL Debug) + set(BUILD_POSTFIX "") +endif(CMAKE_BUILD_TYPE STREQUAL Debug) + + +# Macro to get children directories: +MACRO(SUBDIRLIST result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() + +# Definitions (any way to apply only at ldap context ?): +add_definitions(-DLDAP_DEPRECATED) + +# General includes: +include_directories(include/anna) +include_directories(/usr/include/libxml2) +include_directories(/usr/lib/oracle/12.1/client64/include) + +# +SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}/source) +FOREACH(subdir ${SUBDIRS}) + message(STATUS "Processing library at: source/${subdir}") + file(GLOB_RECURSE SRCS source/${subdir}/*.cpp) + add_library(${subdir}_static STATIC ${SRCS}) + add_library(${subdir}_shared SHARED ${SRCS}) +ENDFOREACH() + +# +file(GLOB_RECURSE DYNAMIC_PROCEDURES ${CMAKE_CURRENT_SOURCE_DIR}/dynamic/launcher/*.cpp) +FOREACH(procedure ${DYNAMIC_PROCEDURES}) + get_filename_component(dirname ${procedure} DIRECTORY) + file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR}/dynamic/launcher ${dirname}) + # convert "/" to "_" + string(REGEX REPLACE "/" "_" libpath ${rel}) + + message(STATUS "Processing dynamic library at: dynamic/launcher/${rel}") + file(GLOB_RECURSE SRCS dynamic/launcher/${rel}/*.cpp) + add_library(launcher_procedure_${libpath}_shared SHARED ${SRCS}) + set(target_dirname build/${CMAKE_BUILD_TYPE}/lib/dynamic_launcher/${libpath}) + set(target_basename launcher_procedure_${libpath}_shared) + set_target_properties(${target_basename} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${target_dirname}) + #file(RENAME ${target_dirname}/lib${target_basename}.so ${target_dirname}/libprocedure.so) +ENDFOREACH() + +# Linking example: +#file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/example/core/genLogon/*.cpp) +#add_executable(genLogon ${SRCS}) +#target_link_libraries(genLogon core_static app_static core_static test_static xml_static io_static crypto xml2 rt) + +# Generalization: +# +SUBDIRLIST(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/example) +FOREACH(module ${MODULES}) + SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}/example/${module}) + FOREACH(subdir ${SUBDIRS}) + message(STATUS "Processing executable at: example/${module}/${subdir}") + + # Sources + file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/*.cpp) + + # Executable + set(target "${module}_${subdir}") + add_executable(${target} "${SRCS}") + set_target_properties(${target} PROPERTIES LINKER_LANGUAGE CXX) + set(libraries_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/libraries.txt") + set(includes_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/includes.txt") + + if(EXISTS "${includes_file}") + file (STRINGS "${includes_file}" HDRS) + # Include own example directory: + target_include_directories(${target} PUBLIC + $ + ) + FOREACH(HDR ${HDRS}) + #message(STATUS "Header directory: ${HDR}") + target_include_directories(${target} PUBLIC + $ + ) + ENDFOREACH() + endif() + + if(EXISTS "${libraries_file}") + file (STRINGS "${libraries_file}" LIBS) + #message(STATUS "Libraries: ${LIBS}") + target_link_libraries(${target} ${LIBS}) + endif() + + ENDFOREACH() +ENDFOREACH() + + +# +find_package(Boost COMPONENTS system filesystem REQUIRED) +SUBDIRLIST(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/test) +FOREACH(module ${MODULES}) + + message(STATUS "Processing basic test at: test/${module}") + + # Sources + file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/test/${module}/*.cpp) + + # Executable + set(target "${module}") + find_package(Boost COMPONENTS system filesystem unit_test_framework REQUIRED) + add_executable(${target} "${SRCS}") + set_target_properties(${target} PROPERTIES LINKER_LANGUAGE CXX) + + + set(libraries_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/libraries.txt") + + if(EXISTS "${libraries_file}") + file (STRINGS "${libraries_file}" LIBS) + #message(STATUS "Libraries: ${LIBS}") + target_link_libraries(${target} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${LIBS}) + endif() + + add_test(tester tester) + +ENDFOREACH() + + +# Install +# see http://stackoverflow.com/questions/14084759/keep-a-single-files-permissions-when-using-install-in-cmake +####set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/deploy") +####install(FILES build/lib/libtools_static.a DESTINATION lib) +####install(PROGRAMS build/lib/libtools_shared.so DESTINATION lib) +####install(PROGRAMS build/bin/hello DESTINATION bin) + +# Add target for API documentation with Doxygen +find_package(Doxygen) +if(DOXYGEN_FOUND) +add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen + COMMENT "Generating API documentation with Doxygen" VERBATIM +) +endif(DOXYGEN_FOUND) + diff --git a/README.md b/README.md index 29e3fef..26e44f1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ANNA is a complete suite of tools and resources to build proffesional applicatio Based on GIT, hosted on http://redmine.teslayout.com You could use my pre-commit specific template if you want to do some basic checkings (i.e. - astyle code processing): Execute './scr/git/use-pre-commit.sh' + astyle code processing): Execute './scripts/git/use-pre-commit.sh' ## Documentation diff --git a/example/comm/blocker/libraries.txt b/example/comm/blocker/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/blocker/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/brkClient/libraries.txt b/example/comm/brkClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/brkClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/client/libraries.txt b/example/comm/client/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/client/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/codec/libraries.txt b/example/comm/codec/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/codec/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/datagramKClient/libraries.txt b/example/comm/datagramKClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/datagramKClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/datagramRServer/libraries.txt b/example/comm/datagramRServer/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/datagramRServer/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/irkClient/libraries.txt b/example/comm/irkClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/irkClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/kClient/libraries.txt b/example/comm/kClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/kClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/kxClient/libraries.txt b/example/comm/kxClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/kxClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/largeBinaryCodec/libraries.txt b/example/comm/largeBinaryCodec/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/largeBinaryCodec/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/rServer/libraries.txt b/example/comm/rServer/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/rServer/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/rrClient/libraries.txt b/example/comm/rrClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/rrClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/rrkClient/libraries.txt b/example/comm/rrkClient/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/rrkClient/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/comm/server/libraries.txt b/example/comm/server/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/comm/server/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/genLogon/libraries.txt b/example/core/genLogon/libraries.txt new file mode 100644 index 0000000..6f0d1f3 --- /dev/null +++ b/example/core/genLogon/libraries.txt @@ -0,0 +1,8 @@ +app_static +test_static +xml_static +io_static +core_static +rt +xml2 +crypto diff --git a/example/core/ipManaging/libraries.txt b/example/core/ipManaging/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/ipManaging/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/recycler/libraries.txt b/example/core/recycler/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/recycler/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/regularExpression/libraries.txt b/example/core/regularExpression/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/regularExpression/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/selectiveTracing/libraries.txt b/example/core/selectiveTracing/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/selectiveTracing/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/showLogon/libraries.txt b/example/core/showLogon/libraries.txt new file mode 100644 index 0000000..f167a29 --- /dev/null +++ b/example/core/showLogon/libraries.txt @@ -0,0 +1,11 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 +crypto diff --git a/example/core/sort/libraries.txt b/example/core/sort/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/sort/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/sortName/libraries.txt b/example/core/sortName/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/sortName/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/thread/libraries.txt b/example/core/thread/libraries.txt new file mode 100644 index 0000000..afef9e3 --- /dev/null +++ b/example/core/thread/libraries.txt @@ -0,0 +1,5 @@ +io_static +core_static +xml_static +rt +xml2 diff --git a/example/core/threadManager/libraries.txt b/example/core/threadManager/libraries.txt new file mode 100644 index 0000000..22da4df --- /dev/null +++ b/example/core/threadManager/libraries.txt @@ -0,0 +1,4 @@ +core_static +xml_static +rt +xml2 diff --git a/example/core/trace/libraries.txt b/example/core/trace/libraries.txt new file mode 100644 index 0000000..0fee661 --- /dev/null +++ b/example/core/trace/libraries.txt @@ -0,0 +1,10 @@ +comm_static +timex_static +app_static +test_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/core/zBlock/libraries.txt b/example/core/zBlock/libraries.txt new file mode 100644 index 0000000..feb5872 --- /dev/null +++ b/example/core/zBlock/libraries.txt @@ -0,0 +1,6 @@ +io_static +core_static +xml_static +z +rt +xml2 diff --git a/example/dbms.mysql/insert/libraries.txt b/example/dbms.mysql/insert/libraries.txt new file mode 100644 index 0000000..18c098a --- /dev/null +++ b/example/dbms.mysql/insert/libraries.txt @@ -0,0 +1 @@ +mysqlclient diff --git a/example/dbms.mysql/insert/main.c b/example/dbms.mysql/insert/main.c deleted file mode 100644 index f3ffd16..0000000 --- a/example/dbms.mysql/insert/main.c +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include - -#include - -#define STRING_SIZE 50 - -#define INSERT_SAMPLE "insert into anna_db_test (xx, yy, zz, tt) values (?,?,?,?)" - - -#define MAXCOLUMN 4 - -MYSQL* mysql; -MYSQL_STMT *stmt; -MYSQL_BIND bind[MAXCOLUMN]; -MYSQL_TIME ts; -unsigned long length[MAXCOLUMN]; -int param_count, column_count, row_count; -float float_data; -int int_data; -char str_data[STRING_SIZE]; -my_bool is_null[MAXCOLUMN]; - -/* - * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html - */ -int main () -{ - if ((mysql = mysql_init (NULL)) == NULL) - exit(-12); - - if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) { - fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Prepare a SELECT query to fetch data from test_table */ - stmt = mysql_stmt_init(mysql); - if (!stmt) - { - fprintf(stderr, " mysql_stmt_init(), out of memory\n"); - exit(0); - } - - if (mysql_stmt_prepare(stmt, INSERT_SAMPLE, strlen(INSERT_SAMPLE))) - { - fprintf(stderr, " mysql_stmt_prepare(), INSERT failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - fprintf(stdout, " prepare, INSERT successful\n"); - - /* Get the parameter count from the statement */ - param_count= mysql_stmt_param_count(stmt); - fprintf(stdout, " total parameters in INSERT: %d\n", param_count); - - if (param_count != MAXCOLUMN) /* validate parameter count */ - { - fprintf(stderr, " invalid parameter count returned by MySQL\n"); - exit(0); - } - - /* Bind the result buffers for all 3 columns before fetching them */ - - memset(bind, 0, sizeof(bind)); - - /* INTEGER COLUMN */ - bind[0].buffer_type= MYSQL_TYPE_LONG; - bind[0].buffer= (char *)&int_data; - bind[0].is_null= &is_null[0]; - bind[0].length= &length[0]; - - /* STRING COLUMN */ - bind[1].buffer_type= MYSQL_TYPE_STRING; - bind[1].buffer= (char *)str_data; - bind[1].buffer_length= STRING_SIZE; - bind[1].is_null= &is_null[1]; - bind[1].length= &length [1]; - - /* FLOAT COLUMN */ - bind[2].buffer_type= MYSQL_TYPE_FLOAT; - bind[2].buffer= (char *)&float_data; - bind[2].is_null= &is_null[2]; - bind[2].length= &length[2]; - - /* TIME COLUMN */ - bind[3].buffer_type= MYSQL_TYPE_DATETIME; - bind[3].buffer= (char *)&ts; - bind[3].is_null= &is_null[2]; - bind[3].length= &length[2]; - - /* Bind the result buffers */ - if (mysql_stmt_bind_param (stmt, bind)) - { - fprintf(stderr, " mysql_stmt_bind_param() failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - int_data = 99; - strcpy (str_data, "insert: 99"); - length [1] = strlen (str_data); - float_data = 0.99; - ts.year = 1996; ts.month = 2; ts.day = 11; - ts.hour = 19; ts.minute = 22; ts.second = 0; - - /* Execute the INSERT query */ - if (mysql_stmt_execute(stmt)) - { - fprintf(stderr, " mysql_stmt_execute(), failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - is_null [0] = 1; - strcpy (str_data, "insert: "); - length [1] = strlen (str_data); - float_data = 0.98; - ts.year = 1999; ts.month = 8; ts.day = 7; - ts.hour = 19; ts.minute = 18; ts.second = 17; - - /* Execute the INSERT query */ - if (mysql_stmt_execute(stmt)) - { - fprintf(stderr, " mysql_stmt_execute(), failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Close the statement */ - if (mysql_stmt_close(stmt)) - { - fprintf(stderr, " failed while closing the statement\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - return 0; -} diff --git a/example/dbms.mysql/insert/main.cpp b/example/dbms.mysql/insert/main.cpp new file mode 100644 index 0000000..7ed298e --- /dev/null +++ b/example/dbms.mysql/insert/main.cpp @@ -0,0 +1,141 @@ +#include +#include +#include + +#include + +#define STRING_SIZE 50 + +#define INSERT_SAMPLE "insert into anna_db_test (xx, yy, zz, tt) values (?,?,?,?)" + + +#define MAXCOLUMN 4 + +MYSQL* mysql; +MYSQL_STMT *stmt; +MYSQL_BIND bind[MAXCOLUMN]; +MYSQL_TIME ts; +unsigned long length[MAXCOLUMN]; +int param_count, column_count, row_count; +float float_data; +int int_data; +char str_data[STRING_SIZE]; +my_bool is_null[MAXCOLUMN]; + +/* + * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html + */ +int main (int argc, const char** argv) +{ + if ((mysql = mysql_init (NULL)) == NULL) + exit(-12); + + if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) { + fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Prepare a SELECT query to fetch data from test_table */ + stmt = mysql_stmt_init(mysql); + if (!stmt) + { + fprintf(stderr, " mysql_stmt_init(), out of memory\n"); + exit(0); + } + + if (mysql_stmt_prepare(stmt, INSERT_SAMPLE, strlen(INSERT_SAMPLE))) + { + fprintf(stderr, " mysql_stmt_prepare(), INSERT failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + fprintf(stdout, " prepare, INSERT successful\n"); + + /* Get the parameter count from the statement */ + param_count= mysql_stmt_param_count(stmt); + fprintf(stdout, " total parameters in INSERT: %d\n", param_count); + + if (param_count != MAXCOLUMN) /* validate parameter count */ + { + fprintf(stderr, " invalid parameter count returned by MySQL\n"); + exit(0); + } + + /* Bind the result buffers for all 3 columns before fetching them */ + + memset(bind, 0, sizeof(bind)); + + /* INTEGER COLUMN */ + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&int_data; + bind[0].is_null= &is_null[0]; + bind[0].length= &length[0]; + + /* STRING COLUMN */ + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)str_data; + bind[1].buffer_length= STRING_SIZE; + bind[1].is_null= &is_null[1]; + bind[1].length= &length [1]; + + /* FLOAT COLUMN */ + bind[2].buffer_type= MYSQL_TYPE_FLOAT; + bind[2].buffer= (char *)&float_data; + bind[2].is_null= &is_null[2]; + bind[2].length= &length[2]; + + /* TIME COLUMN */ + bind[3].buffer_type= MYSQL_TYPE_DATETIME; + bind[3].buffer= (char *)&ts; + bind[3].is_null= &is_null[2]; + bind[3].length= &length[2]; + + /* Bind the result buffers */ + if (mysql_stmt_bind_param (stmt, bind)) + { + fprintf(stderr, " mysql_stmt_bind_param() failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + int_data = 99; + strcpy (str_data, "insert: 99"); + length [1] = strlen (str_data); + float_data = 0.99; + ts.year = 1996; ts.month = 2; ts.day = 11; + ts.hour = 19; ts.minute = 22; ts.second = 0; + + /* Execute the INSERT query */ + if (mysql_stmt_execute(stmt)) + { + fprintf(stderr, " mysql_stmt_execute(), failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + is_null [0] = 1; + strcpy (str_data, "insert: "); + length [1] = strlen (str_data); + float_data = 0.98; + ts.year = 1999; ts.month = 8; ts.day = 7; + ts.hour = 19; ts.minute = 18; ts.second = 17; + + /* Execute the INSERT query */ + if (mysql_stmt_execute(stmt)) + { + fprintf(stderr, " mysql_stmt_execute(), failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Close the statement */ + if (mysql_stmt_close(stmt)) + { + fprintf(stderr, " failed while closing the statement\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + return 0; +} diff --git a/example/dbms.mysql/select/libraries.txt b/example/dbms.mysql/select/libraries.txt new file mode 100644 index 0000000..18c098a --- /dev/null +++ b/example/dbms.mysql/select/libraries.txt @@ -0,0 +1 @@ +mysqlclient diff --git a/example/dbms.mysql/select/main.c b/example/dbms.mysql/select/main.c deleted file mode 100644 index 3851eff..0000000 --- a/example/dbms.mysql/select/main.c +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include - -#include - -#define STRING_SIZE 50 - -#define SELECT_SAMPLE "SELECT xx, yy, zz, tt FROM anna_db_test" - -#define MAXCOLUMN 4 - -MYSQL* mysql; -MYSQL_STMT *stmt; -MYSQL_BIND bind[MAXCOLUMN]; -MYSQL_RES *prepare_meta_result; -MYSQL_TIME ts; -unsigned long length[MAXCOLUMN]; -int param_count, column_count, row_count; -float float_data; -int int_data; -char str_data[STRING_SIZE]; -my_bool is_null[MAXCOLUMN]; - -/* - * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html - */ -int main () -{ - if ((mysql = mysql_init (NULL)) == NULL) - exit (-12); - - if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) { - fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Prepare a SELECT query to fetch data from test_table */ - stmt = mysql_stmt_init(mysql); - if (!stmt) - { - fprintf(stderr, " mysql_stmt_init(), out of memory\n"); - exit(0); - } - - if (mysql_stmt_prepare(stmt, SELECT_SAMPLE, strlen(SELECT_SAMPLE))) - { - fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - fprintf(stdout, " prepare, SELECT successful\n"); - - /* Get the parameter count from the statement */ - param_count= mysql_stmt_param_count(stmt); - fprintf(stdout, " total parameters in SELECT: %d\n", param_count); - - if (param_count != 0) /* validate parameter count */ - { - fprintf(stderr, " invalid parameter count returned by MySQL\n"); - exit(0); - } - - /* Fetch result set meta information */ - prepare_meta_result = mysql_stmt_result_metadata(stmt); - if (!prepare_meta_result) - { - fprintf(stderr," mysql_stmt_result_metadata(), returned no meta information\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Get total columns in the query */ - column_count= mysql_num_fields(prepare_meta_result); - fprintf(stdout, " total columns in SELECT statement: %d\n", column_count); - - if (column_count != MAXCOLUMN) /* validate column count */ - { - fprintf(stderr, " invalid column count returned by MySQL\n"); - exit(0); - } - - /* Execute the SELECT query */ - if (mysql_stmt_execute(stmt)) - { - fprintf(stderr, " mysql_stmt_execute(), failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Bind the result buffers for all 4 columns before fetching them */ - - memset(bind, 0, sizeof(bind)); - - /* INTEGER COLUMN */ - bind[0].buffer_type= MYSQL_TYPE_LONG; - bind[0].buffer= (char *)&int_data; - bind[0].is_null= &is_null[0]; - bind[0].length= &length[0]; - - /* STRING COLUMN */ - bind[1].buffer_type= MYSQL_TYPE_STRING; - bind[1].buffer= (char *)str_data; - bind[1].buffer_length= STRING_SIZE; - bind[1].is_null= &is_null[1]; - bind[1].length= &length[1]; - - /* SMALLINT COLUMN */ - bind[2].buffer_type= MYSQL_TYPE_FLOAT; - bind[2].buffer= (char *)&float_data; - bind[2].is_null= &is_null[2]; - bind[2].length= &length[2]; - - /* TIMESTAMP COLUMN */ - bind[3].buffer_type= MYSQL_TYPE_TIMESTAMP; - bind[3].buffer= (char *)&ts; - bind[3].is_null= &is_null[3]; - bind[3].length= &length[3]; - - /* Bind the result buffers */ - if (mysql_stmt_bind_result(stmt, bind)) - { - fprintf(stderr, " mysql_stmt_bind_result() failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Now buffer all results to client (optional step) */ - if (mysql_stmt_store_result(stmt)) - { - fprintf(stderr, " mysql_stmt_store_result() failed\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - - /* Fetch all rows */ - row_count= 0; - fprintf(stdout, "Fetching results ...\n"); - while (!mysql_stmt_fetch(stmt)) - { - row_count++; - fprintf(stdout, " row %d\n", row_count); - - /* column 1 */ - fprintf(stdout, " column1 (integer) : "); - if (is_null[0]) - fprintf(stdout, " NULL\n"); - else - fprintf(stdout, " %d(%ld)\n", int_data, length[0]); - - /* column 2 */ - fprintf(stdout, " column2 (string) : "); - if (is_null[1]) - fprintf(stdout, " NULL\n"); - else - fprintf(stdout, " %s(%ld)\n", str_data, length[1]); - - /* column 3 */ - fprintf(stdout, " column3 (float) : "); - if (is_null[2]) - fprintf(stdout, " NULL\n"); - else - fprintf(stdout, " %f(%ld)\n", float_data, length[2]); - - /* column 4 */ - fprintf(stdout, " column4 (timestamp): "); - if (is_null[3]) - fprintf(stdout, " NULL\n"); - else - fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n", - ts.year, ts.month, ts.day, - ts.hour, ts.minute, ts.second, - length[3]); - fprintf(stdout, "\n"); - } - - /* Free the prepared result metadata */ - mysql_free_result(prepare_meta_result); - - /* Close the statement */ - if (mysql_stmt_close(stmt)) - { - fprintf(stderr, " failed while closing the statement\n"); - fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); - exit(0); - } - -} diff --git a/example/dbms.mysql/select/main.cpp b/example/dbms.mysql/select/main.cpp new file mode 100644 index 0000000..3a13785 --- /dev/null +++ b/example/dbms.mysql/select/main.cpp @@ -0,0 +1,188 @@ +#include +#include + +#include + +#define STRING_SIZE 50 + +#define SELECT_SAMPLE "SELECT xx, yy, zz, tt FROM anna_db_test" + +#define MAXCOLUMN 4 + +MYSQL* mysql; +MYSQL_STMT *stmt; +MYSQL_BIND bind[MAXCOLUMN]; +MYSQL_RES *prepare_meta_result; +MYSQL_TIME ts; +unsigned long length[MAXCOLUMN]; +int param_count, column_count, row_count; +float float_data; +int int_data; +char str_data[STRING_SIZE]; +my_bool is_null[MAXCOLUMN]; + +/* + * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html + */ +int main (int argc, const char** argv) +{ + if ((mysql = mysql_init (NULL)) == NULL) + exit (-12); + + if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) { + fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Prepare a SELECT query to fetch data from test_table */ + stmt = mysql_stmt_init(mysql); + if (!stmt) + { + fprintf(stderr, " mysql_stmt_init(), out of memory\n"); + exit(0); + } + + if (mysql_stmt_prepare(stmt, SELECT_SAMPLE, strlen(SELECT_SAMPLE))) + { + fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + fprintf(stdout, " prepare, SELECT successful\n"); + + /* Get the parameter count from the statement */ + param_count= mysql_stmt_param_count(stmt); + fprintf(stdout, " total parameters in SELECT: %d\n", param_count); + + if (param_count != 0) /* validate parameter count */ + { + fprintf(stderr, " invalid parameter count returned by MySQL\n"); + exit(0); + } + + /* Fetch result set meta information */ + prepare_meta_result = mysql_stmt_result_metadata(stmt); + if (!prepare_meta_result) + { + fprintf(stderr," mysql_stmt_result_metadata(), returned no meta information\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Get total columns in the query */ + column_count= mysql_num_fields(prepare_meta_result); + fprintf(stdout, " total columns in SELECT statement: %d\n", column_count); + + if (column_count != MAXCOLUMN) /* validate column count */ + { + fprintf(stderr, " invalid column count returned by MySQL\n"); + exit(0); + } + + /* Execute the SELECT query */ + if (mysql_stmt_execute(stmt)) + { + fprintf(stderr, " mysql_stmt_execute(), failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Bind the result buffers for all 4 columns before fetching them */ + + memset(bind, 0, sizeof(bind)); + + /* INTEGER COLUMN */ + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&int_data; + bind[0].is_null= &is_null[0]; + bind[0].length= &length[0]; + + /* STRING COLUMN */ + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)str_data; + bind[1].buffer_length= STRING_SIZE; + bind[1].is_null= &is_null[1]; + bind[1].length= &length[1]; + + /* SMALLINT COLUMN */ + bind[2].buffer_type= MYSQL_TYPE_FLOAT; + bind[2].buffer= (char *)&float_data; + bind[2].is_null= &is_null[2]; + bind[2].length= &length[2]; + + /* TIMESTAMP COLUMN */ + bind[3].buffer_type= MYSQL_TYPE_TIMESTAMP; + bind[3].buffer= (char *)&ts; + bind[3].is_null= &is_null[3]; + bind[3].length= &length[3]; + + /* Bind the result buffers */ + if (mysql_stmt_bind_result(stmt, bind)) + { + fprintf(stderr, " mysql_stmt_bind_result() failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Now buffer all results to client (optional step) */ + if (mysql_stmt_store_result(stmt)) + { + fprintf(stderr, " mysql_stmt_store_result() failed\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + + /* Fetch all rows */ + row_count= 0; + fprintf(stdout, "Fetching results ...\n"); + while (!mysql_stmt_fetch(stmt)) + { + row_count++; + fprintf(stdout, " row %d\n", row_count); + + /* column 1 */ + fprintf(stdout, " column1 (integer) : "); + if (is_null[0]) + fprintf(stdout, " NULL\n"); + else + fprintf(stdout, " %d(%ld)\n", int_data, length[0]); + + /* column 2 */ + fprintf(stdout, " column2 (string) : "); + if (is_null[1]) + fprintf(stdout, " NULL\n"); + else + fprintf(stdout, " %s(%ld)\n", str_data, length[1]); + + /* column 3 */ + fprintf(stdout, " column3 (float) : "); + if (is_null[2]) + fprintf(stdout, " NULL\n"); + else + fprintf(stdout, " %f(%ld)\n", float_data, length[2]); + + /* column 4 */ + fprintf(stdout, " column4 (timestamp): "); + if (is_null[3]) + fprintf(stdout, " NULL\n"); + else + fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n", + ts.year, ts.month, ts.day, + ts.hour, ts.minute, ts.second, + length[3]); + fprintf(stdout, "\n"); + } + + /* Free the prepared result metadata */ + mysql_free_result(prepare_meta_result); + + /* Close the statement */ + if (mysql_stmt_close(stmt)) + { + fprintf(stderr, " failed while closing the statement\n"); + fprintf(stderr, " %s\n", mysql_stmt_error(stmt)); + exit(0); + } + +} diff --git a/example/dbms.mysql/xInsert/libraries.txt b/example/dbms.mysql/xInsert/libraries.txt new file mode 100644 index 0000000..e856851 --- /dev/null +++ b/example/dbms.mysql/xInsert/libraries.txt @@ -0,0 +1,10 @@ +dbms.mysql_static +dbms_static +comm_static +app_static +xml_static +io_static +core_static +mysqlclient +rt +xml2 diff --git a/example/dbms.mysql/xSelect/libraries.txt b/example/dbms.mysql/xSelect/libraries.txt new file mode 100644 index 0000000..e856851 --- /dev/null +++ b/example/dbms.mysql/xSelect/libraries.txt @@ -0,0 +1,10 @@ +dbms.mysql_static +dbms_static +comm_static +app_static +xml_static +io_static +core_static +mysqlclient +rt +xml2 diff --git a/example/dbos/workdir/libraries.txt b/example/dbos/workdir/libraries.txt new file mode 100644 index 0000000..bb96015 --- /dev/null +++ b/example/dbos/workdir/libraries.txt @@ -0,0 +1,9 @@ +dbos_static +dbms_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/diameter/batchConverter/libraries.txt b/example/diameter/batchConverter/libraries.txt new file mode 100644 index 0000000..39a2ba5 --- /dev/null +++ b/example/diameter/batchConverter/libraries.txt @@ -0,0 +1,7 @@ +diameter_static +time_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/diameter/launcher/includes.txt b/example/diameter/launcher/includes.txt new file mode 100644 index 0000000..9730e33 --- /dev/null +++ b/example/diameter/launcher/includes.txt @@ -0,0 +1 @@ +dynamic/launcher/default diff --git a/example/diameter/launcher/libraries.txt b/example/diameter/launcher/libraries.txt new file mode 100644 index 0000000..43bb577 --- /dev/null +++ b/example/diameter/launcher/libraries.txt @@ -0,0 +1,17 @@ +diameter.comm_static +diameter_static +time_static +statistics_static +http_static +timex_static +comm_static +http_static +app_static +xml_static +launcher_procedure_default_shared +testing_shared +io_static +core_static +pthread +rt +xml2 diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 7b13e12..6f2a653 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -26,8 +26,6 @@ int main(int argc, const char** argv) { Launcher app; anna::http::functions::initialize(); - std::cout << "XXXXXXXXXXXXXXXXXXXXXXX " << anna::functions::hash("hola que tal") << std::endl; - try { anna::CommandLine& commandLine(anna::CommandLine::instantiate()); // General diff --git a/example/diameter/pcapDecoder/libraries.txt b/example/diameter/pcapDecoder/libraries.txt new file mode 100644 index 0000000..4a4dc51 --- /dev/null +++ b/example/diameter/pcapDecoder/libraries.txt @@ -0,0 +1,3 @@ +core_static +pcap +rt diff --git a/example/diameter/stackManagement/libraries.txt b/example/diameter/stackManagement/libraries.txt new file mode 100644 index 0000000..39a2ba5 --- /dev/null +++ b/example/diameter/stackManagement/libraries.txt @@ -0,0 +1,7 @@ +diameter_static +time_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/diameter/tme/libraries.txt b/example/diameter/tme/libraries.txt new file mode 100644 index 0000000..39a2ba5 --- /dev/null +++ b/example/diameter/tme/libraries.txt @@ -0,0 +1,7 @@ +diameter_static +time_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/buffer/libraries.txt b/example/http/buffer/libraries.txt new file mode 100644 index 0000000..0cab6e6 --- /dev/null +++ b/example/http/buffer/libraries.txt @@ -0,0 +1,8 @@ +http_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/client/libraries.txt b/example/http/client/libraries.txt new file mode 100644 index 0000000..3d89363 --- /dev/null +++ b/example/http/client/libraries.txt @@ -0,0 +1,10 @@ +http_static +comm_static +timex_static +app_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/http/echo/libraries.txt b/example/http/echo/libraries.txt new file mode 100644 index 0000000..0cab6e6 --- /dev/null +++ b/example/http/echo/libraries.txt @@ -0,0 +1,8 @@ +http_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/kClient/libraries.txt b/example/http/kClient/libraries.txt new file mode 100644 index 0000000..7e25240 --- /dev/null +++ b/example/http/kClient/libraries.txt @@ -0,0 +1,9 @@ +http_static +comm_static +app_static +test_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/rServer/libraries.txt b/example/http/rServer/libraries.txt new file mode 100644 index 0000000..7e25240 --- /dev/null +++ b/example/http/rServer/libraries.txt @@ -0,0 +1,9 @@ +http_static +comm_static +app_static +test_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/server/libraries.txt b/example/http/server/libraries.txt new file mode 100644 index 0000000..7e25240 --- /dev/null +++ b/example/http/server/libraries.txt @@ -0,0 +1,9 @@ +http_static +comm_static +app_static +test_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/wims20Client/libraries.txt b/example/http/wims20Client/libraries.txt new file mode 100644 index 0000000..0cab6e6 --- /dev/null +++ b/example/http/wims20Client/libraries.txt @@ -0,0 +1,8 @@ +http_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/wims20RServer/libraries.txt b/example/http/wims20RServer/libraries.txt new file mode 100644 index 0000000..0cab6e6 --- /dev/null +++ b/example/http/wims20RServer/libraries.txt @@ -0,0 +1,8 @@ +http_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/wims20XClient/libraries.txt b/example/http/wims20XClient/libraries.txt new file mode 100644 index 0000000..3d89363 --- /dev/null +++ b/example/http/wims20XClient/libraries.txt @@ -0,0 +1,10 @@ +http_static +comm_static +timex_static +app_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/http/wims20XRServer/libraries.txt b/example/http/wims20XRServer/libraries.txt new file mode 100644 index 0000000..7e25240 --- /dev/null +++ b/example/http/wims20XRServer/libraries.txt @@ -0,0 +1,9 @@ +http_static +comm_static +app_static +test_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/xmlClient/libraries.txt b/example/http/xmlClient/libraries.txt new file mode 100644 index 0000000..3d89363 --- /dev/null +++ b/example/http/xmlClient/libraries.txt @@ -0,0 +1,10 @@ +http_static +comm_static +timex_static +app_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/http/xmlRServer/libraries.txt b/example/http/xmlRServer/libraries.txt new file mode 100644 index 0000000..7e25240 --- /dev/null +++ b/example/http/xmlRServer/libraries.txt @@ -0,0 +1,9 @@ +http_static +comm_static +app_static +test_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/http/xmlSender/libraries.txt b/example/http/xmlSender/libraries.txt new file mode 100644 index 0000000..0cab6e6 --- /dev/null +++ b/example/http/xmlSender/libraries.txt @@ -0,0 +1,8 @@ +http_static +comm_static +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/io/reader/libraries.txt b/example/io/reader/libraries.txt new file mode 100644 index 0000000..75ef593 --- /dev/null +++ b/example/io/reader/libraries.txt @@ -0,0 +1,6 @@ +app_static +io_static +xml_static +core_static +rt +xml2 diff --git a/example/ldap/tSearch/libraries.txt b/example/ldap/tSearch/libraries.txt new file mode 100644 index 0000000..bcec79b --- /dev/null +++ b/example/ldap/tSearch/libraries.txt @@ -0,0 +1,12 @@ +ldap_static +timex_static +comm_static +app_static +xml_static +io_static +core_static +pthread +rt +xml2 +ldap +lber diff --git a/example/time/conversor/libraries.txt b/example/time/conversor/libraries.txt new file mode 100644 index 0000000..33cfe20 --- /dev/null +++ b/example/time/conversor/libraries.txt @@ -0,0 +1,3 @@ +time_static +xml_static +core_static diff --git a/example/timex/ArithmeticHTTPServer/libraries.txt b/example/timex/ArithmeticHTTPServer/libraries.txt new file mode 100644 index 0000000..bc25732 --- /dev/null +++ b/example/timex/ArithmeticHTTPServer/libraries.txt @@ -0,0 +1,10 @@ +http_static +timex_static +comm_static +app_static +xml_static +io_static +core_static +pthread +rt +xml2 diff --git a/example/xml/xmlBasic/libraries.txt b/example/xml/xmlBasic/libraries.txt new file mode 100644 index 0000000..6cde9d4 --- /dev/null +++ b/example/xml/xmlBasic/libraries.txt @@ -0,0 +1,6 @@ +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/example/xml/xmlBinary/libraries.txt b/example/xml/xmlBinary/libraries.txt new file mode 100644 index 0000000..407ec3c --- /dev/null +++ b/example/xml/xmlBinary/libraries.txt @@ -0,0 +1,7 @@ +app_static +xml_static +io_static +core_static +z +rt +xml2 diff --git a/example/xml/xpath/libraries.txt b/example/xml/xpath/libraries.txt new file mode 100644 index 0000000..6cde9d4 --- /dev/null +++ b/example/xml/xpath/libraries.txt @@ -0,0 +1,6 @@ +app_static +xml_static +io_static +core_static +rt +xml2 diff --git a/scr/git/pre-commit.sh b/scr/git/pre-commit.sh deleted file mode 100755 index 01e85e9..0000000 --- a/scr/git/pre-commit.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-commit". - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 -fi - -# If you want to allow non-ascii filenames set this variable to true. -allownonascii=$(git config hooks.allownonascii) - - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ascii filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - echo "Error: Attempt to add a non-ascii file name." - echo - echo "This can cause problems if you want to work" - echo "with people on other platforms." - echo - echo "To be portable it is advisable to rename the file ..." - echo - echo "If you know what you are doing you can disable this" - echo "check using:" - echo - echo " git config hooks.allownonascii true" - echo - exit 1 -fi - -# Astyle -which astyle >/dev/null 2>/dev/null -if [ $? -ne 0 ]; then -echo "pre-commit hook: 'astyle' not found, install it before continuing or remove .fix_style to skip astyle processing." -exit 1 -fi -ASTYLE=astyle - -case `$ASTYLE --version 2> /dev/null` in - Artistic*) - ;; - default) - echo "pre-commit hook: unsupported astyle version, must be 'Artistic Style Version x.xx'. Install or skip (remove .fix_style)." - exit 1 - ;; -esac - -ASTYLE_PARAMETERS="--style=allman \ - --indent=spaces=2 \ - --convert-tabs \ - --indent-classes \ - --indent-switches \ - --indent-namespaces \ - --indent-labels \ - --indent-col1-comments \ - --min-conditional-indent=0 \ - --pad-oper \ - --pad-header \ - --unpad-paren \ - --align-pointer=name \ - --lineend=linux \ - --suffix=none" -# --brackets=linux -# --one-line=keep-statements -# --indent-preprocessor - -test_style () { - - file=$1 - newfile=${file}.astyled - #$ASTYLE ${ASTYLE_PARAMETERS} < $file > $newfile 2>>/dev/null - echo "Executing $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile" - $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile - if [ $? -ne 0 ] ; then - echo "Error in astyle" - exit 1 - fi - diff "${file}" "${newfile}" - if [ $? -ne 0 ] ; then - echo "Code style error in '$file', please fix before commiting." - if [ -f "./.fix_style" ]; then - echo "Auto-fixing code style..." - cp $file ${file}.orig - mv $newfile $file - else - echo "To autofix, create a hidden file named './.fix_style' on suite root." - rm $newfile - exit 1 - fi - else - rm $newfile - fi -} - -echo "Source code style checking ..." - -files=`git-diff-index --diff-filter=ACMR --name-only -r --cached $against --` -for file in $files; do - x=`echo $file |grep -E '(\.cpp|\.hpp)'` - if test "x$x" != "x"; then - test_style $file - git add $file - fi -done - -# If there are whitespace errors, print the offending file names and fail. -#exec git diff-index --check --cached $against -- - diff --git a/scr/git/use_post-update.sh b/scr/git/use_post-update.sh deleted file mode 100755 index 1e0fcd3..0000000 --- a/scr/git/use_post-update.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# THIS ONLY IS EFFECTIVE IF YOU ARE WORKING ON THE GIT SERVER HOST -cd `dirname $0`/../../.git/hooks -mv post-update.sample post-update 2>/dev/null diff --git a/scr/git/use_pre-commit.sh b/scr/git/use_pre-commit.sh deleted file mode 100755 index 04fcb26..0000000 --- a/scr/git/use_pre-commit.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -cd `dirname $0` -ln -sf ../../scr/git/pre-commit.sh ../../.git/hooks/pre-commit diff --git a/scripts/git/pre-commit.sh b/scripts/git/pre-commit.sh new file mode 100755 index 0000000..01e85e9 --- /dev/null +++ b/scripts/git/pre-commit.sh @@ -0,0 +1,127 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ascii filenames set this variable to true. +allownonascii=$(git config hooks.allownonascii) + + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ascii filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + echo "Error: Attempt to add a non-ascii file name." + echo + echo "This can cause problems if you want to work" + echo "with people on other platforms." + echo + echo "To be portable it is advisable to rename the file ..." + echo + echo "If you know what you are doing you can disable this" + echo "check using:" + echo + echo " git config hooks.allownonascii true" + echo + exit 1 +fi + +# Astyle +which astyle >/dev/null 2>/dev/null +if [ $? -ne 0 ]; then +echo "pre-commit hook: 'astyle' not found, install it before continuing or remove .fix_style to skip astyle processing." +exit 1 +fi +ASTYLE=astyle + +case `$ASTYLE --version 2> /dev/null` in + Artistic*) + ;; + default) + echo "pre-commit hook: unsupported astyle version, must be 'Artistic Style Version x.xx'. Install or skip (remove .fix_style)." + exit 1 + ;; +esac + +ASTYLE_PARAMETERS="--style=allman \ + --indent=spaces=2 \ + --convert-tabs \ + --indent-classes \ + --indent-switches \ + --indent-namespaces \ + --indent-labels \ + --indent-col1-comments \ + --min-conditional-indent=0 \ + --pad-oper \ + --pad-header \ + --unpad-paren \ + --align-pointer=name \ + --lineend=linux \ + --suffix=none" +# --brackets=linux +# --one-line=keep-statements +# --indent-preprocessor + +test_style () { + + file=$1 + newfile=${file}.astyled + #$ASTYLE ${ASTYLE_PARAMETERS} < $file > $newfile 2>>/dev/null + echo "Executing $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile" + $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile + if [ $? -ne 0 ] ; then + echo "Error in astyle" + exit 1 + fi + diff "${file}" "${newfile}" + if [ $? -ne 0 ] ; then + echo "Code style error in '$file', please fix before commiting." + if [ -f "./.fix_style" ]; then + echo "Auto-fixing code style..." + cp $file ${file}.orig + mv $newfile $file + else + echo "To autofix, create a hidden file named './.fix_style' on suite root." + rm $newfile + exit 1 + fi + else + rm $newfile + fi +} + +echo "Source code style checking ..." + +files=`git-diff-index --diff-filter=ACMR --name-only -r --cached $against --` +for file in $files; do + x=`echo $file |grep -E '(\.cpp|\.hpp)'` + if test "x$x" != "x"; then + test_style $file + git add $file + fi +done + +# If there are whitespace errors, print the offending file names and fail. +#exec git diff-index --check --cached $against -- + diff --git a/scripts/git/use_post-update.sh b/scripts/git/use_post-update.sh new file mode 100755 index 0000000..1e0fcd3 --- /dev/null +++ b/scripts/git/use_post-update.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# THIS ONLY IS EFFECTIVE IF YOU ARE WORKING ON THE GIT SERVER HOST +cd `dirname $0`/../../.git/hooks +mv post-update.sample post-update 2>/dev/null diff --git a/scripts/git/use_pre-commit.sh b/scripts/git/use_pre-commit.sh new file mode 100755 index 0000000..44d44cc --- /dev/null +++ b/scripts/git/use_pre-commit.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd `dirname $0` +ln -sf ../../scripts/git/pre-commit.sh ../../.git/hooks/pre-commit