Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
c2498cb0
Commit
c2498cb0
authored
9 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: parse versions in SystemCheckup
parent
fb0edb0d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SuperBuild/CMake/SystemCheckup.cmake
+101
-41
101 additions, 41 deletions
SuperBuild/CMake/SystemCheckup.cmake
with
101 additions
and
41 deletions
SuperBuild/CMake/SystemCheckup.cmake
+
101
−
41
View file @
c2498cb0
...
...
@@ -7,89 +7,149 @@ message(STATUS "|------------ System checkup results ------------")
# contains the CMAKE_INSTALL_PREFIX (-> superbuild libs)
list
(
REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH
${
CMAKE_INSTALL_PREFIX
}
)
macro
(
SB_BASIC_LIBRARY_CHECKUP var
)
# macro to encapsulate a find_package(XXX QUIET)
# output variables are :
# _SB_CHECKUP_XXX_FOUND : lib is found ?
# _SB_CHECKUP_XXX_VERSION : version found
# _SB_CHECKUP_XXX_NAME : name found
macro
(
SB_CHECKUP_FIND_PACKAGE var
)
find_package
(
${
var
}
QUIET
)
string
(
TOUPPER
${
var
}
_uppervar
)
un
set
(
_SB_CHECKUP_
RESULT_VERSION
)
set
(
_
find_var_result 0
)
set
(
_
var_name
""
)
set
(
_SB_CHECKUP_
${
_uppervar
}
_VERSION NOTFOUND
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_FOUND FALSE
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_NAME NOTFOUND
)
if
(
${
var
}
_FOUND
)
set
(
_
find_var_result 1
)
set
(
_
var_name
${
var
}
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_FOUND TRUE
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_NAME
${
var
}
)
elseif
(
${
_uppervar
}
_FOUND
)
set
(
_
find_var_result 1
)
set
(
_
var_name
${
_uppervar
}
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_FOUND TRUE
)
set
(
_
SB_CHECKUP_
${
_uppervar
}
_NAME
${
_uppervar
}
)
endif
()
if
(
_find_var_result
)
if
(
_SB_CHECKUP_
${
_uppervar
}
_FOUND
)
set
(
_var_name
${
_SB_CHECKUP_
${
_uppervar
}
_NAME
}
)
message
(
STATUS
"|------------------------------------------------"
)
message
(
STATUS
"|
${
var
}
:
found"
)
message
(
STATUS
"|
${
var
}
found"
)
if
(
DEFINED
${
_var_name
}
_VERSION
)
message
(
STATUS
"|
${
var
}
:
version =
${${
_var_name
}
_VERSION
}
"
)
set
(
_SB_CHECKUP_
RESULT
_VERSION
${${
_var_name
}
_VERSION
}
)
message
(
STATUS
"|
version =
${${
_var_name
}
_VERSION
}
"
)
set
(
_SB_CHECKUP_
${
_uppervar
}
_VERSION
${${
_var_name
}
_VERSION
}
)
elseif
(
DEFINED
${
_var_name
}
_VERSION_STRING
)
message
(
STATUS
"|
${
var
}
:
version =
${${
_var_name
}
_VERSION_STRING
}
"
)
set
(
_SB_CHECKUP_
RESULT
_VERSION
${${
_var_name
}
_VERSION_STRING
}
)
message
(
STATUS
"|
version =
${${
_var_name
}
_VERSION_STRING
}
"
)
set
(
_SB_CHECKUP_
${
_uppervar
}
_VERSION
${${
_var_name
}
_VERSION_STRING
}
)
elseif
(
DEFINED
${
_var_name
}
_VERSION_MAJOR AND DEFINED
${
_var_name
}
_VERSION_MINOR AND DEFINED
${
_var_name
}
_VERSION_PATCH
)
message
(
STATUS
"|
${
var
}
:
version =
${${
_var_name
}
_VERSION_MAJOR
}
.
${${
_var_name
}
_VERSION_MINOR
}
.
${${
_var_name
}
_VERSION_PATCH
}
"
)
set
(
_SB_CHECKUP_
RESULT
_VERSION
"
${${
_var_name
}
_VERSION_MAJOR
}
.
${${
_var_name
}
_VERSION_MINOR
}
.
${${
_var_name
}
_VERSION_PATCH
}
"
)
message
(
STATUS
"|
version =
${${
_var_name
}
_VERSION_MAJOR
}
.
${${
_var_name
}
_VERSION_MINOR
}
.
${${
_var_name
}
_VERSION_PATCH
}
"
)
set
(
_SB_CHECKUP_
${
_uppervar
}
_VERSION
"
${${
_var_name
}
_VERSION_MAJOR
}
.
${${
_var_name
}
_VERSION_MINOR
}
.
${${
_var_name
}
_VERSION_PATCH
}
"
)
endif
()
if
(
DEFINED
${
_var_name
}
_DIR
)
message
(
STATUS
"|
${
var
}
: directory =
${${
_var_name
}
_DIR
}
"
)
endif
()
if
(
DEFINED
${
_var_name
}
_LIBRARIES
)
message
(
STATUS
"|
${
var
}
: libraries =
${${
_var_name
}
_LIBRARIES
}
"
)
endif
()
if
(
DEFINED
${
_var_name
}
_INCLUDE_DIRS
)
message
(
STATUS
"|
${
var
}
: includes =
${${
_var_name
}
_INCLUDE_DIRS
}
"
)
endif
()
endif
()
endmacro
(
SB_CHECKUP_FIND_PACKAGE
)
macro
(
SB_CHECKUP_SPLIT_VERSION var
)
string
(
TOUPPER
${
var
}
_upperlib
)
if
(
_SB_CHECKUP_
${
_upperlib
}
_VERSION
)
string
(
REGEX REPLACE
"([0-9]+)
\\
.([0-9]+)
\\
.([0-9]+)"
"
\\
1"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MAJOR
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION
}
)
string
(
REGEX REPLACE
"([0-9]+)
\\
.([0-9]+)
\\
.([0-9]+)"
"
\\
2"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MINOR
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION
}
)
string
(
REGEX REPLACE
"([0-9]+)
\\
.([0-9]+)
\\
.([0-9]+)"
"
\\
3"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_PATCH
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION
}
)
math
(
EXPR _SB_CHECKUP_
${
_upperlib
}
_VERSION_NUMBER
"((
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MAJOR
}
)*100+
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MINOR
}
)*100+
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_PATCH
}
"
)
endif
()
endmacro
(
SB_CHECKUP_SPLIT_VERSION
)
macro
(
SB_CHECKUP_FIND_VERSIONS lib header major_name minor_name patch_name
)
string
(
TOUPPER
${
lib
}
_upperlib
)
if
(
_SB_CHECKUP_
${
_upperlib
}
_FOUND AND EXISTS
${
header
}
)
unset
(
_header_content
)
set
(
_major_regex
".*# *define +
${
major_name
}
+([0-9]+).*"
)
set
(
_minor_regex
".*# *define +
${
minor_name
}
+([0-9]+).*"
)
set
(
_patch_regex
".*# *define +
${
patch_name
}
+([0-9]+).*"
)
file
(
READ
${
header
}
_header_content
)
string
(
REGEX REPLACE
${
_major_regex
}
"
\\
1"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MAJOR
${
_header_content
}
)
string
(
REGEX REPLACE
${
_minor_regex
}
"
\\
1"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MINOR
${
_header_content
}
)
string
(
REGEX REPLACE
${
_patch_regex
}
"
\\
1"
_SB_CHECKUP_
${
_upperlib
}
_VERSION_PATCH
${
_header_content
}
)
math
(
EXPR _SB_CHECKUP_
${
_upperlib
}
_VERSION_NUMBER
"((
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MAJOR
}
)*100+
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MINOR
}
)*100+
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_PATCH
}
"
)
set
(
_SB_CHECKUP_
${
_upperlib
}
_VERSION
"
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MAJOR
}
.
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_MINOR
}
.
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION_PATCH
}
"
)
message
(
STATUS
"| version =
${
_SB_CHECKUP_
${
_upperlib
}
_VERSION
}
"
)
endif
()
endmacro
(
SB_
BASIC_LIBRARY_CHECKUP
)
endmacro
(
SB_
CHECKUP_FIND_VERSIONS
)
# Boost
SB_BASIC_LIBRARY_CHECKUP
(
Boost
)
SB_CHECKUP_FIND_PACKAGE
(
Boost
)
if
(
_SB_CHECKUP_BOOST_VERSION
)
set
(
_SB_CHECKUP_BOOST_VERSION_NUMBER
${
_SB_CHECKUP_BOOST_VERSION
}
)
endif
()
# Curl
SB_BASIC_LIBRARY_CHECKUP
(
CURL
)
SB_CHECKUP_FIND_PACKAGE
(
CURL
)
SB_CHECKUP_SPLIT_VERSION
(
CURL
)
# GDAL
SB_BASIC_LIBRARY_CHECKUP
(
GDAL
)
SB_CHECKUP_FIND_PACKAGE
(
GDAL
)
SB_CHECKUP_FIND_VERSIONS
(
GDAL
${
GDAL_INCLUDE_DIR
}
/gdal_version.h
GDAL_VERSION_MAJOR
GDAL_VERSION_MINOR
GDAL_VERSION_REV
)
# GeoTIFF
SB_
BASIC_LIBRARY_CHECKUP
(
GeoTIFF
)
SB_
CHECKUP_FIND_PACKAGE
(
GeoTIFF
)
# ITK
SB_
BASIC_LIBRARY_CHECKUP
(
ITK
)
SB_
CHECKUP_FIND_PACKAGE
(
ITK
)
# libkml
SB_BASIC_LIBRARY_CHECKUP
(
LibKML
)
SB_CHECKUP_FIND_PACKAGE
(
LibKML
)
SB_CHECKUP_FIND_VERSIONS
(
LibKML
${
LIBKML_INCLUDE_DIR
}
/kml/base/version.h
LIBKML_MAJOR_VERSION
LIBKML_MINOR_VERSION
LIBKML_MICRO_VERSION
)
# LibSVM
SB_BASIC_LIBRARY_CHECKUP
(
LibSVM
)
SB_CHECKUP_FIND_PACKAGE
(
LibSVM
)
SB_CHECKUP_SPLIT_VERSION
(
LibSVM
)
# muParser
SB_
BASIC_LIBRARY_CHECKUP
(
MuParser
)
SB_
CHECKUP_FIND_PACKAGE
(
MuParser
)
# muParserX
SB_
BASIC_LIBRARY_CHECKUP
(
MuParserX
)
SB_
CHECKUP_FIND_PACKAGE
(
MuParserX
)
# OpenCV
SB_BASIC_LIBRARY_CHECKUP
(
OpenCV
)
SB_CHECKUP_FIND_PACKAGE
(
OpenCV
)
SB_CHECKUP_SPLIT_VERSION
(
OpenCV
)
# OpenJPEG
SB_
BASIC_LIBRARY_CHECKUP
(
OpenJPEG
)
SB_
CHECKUP_FIND_PACKAGE
(
OpenJPEG
)
# OpenThreads
SB_
BASIC_LIBRARY_CHECKUP
(
OpenThreads
)
SB_
CHECKUP_FIND_PACKAGE
(
OpenThreads
)
# OSSIM
SB_
BASIC_LIBRARY_CHECKUP
(
Ossim
)
SB_
CHECKUP_FIND_PACKAGE
(
Ossim
)
# Qt4
SB_BASIC_LIBRARY_CHECKUP
(
Qt4
)
SB_CHECKUP_FIND_PACKAGE
(
Qt4
)
if
(
_SB_CHECKUP_QT4_FOUND
)
set
(
_SB_CHECKUP_QT4_VERSION
"
${
QT_VERSION_MAJOR
}
.
${
QT_VERSION_MINOR
}
.
${
QT_VERSION_PATCH
}
"
)
message
(
STATUS
"| version =
${
_SB_CHECKUP_QT4_VERSION
}
"
)
SB_CHECKUP_SPLIT_VERSION
(
Qt4
)
endif
()
# TinyXML
SB_
BASIC_LIBRARY_CHECKUP
(
TinyXML
)
SB_
CHECKUP_FIND_PACKAGE
(
TinyXML
)
message
(
STATUS
"|------------------------------------------------"
)
# restore real install prefix
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment