-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(core): lock exact version of spdlog and fmtlib transitive dependency #621
base: main
Are you sure you want to change the base?
Changes from all commits
0dc0748
266affb
0ce2faf
114f075
2a1f85f
619fdb0
00a7f6c
8bc5f5e
8283916
0af9f08
4ab24c4
28ac70c
bec6191
f7c07fb
02b648a
fdda85b
4cc27e3
262b2d5
abdbfcf
e614a48
e3eacca
a564af2
d17df24
242bb37
589689d
a9c9abe
cb0ebff
1f0b637
19eecef
bd846f6
2d49542
c213a7d
d9bb90c
aa4cfc7
ad41ef5
3fd34cb
d0db46c
54a1c21
236ea17
d8df8f0
92d78d3
7700567
b1a9f86
4a117d6
8e1306e
b96f5a1
e9d5b2b
fbc475e
0148b5d
16ef663
1c6c925
ea3b93c
cda4455
ed09024
e23f803
d8d21ad
2a46b42
b7ad520
aad78ce
fef69ca
a7a5dab
c42d1bb
8f4f2fc
02498db
8ec439a
b62465e
d7f073a
2699ca9
bc7cf14
f6c657d
412e0e2
73356b0
c616405
20ff690
07b467d
6535efe
ce76279
53534b9
eb9e7ea
45aeaaa
7b10f41
6385cb6
8b41436
b499711
071edce
b6535c1
7f822cb
2c84316
3e8335b
cdea01f
7159e21
5ece291
6f7d65f
9610ab5
2feb739
58f98ad
76c9bc9
c14c4ca
e88e72a
e29e6df
e8a9470
140f526
1e53f2c
7a1c842
fb70484
ee8c8ad
e50c423
4543d61
2a81913
62538f3
a48b066
7054958
afdb394
e095213
84f7366
44604c1
a402054
4d1e9e6
1da88c6
7632955
a1fd272
95d4425
3329aae
f5f1613
52a16f8
7a08ac8
765b19d
ae54f7b
3dc9eb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,37 +105,72 @@ else() | |
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") | ||
endif() | ||
|
||
# Find and setup fmt | ||
# NOTE: | ||
# - We only try to link to the static library | ||
# - spdlog uses fmt, so their versions need to be kept in-sync | ||
find_package(fmt 8.0.1 REQUIRED) | ||
if(fmt_FOUND) | ||
message(STATUS "Found fmt ${fmt_VERSION}") | ||
else() | ||
message(FATAL_ERROR "Could not find static libraries for fmt") | ||
endif() | ||
# Find and setup spdlog and fmt transitive dependency | ||
|
||
# Find and setup spdlog | ||
# Specify the minimum required spdlog version (can be overridden by the user) | ||
set (spdlog_MIN_VERSION "1.9.0" CACHE STRING "Minimum required version of spdlog") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
if(CLP_USE_STATIC_LIBS) | ||
# NOTE: On some Linux distributions (e.g. Ubuntu), the spdlog package only contains a dynamic | ||
# library. If the `find_package(spdlog)` call below fails, re-run | ||
# `tools/scripts/lib_install/<dist_name>/install-packages-from-source.sh` to build spdlog from | ||
# source. | ||
set(spdlog_USE_STATIC_LIBS ON) | ||
endif() | ||
find_package(spdlog 1.9.2 REQUIRED) | ||
find_package(spdlog ${spdlog_MIN_VERSION} REQUIRED) | ||
if(spdlog_FOUND) | ||
message(STATUS "Found spdlog ${spdlog_VERSION}") | ||
else() | ||
message("You may want to re-run `components/core/tools/scripts/lib_install/<dist>/install-packages-from-source.sh`") | ||
if (CLP_USE_STATIC_LIBS) | ||
message(FATAL_ERROR "Could not find static libraries for spdlog. You may want to re-run | ||
`components/core/tools/scripts/lib_install/<dist>/install-packages-from-source.sh`") | ||
message(FATAL_ERROR "Could not find static libraries for spdlog.") | ||
else() | ||
message(FATAL_ERROR "Could not find libraries for spdlog.") | ||
endif() | ||
endif() | ||
Comment on lines
122
to
129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because |
||
|
||
# Determine the lower bound version compatibility of fmt w.r.t to spdlog | ||
if(spdlog_VERSION VERSION_GREATER_EQUAL "1.15.0") | ||
set(FMT_MIN_VERSION "11.0.0") | ||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.12.0") | ||
set(FMT_MIN_VERSION "10.0.0") | ||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.11.0") | ||
set(FMT_MIN_VERSION "9.0.0") | ||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.9.0") | ||
set(FMT_MIN_VERSION "8.0.0") | ||
else() | ||
message(FATAL_ERROR "Unsupported spdlog version (${spdlog_VERSION}). Minimum supported version is 1.9.0.") | ||
endif() | ||
Comment on lines
+131
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to the reasons explained below, this is unnecessary. |
||
|
||
# Find fmt with the compatible version | ||
# NOTE: | ||
# - We only try to link to the static library | ||
find_package(fmt ${FMT_MIN_VERSION} REQUIRED) | ||
kirkrodrigues marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we specify a version of fmt in the |
||
if(fmt_FOUND) | ||
# Determine the upper bound version compatibility of fmt w.r.t to spdlog | ||
if(spdlog_VERSION VERSION_GREATER_EQUAL "1.15.0") | ||
# Empty block, no upper version limit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should be conservative and assume that spdlog v1.15.x will only be compatible with fmt v11. |
||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.12.0") | ||
if (fmt_VERSION VERSION_GREATER_EQUAL "11.0.0") | ||
message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 10.0.0 <= version < 11.0.0") | ||
endif() | ||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.11.0") | ||
if (fmt_VERSION VERSION_GREATER_EQUAL "10.0.0") | ||
message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 9.0.0 <= version < 10.0.0") | ||
endif() | ||
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.9.0") | ||
if (fmt_VERSION VERSION_GREATER_EQUAL "9.0.0") | ||
message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 8.0.0 <= version < 9.0.0") | ||
endif() | ||
endif() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a default case that prints an error. |
||
message(STATUS "Found fmt ${fmt_VERSION}") | ||
else() | ||
message(FATAL_ERROR "Could not find static libraries for fmt") | ||
endif() | ||
|
||
# Print the selected versions for debugging | ||
message(STATUS "Using spdlog version ${spdlog_VERSION}") | ||
message(STATUS "Using fmt version ${fmt_VERSION}") | ||
Comment on lines
+170
to
+172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are redundant since we're already printing "Found Xxx" for each library above. |
||
|
||
Comment on lines
-109
to
+173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's how I would write it: # Find and set up spdlog
set(CLP_SPDLOG_MIN_VERSION "1.9.0")
if(CLP_USE_STATIC_LIBS)
# NOTE: On some Linux distributions (e.g. Ubuntu), the spdlog package only contains a dynamic
# library. If the `find_package(spdlog)` call below fails, re-run
# `tools/scripts/lib_install/<dist_name>/install-packages-from-source.sh` to build spdlog from
# source.
set(spdlog_USE_STATIC_LIBS ON)
endif()
find_package(spdlog "${CLP_SPDLOG_MIN_VERSION}" REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog ${spdlog_VERSION}")
if(spdlog_VERSION VERSION_LESS CLP_SPDLOG_MIN_VERSION)
message(FATAL_ERROR "spdlog v${spdlog_VERSION} is unsupported. Minimum supported version is"
" ${CLP_SPDLOG_MIN_VERSION}.")
endif()
endif()
# Find and set up a version of fmt that's compatible with the installed version of spdlog
# NOTE:
# - We only try to link to the static library
find_package(fmt REQUIRED)
if(fmt_FOUND)
# Validate that the installed fmt version is compatible with the installed spdlog version
if(spdlog_VERSION VERSION_GREATER_EQUAL "1.15")
if(fmt_VERSION VERSION_GREATER "11")
message(FATAL_ERROR "fmt v${fmt_VERSION} is unsupported. Only v11 is supported with spdlog"
" v${spdlog_VERSION}.")
endif()
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.12")
if(fmt_VERSION VERSION_GREATER_EQUAL "11")
message(FATAL_ERROR "fmt v${fmt_VERSION} is unsupported. Only v10 is supported with spdlog"
" v${spdlog_VERSION}.")
endif()
elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.11")
if(fmt_VERSION VERSION_GREATER_EQUAL "10")
message(FATAL_ERROR "fmt v${fmt_VERSION} is unsupported. Only v9 is supported with spdlog"
" v${spdlog_VERSION}.")
endif()
elseif(spdlog_VERSION VERSION_GREATER_EQUAL CLP_SPDLOG_MIN_VERSION)
if(fmt_VERSION VERSION_GREATER_EQUAL "9")
message(FATAL_ERROR "fmt v${fmt_VERSION} is unsupported. Only v8 is supported with spdlog"
" v${spdlog_VERSION}.")
endif()
else()
message(FATAL_ERROR "Internal error: spdlog v${spdlog_VERSION} is unhandled.")
endif()
message(STATUS "Found fmt ${fmt_VERSION}")
endif() I'll explain why in other comments. |
||
# Find and setup libarchive | ||
if(CLP_USE_STATIC_LIBS) | ||
set(LibArchive_USE_STATIC_LIBS ON) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user shouldn't really be allowed to override the version since they could easily pick a version that's incompatible with the code, right?