From f37932e1a7e20497e4562d047c148b0c8053b15c Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Thu, 19 Jan 2017 08:09:51 +0000 Subject: [PATCH] preliminary CMake support --- CMakeLists.txt | 63 ++++++++++++++ core/CMakeLists.txt | 28 ++++++ drivers/CMakeLists.txt | 90 ++++++++++++++++++++ drivers/SpinCore-PulseBlaster/CMakeLists.txt | 21 +++++ machines/CMakeLists.txt | 45 ++++++++++ 5 files changed, 247 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 core/CMakeLists.txt create mode 100644 drivers/CMakeLists.txt create mode 100644 drivers/SpinCore-PulseBlaster/CMakeLists.txt create mode 100644 machines/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c265ad5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.0) +project(damaris_backends) + +include(FindPkgConfig) + +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +set(SOURCE_FILES + + machines/berta.cpp + machines/bg_backend.cpp + machines/birgit.cpp + machines/deuteron_backend.cpp + machines/dummycore.cpp + machines/fc1_backend.cpp + machines/fc1_digital_backend.cpp + machines/fc1_vierkanal_backend.cpp + machines/fc1neu_backend.cpp + machines/fc2_backend.cpp + machines/fc2_backend_AD5791.cpp + machines/general.cpp + machines/hardware.cpp + machines/hardware.h + machines/magnexgrad_backend.cpp + machines/magnexgrad_backend_dds.cpp + machines/Mobile_wo_sync_backend.cpp + machines/Mobilecore.cpp + machines/NQRcore.cpp + machines/pb_radio_processor_g_backend.cpp + machines/pb_radio_processor_g_backend.h + machines/PFGcore.cpp + machines/pulseblaster_only.cpp + tests/stefan/result.hpp + tests/stefan/tcore.cpp + tests/stefan/tcore.h + tests/stefan/testmain.cpp + tests/stefan/tjob.cpp + tests/stefan/tjob.h + tests/iterator_insert_test.cpp + tests/state_iterate_test.cpp + tests/state_read_test.cpp + tests/stopwatch_test.cpp + tests/xml_result_test.cpp + tools/add_endline.cpp + tools/restart_core.cpp) + + +find_package(EXPAT REQUIRED) +find_package(PkgConfig REQUIRED) + +pkg_check_modules (GLIB2 glib-2.0 REQUIRED) +pkg_check_modules (XERCES xerces-c REQUIRED) + +include_directories (. ${GLIB2_INCLUDE_DIRS} ${XERCES_INCLUDE_DIRS}) +link_directories (${GLIB2_LIBRARY_DIRS} ${XERCES_LIBRARY_DIRS}) + +add_subdirectory(core) +#add_subdirectory(doc) +add_subdirectory(drivers) +#add_subdirectory(tools) +#add_subdirectory(tests) +add_subdirectory(machines) +#add_executable(backends ${SOURCE_FILES}) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 0000000..02561dd --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.0) +include(FindPkgConfig) +set(core_src_files + backend_config_reader.cpp + core.cpp + core_config.cpp + job.cpp + job.h + job_receiver.cpp + result.cpp + states.cpp + xml_result.cpp + xml_states.cpp +) +find_package(EXPAT REQUIRED) +find_package(PkgConfig REQUIRED) + +pkg_check_modules (GLIB2 glib-2.0 REQUIRED) +pkg_check_modules (XERCES xerces-c REQUIRED) + +include_directories(.. ${XERCES_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}) +link_directories(${XERCES_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS}) + + +# https://cmake.org/Wiki/CMake/Tutorials/Object_Library +add_library(core STATIC ${core_src_files}) +target_link_libraries(core ${XERCES_LIBRARIES} expat) + diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt new file mode 100644 index 0000000..f4d52ca --- /dev/null +++ b/drivers/CMakeLists.txt @@ -0,0 +1,90 @@ +cmake_minimum_required(VERSION 3.0) +include(FindPkgConfig) + +set(AD5791_src_files + DAC-AD5791/AD5791.cpp +) + +set(Datel_src_files + Datel-PCI416/Datel-PCI416.cpp +) + +set(dummy_src_files + dummy/dummy.cpp + dummy/temperature_dummy.cpp +) + +set(Eurotherm_src_files +# Eurotherm-2000Series/control.cpp + Eurotherm-2000Series/Eurotherm-2000Series.cpp +# Eurotherm-2000Series/gnuplot_output.cpp +# Eurotherm-2000Series/test.cpp +) + +set(PTS_src_files + PTS-Synthesizer/PTS.cpp + PTS-Synthesizer/PTS_test.cpp +) + +set(M2i40xx_src_files + Spectrum-M2i40xxSeries/GatedData.cpp + Spectrum-M2i40xxSeries/Spectrum-M2i40xxSeries.cpp +# Spectrum-M2i40xxSeries/test.cpp +) + +set(MI40xx_src_files + Spectrum-MI40xxSeries/GatedData.cpp +# Spectrum-MI40xxSeries/hw_test_extclock.cpp +# Spectrum-MI40xxSeries/hw_test_intclock.cpp + Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp +# Spectrum-MI40xxSeries/test.cpp +) + +set(PB_src_files +# SpinCore-PulseBlaster/pulseblaster.c +# SpinCore-PulseBlaster/pulseblaster_test.cpp +# SpinCore-PulseBlaster/PulseBlasterProgram.cpp + SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp +# SpinCore-PulseBlaster/TestCase.cpp +) + +set(PB24_src_files + SpinCore-PulseBlaster24Bit/SpinCore-PulseBlaster24Bit.cpp +# SpinCore-PulseBlaster24Bit/test.cpp +) + +set(PBDDS_src_files + SpinCore-PulseBlasterDDSIII/SpinCore-PulseBlasterDDSIII.cpp +# SpinCore-PulseBlasterDDSIII/test.cpp +) + +set(DAC20_src_files + Tecmag-DAC20/DAC20.cpp +# Tecmag-DAC20/DAC_test.cpp +) + +set(tiepie_src_files + TiePie-HS3/HS3test.cpp + TiePie-HS3/TiePie-HS3.cpp + TiePie-HS3/tiepie.cpp +) + + +include_directories(..) +# https://cmake.org/Wiki/CMake/Tutorials/Object_Library +add_library(AD5791 STATIC ${AD5791_src_files}) +#add_library(Datel STATIC ${Datel_src_files}) +add_library(dummy STATIC ${dummy_src_files}) +add_library(Eurotherm-2000Series STATIC ${Eurotherm_src_files} tempcont.cpp) +add_library(PTS STATIC ${PTS_src_files}) +add_library(Spectrum_M2i40xxSeries STATIC ${M2i40xx_src_files}) +add_library(Spectrum_MI40xxSeries STATIC ${MI40xx_src_files}) +add_subdirectory(SpinCore-PulseBlaster) +#add_library(PB STATIC ${general_src_files} SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp) +#add_library(PB_PROG STATIC ${general_src_files} SpinCore-PulseBlaster/PulseBlasterProgram.cpp) +add_library(PB24 STATIC ${PB24_src_files}) +add_library(PBDDS STATIC ${PBDDS_src_files}) +add_library(Tecmag-DAC20 STATIC ${DAC20_src_files}) +#add_library(tiepie STATIC ${general_src_files} ${tiepie_src_files}) + + diff --git a/drivers/SpinCore-PulseBlaster/CMakeLists.txt b/drivers/SpinCore-PulseBlaster/CMakeLists.txt new file mode 100644 index 0000000..fa826c1 --- /dev/null +++ b/drivers/SpinCore-PulseBlaster/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.0) + +Set( DRIVER_FILE pulseblaster.ko ) +# +#Set( DRIVER_BIN_FILE ../pulseblaster.ko ) +Set( KERNEL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build" ) +Set( KBUILD_CMD ${CMAKE_MAKE_PROGRAM} + -C ${KERNEL_DIR} + M=${CMAKE_CURRENT_SOURCE_DIR} modules) + +add_custom_command( OUTPUT ${DRIVER_FILE} + COMMAND ${KBUILD_CMD} +# COMMAND cp -f ${DRIVER_FILE} ${DRIVER_BIN_FILE} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${src} Kbuild VERBATIM ) + +add_custom_target ( driver DEPENDS ${DRIVER_FILE} ) + +#include_directories(..) +add_library(PB STATIC SpinCore-PulseBlaster.cpp) +add_library(PB_PROG STATIC PulseBlasterProgram.cpp) diff --git a/machines/CMakeLists.txt b/machines/CMakeLists.txt new file mode 100644 index 0000000..48d2429 --- /dev/null +++ b/machines/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.0) + +include(FindPkgConfig) + +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +set(SOURCE_FILES + machines/berta.cpp + machines/bg_backend.cpp + machines/birgit.cpp + machines/deuteron_backend.cpp + machines/dummycore.cpp + machines/fc1_backend.cpp + machines/fc1_digital_backend.cpp + machines/fc1_vierkanal_backend.cpp + machines/fc1neu_backend.cpp + machines/fc2_backend.cpp + machines/fc2_backend_AD5791.cpp + machines/general.cpp + machines/hardware.cpp + machines/hardware.h + machines/magnexgrad_backend.cpp + machines/magnexgrad_backend_dds.cpp + machines/Mobile_wo_sync_backend.cpp + machines/Mobilecore.cpp + machines/NQRcore.cpp + machines/pb_radio_processor_g_backend.cpp + machines/pb_radio_processor_g_backend.h + machines/PFGcore.cpp + machines/pulseblaster_only.cpp + ) + +#pkg_check_modules (XERCES xerces-c REQUIRED) +#include_directories(.. ${XERCES_INCLUDE_DIRS}) +#link_directories(${XERCES_LIBRARY_DIRS}) + + +add_executable(dummycore dummycore.cpp hardware.cpp) +target_link_libraries( dummycore pthread ${XERCES_LIBRARIES} core dummy Eurotherm-2000Series) + +add_executable(PFGcore PFGcore.cpp hardware.cpp) +target_link_libraries( PFGcore pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries PB PB24 PB_PROG PTS Tecmag-DAC20 ) + +add_executable(general general.cpp hardware.cpp) +target_link_libraries( general pthread ${XERCES_LIBRARIES} ${GLIB2_LIBRARIES} core Spectrum_MI40xxSeries PB PB24 PB_PROG PTS Tecmag-DAC20 )