diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..2eb779d1f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 2.8) +project(libtango) +include(CTest) + +enable_testing() +#need to define the version of the library +set(MAJOR_VERSION "9") +set(MINOR_VERSION "2") +set(PATCH_VERSION "5") + +#convenient versions +set(LIBRARY_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") +set(SO_VERSION "${MAJOR_VERSION}") + +include(configure/CMakeLists.txt) + +include_directories(cppapi/client) +include_directories(cppapi/client/helpers) +include_directories(cppapi/server) +include_directories(cppapi/server/idl) +include_directories(log4tango/include) +#required for generated config.h +include_directories(${CMAKE_CURRENT_BINARY_DIR}/log4tango/include) + + +#source code +add_subdirectory("log4tango") +add_subdirectory("cppapi") +add_subdirectory("cpp_test_suite") +add_subdirectory("cpp_test_ds") + +add_library(tango SHARED $ + $ + $ + $ + $ + $) +target_include_directories(tango PUBLIC ${ZMQ_PKG_INCLUDE_DIRS} ${OMNIORB_PKG_INCLUDE_DIRS} ${OMNIDYN_PKG_INCLUDE_DIRS}) +target_link_libraries(tango PUBLIC ${ZMQ_PKG_LIBRARIES} ${OMNIORB_PKG_LIBRARIES} ${OMNICOS_PKG_LIBRARIES} ${OMNIDYN_PKG_LIBRARIES}) +target_compile_options(tango PUBLIC ${ZMQ_PKG_CFLAGS_OTHER} ${OMNIORB_PKG_CFLAGS_OTHER} ${OMNICOS_PKG_CFLAGS_OTHER} ${OMNIDYN_PKG_CFLAGS_OTHER}) + +set_target_properties(tango PROPERTIES + VERSION ${LIBRARY_VERSION} + SOVERSION ${SO_VERSION}) + +#install code +install(TARGETS tango LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}") + +configure_file(tango.pc.cmake tango.pc @ONLY) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tango.pc" + DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") diff --git a/README.md b/README.md index 303b7cb1a..0e9b5f043 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,10 @@ This repository is the result of svn2git migration of tango source code. It is c 7. Public automatic testing/continuous integration (e.g., via Travis) is recommended 8. The main development should be done on the tango-controls hosted project (as opposed to using a private organization project and just pushing to the tango-controls repo from time to time). This allows for public visibility of the latest development and issues and encourages sharing and reuse. If a given organization needs special tweaks or has particular release/testing cycles, the recommendation is that the organization forks from the "canonical" repo +# How to build and install using cmake + +`mkdir build; cd build; cmake .. [-DCMAKE_INSTALL_PREFIX=] [-DOMNI_BASE=] [-DZMQ_BASE=] [-DCMAKE_BUILD_TYPE=RELEASE|DEBUG] [-DCMAKE_VERBOSE_MAKEFILE=true]; make; make install` # Links -[Tango Controls web page](http://tango-controls.org) +[Tango Controls web page](http://tango-controls.org) \ No newline at end of file diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt new file mode 100644 index 000000000..b21ee8879 --- /dev/null +++ b/configure/CMakeLists.txt @@ -0,0 +1,53 @@ +include(FindPkgConfig) + +if(NOT CMAKE_BUILD_TYPE) + message("No build type specified - default is DEBUG") + set(CMAKE_BUILD_TYPE DEBUG) +endif() + +if(OMNI_BASE) + message("Using OMNI_BASE=${OMNI_BASE}") + set(OMNIORB_PKG_INCLUDE_DIRS ${OMNI_BASE}/include) + set(OMNIORB_PKG_LIBRARIES "-lomniORB4 -lomnithread -lCOS4 -lomniDynamic4") + include_directories(${OMNI_BASE}/include) + link_directories(${OMNI_BASE}/lib) +else() + #CORBA + pkg_search_module(OMNIORB_PKG REQUIRED omniORB4) + #COS + pkg_search_module(OMNICOS_PKG REQUIRED omniCOS4) + #dynamic CORBA + pkg_search_module(OMNIDYN_PKG REQUIRED omniDynamic4) + if(NOT OMNIORB_PKG_FOUND) + message(FATAL "omniORB4 library is required for Tango") + endif() +endif() + +if(ZMQ_BASE) + message("Using ZMQ_BASE=${ZMQ_BASE}") + set(ZMQ_PKG_INCLUDE_DIRS ${ZMQ_BASE}/include) + set(ZMQ_PKG_LIBRARIES "-lzmq") + link_directories(${ZMQ_BASE}/lib) +else() + pkg_search_module(ZMQ_PKG REQUIRED libzmq) + if(NOT ZMQ_PKG_FOUND) + message(FATAL "ZMQ library is required for Tango") + endif() +endif() + +#setup for GNU CXX compiler +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message("found GNU compiler ...") + if(CMAKE_BUILD_TYPE MATCHES RELEASE) + message("setup for release build ...") + add_definitions(-O2 -D_TANGO_LIB) + else() + message("setup for debug build ...") + add_definitions(-g -O0 -Wall -Wextra)# -pedantic + endif() + add_definitions(-std=c++11) + add_definitions(-DGNU_CXX -DOMNI_UNLOADABLE_STUBS -D_FORTIFY_SOURCE=2) + add_definitions(-fPIC) +endif() + +include(GNUInstallDirs) \ No newline at end of file diff --git a/cpp_test_ds/CMakeLists.txt b/cpp_test_ds/CMakeLists.txt new file mode 100644 index 000000000..d09944dde --- /dev/null +++ b/cpp_test_ds/CMakeLists.txt @@ -0,0 +1,23 @@ +set(SOURCES main.cpp + TypeCmds.cpp + SigThrow.cpp + IOMisc.cpp + IOStr1.cpp + IOStr2.cpp + IOArray1.cpp + IOArray2.cpp + IOStrArray.cpp + IOStruct.cpp + IOSetAttr.cpp + IOAddAttribute.cpp + IOSeqVec.cpp + FileDb.cpp + classfactory.cpp + DevTestClass.cpp + DevTest.cpp) + +add_subdirectory(fwd_ds) + +add_executable(devTest ${SOURCES}) +target_include_directories(devTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(devTest PUBLIC ${CMAKE_DL_LIBS} tango) diff --git a/cpp_test_ds/IOLongVar.cpp b/cpp_test_ds/IOLongVar.cpp deleted file mode 100644 index 13cd0c845..000000000 --- a/cpp_test_ds/IOLongVar.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "IOLong.h" - -//+---------------------------------------------------------------------------- -// -// method : IOLong::IOLong() -// -// description : constructor for the IOLong command of the -// DevTest. -// -// In : - name : The command name -// - in : The input parameter type -// - out : The output parameter type -// - in_desc : The input parameter description -// - out_desc : The output parameter description -// -//----------------------------------------------------------------------------- - -IOLong::IOLong(const char *name,Tango_CmdArgType in, - Tango_CmdArgType out,const char *in_desc, - const char *out_desc) -:Command(name,in,out,in_desc,out_desc) -{ -} - -//+---------------------------------------------------------------------------- -// -// method : IOLong::is_allowed() -// -// description : method to test whether command is allowed or not in this -// state. In this case, the command is allowed only if -// the device is in ON state -// -// in : - device : The device on which the command must be excuted -// - in_any : The command input data -// -// returns : boolean - true == is allowed , false == not allowed -// -//----------------------------------------------------------------------------- - -bool IOLong::is_allowed(DeviceImpl *device, const CORBA_Any &in_any) -{ - -// -// command allowed only if the device is on -// - - if (device->get_state() == Tango_ON) - return(true); - else - return(false); -} - -//+---------------------------------------------------------------------------- -// -// method : IOLong::execute() -// -// description : method to trigger the execution of the IOLong -// command -// -// in : - device : The device on which the command must be excuted -// - in_any : The command input data -// -// returns : The command output data (packed in the Any object) -// -//----------------------------------------------------------------------------- - - -CORBA_Any *IOLong::execute(DeviceImpl *device,const CORBA_Any &in_any) -{ - try { - Tango_DevLong theNumber; - extract(in_any,theNumber); - cout << "[IOLong::execute] received number " << theNumber << endl; - theNumber = theNumber * 2; - cout << "[IOLong::execute] return number " << theNumber << endl; - return insert(theNumber); - } - catch (CORBA_Exception &e) - { - Tango::Except::print_exception(e); - throw ; - } -} - - diff --git a/cpp_test_ds/fwd_ds/CMakeLists.txt b/cpp_test_ds/fwd_ds/CMakeLists.txt new file mode 100644 index 000000000..e589c4386 --- /dev/null +++ b/cpp_test_ds/fwd_ds/CMakeLists.txt @@ -0,0 +1,9 @@ +set(SOURCES ClassFactory.cpp + FwdTestClass.cpp + FwdTest.cpp + FwdTestStateMachine.cpp + main.cpp) + +add_executable(FwdTest ${SOURCES}) +target_include_directories(FwdTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(FwdTest PUBLIC ${CMAKE_DL_LIBS} tango) diff --git a/cpp_test_suite/CMakeLists.txt b/cpp_test_suite/CMakeLists.txt new file mode 100644 index 000000000..1cd9cb3f5 --- /dev/null +++ b/cpp_test_suite/CMakeLists.txt @@ -0,0 +1,26 @@ +#TODO different OS +set(DEV1 "test/debian8/10") +set(DEV2 "test/debian8/11") +set(DEV3 "test/debian8/12") +set(FWD_DEV "test/fwd_debian8/10") +set(SERV_NAME "devTest") +set(INST_NAME "debian8") +set(DEV1_ALIAS "debian8_alias") +set(ATTR_ALIAS "debian8_attr_alias") +cmake_host_system_information(RESULT HOST_NAME QUERY HOSTNAME) +set(FULL_HOSTNAME "${HOST_NAME}:10000") + +macro(TEST_SUITE_ADD_TEST test) + message("Add test ${test}") + add_executable(${test} ${test}.cpp) + target_compile_definitions(${test} PUBLIC "-DVALGRIND -D_PTHREADS -D_REENTRANT") +# target_include_directories(${test} PUBLIC ../cxxtest/include) + target_link_libraries(${test} ${CMAKE_DL_LIBS} tango) + add_test(NAME "CPP::${test}" COMMAND $ ${DEV1}) +endmacro() + +add_subdirectory(asyn) +add_subdirectory(event) +#add_subdirectory(old_tests) +add_subdirectory(new_tests) +add_subdirectory(cxxtest) \ No newline at end of file diff --git a/cpp_test_suite/asyn/CMakeLists.txt b/cpp_test_suite/asyn/CMakeLists.txt new file mode 100644 index 000000000..b2936c69a --- /dev/null +++ b/cpp_test_suite/asyn/CMakeLists.txt @@ -0,0 +1,17 @@ +set(TESTS asyn_attr_cb + asyn_attr + asyn_attr_multi + asyn_cb2 + asyn_cb_cmd + asyn_cb + asyn_cmd + asyn_faf + asyn_thread + asyn_write_attr + asyn_write_attr_multi + asyn_write_cb + auto_asyn_cmd) + +foreach(TEST ${TESTS}) + TEST_SUITE_ADD_TEST(${TEST}) +endforeach(TEST) \ No newline at end of file diff --git a/cpp_test_suite/cxxtest/CMakeLists.txt b/cpp_test_suite/cxxtest/CMakeLists.txt new file mode 100644 index 000000000..16fb2bd31 --- /dev/null +++ b/cpp_test_suite/cxxtest/CMakeLists.txt @@ -0,0 +1,61 @@ +message("Generate runner.cpp") +execute_process(COMMAND python cxxtestgen.py --template=${CMAKE_CURRENT_SOURCE_DIR}/template/tango_template.tpl + -o ${CMAKE_CURRENT_SOURCE_DIR}/runner.cpp + ../../new_tests/cxx_syntax.cpp + ../../new_tests/cxx_poll.cpp + ../../new_tests/cxx_poll_admin.cpp + ../../new_tests/cxx_dserver_cmd.cpp + ../../new_tests/cxx_dserver_misc.cpp + ../../new_tests/cxx_always_hook.cpp + ../../new_tests/cxx_blackbox.cpp + ../../new_tests/cxx_attr_misc.cpp + ../../new_tests/cxx_attrprop.cpp + ../../new_tests/cxx_attr_write.cpp + ../../new_tests/cxx_attr_conf.cpp + ../../new_tests/cxx_attr.cpp + ../../new_tests/cxx_misc_util.cpp + ../../new_tests/cxx_templ_cmd.cpp + ../../new_tests/cxx_exception.cpp + ../../new_tests/cxx_cmd_query.cpp + ../../new_tests/cxx_seq_vec.cpp + ../../new_tests/cxx_test_state_on.cpp + ../../new_tests/cxx_misc.cpp + ../../new_tests/cxx_cmd_types.cpp + ../../new_tests/cxx_group.cpp + ../../new_tests/cxx_encoded.cpp + ../../new_tests/cxx_database.cpp + ../../new_tests/cxx_mem_attr.cpp + ../../new_tests/cxx_enum_att.cpp + ../../new_tests/cxx_write_attr_hard.cpp + ../../new_tests/cxx_fwd_att.cpp + ../../new_tests/cxx_pipe_conf.cpp + ../../new_tests/cxx_pipe.cpp + ../../new_tests/cxx_z00_dyn_cmd.cpp + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) + +add_executable(runner $ ${CMAKE_CURRENT_SOURCE_DIR}/runner.cpp) +target_include_directories(runner PUBLIC include) +target_link_libraries(runner PUBLIC ${CMAKE_DL_LIBS} tango) +target_compile_definitions(runner PUBLIC "-DVALGRIND -D_PTHREADS -D_REENTRANT") + +add_test("CXX::runner" runner + --device1=${DEV1} + --device2=${DEV2} + --device3=${DEV3} + --fwd_device=${FWD_DEV} + --loop=1 + --fulldsname=${SERV_NAME}/${INST_NAME} + --serverhost=${FULL_HOSTNAME} + --clienthost=${FULL_HOSTNAME} + --serverversion=5 + --docurl=http://www.tango-controls.org + --devtype=TestDevice + --dbserver=sys/database/2 + --outpath=/tmp/ + --refpath=${CMAKE_CURRENT_SOURCE_DIR}/../new_tests/out/ + --loglevel=0 + --dsloglevel=3 + --suiteloop=1 + --devicealias=${DEV1_ALIAS} + --attributealias=${ATTR_ALIAS} +) \ No newline at end of file diff --git a/cpp_test_suite/event/CMakeLists.txt b/cpp_test_suite/event/CMakeLists.txt new file mode 100644 index 000000000..8e778954d --- /dev/null +++ b/cpp_test_suite/event/CMakeLists.txt @@ -0,0 +1,29 @@ +set(TESTS archive_event + att_conf_event + back_ch_event + change_event64 + change_event + data_ready_event + event_lock + multi_event + pipe_event + reco_svc + scan + state_event + user_event + att_conf_event_buffer + att_type_event + back_per_event + change_event_buffer + data_ready_event_buffer + dev_intr_event + multi_dev_event + per_event + reco_event + reco_zmq + server_event + stateless_sub) + +foreach(TEST ${TESTS}) + TEST_SUITE_ADD_TEST(${TEST}) +endforeach(TEST) \ No newline at end of file diff --git a/cpp_test_suite/new_tests/CMakeLists.txt b/cpp_test_suite/new_tests/CMakeLists.txt new file mode 100644 index 000000000..65a26a8b4 --- /dev/null +++ b/cpp_test_suite/new_tests/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(conf_devtest conf_devtest.cpp) +target_link_libraries(conf_devtest PUBLIC ${CMAKE_DL_LIBS} tango) +add_library(compare_test_object OBJECT compare_test.cpp compare_test.h) \ No newline at end of file diff --git a/cpp_test_suite/old_tests/CMakeLists.txt b/cpp_test_suite/old_tests/CMakeLists.txt new file mode 100644 index 000000000..9133ca7b1 --- /dev/null +++ b/cpp_test_suite/old_tests/CMakeLists.txt @@ -0,0 +1,55 @@ +set(TESTS 64 + acc_right + add_rem_attr + add_rem_dev + allowed_cmd + att_conf + attr_conf_test + attr_manip + attr_misc + attr_proxy + attr_types + cmd_inout + cmd_types + ConfEventBugClient + copy_devproxy + ds_cache + helper + lock + locked_device + mem_att + misc_devattr + misc_devdata + misc_devproxy + multiple_new + new_devproxy + obj_prop + poll_attr + Poll + poll_except + poll_met + poll_pool + print_data + print_data_hist + prop_list + rds + read_attr + read_hist + read_hist_ext + reconnect_attr + reconnect + restart_device + ring_depth + size + state_attr + StopPoll + sub_dev + unlock + wait_mcast_dev + w_r_attr + write_attr_3 + write_attr) + +foreach(TEST ${TESTS}) + TEST_SUITE_ADD_TEST(${TEST}) +endforeach(TEST) \ No newline at end of file diff --git a/cppapi/CMakeLists.txt b/cppapi/CMakeLists.txt new file mode 100644 index 000000000..aaaea6e97 --- /dev/null +++ b/cppapi/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory(doxygen) +add_subdirectory(client) +add_subdirectory(server) + + +#link_libraries() + +#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tango.pc" +# DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") \ No newline at end of file diff --git a/cppapi/client/CMakeLists.txt b/cppapi/client/CMakeLists.txt new file mode 100644 index 000000000..e7d4ab161 --- /dev/null +++ b/cppapi/client/CMakeLists.txt @@ -0,0 +1,64 @@ +set(SOURCES dbapi_class.cpp + dbapi_server.cpp + dbapi_datum.cpp + dbapi_base.cpp + dbapi_device.cpp + dbapi_history.cpp + dbapi_attribute.cpp + dbapi_cache.cpp + dbapi_serverdata.cpp + devapi_attr.cpp + devapi_base.cpp + devapi_data.cpp + devapi_datahist.cpp + devapi_utils.cpp + devapi_pipe.cpp + api_util.cpp + asynreq.cpp + cbthread.cpp + proxy_asyn.cpp + proxy_asyn_cb.cpp + attr_proxy.cpp + group.cpp + filedatabase.cpp + apiexcept.cpp + accessproxy.cpp + lockthread.cpp + event.cpp + eventkeepalive.cpp + eventqueue.cpp + notifdeventconsumer.cpp + zmqeventconsumer.cpp) + +set(HEADERS accessproxy.h + apiexcept.h + cbthread.h + dbapi.h + devapi.h + devasyn.h + event.h + eventconsumer.h + filedatabase.h + group.h + lockthread.h + Database.h + DbDevice.h + ApiUtil.h + DeviceData.h + DeviceAttribute.h + DevicePipe.h + Connection.h + DeviceProxy.h + AttributeProxy.h + event.tpp + devapi_attr.tpp + devapi_utils.tpp + api_util.tpp + devapi_pipe.tpp + zmq.hpp) + +add_subdirectory(helpers) + +add_library(client_objects OBJECT ${SOURCES}) + +install(FILES ${HEADERS} DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") \ No newline at end of file diff --git a/cppapi/client/helpers/CMakeLists.txt b/cppapi/client/helpers/CMakeLists.txt new file mode 100644 index 000000000..e54af39b7 --- /dev/null +++ b/cppapi/client/helpers/CMakeLists.txt @@ -0,0 +1,6 @@ +set(HELPERS DeviceProxyHelper.h + PogoHelper.h + TangoExceptionsHelper.h + Xstring.h) + +install(FILES ${HELPERS} DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") \ No newline at end of file diff --git a/cppapi/doxygen/CMakeLists.txt b/cppapi/doxygen/CMakeLists.txt new file mode 100644 index 000000000..89b1b8e2c --- /dev/null +++ b/cppapi/doxygen/CMakeLists.txt @@ -0,0 +1,3 @@ +add_custom_target(doc doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../server + SOURCES Doxyfile) \ No newline at end of file diff --git a/cppapi/server/CMakeLists.txt b/cppapi/server/CMakeLists.txt new file mode 100644 index 000000000..794e15c03 --- /dev/null +++ b/cppapi/server/CMakeLists.txt @@ -0,0 +1,140 @@ +set(SOURCES attrdesc.cpp + attrgetsetprop.cpp + attribute.cpp + attrsetval.cpp + attrmanip.cpp + basiccommand.cpp + blackbox.cpp + class_factory.cpp + classattribute.cpp + command.cpp + coutappender.cpp + classpipe.cpp + dev_event.cpp + dev_poll.cpp + device.cpp + device_2.cpp + device_3.cpp + device_4.cpp + device_5.cpp + deviceclass.cpp + devicelog.cpp + devintr.cpp + dintrthread.cpp + dserver.cpp + dserverclass.cpp + dserverlock.cpp + dserverlog.cpp + dserverpoll.cpp + dserversignal.cpp + encoded_attribute.cpp + eventcmds.cpp + eventsupplier.cpp + except.cpp + fwdattrdesc.cpp + fwdattribute.cpp + logcmds.cpp + logging.cpp + logstream.cpp + multiattribute.cpp + notifdeventsupplier.cpp + pipe.cpp + pollcmds.cpp + pollobj.cpp + pollring.cpp + pollthread.cpp + rootattreg.cpp + seqvec.cpp + subdev_diag.cpp + tangoappender.cpp + tangorollingfileappender.cpp + templ_inst.cpp + thsig.cpp + utils.cpp + utils_polling.cpp + utils_shut.cpp + w_attribute.cpp + w_pipe.cpp + zmqeventsupplier.cpp) + +set(HEADERS attrdesc.h + attribute.h + attribute.tpp + attrsetval.tpp + attribute_spec.tpp + attrmanip.h + attrprop.h + attrprop.tpp + auto_tango_monitor.h + basiccommand.h + blackbox.h + classattribute.h + classpipe.h + command.h + pipe.h + pipe.tpp + coutappender.h + coutbuf.h + device.h + device_2.h + device_3.h + device_3.tpp + device_4.h + device_5.h + deviceclass.h + devintr.h + dintrthread.h + dserver.h + dserverclass.h + dserversignal.h + eventsupplier.h + except.h + fwdattrdesc.h + fwdattribute.h + fwdattribute.tpp + fwdattribute_spec.tpp + log4tango.h + logcmds.h + logging.h + logstream.h + multiattribute.h + ntservice.h + pipedesc.h + pollcmds.h + pollext.h + pollext.tpp + pollobj.h + pollring.h + pollring.tpp + pollthread.h + pollthread.tpp + readers_writers_lock.h + rootattreg.h + seqvec.h + tango.h + tango_config.h + tango_const.h + tango_monitor.h + tangoappender.h + tangorollingfileappender.h + utils.h + utils.tpp + utils_spec.tpp + w32win.h + w_attribute.h + w_attribute.tpp + w_attrsetval.tpp + w_attribute_spec.tpp + w_pipe.h + w_pipe.tpp + subdev_diag.h + encoded_attribute.h + encoded_format.h) + +add_subdirectory(idl) +add_subdirectory(jpeg) +add_subdirectory(jpeg_mmx) + +add_library(server_objects OBJECT ${SOURCES}) + +install(FILES ${HEADERS} DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") \ No newline at end of file diff --git a/cppapi/server/idl/CMakeLists.txt b/cppapi/server/idl/CMakeLists.txt new file mode 100644 index 000000000..7683100e1 --- /dev/null +++ b/cppapi/server/idl/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SOURCES tangoSK.cpp + tangoDynSK.cpp) + +add_library(idl_objects OBJECT ${SOURCES} tango.h) + +#TODO generate source code from idl + +install(FILES tango.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/idl") \ No newline at end of file diff --git a/cppapi/server/idl/tangoDynSK.cpp b/cppapi/server/idl/tangoDynSK.cpp index d5763133c..677d83aa9 100644 --- a/cppapi/server/idl/tangoDynSK.cpp +++ b/cppapi/server/idl/tangoDynSK.cpp @@ -4,7 +4,7 @@ OMNI_USING_NAMESPACE(omni) -static const char* _0RL_dyn_library_version = omniORB_4_2_dyn; +//static const char* _0RL_dyn_library_version = omniORB_4_2_dyn; static ::CORBA::TypeCode::_Tracker _0RL_tcTrack(__FILE__); diff --git a/cppapi/server/idl/tangoSK.cpp b/cppapi/server/idl/tangoSK.cpp index c47610d94..d2fa6a436 100644 --- a/cppapi/server/idl/tangoSK.cpp +++ b/cppapi/server/idl/tangoSK.cpp @@ -10,7 +10,7 @@ OMNI_USING_NAMESPACE(omni) -static const char* _0RL_library_version = omniORB_4_2; +//static const char* _0RL_library_version = omniORB_4_2; diff --git a/cppapi/server/jpeg/CMakeLists.txt b/cppapi/server/jpeg/CMakeLists.txt new file mode 100644 index 000000000..d1160fd59 --- /dev/null +++ b/cppapi/server/jpeg/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SOURCES jpeg_bitstream.cpp + jpeg_color.cpp + jpeg_dct.cpp + jpeg_decoder.cpp + jpeg_encoder.cpp + jpeg_memory.cpp) + +add_library(jpeg_objects OBJECT ${SOURCES}) diff --git a/cppapi/server/jpeg_mmx/CMakeLists.txt b/cppapi/server/jpeg_mmx/CMakeLists.txt new file mode 100644 index 000000000..2f085d761 --- /dev/null +++ b/cppapi/server/jpeg_mmx/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../jpeg) + +set(SOURCES + jpeg_color_mmx.cpp + jpeg_dct_mmx.cpp) + +add_library(jpeg_mmx_objects OBJECT ${SOURCES}) diff --git a/log4tango/CMakeLists.txt b/log4tango/CMakeLists.txt new file mode 100644 index 000000000..d5e9fc42e --- /dev/null +++ b/log4tango/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# +1 : ? : +1 == new interface that does not break old one +# +1 : ? : 0 == new interface that breaks old one +# ? : ? : 0 == no new interfaces, but breaks apps +# ? :+1 : ? == just some internal changes, nothing breaks but might work +# better +# CURRENT : REVISION : AGE +set (LOG4TANGO_PACKAGE_URL "https://github.com/tango-controls/cppTango/log4tango") +set (LOG4TANGO_PACKAGE_BUGREPORT "https://github.com/tango-controls/cppTango/issues") + +include(${CMAKE_CURRENT_SOURCE_DIR}/config/config.cmake) + +add_subdirectory(include) +add_subdirectory(src) +add_subdirectory(tests) \ No newline at end of file diff --git a/log4tango/config/check_namespace.cpp b/log4tango/config/check_namespace.cpp new file mode 100644 index 000000000..fb399f347 --- /dev/null +++ b/log4tango/config/check_namespace.cpp @@ -0,0 +1,9 @@ +// +// Created by ingvord on 9/14/16. +// +namespace Outer { namespace Inner { int i = 0; }} +int main(int argc, char* argv[]) +{ + using namespace Outer::Inner; return i; +} + diff --git a/log4tango/config/check_snprintf.cpp b/log4tango/config/check_snprintf.cpp new file mode 100644 index 000000000..a278aa177 --- /dev/null +++ b/log4tango/config/check_snprintf.cpp @@ -0,0 +1,6 @@ +// +// Created by ingvord on 9/14/16. +// +#include +int main () { int l = snprintf(NULL,0,"%d",100); return (!((3 <= l) || (-1 == l))); } + diff --git a/log4tango/config/check_sstream.cpp b/log4tango/config/check_sstream.cpp new file mode 100644 index 000000000..3cf5390c1 --- /dev/null +++ b/log4tango/config/check_sstream.cpp @@ -0,0 +1,14 @@ +// +// Created by ingvord on 9/13/16. +// +#include + +int main(int argc,char **arv) +{ + std::stringstream ss; + + ss << "Hello"; + + return 0; +} + diff --git a/log4tango/config/config.cmake b/log4tango/config/config.cmake new file mode 100644 index 000000000..6fb74c100 --- /dev/null +++ b/log4tango/config/config.cmake @@ -0,0 +1,66 @@ +include(CheckIncludeFile) +include(CheckFunctionExists) +include(FindThreads) +include(CheckCXXSourceCompiles) +include(CheckTypeSize) + +macro (LOG4TANGO_CHECK_INCLUDE_FILE header var) + CHECK_INCLUDE_FILE("${header}" LOG4TANGO_${var} ) +endmacro() + +LOG4TANGO_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) +LOG4TANGO_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) +LOG4TANGO_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) +LOG4TANGO_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) +LOG4TANGO_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) +LOG4TANGO_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) +LOG4TANGO_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) +LOG4TANGO_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) +LOG4TANGO_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) +LOG4TANGO_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) +LOG4TANGO_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) + +macro (LOG4TANGO_CHECK_FUNCTION_EXISTS function var) + CHECK_FUNCTION_EXISTS("${function}" LOG4TANGO_${var} ) +endmacro() +#check function +LOG4TANGO_CHECK_FUNCTION_EXISTS(ftime HAVE_FTIME) +LOG4TANGO_CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) + + +#check threads +check_library_exists(pthread pthread_attr_get_np "" HAVE_PTHREAD_ATTR_GET_NP) +check_library_exists(pthread pthread_getattr_np "" HAVE_PTHREAD_GETATTR_NP) +check_library_exists(pthread pthread_create "" HAVE_PTHREAD_CREATE) +check_include_file("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H) + +if(CMAKE_THREAD_LIBS_INIT) + set(LOG4TANGO_HAVE_THREADING "/**/") +endif() + +#check compiler features +macro (LOG4TANGO_CHECK_COMPILER_FEATURE source var) + file(READ "${source}" ${var}_CHECK_SOURCE) + check_cxx_source_compiles("${${var}_CHECK_SOURCE}" ${var}_CHECK) + if(${var}_CHECK) + set(LOG4TANGO_HAVE_${var} "/**/") + endif() +endmacro() + +#sstream +LOG4TANGO_CHECK_COMPILER_FEATURE("config/check_sstream.cpp" SSTREAM) + +#namespace +LOG4TANGO_CHECK_COMPILER_FEATURE("config/check_namespace.cpp" NAMESPACES) + +#snprintf +LOG4TANGO_CHECK_COMPILER_FEATURE("config/check_snprintf.cpp" SNPRINTF) + +#check types +check_type_size(int64_t INT64_SIZE) +if(${INT64_SIZE} EQUAL 8) + set(LOG4TANGO_HAVE_INT64_T "/**/") +endif() + + +configure_file(config/config.h.in ${PROJECT_BINARY_DIR}/log4tango/include/log4tango/config.h) \ No newline at end of file diff --git a/log4tango/config/config.h.in b/log4tango/config/config.h.in new file mode 100644 index 000000000..db1d25b0b --- /dev/null +++ b/log4tango/config/config.h.in @@ -0,0 +1,80 @@ +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_DLFCN_H + +/* Define to 1 if you have the `ftime' function. */ +#cmakedefine LOG4TANGO_HAVE_FTIME + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine LOG4TANGO_HAVE_GETTIMEOFDAY + +/* define if the compiler has int64_t */ +#cmakedefine LOG4TANGO_HAVE_INT64_T + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_IO_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_MEMORY_H + +/* define if the compiler implements namespaces */ +#cmakedefine LOG4TANGO_HAVE_NAMESPACES + +/* define if the C library has snprintf */ +#cmakedefine LOG4TANGO_HAVE_SNPRINTF + +/* define if the compiler has stringstream */ +#cmakedefine LOG4TANGO_HAVE_SSTREAM + +/* define if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_SYS_TYPES_H + +/* define if threading is enabled */ +#cmakedefine LOG4TANGO_HAVE_THREADING + +/* Define to 1 if you have the header file. */ +#cmakedefine LOG4TANGO_HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine LOG4TANGO_PACKAGE_BUGREPORT "@LOG4TANGO_PACKAGE_BUGREPORT@" + +/* Define to the home page for this package. */ +#cmakedefine LOG4TANGO_PACKAGE_URL "@LOG4TANGO_PACKAGE_URL@" + +/* Define to the version of this package. */ +#cmakedefine LOG4TANGO_PACKAGE_VERSION "${LIBRARY_VERSION}" + +/* define if pthread library is available */ +#cmakedefine HAVE_PTHREAD_ATTR_GET_NP 1 +#cmakedefine HAVE_PTHREAD_GETATTR_NP 1 +#cmakedefine HAVE_PTHREAD_CREATE 1 +#cmakedefine HAVE_PTHREAD_NP_H 1 +#if defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP) || defined(HAVE_PTHREAD_CREATE) || defined(HAVE_PTHREAD_NP_H) +#define LOG4TANGO_USE_PTHREADS 1 +#endif + +/* Version number of package */ +#cmakedefine LOG4TANGO_VERSION "@LIBRARY_VERSION@" + +/* If we're running on darwin/MacOsX */ +#cmakedefine __darwin__ + +/* If we're running on FreeBSD */ +#cmakedefine __freebsd__ \ No newline at end of file diff --git a/log4tango/include/CMakeLists.txt b/log4tango/include/CMakeLists.txt new file mode 100644 index 000000000..1f661a3b0 --- /dev/null +++ b/log4tango/include/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(log4tango) \ No newline at end of file diff --git a/log4tango/include/log4tango/CMakeLists.txt b/log4tango/include/log4tango/CMakeLists.txt new file mode 100644 index 000000000..3b32cf48e --- /dev/null +++ b/log4tango/include/log4tango/CMakeLists.txt @@ -0,0 +1,29 @@ +set(HEADER_FILES + Appender.hh + AppenderAttachable.hh + LayoutAppender.hh + FileAppender.hh + RollingFileAppender.hh + OstreamAppender.hh + Layout.hh + PatternLayout.hh + XmlLayout.hh + Logger.hh + LogSeparator.hh + LoggerStream.hh + LogStream.hh + LogStreambuf.hh + LoggingEvent.hh + Level.hh + NDC.hh + TimeStamp.hh + Filter.hh + Export.hh + Portability.hh) + +add_subdirectory(threading) + +install(FILES ${HEADER_FILES} + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/log4tango) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/log4tango) +#TODO if windows 32 install config-win32.h \ No newline at end of file diff --git a/log4tango/include/log4tango/threading/CMakeLists.txt b/log4tango/include/log4tango/threading/CMakeLists.txt new file mode 100644 index 000000000..71f3669f2 --- /dev/null +++ b/log4tango/include/log4tango/threading/CMakeLists.txt @@ -0,0 +1,8 @@ +set(HEADER_FILES + DummyThreads.hh + PThreads.hh + MSThreads.hh + Threading.hh) + +install(FILES ${HEADER_FILES} + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/log4tango/threading) \ No newline at end of file diff --git a/log4tango/src/CMakeLists.txt b/log4tango/src/CMakeLists.txt new file mode 100644 index 000000000..091813f12 --- /dev/null +++ b/log4tango/src/CMakeLists.txt @@ -0,0 +1,28 @@ +set(SOURCES + Appender.cpp + AppenderAttachable.cpp + LayoutAppender.cpp + FileAppender.cpp + RollingFileAppender.cpp + OstreamAppender.cpp + Layout.cpp + PatternLayout.cpp + XmlLayout.cpp + Logger.cpp + LogSeparator.cpp + LoggerStream.cpp + LoggingEvent.cpp + Level.cpp + NDC.cpp + Filter.cpp + TimeStamp.cpp + StringUtil.hh + StringUtil.cpp + DllMain.cpp + DummyThreads.cpp + MSThreads.cpp + PThreads.cpp + PortabilityImpl.hh + PortabilityImpl.cpp) + +add_library(log4tango_objects OBJECT ${SOURCES}) \ No newline at end of file diff --git a/log4tango/tests/CMakeLists.txt b/log4tango/tests/CMakeLists.txt new file mode 100644 index 000000000..5c476dfec --- /dev/null +++ b/log4tango/tests/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LOG4TANGO_TEST_SOURCES test_log4tango.cpp) +set(BENCH_TEST_SOURCES clock.cpp clock.hh test_bench.cpp) + +add_executable(test_log4tango ${LOG4TANGO_TEST_SOURCES} $) +add_executable(test_bench ${BENCH_TEST_SOURCES} $) + +add_test("log4tango_test" test_log4tango) +add_test("log4tango_benchmark" test_bench) \ No newline at end of file diff --git a/tango.pc.cmake b/tango.pc.cmake new file mode 100644 index 000000000..1260febd4 --- /dev/null +++ b/tango.pc.cmake @@ -0,0 +1,11 @@ +prefix = @CMAKE_INSTALL_PREFIX@ +exec_prefix = ${prefix} +includedir = ${prefix}/include +libdir = ${prefix}/@CMAKE_INSTALL_LIBDIR@ + +Name: @CMAKE_PROJECT_NAME@ +Description: Tango client/server API library +Version: @LIBRARY_VERSION@ +Cflags: -I${includedir} +Requires: libzmq omniORB4 omniCOS4 omniDynamic4 +Libs: -L${libdir} -ltango -lzmq -lomniORB4 -lomnithread -lCOS4 -lomniDynamic4 \ No newline at end of file