From e73407f64c6edce4d7fff7c13b7925e4d622d70e Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Thu, 19 Jan 2017 21:27:35 +0000 Subject: [PATCH] cmake configurations * pulseblaster kernel module now building with cmake * each driver has own CMakeLists.txt --- CMakeLists.txt | 42 +-------- core/CMakeLists.txt | 3 +- drivers/CMakeLists.txt | 87 ++----------------- drivers/DAC-AD5791/CMakeLists.txt | 2 + drivers/Eurotherm-2000Series/CMakeLists.txt | 2 +- drivers/Spectrum-M2i40xxSeries/CMakeLists.txt | 12 +-- drivers/Spectrum-MI40xxSeries/CMakeLists.txt | 17 ++++ drivers/SpinCore-PulseBlaster/CMakeLists.txt | 4 +- .../SpinCore-PulseBlaster24Bit/CMakeLists.txt | 3 + .../CMakeLists.txt | 3 + drivers/Tecmag-DAC20/CMakeLists.txt | 3 + drivers/dummy/CMakeLists.txt | 3 + machines/CMakeLists.txt | 84 ++++++++++++------ 13 files changed, 108 insertions(+), 157 deletions(-) create mode 100644 drivers/DAC-AD5791/CMakeLists.txt create mode 100644 drivers/Spectrum-MI40xxSeries/CMakeLists.txt create mode 100644 drivers/SpinCore-PulseBlaster24Bit/CMakeLists.txt create mode 100644 drivers/SpinCore-PulseBlasterDDSIII/CMakeLists.txt create mode 100644 drivers/Tecmag-DAC20/CMakeLists.txt create mode 100644 drivers/dummy/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c265ad5..42b3c3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,46 +3,7 @@ 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) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wall -O0 -g -DSPC_DEBUG=0") find_package(EXPAT REQUIRED) @@ -54,6 +15,7 @@ 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) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 02561dd..055d4c6 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -12,6 +12,7 @@ set(core_src_files xml_result.cpp xml_states.cpp ) + find_package(EXPAT REQUIRED) find_package(PkgConfig REQUIRED) @@ -23,6 +24,6 @@ link_directories(${XERCES_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS}) # https://cmake.org/Wiki/CMake/Tutorials/Object_Library -add_library(core STATIC ${core_src_files}) +add_library(core ${core_src_files}) target_link_libraries(core ${XERCES_LIBRARIES} expat) diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index ca82738..86a6689 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -1,93 +1,20 @@ 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(tempcont tempcont.cpp) -#add_library(Datel STATIC ${Datel_src_files}) -add_library(dummy STATIC ${dummy_src_files}) +add_subdirectory(DAC-AD5791) +add_subdirectory(dummy) add_subdirectory(Eurotherm-2000Series) add_subdirectory(PTS-Synthesizer) add_subdirectory(Spectrum-M2i40xxSeries) -#add_library(Spectrum_M2i40xxSeries STATIC ${M2i40xx_src_files}) -add_library(Spectrum_MI40xxSeries STATIC ${MI40xx_src_files}) +add_subdirectory(Spectrum-MI40xxSeries) add_subdirectory(SpinCore-PulseBlaster) +add_subdirectory(SpinCore-PulseBlaster24Bit) +add_subdirectory(SpinCore-PulseBlasterDDSIII) +add_subdirectory(Tecmag-DAC20) +add_library(tempcont tempcont.cpp) -#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/DAC-AD5791/CMakeLists.txt b/drivers/DAC-AD5791/CMakeLists.txt new file mode 100644 index 0000000..0ef2043 --- /dev/null +++ b/drivers/DAC-AD5791/CMakeLists.txt @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.0) +add_library(AD5791 AD5791.cpp) \ No newline at end of file diff --git a/drivers/Eurotherm-2000Series/CMakeLists.txt b/drivers/Eurotherm-2000Series/CMakeLists.txt index f955e3f..0addf04 100644 --- a/drivers/Eurotherm-2000Series/CMakeLists.txt +++ b/drivers/Eurotherm-2000Series/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 3.0) -add_library(Eurotherm-2000Series Eurotherm-2000Series.cpp) \ No newline at end of file +add_library(Eurotherm-2000Series Eurotherm-2000Series.cpp ../tempcont.cpp) \ No newline at end of file diff --git a/drivers/Spectrum-M2i40xxSeries/CMakeLists.txt b/drivers/Spectrum-M2i40xxSeries/CMakeLists.txt index cd4bae9..36d571d 100644 --- a/drivers/Spectrum-M2i40xxSeries/CMakeLists.txt +++ b/drivers/Spectrum-M2i40xxSeries/CMakeLists.txt @@ -1,16 +1,18 @@ cmake_minimum_required(VERSION 3.0) -set( SPC_DRV drv_spcm_linux_drv_v214b5633.zip) +set(SPC_DRV drv_spcm_linux_drv_v214b5633.zip) set(SPC_HEADERS include/spcerr.h include/regs.h include/dlltyp.h - include/spcioctl.inc) + include/spcioctl.inc + include/spcm_drv.h) add_custom_command(OUTPUT ${SPC_HEADERS} - COMMAND ${CMAKE_COMMAND} -E unzip -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/ - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include + COMMAND unzip -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/ + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Unpacking SPC headers" VERBATIM) -add_library(Spectrum-M2i40xxSeries STATIC Spectrum-M2i40xxSeries.cpp GatedData.cpp) \ No newline at end of file + +add_library(Spectrum-M2i40xxSeries STATIC Spectrum-M2i40xxSeries.cpp GatedData.cpp ${SPC_HEADERS}) diff --git a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt new file mode 100644 index 0000000..40f71eb --- /dev/null +++ b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.0) + +set( SPC_DRV drv_header_v402b6844.zip) +set(SPC_HEADERS + include/spcerr.h + include/regs.h + include/dlltyp.h + include/spcioctl.inc) + +add_custom_command(OUTPUT ${SPC_HEADERS} + COMMAND unzip -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/ + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Unpacking SPC headers" + VERBATIM) + +add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS}) + diff --git a/drivers/SpinCore-PulseBlaster/CMakeLists.txt b/drivers/SpinCore-PulseBlaster/CMakeLists.txt index fa826c1..a7507b1 100644 --- a/drivers/SpinCore-PulseBlaster/CMakeLists.txt +++ b/drivers/SpinCore-PulseBlaster/CMakeLists.txt @@ -17,5 +17,5 @@ add_custom_command( OUTPUT ${DRIVER_FILE} add_custom_target ( driver DEPENDS ${DRIVER_FILE} ) #include_directories(..) -add_library(PB STATIC SpinCore-PulseBlaster.cpp) -add_library(PB_PROG STATIC PulseBlasterProgram.cpp) +add_library(SpinCore-PulseBlaster SpinCore-PulseBlaster.cpp) +add_library(PulseBlasterProgram PulseBlasterProgram.cpp) diff --git a/drivers/SpinCore-PulseBlaster24Bit/CMakeLists.txt b/drivers/SpinCore-PulseBlaster24Bit/CMakeLists.txt new file mode 100644 index 0000000..c317148 --- /dev/null +++ b/drivers/SpinCore-PulseBlaster24Bit/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) + +add_library(SpinCore-PulseBlaster24Bit SpinCore-PulseBlaster24Bit.cpp) \ No newline at end of file diff --git a/drivers/SpinCore-PulseBlasterDDSIII/CMakeLists.txt b/drivers/SpinCore-PulseBlasterDDSIII/CMakeLists.txt new file mode 100644 index 0000000..a57f1b4 --- /dev/null +++ b/drivers/SpinCore-PulseBlasterDDSIII/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) + +add_library(SpinCore-PulseBlasterDDSIII SpinCore-PulseBlasterDDSIII.cpp) \ No newline at end of file diff --git a/drivers/Tecmag-DAC20/CMakeLists.txt b/drivers/Tecmag-DAC20/CMakeLists.txt new file mode 100644 index 0000000..38cda6f --- /dev/null +++ b/drivers/Tecmag-DAC20/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) + +add_library(DAC20 DAC20.cpp) \ No newline at end of file diff --git a/drivers/dummy/CMakeLists.txt b/drivers/dummy/CMakeLists.txt new file mode 100644 index 0000000..e1e844e --- /dev/null +++ b/drivers/dummy/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) + +add_library(dummy dummy.cpp) \ No newline at end of file diff --git a/machines/CMakeLists.txt b/machines/CMakeLists.txt index 6e15f0d..77ed01b 100644 --- a/machines/CMakeLists.txt +++ b/machines/CMakeLists.txt @@ -4,42 +4,70 @@ 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}) +#find_library(PB24 SpinCore-PulseBlaster24Bit PATH ${CMAKE_SOURCE_DIR}) +link_directories(../drivers/SpinCore-PulseBlaster24Bit + ../drivers/SpinCore-PulseBlaster + ../drivers/SpinCore-PulseBlasterDDSIII + ../drivers) + +set(PB24 SpinCore-PulseBlaster24Bit SpinCore-PulseBlaster PulseBlasterProgram) +set(PBDDS SpinCore-PulseBlasterDDSIII SpinCore-PulseBlaster PulseBlasterProgram) + add_executable(dummycore dummycore.cpp hardware.cpp) -target_link_libraries( dummycore pthread ${XERCES_LIBRARIES} core dummy tempcont Eurotherm-2000Series) +target_link_libraries(dummycore pthread ${XERCES_LIBRARIES} core dummy tempcont Eurotherm-2000Series) + +add_executable(berta berta.cpp hardware.cpp) +target_link_libraries(berta pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) + +add_executable(birgit birgit.cpp hardware.cpp) +target_link_libraries(birgit pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) + +add_executable(bg_backend bg_backend.cpp hardware.cpp) + +target_link_libraries(bg_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) + +add_executable(Mobilecore Mobilecore.cpp hardware.cpp) +target_link_libraries(Mobilecore pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) + +add_executable(Mobilecore_wo_sync_backend Mobile_wo_sync_backend.cpp hardware.cpp) +target_link_libraries(Mobilecore_wo_sync_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) + + +add_executable(deuteron_backend deuteron_backend.cpp hardware.cpp) +target_link_libraries(deuteron_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} ${PBDDS} PTS ) add_executable(PFGcore PFGcore.cpp hardware.cpp) -target_link_libraries( PFGcore pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries PB PB24 PB_PROG PTS Tecmag-DAC20 ) +target_link_libraries( PFGcore pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) + + +add_executable(fc1neu_backend fc1neu_backend.cpp hardware.cpp) +target_link_libraries( fc1neu_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) + +# spcm linux driver needs to be installed (see http://spectrum-instrumentation.com/de/downloads/drivers) +#include_directories(${CMAKE_SOURCE_DIR}/drivers/Spectrum-M2i40xxSeries/include) +#add_executable(fc1_vierkanal_backend fc1_vierkanal_backend.cpp hardware.cpp) +#target_link_libraries( fc1_vierkanal_backend pthread ${XERCES_LIBRARIES} core spcm_linux Spectrum-M2i40xxSeries ${PB24} PTS DAC20 ) + +add_executable(fc2_backend fc2_backend.cpp hardware.cpp) +target_link_libraries( fc2_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) + +add_executable(fc2_AD5791_backend fc2_backend_AD5791.cpp hardware.cpp) +target_link_libraries( fc2_AD5791_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS 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 ) +target_link_libraries( general pthread ${XERCES_LIBRARIES} ${GLIB2_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) + +add_executable(magnexgrad_backend magnexgrad_backend.cpp hardware.cpp) +target_link_libraries( magnexgrad_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 tempcont Eurotherm-2000Series) + +add_executable(magnexgrad_dds_backend magnexgrad_backend_dds.cpp hardware.cpp) +target_link_libraries( magnexgrad_dds_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PBDDS} PTS DAC20 tempcont Eurotherm-2000Series) + +add_executable(pulseblaster_only pulseblaster_only.cpp hardware.cpp) +target_link_libraries(pulseblaster_only pthread ${XERCES_LIBRARIES} core ${PB24} PTS dummy DAC20 tempcont Eurotherm-2000Series ) \ No newline at end of file