Merge pull request #770 from franramirez688/biidevelop

Adapted POCO C++ to biicode C/C++ dependency manager
This commit is contained in:
Aleksandar Fabijanic 2015-04-07 12:57:00 -05:00
commit 3ee9e2a09d
18 changed files with 1023 additions and 0 deletions

View File

@ -35,6 +35,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Append our module directory to CMake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# COMMENT REPLACED BY BIICODE
#################################################################################
# Setup C/C++ compiler options
#################################################################################

View File

@ -6,6 +6,7 @@ Build Status
- Travis: [![Travis Build Status](https://travis-ci.org/pocoproject/poco.png?branch=develop)](https://travis-ci.org/pocoproject/poco)
- AppVeyor: [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/7iyrx3f233s3akae)](https://ci.appveyor.com/project/obiltschnig/poco)
- biicode: [![Build Status](https://webapi.biicode.com/v1/badges/fenix/fenix/poco/develop)](https://www.biicode.com/fenix/fenix/poco/develop)
![alt text][logo]

37
biicode/README.md Normal file
View File

@ -0,0 +1,37 @@
Biicode C/C++ dependency manager
=================================
New with biicode? Check the [Getting Started Guide](http://docs.biicode.com/c++/gettingstarted.html).
How to build it?
------------------
Building it is too easy:
$ git clone git@github.com:pocoproject/poco.git
$ cd poco
$ bii init -l && bii work
It creates all the necessary structure to build POCO C++ with biicode. Then, you could run its default samples:
$ bii build
$ ./bin/any_executable
Run faster using several processors, e.g., using 4 cores:
$ bii build -j4
**Note**: I recommend Windows OS users to use Visual Studio generator to build POCO project:
$ bii configure -G "Visual Studio 10"
$ bii build -j4
$ ./bin/any_executable
By default, the first use applies all the changes to the repository, if you want to revert these ones, set the BII_POCO_REVERT_CHANGES environment variable to True and run bii work to keep your original code and undo the biicode changes.
$ export BII_POCO_REVERT_CHANGES=True
$ bii work
How to use it in other external projects?
-------------------------------------------
Take a look at any example from [examples/poco(develop) block](https://www.biicode.com/examples/examples/poco/develop) and try your own using *POCO C++ develop version* with biicode.

View File

@ -0,0 +1,148 @@
macro(ENABLE_LIBRARIES )
if(NOT BII_LIB_SRC)
return()
endif()
string(FIND "${BII_LIB_SRC}" "Data/MySQL/include" MySQL_SINGLE_MATCHED )
IF(MySQL_SINGLE_MATCHED)
SET(ENABLE_DATA_MYSQL ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Data/ODBC/include" ODBC_SINGLE_MATCHED)
IF(ODBC_SINGLE_MATCHED)
SET(ENABLE_DATA_ODBC ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Data/SQLite/include" SQLite_SINGLE_MATCHED )
IF(SQLite_SINGLE_MATCHED)
SET(ENABLE_DATA_SQLITE ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "JSON/include" JSON_SINGLE_MATCHED )
IF(JSON_SINGLE_MATCHED)
SET(ENABLE_JSON ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "MongoDB/include" MONGODB_SINGLE_MATCHED )
IF(MONGODB_SINGLE_MATCHED)
SET(ENABLE_MONGODB ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Util/include" UTIL_SINGLE_MATCHED )
IF(UTIL_SINGLE_MATCHED)
SET(ENABLE_UTIL ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Net/include" NET_SINGLE_MATCHED )
IF(NET_SINGLE_MATCHED)
SET(ENABLE_NET ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Zip/include" ZIP_SINGLE_MATCHED )
IF(ZIP_SINGLE_MATCHED)
SET(ENABLE_ZIP ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "ApacheConnector/include" APACHECONNECTOR_SINGLE_MATCHED )
IF(APACHECONNECTOR_SINGLE_MATCHED)
SET(ENABLE_APACHECONNECTOR ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "CppParser/include" CPPPARSER_SINGLE_MATCHED )
IF(CPPPARSER_SINGLE_MATCHED)
SET(ENABLE_CPPPARSER ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "XML/include" XML_SINGLE_MATCHED )
IF(XML_SINGLE_MATCHED)
SET(ENABLE_XML ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Crypto/include" CRYPTO_SINGLE_MATCHED )
IF(CRYPTO_SINGLE_MATCHED)
SET(ENABLE_CRYPTO ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "Data/include" DATA_SINGLE_MATCHED )
IF(DATA_SINGLE_MATCHED)
SET(ENABLE_DATA ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "NetSSL_OpenSSL/include" NETSSL_OPENSSL_SINGLE_MATCHED )
IF(NETSSL_OPENSSL_SINGLE_MATCHED)
SET(ENABLE_NETSSL ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "NetSSL_Win/include" NETSSL_WIN_SINGLE_MATCHED )
IF(NETSSL_WIN_SINGLE_MATCHED)
SET(ENABLE_NETSSL_WIN ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "PDF/include" PDF_SINGLE_MATCHED )
IF(PDF_SINGLE_MATCHED)
SET(ENABLE_PDF ON)
ENDIF()
string(FIND "${BII_LIB_SRC}" "SevenZip/include" SEVENZIP_SINGLE_MATCHED )
IF(SEVENZIP_SINGLE_MATCHED)
SET(ENABLE_SEVENZIP ON)
ENDIF()
endmacro()
macro(FILTER_BII_LIB_SRC PATTERN)
if(NOT BII_LIB_SRC)
return()
endif()
SET(ALL_MATCHES )
foreach(RESOURCE_FILE ${BII_LIB_SRC})
set(SINGLE_MATCHED )
string(REGEX MATCH "${PATTERN}" SINGLE_MATCHED "${RESOURCE_FILE}")
IF(DEFINED SINGLE_MATCHED)
SET(ALL_MATCHES ${ALL_MATCHES} ${SINGLE_MATCHED})
ENDIF(DEFINED SINGLE_MATCHED)
endforeach(RESOURCE_FILE ${BII_LIB_SRC})
FOREACH(BAD_ITEM ${ALL_MATCHES})
LIST(REMOVE_ITEM BII_LIB_SRC ${BAD_ITEM})
ENDFOREACH(BAD_ITEM ${ALL_MATCHES})
endmacro()
# Delete all the bad implementations which biicode detects
macro(FILTER_BAD_DEPENDENCIES)
if(NOT BII_LIB_SRC)
return()
endif()
SET(BAD_DEPS_PATTERN "(.*)(_WIN32U|_UNIX|_POSIX|_STD|_C99|_DEC|_DUMMY|_SUN|_VMS|_WINCE|_WIN32|_VX|_Android|_HPUX)(.*)")
# First filter: selected the pattern "_WIN32" or similars
FILTER_BII_LIB_SRC(${BAD_DEPS_PATTERN})
# Second filter: special cases
SET(SPECIAL_BAD_DEPENDENCIES_WIN Foundation/include/Poco/SyslogChannel.h
Foundation/src/SyslogChannel.cpp
Foundation/include/Poco/OpcomChannel.h
Foundation/src/OpcomChannel.cpp)
SET(SPECIAL_BAD_DEPENDENCIES_UNIX Foundation/include/Poco/EventLogChannel.h
Foundation/src/EventLogChannel.cpp
Foundation/include/Poco/WindowsConsoleChannel.h
Foundation/src/WindowsConsoleChannel.cpp
Foundation/include/Poco/OpcomChannel.h
Foundation/src/OpcomChannel.cpp
Util/src/WinRegistryKey.cpp
Util/src/WinRegistryConfiguration.cpp
Util/src/WinService.cpp)
IF(WIN32)
FOREACH(SPECIAL_DEP ${SPECIAL_BAD_DEPENDENCIES_WIN})
list(FIND BII_LIB_SRC ${SPECIAL_DEP} DEP_MATCH)
if(DEP_MATCH)
LIST(REMOVE_ITEM BII_LIB_SRC ${SPECIAL_DEP})
endif()
ENDFOREACH()
ELSEIF(UNIX)
FOREACH(SPECIAL_DEP ${SPECIAL_BAD_DEPENDENCIES_UNIX})
list(FIND BII_LIB_SRC ${SPECIAL_DEP} DEP_MATCH)
if(DEP_MATCH)
LIST(REMOVE_ITEM BII_LIB_SRC ${SPECIAL_DEP})
endif()
ENDFOREACH()
ENDIF()
endmacro()

View File

@ -0,0 +1 @@
TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE ${OPENSSL_LIBRARIES})

41
biicode/cmake/Data.cmake Normal file
View File

@ -0,0 +1,41 @@
if (NOT POCO_STATIC)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DTHREADSAFE)
endif (NOT POCO_STATIC)
if(MSVC AND NOT(MSVC_VERSION LESS 1400))
set_source_files_properties(src/StatementImpl.cpp
PROPERTIES COMPILE_FLAGS "/bigobj")
endif()
if(ENABLE_DATA_SQLITE)
# SQlite3 is built in any case
include( SQLite )
endif(ENABLE_DATA_SQLITE)
if(ENABLE_DATA_MYSQL)
find_package(MySQL)
if(MYSQL_FOUND)
target_include_directories(${BII_BLOCK_TARGET} INTERFACE "${MYSQL_INCLUDE_DIR}")
message(STATUS "MySQL Support Enabled")
include( MySQL )
else()
message(STATUS "MySQL Support Disabled - no MySQL library")
endif(MYSQL_FOUND)
endif(ENABLE_DATA_MYSQL)
if(ENABLE_DATA_ODBC)
find_package(ODBC)
if(WIN32 AND NOT WINCE)
set(ODBC_LIBRARIES "odbc32" "odbccp32")
message(STATUS "Windows native ODBC Support Enabled")
include( ODBC )
else(WIN32 AND NOT WINCE)
if(ODBC_FOUND)
target_include_directories(${BII_BLOCK_TARGET} INTERFACE "${ODBC_INCLUDE_DIRECTORIES}")
message(STATUS "ODBC Support Enabled")
include( ODBC )
else()
message(STATUS "ODBC Support Disabled - no ODBC runtime")
endif()
endif(WIN32 AND NOT WINCE)
endif(ENABLE_DATA_ODBC)

View File

@ -0,0 +1,16 @@
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if (POCO_UNBUNDLED)
find_package(PCRE REQUIRED)
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES})
target_include_directories(${BII_BLOCK_TARGET} INTERFACE ${PCRE_INCLUDE_DIRS})
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
target_include_directories(${BII_BLOCK_TARGET} INTERFACE ${ZLIB_INCLUDE_DIRS})
endif (POCO_UNBUNDLED)
if(WIN32)
set(SYSLIBS ${SYSLIBS} iphlpapi)
endif(WIN32)
target_link_libraries(${BII_BLOCK_TARGET} INTERFACE ${SYSLIBS})

View File

@ -0,0 +1,2 @@
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DTHREADSAFE -DNO_TCL)
target_link_libraries( ${BII_BLOCK_TARGET} INTERFACE ${MYSQL_LIB})

View File

@ -0,0 +1 @@
target_link_libraries(${BII_BLOCK_TARGET} INTERFACE Crypt32.lib)

2
biicode/cmake/ODBC.cmake Normal file
View File

@ -0,0 +1,2 @@
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE ${ODBC_CFLAGS} -DTHREADSAFE)
target_link_libraries( ${BII_BLOCK_TARGET} INTERFACE ${ODBC_LIBRARIES})

6
biicode/cmake/PDF.cmake Normal file
View File

@ -0,0 +1,6 @@
if (POCO_UNBUNDLED)
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
endif (POCO_UNBUNDLED)
target_link_libraries(${BII_BLOCK_TARGET} INTERFACE ${SYSLIBS} )

View File

@ -0,0 +1,7 @@
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DSQLITE_THREADSAFE=1
-DSQLITE_DISABLE_LFS
-DSQLITE_OMIT_UTF16
-DSQLITE_OMIT_PROGRESS_CALLBACK
-DSQLITE_OMIT_COMPLETE
-DSQLITE_OMIT_TCL_VARIABLE
-DSQLITE_OMIT_DEPRECATED)

15
biicode/cmake/XML.cmake Normal file
View File

@ -0,0 +1,15 @@
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if (POCO_UNBUNDLED)
find_package(EXPAT REQUIRED)
set(SYSLIBS ${SYSLIBS} ${EXPAT_LIBRARIES})
include_directories(${EXPAT_INCLUDE_DIRS})
endif (POCO_UNBUNDLED)
if(WIN32)
#TODO: Is XML_STATIC only required with Windows? What does it do?
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DXML_STATIC -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
else()
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
endif()
target_link_libraries(${BII_BLOCK_TARGET} INTERFACE ${SYSLIBS})

View File

@ -0,0 +1,84 @@
# Append biicode module directory to CMake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_SOURCE_DIR}/biicode/cmake)
include(BiiPocoMacros)
FILTER_BAD_DEPENDENCIES()
# Actually create targets: EXEcutables and libraries.
ADD_BIICODE_TARGETS()
option(POCO_STATIC
"Set to OFF|ON (default is OFF) to control build of POCO as STATIC library" ON)
# Uncomment from next two lines to force statitc or dynamic library, default is autodetection
if(POCO_STATIC)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DPOCO_STATIC -DPOCO_NO_AUTOMATIC_LIBS)
set( LIB_MODE STATIC )
message(STATUS "Building static libraries")
else(POCO_STATIC)
set( LIB_MODE SHARED )
message(STATUS "Building dynamic libraries")
endif(POCO_STATIC)
# OS Detection
if(WIN32)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DPOCO_OS_FAMILY_WINDOWS -DUNICODE -D_UNICODE)
#set(SYSLIBS iphlpapi gdi32 odbc32)
endif(WIN32)
if (UNIX AND NOT ANDROID )
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DPOCO_OS_FAMILY_UNIX )
# Standard 'must be' defines
if (APPLE)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
set(SYSLIBS dl)
else (APPLE)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
set(SYSLIBS pthread dl rt)
endif (APPLE)
endif(UNIX AND NOT ANDROID )
if (CMAKE_COMPILER_IS_MINGW)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
target_compile_definitions(${BII_BLOCK_TARGET} INTERFACE -D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE)
endif (CMAKE_COMPILER_IS_MINGW)
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
ENABLE_LIBRARIES()
include(Foundation)
if(ENABLE_XML)
include(XML)
endif()
if(ENABLE_PDF)
include(PDF)
endif()
#NetSSL
if(WIN32 AND ENABLE_NETSSL_WIN)
include(NetSSL_Win)
endif(WIN32 AND ENABLE_NETSSL_WIN)
find_package(OpenSSL)
if(OPENSSL_FOUND)
target_include_directories(${BII_BLOCK_TARGET} INTERFACE "${OPENSSL_INCLUDE_DIR}")
if(ENABLE_NETSSL)
target_link_libraries(${BII_BLOCK_TARGET} INTERFACE ${OPENSSL_SSL_LIBRARY})
endif()
if(ENABLE_CRYPTO)
include(Crypto)
endif()
endif(OPENSSL_FOUND)
if(ENABLE_DATA)
include(Data)
endif()
find_package(APR)
find_package(Apache2)
if(APRUTIL_FOUND AND APACHE_FOUND)
target_include_directories(${BII_BLOCK_TARGET} INTERFACE "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" )
endif(APRUTIL_FOUND AND APACHE_FOUND)

74
biicode/conf/biicode.conf Normal file
View File

@ -0,0 +1,74 @@
# Biicode configuration file
[requirements]
fenix/7z: 0
fenix/hpdf: 1
fenix/sqlite: 0
zlib/zlib: 2
lasote/openssl(v1.0.2): 3
fenix/pcre: 0
[paths]
# Local directories to look for headers (within block)
/ApacheConnector/include
/CppParser/include
/CppUnit/include
/CppUnit/WinTestRunner/include
/Crypto/include
/Data/include
/Data/MySQL/include
/Data/ODBC/include
/Data/SQLite/include
/Foundation/include
/Net/include
/Util/include
/XML/include
/JSON/include
/MongoDB/include
/NetSSL_OpenSSL/include
/NetSSL_Win/include/Poco/Net
/PDF/include
/SevenZip/include
/Zip/include
[dependencies]
CMakeLists.txt + cmake/* VERSION LICENSE
Foundation/include/Poco/String.h = Foundation/src/String.cpp
Foundation/include/Poco/Format.h = Foundation/src/Format.cpp
# Advanced implementations
XML/include/Poco/XML/XMLException.h = XML/src/XMLException.cpp
XML/include/Poco/XML/expat.h = XML/src/xmlparse.cpp
XML/src/xmlrole.h = XML/src/xmlrole.c
XML/src/xmltok.h = XML/src/xmltok.c
XML/src/xmltok_impl.h = XML/src/xmltok_impl.c
Net/include/Poco/Net/NetException.h = Net/src/NetException.cpp
Util/include/Poco/Util/OptionException.h = Util/src/OptionException.cpp
Foundation/include/Poco/PipeImpl.h = Foundation/src/PipeImpl.cpp
JSON/include/Poco/JSON/JSONException.h = JSON/src/JSONException.cpp
JSON/include/Poco/JSON/Template.h = JSON/src/Template.cpp
PDF/include/Poco/PDF/PDFException.h = PDF/src/PDFException.cpp
Zip/include/Poco/Zip/ZipException.h = Zip/src/ZipException.cpp
Data/include/Poco/Data/DataException.h = Data/src/DataException.cpp
Data/SQLite/include/Poco/Data/SQLite/SQLiteException.h = Data/SQLite/src/SQLiteException.cpp
Data/ODBC/include/Poco/Data/ODBC/ODBCException.h = Data/ODBC/src/ODBCException.cpp
# Editing bad dependencies from NetSSL_OpenSSL and NetSSL_Win libraries
NetSSL_OpenSSL/include/Poco/Net/*.h - Net/src/*.cpp NetSSL_Win/src/*.cpp
NetSSL_OpenSSL/include/Poco/Net/SSLException.h = NetSSL_OpenSSL/src/SSLException.cpp
NetSSL_Win/include/Poco/Net/*.h - Net/src/*.cpp NetSSL_OpenSSL/src/*.cpp
NetSSL_Win/include/Poco/Net/SSLException.h = NetSSL_Win/src/SSLException.cpp
[includes]
# Creating relations if UNBUNDLED isn't defined
pcre*.h: fenix/pcre
zlib.h: zlib/zlib
zutil.h: zlib/zlib
hpdf*.h: fenix/hpdf/include
7z*.h: fenix/7z
openssl/*.h: lasote/openssl/include
sqlite3.h: fenix/sqlite
#[mains] section

250
biicode/conf/ignore.bii Normal file
View File

@ -0,0 +1,250 @@
*.com
*.sh
*.class
*.dll
*.exe
*.o
*.so
*.obj
*.pyc
*.dir
*.sln
*.vcpro
*.filters
*.sln
*.vcxproj
*.progen
*.vcproj
*.vxbuild
*.page
*.doc
*.template
*.properties
*.cmd
doc/*
build/*
contrib/*
patches/*
PocoDoc/*
PageCompiler/*
release/*
ProGen/*
PageCompiler/*
*/doc/*
*/testsuite/*
*/wcelibcex-1.0/*
*/File2Page/*
*/samples/*
# Ignored library files (zlib, pcre, hdpf, 7-zip)
*7z.h
*7zAlloc.c
*7zAlloc.h
*7zBuf.c
*7zBuf.h
*7zBuf2.c
*7zCrc.c
*7zCrc.h
*7zCrcOpt.c
*7zDec.c
*7zFile.c
*7zFile.h
*7zIn.c
*7zStream.c
*7zVersion.h
*adler32.c
*Alloc.c
*Alloc.h
*Bcj2.c
*Bcj2.h
*Bra.c
*Bra.h
*Bra86.c
*BraIA64.c
*compress.c
*CpuArch.c
*CpuArch.h
*crc32.c
*crc32.h
*deflate.c
*deflate.h
*Delta.c
*Delta.h
*gzguts.h
*gzio.c
*hpdf.h
*hpdf_annotation.c
*hpdf_annotation.h
*hpdf_array.c
*hpdf_binary.c
*hpdf_boolean.c
*hpdf_catalog.c
*hpdf_catalog.h
*hpdf_conf.h
*hpdf_consts.h
*hpdf_destination.c
*hpdf_destination.h
*hpdf_dict.c
*hpdf_doc.c
*hpdf_doc.h
*hpdf_doc_png.c
*hpdf_encoder.c
*hpdf_encoder.h
*hpdf_encoder_cns.c
*hpdf_encoder_cnt.c
*hpdf_encoder_jp.c
*hpdf_encoder_kr.c
*hpdf_encrypt.c
*hpdf_encrypt.h
*hpdf_encryptdict.c
*hpdf_encryptdict.h
*hpdf_error.c
*hpdf_error.h
*hpdf_ext_gstate.c
*hpdf_ext_gstate.h
*hpdf_font.c
*hpdf_font.h
*hpdf_fontdef.c
*hpdf_fontdef.h
*hpdf_fontdef_base14.c
*hpdf_fontdef_cid.c
*hpdf_fontdef_cns.c
*hpdf_fontdef_cnt.c
*hpdf_fontdef_jp.c
*hpdf_fontdef_kr.c
*hpdf_fontdef_tt.c
*hpdf_fontdef_type1.c
*hpdf_font_cid.c
*hpdf_font_tt.c
*hpdf_font_type1.c
*hpdf_gstate.c
*hpdf_gstate.h
*hpdf_image.c
*hpdf_image.h
*hpdf_image_png.c
*hpdf_info.c
*hpdf_info.h
*hpdf_list.c
*hpdf_list.h
*hpdf_mmgr.c
*hpdf_mmgr.h
*hpdf_name.c
*hpdf_null.c
*hpdf_number.c
*hpdf_objects.c
*hpdf_objects.h
*hpdf_outline.c
*hpdf_outline.h
*hpdf_pages.c
*hpdf_pages.h
*hpdf_page_label.c
*hpdf_page_label.h
*hpdf_page_operator.c
*hpdf_real.c
*hpdf_streams.c
*hpdf_streams.h
*hpdf_string.c
*hpdf_types.h
*hpdf_utils.c
*hpdf_utils.h
*hpdf_xref.c
*infback.c
*inffast.c
*inffast.h
*inffixed.h
*inflate.c
*inflate.h
*inftrees.c
*inftrees.h
*LzFind.c
*LzFind.h
*LzFindMt.c
*LzFindMt.h
*LzHash.h
*Lzma2Dec.c
*Lzma2Dec.h
*Lzma2Enc.c
*Lzma2Enc.h
*Lzma86.h
*Lzma86Dec.c
*Lzma86Enc.c
*LzmaDec.c
*LzmaDec.h
*LzmaEnc.c
*LzmaEnc.h
*LzmaLib.c
*LzmaLib.h
*MtCoder.c
*MtCoder.h
*pcre.h
*pcre_byte_order.c
*pcre_chartables.c
*pcre_compile.c
*pcre_config.c
*pcre_config.h
*pcre_dfa_exec.c
*pcre_exec.c
*pcre_fullinfo.c
*pcre_get.c
*pcre_globals.c
*pcre_internal.h
*pcre_jit_compile.c
*pcre_maketables.c
*pcre_newline.c
*pcre_ord2utf8.c
*pcre_refcount.c
*pcre_string_utils.c
*pcre_study.c
*pcre_tables.c
*pcre_ucd.c
*pcre_valid_utf8.c
*pcre_version.c
*pcre_xclass.c
*png.c
*png.h
*pngconf.h
*pngerror.c
*pnggccrd.c
*pngget.c
*pngmem.c
*pngpread.c
*pngread.c
*pngrio.c
*pngrtran.c
*pngrutil.c
*pngset.c
*pngtest.c
*pngtrans.c
*pngvcrd.c
*pngwio.c
*pngwrite.c
*pngwtran.c
*pngwutil.c
*Ppmd.h
*Ppmd7.c
*Ppmd7.h
*Ppmd7Dec.c
*Ppmd7Enc.c
*RotateDefs.h
*Sha256.c
*Sha256.h
*Threads.c
*Threads.h
*trees.c
*trees.h
*ucp.h
*Xz.c
*Xz.h
*XzCrc64.c
*XzCrc64.h
*XzDec.c
*XzEnc.c
*XzEnc.h
*XzIn.c
*zconf.h
*zlib.h
*zutil.c
*zutil.h
*sqlite3.c
*sqlite3.h

157
biicode/conf/pocomsg.h.bii Normal file
View File

@ -0,0 +1,157 @@
//
// pocomsg.mc[.h]
//
// $Id: //poco/1.4/Foundation/src/pocomsg.mc#1 $
//
// The Poco message source/header file.
//
// NOTE: pocomsg.h is automatically generated from pocomsg.mc.
// Never edit pocomsg.h directly!
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// Categories
//
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
//
// Define the severity codes
//
//
// MessageId: POCO_CTG_FATAL
//
// MessageText:
//
// Fatal
//
#define POCO_CTG_FATAL 0x00000001L
//
// MessageId: POCO_CTG_CRITICAL
//
// MessageText:
//
// Critical
//
#define POCO_CTG_CRITICAL 0x00000002L
//
// MessageId: POCO_CTG_ERROR
//
// MessageText:
//
// Error
//
#define POCO_CTG_ERROR 0x00000003L
//
// MessageId: POCO_CTG_WARNING
//
// MessageText:
//
// Warning
//
#define POCO_CTG_WARNING 0x00000004L
//
// MessageId: POCO_CTG_NOTICE
//
// MessageText:
//
// Notice
//
#define POCO_CTG_NOTICE 0x00000005L
//
// MessageId: POCO_CTG_INFORMATION
//
// MessageText:
//
// Information
//
#define POCO_CTG_INFORMATION 0x00000006L
//
// MessageId: POCO_CTG_DEBUG
//
// MessageText:
//
// Debug
//
#define POCO_CTG_DEBUG 0x00000007L
//
// MessageId: POCO_CTG_TRACE
//
// MessageText:
//
// Trace
//
#define POCO_CTG_TRACE 0x00000008L
//
// Event Identifiers
//
//
// MessageId: POCO_MSG_LOG
//
// MessageText:
//
// %1
//
#define POCO_MSG_LOG 0x00001000L

View File

@ -0,0 +1,179 @@
'''
This is the biicode hook file. It changes some relative #include's, adds some lines to CMakeLists
and some configuration files to root project folder to make possible POCO reusing.
You can revert all the modifications suffered in the original code. By default,
if you're using biicode, the changes are applied:
BII_POCO_REVERT_CHANGES = False
To revert all, run into your current command prompt:
Windows: $ set BII_POCO_REVERT_CHANGES=True
Unix: $ export BII_POCO_REVERT_CHANGES=True
and execute "bii work" to back into original form.
'''
import os
import re
import shutil
import platform
def replacement(match_object):
if not "Poco/Net/" in match_object.group(0):
return '#include "Poco/Net/%s"' % match_object.group(1)
return '#include "%s"' % match_object.group(1)
def save(path, binary_content):
with open(path, 'wb') as handle:
handle.write(binary_content)
def load(path):
with open(path, 'rb') as handle:
return handle.read()
def search_and_replace_pattern(_files, base_path, pattern):
for _file in _files:
try:
_file_path = os.path.join(base_path, _file)
c = load(_file_path)
c = re.sub(pattern, replacement, c)
save(_file_path, c)
except:
pass
def search_and_replace(_file, token, _replacement):
try:
c = load(_file)
c = c.replace(token, _replacement)
save(_file, c)
except:
pass
def prepare_all_samples():
ignored_samples = ['ApacheConnector', 'CppUnit',
'PageCompiler']
poco_modules = os.listdir(root_folder)
for module in os.listdir(root_folder):
if (platform.system() != "Windows" and module == "NetSSL_Win") \
or module in ignored_samples:
continue
samples_module_path = os.path.join(root_folder, module, 'samples')
if os.path.exists(samples_module_path):
example_dest = os.path.join(root_folder, 'examples', module)
shutil.copytree(samples_module_path, example_dest)
if "#[mains] section" in load(biicode_conf_path):
examples_mains = '''[mains]
# Crypto
examples/Crypto/genrsakey/src/genrsakey.cpp
# SevenZip
examples/SevenZip/un7zip/src/un7zip.cpp
# Util
examples/Util/pkill/src/pkill.cpp
examples/Util/SampleApp/src/SampleApp.cpp
examples/Util/SampleServer/src/SampleServer.cpp
# Zip
examples/Zip/zip/src/zip.cpp
examples/Zip/unzip/src/unzip.cpp
'''
search_and_replace(biicode_conf_path, "#[mains] section", examples_mains)
def delete_all_samples():
examples_path = os.path.join(root_folder, 'examples')
if os.path.exists(examples_path):
shutil.rmtree(examples_path)
def apply_changes():
''' Applying necessary chnages to use POCO with biicode '''
shutil.copy(os.path.join(root_folder, 'biicode', 'conf', 'biicode.conf'), root_folder)
shutil.copy(os.path.join(root_folder, 'biicode', 'conf', 'ignore.bii'), root_folder)
shutil.copy(os.path.join(root_folder, 'biicode', 'conf', 'pocomsg.h.bii'),
os.path.join(root_folder, 'Foundation', 'src', 'pocomsg.h'))
base_header_name = os.path.join(root_folder, "Foundation", "include", "Poco")
# Replacements
if os_platform == "Windows":
pattern_match = '#include\s+"Poco/Net/(%s)"' % '|'.join(netssl_win_all_headers)
pattern_match = pattern_match.replace('.', '\\.')
search_and_replace_pattern(netssl_win_all_headers, netssl_win_headers_path, pattern_match)
search_and_replace_pattern(netssl_win_all_sources, netssl_win_src_path, pattern_match)
search_and_replace(os.path.join(base_header_name, "DeflatingStream.h"), "Poco/zlib.h", "zlib/zlib/zlib.h")
search_and_replace(os.path.join(base_header_name, "InflatingStream.h"), "Poco/zlib.h", "zlib/zlib/zlib.h")
search_and_replace(os.path.join(root_folder, "Foundation", "src", "Checksum.cpp"), "Poco/zlib.h", "zlib/zlib/zlib.h")
search_and_replace(os.path.join(root_folder, "Zip", "src", "ZipStream.cpp"), "Poco/zlib.h", "zlib/zlib/zlib.h")
search_and_replace(cmakelist_path, cmakelist_token, cmakelist_replacement)
prepare_all_samples()
def revert_changes():
''' Revert all the biicode changes code '''
os.remove(biicode_conf_path)
os.remove(ignore_bii_path)
os.remove(pocomsg_h_path)
base_header_name = os.path.join(root_folder, "Foundation", "include", "Poco")
# Replacements
if os_platform == "Windows":
pattern_match = '#include\s+"(%s)"' % '|'.join(netssl_win_all_headers)
pattern_match = pattern_match.replace('.', '\\.')
search_and_replace_pattern(netssl_win_all_headers, netssl_win_headers_path, pattern_match)
search_and_replace_pattern(netssl_win_all_sources, netssl_win_src_path, pattern_match)
search_and_replace(os.path.join(base_header_name, "DeflatingStream.h"), "zlib/zlib/zlib.h", "Poco/zlib.h")
search_and_replace(os.path.join(base_header_name, "InflatingStream.h"), "zlib/zlib/zlib.h", "Poco/zlib.h")
search_and_replace(os.path.join(root_folder, "Foundation", "src", "Checksum.cpp"), "zlib/zlib/zlib.h", "Poco/zlib.h")
search_and_replace(os.path.join(root_folder, "Zip", "src", "ZipStream.cpp"), "zlib/zlib/zlib.h", "Poco/zlib.h")
if os_platform == "Windows":
search_and_replace(cmakelist_path, cmakelist_replacement_win, cmakelist_token)
else:
search_and_replace(cmakelist_path, cmakelist_replacement, cmakelist_token)
delete_all_samples()
# Main code
os_platform = platform.system()
BII_POCO_REVERT_CHANGES = os.environ.get('BII_POCO_REVERT_CHANGES', 'False')
root_folder = bii.block_folder if os.path.exists(bii.block_folder) else bii.project_folder
netssl_win_headers_path = os.path.join(root_folder, 'NetSSL_Win', 'include', 'Poco', 'Net')
netssl_win_all_headers = os.listdir(netssl_win_headers_path)
netssl_win_src_path = os.path.join(root_folder, 'NetSSL_Win', 'src')
netssl_win_all_sources = os.listdir(netssl_win_src_path)
ignore_bii_path = os.path.join(root_folder, 'ignore.bii')
biicode_conf_path = os.path.join(root_folder, 'biicode.conf')
pocomsg_h_path = os.path.join(root_folder, 'Foundation', 'src', 'pocomsg.h')
cmakelist_path = os.path.join(root_folder, "CMakeLists.txt")
cmakelist_token = "# COMMENT REPLACED BY BIICODE"
cmakelist_replacement = '''if(BIICODE)
include(biicode/cmake/biicode.cmake)
return()
endif()'''
cmakelist_replacement_win = "if(BIICODE)\r\ninclude(biicode/cmake/biicode.cmake)\r\nreturn()\r\nendif()"
try:
# Apply or revert changes
if BII_POCO_REVERT_CHANGES == 'False':
if "if(BIICODE)" in load(cmakelist_path):
print "Hook: changes just applied"
else:
print "Hook: applying changes"
apply_changes()
else:
if "if(BIICODE)" not in load(cmakelist_path):
print "Hook: changes just reverted"
else:
print "Hook: reverting changes"
revert_changes()
except Exception as e:
print "Exception: %s" % e