diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d557b3ad61691a25ebd1d6e481d25944788f75a..58d999e5d52f882b2f6d310fc3806e6d5c438fbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,18 @@ project(mainapp) +cmake_minimum_required(VERSION 2.8) + if(CMAKE_BUILD_TYPE STREQUAL Release) set(CMAKE_BUILD_TYPE Release) + message("Release Compile Project") + set(by3rd_library_output "${PROJECT_SOURCE_DIR}/3rd/lib" CACHE INTERNAL "3rd Library" ) set(by3rd_library_execute "${PROJECT_SOURCE_DIR}/3rdexecute/release" CACHE INTERNAL "3rd execute" ) else() - set(CMAKE_BUILD_TYPE debug) + set(CMAKE_BUILD_TYPE Debug) add_definitions(-DDEBUG) + message("Debug Compile Project") + set(by3rd_library_output "${PROJECT_SOURCE_DIR}/3rd/lib" CACHE INTERNAL "3rd Library" ) set(by3rd_library_execute "${PROJECT_SOURCE_DIR}/3rd/3rdexecute/debug" CACHE INTERNAL "3rd execute" ) endif() @@ -31,6 +37,8 @@ else() endif() +message("Compile Info") +message("Compile System = ${CMAKE_SYSTEM_NAME}") add_subdirectory(main) add_subdirectory(comenv) add_subdirectory(infoanalysis) @@ -40,5 +48,4 @@ add_subdirectory(sshchannel) #add_subdirectory(adapterlua) #add_subdirectory(adapterpy) #add_subdirectory(mempool) -#add_subdirectory(adapters) - +#add_subdirectory(adapters) \ No newline at end of file diff --git a/adapterjs/CMakeLists.txt b/adapterjs/CMakeLists.txt index 2a69fc8b7433e5a0cfd8e5267a73d7b03ce46663..b38f0d48bb0bcda6a8cf5d365b276a564825bb2f 100644 --- a/adapterjs/CMakeLists.txt +++ b/adapterjs/CMakeLists.txt @@ -17,9 +17,15 @@ add_library(adapterjs SHARED ${adapterjs_src}) set_target_properties(adapterjs PROPERTIES OUTPUT_NAME "adapterjs") set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") -target_link_libraries(adapterjs dl pthread) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-O3") +endif() -target_link_libraries(adapterjs libnode.a) +target_link_libraries(adapterjs dl pthread) install(TARGETS adapterjs LIBRARY DESTINATION bin diff --git a/adapterjs/adapterjavascriptimpl.cpp b/adapterjs/adapterjavascriptimpl.cpp index 76b5bb77e3f8410e504c544ffcc993ef69f8cadd..aa8cb2d2c1f630bd40f521aedbe24ace90e146aa 100644 --- a/adapterjs/adapterjavascriptimpl.cpp +++ b/adapterjs/adapterjavascriptimpl.cpp @@ -1,7 +1,4 @@ #include "adapterjavascriptimpl.h" -#include -using namespace node; - CAdapterjavascriptImpl::CAdapterjavascriptImpl(void) { } @@ -50,8 +47,6 @@ std_method_impl CAdapterjavascriptImpl::RunFile(const char* file) char** argv = new char*[argc + 1]; string_strcpy(argv[0],"-e"); string_strcpy(argv[1],"console.log('Hello World')"); - - node::Start(argc, argv); return hr; } \ No newline at end of file diff --git a/adapterlua/CMakeLists.txt b/adapterlua/CMakeLists.txt index 53e104c01c4a67bfdbe2ccc7e9edaaa812e7cfab..4dedb403604bca1682199285f0d66586e6dc6727 100644 --- a/adapterlua/CMakeLists.txt +++ b/adapterlua/CMakeLists.txt @@ -24,7 +24,15 @@ add_library(adapterlua SHARED ${adapterlua_src}) set_target_properties(adapterlua PROPERTIES OUTPUT_NAME "adapterlua") set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") -#link_directories(/usr/lib/x86_64-linux-gnu) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-O3") +endif() + target_link_libraries(adapterlua dl crypt m lua5.1) diff --git a/adapterpy/CMakeLists.txt b/adapterpy/CMakeLists.txt index 95f51a4298c8e0e3dd6a4263cb1d5f46f958a652..da5dfd3c5f717dbd4aa214fc6fd32378dbc07609 100644 --- a/adapterpy/CMakeLists.txt +++ b/adapterpy/CMakeLists.txt @@ -25,6 +25,15 @@ add_library(adapterpy SHARED ${adapterpy_src}) set_target_properties(adapterpy PROPERTIES OUTPUT_NAME "adapterpy") set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-O3") +endif() + + link_directories(/usr/lib/x86_64-linux-gnu) target_link_libraries(adapterpy dl crypt m libpython3.4m.so) diff --git a/adapters/CMakeLists.txt b/adapters/CMakeLists.txt index 11a63063d6d04e22724887160b99474c0754268a..85dcacd462ed3cbe3a823432ed3bad601b84ac63 100644 --- a/adapters/CMakeLists.txt +++ b/adapters/CMakeLists.txt @@ -24,6 +24,13 @@ add_library(adapters SHARED ${adapters_src}) set_target_properties(adapters PROPERTIES OUTPUT_NAME "adapters") set_target_properties(adapters PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(adapters PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(adapters PROPERTIES COMPILE_FLAGS "-O3") +endif() target_link_libraries(adapters dl crypt m lua5.1) diff --git a/asynio/CMakeLists.txt b/asynio/CMakeLists.txt index 90ef4735286164011938d4a4539bebd152d98bd7..2e36f0bbf448c0f8bda334a6fe7e58cb33774036 100644 --- a/asynio/CMakeLists.txt +++ b/asynio/CMakeLists.txt @@ -31,7 +31,14 @@ set_target_properties(asynio PROPERTIES OUTPUT_NAME "asynio") set_target_properties(asynio PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -Werror -fexceptions") -#target_compile_options(asynio PRIVATE -fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -fexceptions) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(asynio PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(asynio PROPERTIES COMPILE_FLAGS "-O3") +endif() + target_link_libraries(asynio dl) diff --git a/comenv/CMakeLists.txt b/comenv/CMakeLists.txt index 8e7fe3086ab89656bc01271973cf2bd3d0cdc29b..a83a5ba2630f01cd57adb24891667f88366cc8b1 100644 --- a/comenv/CMakeLists.txt +++ b/comenv/CMakeLists.txt @@ -31,7 +31,15 @@ set_target_properties(comenv PROPERTIES OUTPUT_NAME "comenv") set_target_properties(comenv PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -Werror -fexceptions") -#target_compile_options(comenv PRIVATE -fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -fexceptions) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(comenv PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(comenv PROPERTIES COMPILE_FLAGS "-O3") +endif() + target_link_libraries(comenv dl) diff --git a/include/dlcom/tproperty.h b/include/dlcom/tproperty.h index 34da5b2713782f1efd1bbaa8009849f94577ec76..8e73a719548ae9d2c6a62bf879f5c9fc6fe03d39 100644 --- a/include/dlcom/tproperty.h +++ b/include/dlcom/tproperty.h @@ -7,7 +7,7 @@ using namespace util; namespace by { - template> + template > class TProperty_Impl { public: diff --git a/infoanalysis/CMakeLists.txt b/infoanalysis/CMakeLists.txt index 633755abf16af76a9602107f6229c29a97c19259..8a25f7efc3d6891b81301f9776b3a49e4592b807 100644 --- a/infoanalysis/CMakeLists.txt +++ b/infoanalysis/CMakeLists.txt @@ -30,7 +30,15 @@ set_target_properties(infoanalysis PROPERTIES OUTPUT_NAME "infoanalysis") set_target_properties(infoanalysis PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -Werror -fexceptions") -#target_compile_options(infoanalysis PRIVATE -fvisibility=hidden -fPIC -std=c++11 -frtti -Wall -fexceptions) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(infoanalysis PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(infoanalysis PROPERTIES COMPILE_FLAGS "-O3") +endif() + target_link_libraries(infoanalysis dl) diff --git a/infoanalysis/json.cpp b/infoanalysis/json.cpp index b6771e34657a6d42ccef538b1b09f8dcfcaa22d3..5e6b22100f2cd90fe1a6b9c204f9931749ba6924 100644 --- a/infoanalysis/json.cpp +++ b/infoanalysis/json.cpp @@ -31,106 +31,12 @@ string& CJson::replace_all(string& str, const string& old_value, const string& string CJson::Json2Xml(const string &strJson) { - string strXml = ""; - cJSON *pRoot = cJSON_Parse(strJson.c_str()); - if (NULL == pRoot) - { - return ""; - } - cJSON *pChild = pRoot->child; - while (pChild != NULL) - { - if (pChild->child != NULL) - { - std::string strSubKey = pChild->string; - - std::string strSubValue = Json2Xml(cJSON_Print(pChild)); - std::string strSubXml = "<" + strSubKey + ">" + strSubValue + ""; - strXml += strSubXml; - }else - { - std::string strKey = pChild->string; - std::string strVal = ""; - if (pChild->valuestring != NULL) - { - string strTemp = pChild->valuestring; - strVal = "\"" + strTemp + "\""; - }else - { - strVal = cJSON_Print(pChild); - } - - strXml = strXml + "<" + strKey + ">" + strVal + ""; - - } - - pChild = pChild->next; - } - if(NULL != pRoot) - { - cJSON_Delete(pRoot); - } - - return strXml; + return ""; } string CJson::Xml2Json(const string &strxml) { - cJSON *pJsonRoot = cJSON_CreateObject(); - - string strNext = strxml; - int nPos = 0; - while ((nPos = strNext.find("<")) != -1) - { - string strKey = GetXmlKey(strNext); - string strValue = GetXmlValueFromKey(strNext, strKey); - string strCurrXml = strNext; - strNext = GoToNextItem(strNext, strKey); - int LabelPos = strValue.find("<"); - int nMarkPos = strValue.find("\""); - if (strValue != "" && LabelPos != -1 && LabelPos < nMarkPos) - { - string strNextKey = GetXmlKey(strNext); - if (strNextKey == strKey) - { - cJSON *pArrayObj = cJSON_CreateArray(); - int nCnt = GetArrayItem(strCurrXml); - for (int i = 0; i < nCnt; i++) - { - strKey = GetXmlKey(strCurrXml); - strValue = GetXmlValueFromKey(strCurrXml, strKey); - string strArrayItem = Xml2Json(strValue); - cJSON *pArrayItem = cJSON_Parse(strArrayItem.c_str()); - cJSON_AddItemToArray(pArrayObj, pArrayItem); - strCurrXml = GoToNextItem(strCurrXml, strKey); - } - - cJSON_AddItemToObject(pJsonRoot, strNextKey.c_str(), pArrayObj); - strNext = strCurrXml; - }else - { - string strSubJson = Xml2Json(strValue); - cJSON *pSubJsonItem = cJSON_CreateObject(); - pSubJsonItem = cJSON_Parse(strSubJson.c_str()); - cJSON_AddItemToObject(pJsonRoot, strKey.c_str(), pSubJsonItem); - } - } - else - { - if (strValue.find("\"") == string::npos) - { - cJSON_AddNumberToObject(pJsonRoot, strKey.c_str(), atof(strValue.c_str())); - }else - { - remove_char(strValue, '\"'); - cJSON_AddStringToObject(pJsonRoot, strKey.c_str(), strValue.c_str()); - } - } - } - - string strJson = cJSON_Print(pJsonRoot); - cJSON_Delete(pJsonRoot); - return strJson; + return ""; } string CJson::GetXmlKey(const string &strxml) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index de0841005a740ba4033d6ecfa49b0f2b24948e4b..f2769353fc2243cc6b6e31cd3d9feb44350a55c2 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -25,10 +25,18 @@ set_target_properties(main PROPERTIES OUTPUT_NAME "main") set_target_properties(main PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall -Werror -fexceptions") -link_directories (/usr/local/lib) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(main PROPERTIES COMPILE_FLAGS "-g3") +endif() -target_link_libraries(main dl) +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(main PROPERTIES COMPILE_FLAGS "-O3") +endif() + + +link_directories (/usr/local/lib) +target_link_libraries(main dl) install(TARGETS main DESTINATION bin) diff --git a/mempool/CMakeLists.txt b/mempool/CMakeLists.txt index 07cd7ec6a7b6019a64f0cced789a8fd7377cdc40..b7fc3cb27a8205f0cb9be7769be550dba02e29d8 100644 --- a/mempool/CMakeLists.txt +++ b/mempool/CMakeLists.txt @@ -28,6 +28,14 @@ set_target_properties(mempool PROPERTIES OUTPUT_NAME "mempool") set_target_properties(mempool PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(mempool PROPERTIES COMPILE_FLAGS "-g3") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(mempool PROPERTIES COMPILE_FLAGS "-O3") +endif() + target_link_libraries(mempool dl crypt) install(TARGETS mempool diff --git a/sshchannel/CMakeLists.txt b/sshchannel/CMakeLists.txt index 2f332ac3f606190cf2ac782fd2a5e15a044d4e9b..58e7419f4e05be27220b98fc7550bf74c620e748 100644 --- a/sshchannel/CMakeLists.txt +++ b/sshchannel/CMakeLists.txt @@ -30,11 +30,13 @@ set_target_properties(sshchannel PROPERTIES OUTPUT_NAME "sshchannel") set_target_properties(sshchannel PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set_target_properties(sshchannel PROPERTIES COMPILE_FLAGS "-g3") +endif() - - - - +if(CMAKE_BUILD_TYPE STREQUAL Release) + set_target_properties(sshchannel PROPERTIES COMPILE_FLAGS "-O3") +endif() install(TARGETS sshchannel diff --git a/sshchannel/sshchannelimpl.cpp b/sshchannel/sshchannelimpl.cpp index c2cb35c62d68201ef9036fbfa875bc7f411b9257..5c4dcd40bd33cc7fe8abc700122398ed40f33501 100644 --- a/sshchannel/sshchannelimpl.cpp +++ b/sshchannel/sshchannelimpl.cpp @@ -43,6 +43,9 @@ std_method_impl CSshChannelImpl::Start() std_method_impl CSshChannelImpl::Stop() { HRESULT hr = S_OK; + + WaitDebug(); + return hr; }