Skip to content

Commit 25f4b5b

Browse files
kmorelJieyangChen7
authored andcommitted
Fix defines created by CMake configure_file
Recent versions of CMake must have changed how variables created from `option` commands were substituted in the `configure_file` command. Previously, they substituted to `ON` or `OFF`, but now they substitute for `TRUE` or `FALSE`. This causes a problem with how MGARDXConfig.h matched strings to set the `MGARD_ENABLE_X` macros. This change replaces string substitution with `#cmakedefine01`, which will simply replace the statement with a `#define` setting the variable to either 0 or 1, which is the desired outcome.
1 parent 024ccc2 commit 25f4b5b

File tree

2 files changed

+10
-40
lines changed

2 files changed

+10
-40
lines changed

include/MGARDXConfig.h.in

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,20 @@
88
#ifndef MGARD_X_CONFIG_H
99
#define MGARD_X_CONFIG_H
1010

11-
#if '@MGARD_ENABLE_SERIAL@' == 'ON'
12-
#define MGARD_ENABLE_SERIAL 1
13-
#else
14-
#define MGARD_ENABLE_SERIAL 0
15-
#endif
11+
#cmakedefine01 MGARD_ENABLE_SERIAL
1612

17-
#if '@MGARD_ENABLE_OPENMP@' == 'ON'
18-
#define MGARD_ENABLE_OPENMP 1
19-
#else
20-
#define MGARD_ENABLE_OPENMP 0
21-
#endif
13+
#cmakedefine01 MGARD_ENABLE_OPENMP
2214

23-
#if '@MGARD_ENABLE_CUDA@' == 'ON'
24-
#define MGARD_ENABLE_CUDA 1
25-
#else
26-
#define MGARD_ENABLE_CUDA 0
27-
#endif
15+
#cmakedefine01 MGARD_ENABLE_CUDA
2816

29-
#if '@MGARD_ENABLE_HIP@' == 'ON'
30-
#define MGARD_ENABLE_HIP 1
31-
#else
32-
#define MGARD_ENABLE_HIP 0
33-
#endif
17+
#cmakedefine01 MGARD_ENABLE_HIP
3418

35-
#if '@MGARD_ENABLE_SYCL@' == 'ON'
36-
#define MGARD_ENABLE_SYCL 1
37-
#else
38-
#define MGARD_ENABLE_SYCL 0
39-
#endif
19+
#cmakedefine01 MGARD_ENABLE_SYCL
4020

41-
#if '@MGARD_ENABLE_LEGACY_CUDA@' == 'ON'
42-
#define MGARD_ENABLE_LEGACY_CUDA 1
43-
#else
44-
#define MGARD_ENABLE_LEGACY_CUDA 0
45-
#endif
21+
#cmakedefine01 MGARD_ENABLE_LEGACY_CUDA
4622

47-
#if '@MGARD_ENABLE_AUTO_TUNING@' == 'ON'
48-
#define MGARD_ENABLE_AUTO_TUNING 1
49-
#else
50-
#define MGARD_ENABLE_AUTO_TUNING 0
51-
#endif
23+
#cmakedefine01 MGARD_ENABLE_AUTO_TUNING
5224

53-
#if '@MGARD_ENABLE_EXTERNAL_COMPRESSOR@' == 'ON'
54-
#define MGARD_ENABLE_EXTERNAL_COMPRESSOR 1
55-
#else
56-
#define MGARD_ENABLE_EXTERNAL_COMPRESSOR 0
57-
#endif
25+
#cmakedefine01 MGARD_ENABLE_EXTERNAL_COMPRESSOR
5826

5927
#endif

include/mgard-x/RuntimeX/RuntimeX.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
// Serial backend should be always available
2121
#if MGARD_ENABLE_SERIAL
2222
#include "DeviceAdapters/DeviceAdapterSerial.h"
23+
#else
24+
#error "The serial MGARD device should always be available."
2325
#endif
2426

2527
#if MGARD_ENABLE_OPENMP

0 commit comments

Comments
 (0)