Skip to content

Commit 531737c

Browse files
committed
[roc] Append o2- to bin names and keep legacy symlinks
1 parent aae4e7a commit 531737c

File tree

2 files changed

+75
-81
lines changed

2 files changed

+75
-81
lines changed

CMakeLists.txt

Lines changed: 75 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ endif()
1313

1414
# Define project
1515
project(ReadoutCard
16-
VERSION 0.11.11
16+
VERSION 0.31.0
1717
DESCRIPTION "O2 ReadoutCard library"
18-
LANGUAGES C CXX
18+
LANGUAGES CXX
1919
)
2020

2121
# Documentation dir
@@ -39,18 +39,16 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
3939
)
4040
endif()
4141

42-
4342
####################################
4443
# Populate the Cru/Constants.h file with the register addresses contained in CRU/cru_table.py
4544
####################################
46-
execute_process(COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/src/Cru/cru_constants_populate.py
45+
execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/src/Cru/cru_constants_populate.py
4746
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/Cru
4847
RESULT_VARIABLE status)
4948
IF(NOT "${status}" EQUAL "0")
5049
MESSAGE(WARNING "Couldn't update CRU Register Addresses")
5150
ENDIF()
5251

53-
5452
####################################
5553
# Dependencies
5654
####################################
@@ -91,29 +89,36 @@ include(GNUInstallDirs)
9189
####################################
9290
# RPATH
9391
####################################
94-
include(GNUInstallDirs)
9592

9693
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
97-
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
98-
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
99-
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
100-
if("${isSystemDir}" STREQUAL "-1")
101-
set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
102-
endif()
103-
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
104-
endif()
105-
unset(isSystemDir)
94+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) #TODO: Why does the lib dir end up in the BUILD bin but not the INSTALL bin?
10695

10796
####################################
10897
# Module, library and executable definition
10998
####################################
11099

111100
add_library(ReadoutCard SHARED
101+
src/BarInterfaceBase.cxx
102+
src/CardConfigurator.cxx
103+
src/CardFinder.cxx
112104
src/CardType.cxx
113-
src/Factory/ChannelFactory.cxx
105+
src/Crorc/Crorc.cxx
106+
src/Crorc/CrorcDmaChannel.cxx
107+
src/Crorc/CrorcBar.cxx
108+
src/Cru/Common.cxx
109+
src/Cru/CruDmaChannel.cxx
110+
src/Cru/CruBar.cxx
111+
src/Cru/DatapathWrapper.cxx
112+
src/Cru/Eeprom.cxx
113+
src/Cru/Gbt.cxx
114+
src/Cru/I2c.cxx
115+
src/Cru/PatternPlayer.cxx
116+
src/Cru/Ttc.cxx
114117
src/DmaChannelBase.cxx
118+
src/DmaChannelPdaBase.cxx
115119
src/ChannelPaths.cxx
116120
src/ExceptionInternal.cxx
121+
src/Factory/ChannelFactory.cxx
117122
src/FirmwareChecker.cxx
118123
src/Logger.cxx
119124
src/MemoryMappedFile.cxx
@@ -129,33 +134,13 @@ add_library(ReadoutCard SHARED
129134
src/ParameterTypes/PciSequenceNumber.cxx
130135
src/ParameterTypes/ResetLevel.cxx
131136
src/ParameterTypes/SerialId.cxx
132-
src/Utilities/Hugetlbfs.cxx
133-
src/Utilities/MemoryMaps.cxx
134-
src/Utilities/Numa.cxx
135-
)
136-
137-
# Add sources requiring PDA
138-
target_sources(ReadoutCard PRIVATE
139-
src/DmaChannelPdaBase.cxx
140-
src/BarInterfaceBase.cxx
141-
src/CardConfigurator.cxx
142-
src/CardFinder.cxx
143-
src/Crorc/Crorc.cxx
144-
src/Crorc/CrorcDmaChannel.cxx
145-
src/Crorc/CrorcBar.cxx
146-
src/Cru/Common.cxx
147-
src/Cru/CruDmaChannel.cxx
148-
src/Cru/CruBar.cxx
149-
src/Cru/DatapathWrapper.cxx
150-
src/Cru/Eeprom.cxx
151-
src/Cru/Gbt.cxx
152-
src/Cru/I2c.cxx
153-
src/Cru/PatternPlayer.cxx
154-
src/Cru/Ttc.cxx
155137
src/Pda/PdaBar.cxx
156138
src/Pda/PdaDevice.cxx
157139
src/Pda/PdaDmaBuffer.cxx
158140
src/RocPciDevice.cxx
141+
src/Utilities/Hugetlbfs.cxx
142+
src/Utilities/MemoryMaps.cxx
143+
src/Utilities/Numa.cxx
159144
$<$<BOOL:${Python2_FOUND}>:src/PythonInterface.cxx>
160145
$<$<BOOL:${Python3_FOUND}>:src/PythonInterface.cxx>
161146
)
@@ -195,28 +180,11 @@ target_compile_features(ReadoutCard PUBLIC cxx_std_17)
195180
####################################
196181

197182
set(EXE_SRCS
198-
ProgramDmaBench.cxx
199-
ProgramReset.cxx
200-
ProgramRegisterModify.cxx
201-
ProgramRegisterRead.cxx
202-
ProgramRegisterReadRange
203-
ProgramRegisterWrite.cxx
204-
)
205-
206-
set(EXE_NAMES
207-
roc-bench-dma
208-
roc-reset
209-
roc-reg-modify
210-
roc-reg-read
211-
roc-reg-read-range
212-
roc-reg-write
213-
)
214-
215-
list(APPEND EXE_SRCS
216183
ProgramBarStress.cxx
217184
ProgramConfig.cxx
218185
ProgramCtpEmulator.cxx
219186
ProgramCleanup.cxx
187+
ProgramDmaBench.cxx
220188
../Example.cxx
221189
ProgramFirmwareCheck.cxx
222190
ProgramFlash.cxx
@@ -225,31 +193,43 @@ list(APPEND EXE_SRCS
225193
ProgramMetrics.cxx
226194
ProgramPacketMonitor.cxx
227195
ProgramPatternPlayer.cxx
196+
ProgramReset.cxx
197+
ProgramRegisterModify.cxx
198+
ProgramRegisterRead.cxx
199+
ProgramRegisterReadRange
200+
ProgramRegisterWrite.cxx
228201
ProgramSiuStatus.cxx
229202
ProgramStatus.cxx
230203
ProgramTriggerMonitor.cxx
231204
ProgramUserLogic.cxx
232205
)
233206

234-
list(APPEND EXE_NAMES
235-
roc-bar-stress
236-
roc-config
237-
roc-ctp-emulator
238-
roc-cleanup
239-
roc-example
240-
roc-fw-check
241-
roc-flash
242-
roc-flash-read
243-
roc-list-cards
244-
roc-metrics
245-
roc-pkt-monitor
246-
roc-pat-player
247-
roc-siu-status
248-
roc-status
249-
roc-trig-monitor
250-
roc-ul
207+
set(EXE_NAMES
208+
o2-roc-bar-stress
209+
o2-roc-config
210+
o2-roc-ctp-emulator
211+
o2-roc-cleanup
212+
o2-roc-bench-dma
213+
o2-roc-example
214+
o2-roc-fw-check
215+
o2-roc-flash
216+
o2-roc-flash-read
217+
o2-roc-list-cards
218+
o2-roc-metrics
219+
o2-roc-pkt-monitor
220+
o2-roc-pat-player
221+
o2-roc-reset
222+
o2-roc-reg-modify
223+
o2-roc-reg-read
224+
o2-roc-reg-read-range
225+
o2-roc-reg-write
226+
o2-roc-siu-status
227+
o2-roc-status
228+
o2-roc-trig-monitor
229+
o2-roc-ul
251230
)
252231

232+
set(LEGACY_EXE_NAMES)
253233

254234
list(LENGTH EXE_SRCS count)
255235
math(EXPR count "${count}-1")
@@ -267,6 +247,12 @@ foreach(i RANGE ${count})
267247
Boost::program_options
268248
pda::pda
269249
)
250+
251+
# create binary symlinks to preserve backwards compatibility
252+
STRING(REGEX REPLACE "^o2-roc" "roc" legacy_exe_link ${name})
253+
add_custom_command(TARGET ${name} POST_BUILD
254+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${name} ${legacy_exe_link})
255+
list(APPEND LEGACY_EXE_NAMES ${legacy_exe_link})
270256
endforeach()
271257

272258
####################################
@@ -309,7 +295,6 @@ foreach (test ${TEST_SRCS})
309295
set_tests_properties(${test_name} PROPERTIES TIMEOUT 15)
310296
endforeach()
311297

312-
313298
####################################
314299
# Install
315300
####################################
@@ -328,10 +313,11 @@ set_target_properties(ReadoutCard
328313
O2ReadoutCard # Adhere to O2 naming conventions
329314
)
330315

316+
# create a symlink libReadoutCard -> libO2ReadoutCard for backwards compatibility
331317
set(legacy_library_link libReadoutCard.so)
332318
set(legacy_library_target libO2ReadoutCard.so)
333319

334-
add_custom_target(link_build_target ReadoutCard
320+
add_custom_target(legacy_library_target ReadoutCard
335321
COMMAND ${CMAKE_COMMAND} -E create_symlink ${legacy_library_target} ${legacy_library_link})
336322

337323
# Create version file
@@ -371,17 +357,17 @@ install(
371357

372358
# Install the hugetlbfs script separately, because it's not a compiled target
373359
install(
374-
FILES src/roc-setup-hugetlbfs.sh
360+
FILES src/o2-roc-setup-hugetlbfs.sh
375361
DESTINATION ${CMAKE_INSTALL_BINDIR}
376362
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
377-
RENAME roc-setup-hugetlbfs
363+
RENAME o2-roc-setup-hugetlbfs
378364
)
379365

380366
install(
381-
FILES src/roc-setup-hugetlbfs.sh
367+
FILES src/o2-roc-setup-hugetlbfs.sh
382368
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
383369
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
384-
RENAME roc-setup-hugetlbfs
370+
RENAME o2-roc-setup-hugetlbfs
385371
)
386372

387373
# Install the roc-config template
@@ -391,8 +377,16 @@ install(
391377
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
392378
)
393379

380+
# Install the binary symlinks
381+
foreach(legacy_exe ${LEGACY_EXE_NAMES})
382+
install (
383+
FILES ${CMAKE_CURRENT_BINARY_DIR}/${legacy_exe}
384+
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
385+
)
386+
endforeach()
387+
394388
# Install the legacy library symlink
395389
install(
396390
FILES ${CMAKE_CURRENT_BINARY_DIR}/${legacy_library_link}
397-
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
391+
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
398392
)

0 commit comments

Comments
 (0)