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
David Youssefi
otb
Commits
07c6de6f
Commit
07c6de6f
authored
15 years ago
by
Manuel Grizonnet
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add parameter to OTBconfigfile
parent
0eb68b5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMake/GenerateConfigProperties.cpp
+34
-68
34 additions, 68 deletions
CMake/GenerateConfigProperties.cpp
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
with
35 additions
and
69 deletions
CMake/GenerateConfigProperties.cpp
+
34
−
68
View file @
07c6de6f
...
...
@@ -22,6 +22,7 @@ PURPOSE. See the above copyright notices for more information.
#include
<fstream>
#include
<string>
#include
<iostream>
#include
<vector>
/**
* @brief main application for generating the otb.conf file.
...
...
@@ -32,87 +33,52 @@ PURPOSE. See the above copyright notices for more information.
*/
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
3
)
{
exit
(
1
);
}
const
unsigned
int
nbParameters
=
3
;
// if (argc != 5)
// {
// exit(1);
// }
std
::
ofstream
os
(
argv
[
1
]);
std
::
ofstream
os
(
argv
[
1
]);
if
(
!
os
)
{
exit
(
1
);
}
/*
// Get the version. This is now passed in from the make file.
std::string versionString = "Version ";
versionString += argv[2];
std::string versionNumber = argv[2];
std::string majorVersion;
std::string minorVersion = "0";
std::string releaseVersion = "0";
std::string::size_type pos1 = std::string::npos;
std::string::size_type pos2 = std::string::npos;
pos1 = versionNumber.find(".", 0);
if(pos1 != std::string::npos)
std
::
vector
<
std
::
string
>
paramVector
;
/* write available parameters to a vector */
for
(
unsigned
int
i
=
0
;
i
<
nbParameters
;
++
i
)
{
majorVersion = std::string(versionNumber.begin(),
versionNumber.begin()+pos1);
pos2 = versionNumber.find(".", pos1+1);
if(pos2 != std::string::npos)
{
minorVersion = std::string(versionNumber.begin()+pos1+1,
versionNumber.begin()+pos2);
releaseVersion = std::string(versionNumber.begin()+pos2+1,
versionNumber.end()
);
}
if
(
argc
>=
(
i
+
3
)
)
{
/** Get the default parameter (from cmake)*/
paramVector
.
push_back
(
argv
[
i
+
2
]
);
}
else
{
/** Set param="" if the parameter is not available*/
paramVector
.
push_back
(
""
);
}
}
else
{
majorVersion = versionNumber;
}
// Get the build date in the format of (yyyymmdd).
char s[11];
s[10] = '\0';
time_t t;
time(&t);
tm* lt = localtime(&t);
strftime(s, 11, "(%Y%m%d)", lt);
std::string date = s;
// Write the header file.
os << "// Auto generated by version-config - DO NOT EDIT\n"
<< "#ifndef ossimVersion_HEADER\n"
<< "#define ossimVersion_HEADER\n"
<< "\n"
<< "#include <ossim/ossimConfig.h>\n"
<< "\n"
<< "#ifndef OSSIM_VERSION\n"
<< "# define OSSIM_VERSION " << "\"" << versionString << "\"\n"
<< "# define OSSIM_VERSION_NUMBER " << "\"" << versionNumber << "\"\n"
<< "# define OSSIM_MAJOR_VERSION_NUMBER " << majorVersion << "\n"
<< "# define OSSIM_MINOR_VERSION_NUMBER " << minorVersion << "\n"
<< "# define OSSIM_RELEASE_NUMBER " << releaseVersion << "\n"
<< "#endif\n"
<< "\n"
<< "// date format = (yyyymmdd)\n"
<< "#ifndef OSSIM_BUILD_DATE\n"
<< "# define OSSIM_BUILD_DATE " << "\"" << date << "\"\n"
<< "#endif\n"
<< "\n"
<< "#endif /* End of #ifndef ossimVersion_HEADER "
<< std::endl;
*/
std
::
string
language
(
argv
[
2
]);
// std::string language(argv[2]);
// std::string activateStreaming(argv[3]);
// std::string sizeStreaming(argv[4]);
os
<<
"#Auto generated by config-properties
\n
"
<<
"#Language
\n
"
<<
"OTB_LANG="
<<
language
<<
paramVector
[
0
]
<<
"
\n
"
<<
"OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING="
<<
paramVector
[
1
]
<<
"
\n
"
<<
"OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING="
<<
paramVector
[
2
]
<<
"
\n
"
<<
"#
e
nd of config file properties generation"
<<
"#
E
nd of config file properties generation"
<<
std
::
endl
;
os
.
close
();
std
::
cout
<<
"wrote file: "
<<
argv
[
1
]
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
1
−
1
View file @
07c6de6f
...
...
@@ -1136,5 +1136,5 @@ ADD_CUSTOM_COMMAND(
TARGET GenerateConfigProperties
POST_BUILD
COMMAND GenerateConfigProperties
ARGS
"
${
otbconfigfile_DEFAULT
}
"
"
${
OTB_LANG
}
"
ARGS
"
${
otbconfigfile_DEFAULT
}
"
"
${
OTB_LANG
}
"
"
${
OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING
}
"
"
${
OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING
}
"
COMMENT
"Generating
${
otbconfigfile_DEFAULT
}
"
)
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