Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

TANGO-678 Migrate to cmake #1

Merged
merged 49 commits into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ade9c95
TANGO-678 progress (migrate to cmake)
Sep 13, 2016
beb2c8e
TANGO-678 progress (migrate to cmake)
Sep 13, 2016
5e8f4bd
TANGO-678 progress: log4tango compiles
Sep 14, 2016
865aca0
TANGO-678 progress: downgrade cmake minimum version; add c++11 flags
Sep 14, 2016
17c7feb
TANGO-678 progress: libtango compiles
Sep 14, 2016
6900fad
TANGO-678 progress
Sep 14, 2016
aec75fa
TANGO-678 progress: minor changes
Sep 14, 2016
a93c937
TANGO-678 progress
Sep 14, 2016
08e74bd
TANGO-678 progress
Sep 14, 2016
e1ef1b7
TANGO-678 progress: failed compilation temporary fix
Sep 14, 2016
1340463
TANGO-678 progress: add cpp_test_suite
Sep 15, 2016
428b0e5
TANGO-678 progress: add cpp_test_suite/cxxtest
Sep 15, 2016
b027ad2
TANGO-678 progress: add cpp_test_ds; devTest does not compile - missi…
Sep 15, 2016
06566d7
TANGO-678 progress: install
Sep 15, 2016
a689c1d
TANGO-678 progress: install idl header
Sep 15, 2016
4c7d5d2
TANGO-678 progress: fix devTest compilation failure
Sep 16, 2016
e364199
TANGO-678 progress: minor changes
Sep 16, 2016
a3f2121
TANGO-678 progress: add doc target
Sep 16, 2016
5c2ea6c
TANGO-678 progress: fix missing headers in installation
Sep 16, 2016
60ce939
TANGO-678 progress: add readme; use XXX_BASE over pkg-config if present
Sep 16, 2016
61ff4c0
TANGO-678 progress: fix cmake configuration for ESRF
Sep 16, 2016
13dd752
TANGO-678 progress: update readme
Sep 16, 2016
2b56ca4
TANGO-678 progress: fix compilation warning related to PACKAGE_URL be…
Sep 16, 2016
f66d6ee
TANGO-678 progress: fix compilation warning related to PACKAGE_URL be…
Sep 16, 2016
a597248
TANGO-678 progress (migrate to cmake)
Sep 13, 2016
894179c
TANGO-678 progress (migrate to cmake)
Sep 13, 2016
d5bcd70
TANGO-678 progress: log4tango compiles
Sep 14, 2016
8c6393c
TANGO-678 progress: downgrade cmake minimum version; add c++11 flags
Sep 14, 2016
c2256a6
TANGO-678 progress: libtango compiles
Sep 14, 2016
f784d49
TANGO-678 progress
Sep 14, 2016
bc9b93c
TANGO-678 progress: minor changes
Sep 14, 2016
6804798
TANGO-678 progress
Sep 14, 2016
185195d
TANGO-678 progress
Sep 14, 2016
208f1ec
TANGO-678 progress: failed compilation temporary fix
Sep 14, 2016
baa63ac
TANGO-678 progress: add cpp_test_suite
Sep 15, 2016
0107d5e
TANGO-678 progress: add cpp_test_suite/cxxtest
Sep 15, 2016
58e8f47
TANGO-678 progress: add cpp_test_ds; devTest does not compile - missi…
Sep 15, 2016
85ad943
TANGO-678 progress: install
Sep 15, 2016
05a1455
TANGO-678 progress: install idl header
Sep 15, 2016
9dfa19b
TANGO-678 progress: fix devTest compilation failure
Sep 16, 2016
0608a0e
TANGO-678 progress: minor changes
Sep 16, 2016
6c197a9
TANGO-678 progress: add doc target
Sep 16, 2016
a797126
TANGO-678 progress: fix missing headers in installation
Sep 16, 2016
6c4d8bb
TANGO-678 progress: add readme; use XXX_BASE over pkg-config if present
Sep 16, 2016
2afc958
TANGO-678 progress: fix cmake configuration for ESRF
Sep 16, 2016
f26f1af
TANGO-678 progress: update readme
Sep 16, 2016
49d7d59
TANGO-678 progress: fix compilation warning related to PACKAGE_URL be…
Sep 16, 2016
fcfe0cf
TANGO-678 progress: fix compilation warning related to PACKAGE_URL be…
Sep 16, 2016
9b84c4e
Merge branch 'master' of github.com:Ingvord/cppTango
Sep 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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_OBJECTS:log4tango_objects>
$<TARGET_OBJECTS:client_objects>
$<TARGET_OBJECTS:idl_objects>
$<TARGET_OBJECTS:jpeg_objects>
$<TARGET_OBJECTS:jpeg_mmx_objects>
$<TARGET_OBJECTS:server_objects>)
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")
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<desired installation path>] [-DOMNI_BASE=<omniORB4 home folder>] [-DZMQ_BASE=<zmq home folder>] [-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)
53 changes: 53 additions & 0 deletions configure/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 23 additions & 0 deletions cpp_test_ds/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
85 changes: 0 additions & 85 deletions cpp_test_ds/IOLongVar.cpp

This file was deleted.

9 changes: 9 additions & 0 deletions cpp_test_ds/fwd_ds/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions cpp_test_suite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<TARGET_FILE:${test}> ${DEV1})
endmacro()

add_subdirectory(asyn)
add_subdirectory(event)
#add_subdirectory(old_tests)
add_subdirectory(new_tests)
add_subdirectory(cxxtest)
17 changes: 17 additions & 0 deletions cpp_test_suite/asyn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
61 changes: 61 additions & 0 deletions cpp_test_suite/cxxtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<TARGET_OBJECTS:compare_test_object> ${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}
)
29 changes: 29 additions & 0 deletions cpp_test_suite/event/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions cpp_test_suite/new_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Loading