Skip to content

Commit fb7d578

Browse files
p12ticsimogasp
authored andcommitted
Replace CCTAG_EIGEN_NO_ALIGN with CCTAG_EIGEN_MEMORY_ALIGNMENT
Avoiding negation in variable names makes code easier to understand. We needed a similar flag in main AliceVision project, so CCTag is adjusted too for consistency.
1 parent ef03ed3 commit fb7d578

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- Enable -faligned-new when CCTAG_EIGEN_NO_ALIGN is not set on GCC >= 7.1 [PR](https://github.com/alicevision/CCTag/pull/193)
12+
- Enable -faligned-new when CCTAG_EIGEN_MEMORY_ALIGNMENT is set on GCC >= 7.1 [PR](https://github.com/alicevision/CCTag/pull/193)
1313

1414
### Changed
1515

16+
- Replaced CCTAG_EIGEN_MEMORY_ALIGNMENT with CCTAG_EIGEN_MEMORY_ALIGNMENT which has the opposite meaning.
17+
1618
### Fixed
1719
- fix gcc11 ordered pointer comparison [PR](https://github.com/alicevision/CCTag/pull/191)
1820

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ option(CCTAG_WITH_CUDA "Compile the library with CUDA support" ON)
2121
option(CCTAG_BUILD_APPS "Build the sample applications" ON)
2222
option(CCTAG_CUDA_CC_CURRENT_ONLY "Set to on to build only for the current machine's CC" OFF)
2323
option(CCTAG_NVCC_WARNINGS "Switch on several additional warnings for CUDA nvcc." OFF)
24-
option(CCTAG_EIGEN_NO_ALIGN "Disable Eigen alignment" ON)
24+
option(CCTAG_EIGEN_MEMORY_ALIGNMENT "Enable Eigen alignment" OFF)
2525

2626
option(CCTAG_USE_POSITION_INDEPENDENT_CODE "Generate position independent code." ON)
2727
option(CCTAG_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
@@ -232,7 +232,7 @@ if(MSVC AND CCTAG_WITH_CUDA)
232232
endif()
233233
find_package(Eigen3 ${CCTAG_EIGEN_REQUIRED_VERSION} REQUIRED)
234234
message(STATUS "Found Eigen: version ${Eigen3_VERSION}")
235-
if(CCTAG_EIGEN_NO_ALIGN)
235+
if(NOT CCTAG_EIGEN_MEMORY_ALIGNMENT)
236236
set(AV_EIGEN_DEFINITIONS -DEIGEN_MAX_ALIGN_BYTES=0 -DEIGEN_MAX_STATIC_ALIGN_BYTES=0)
237237
endif()
238238

@@ -272,7 +272,7 @@ message(STATUS "Cuda support: " ${CCTAG_WITH_CUDA})
272272
if(CCTAG_WITH_CUDA)
273273
message(STATUS "Compiling for CUDA CCs: ${ARCH_FLAGS}")
274274
endif()
275-
message(STATUS "Disable Eigen alignment: " ${CCTAG_EIGEN_NO_ALIGN})
275+
message(STATUS "Enable Eigen alignment: " ${CCTAG_EIGEN_MEMORY_ALIGNMENT})
276276
message(STATUS "Enable AVX2 optimizations: " ${CCTAG_ENABLE_SIMD_AVX2})
277277
message(STATUS "[debug] Serialize all the output: " ${CCTAG_SERIALIZE})
278278
message(STATUS "[debug] Enable visual debug: " ${CCTAG_VISUAL_DEBUG})

src/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,16 @@ endif(CCTAG_NO_COUT)
253253
if(CCTAG_VISUAL_DEBUG)
254254
target_compile_definitions(CCTag PRIVATE "-DCCTAG_VISUAL_DEBUG")
255255
endif(CCTAG_VISUAL_DEBUG)
256-
if(CCTAG_EIGEN_NO_ALIGN)
257-
target_compile_definitions(CCTag PUBLIC ${AV_EIGEN_DEFINITIONS})
258-
else()
256+
if(CCTAG_EIGEN_MEMORY_ALIGNMENT)
259257
# If user enabled Eigen alignment assumptions, then allocations should be with appropriate
260258
# alignment. Fortunately this is fixed in C++17. While we can't upgrade to C++17 just yet, some
261259
# compilers support overaligned allocation feature with a separate flag.
262260
# See https://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html
263261
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.1)
264262
target_compile_options(CCTag PRIVATE "-faligned-new")
265263
endif()
264+
else()
265+
target_compile_definitions(CCTag PUBLIC ${AV_EIGEN_DEFINITIONS})
266266
endif()
267267
set_target_properties(CCTag PROPERTIES VERSION ${PROJECT_VERSION})
268268
set_target_properties(CCTag PROPERTIES DEBUG_POSTFIX "d")

0 commit comments

Comments
 (0)