Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
02f80536
Commit
02f80536
authored
Nov 03, 2014
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using the environment variable to load the plugin name.
parent
83c37875
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
26 deletions
+85
-26
configs/qt/openmp.prf
configs/qt/openmp.prf
+12
-0
setpath.sh
setpath.sh
+1
-0
sources/core/SConscript
sources/core/SConscript
+1
-1
sources/core/plugins_manager.cpp
sources/core/plugins_manager.cpp
+44
-5
sources/python/SConscript
sources/python/SConscript
+10
-5
sources/python/alta.cpp
sources/python/alta.cpp
+1
-1
sources/softs/data2data/main.cpp
sources/softs/data2data/main.cpp
+16
-14
No files found.
configs/qt/openmp.prf
View file @
02f80536
...
...
@@ -11,3 +11,15 @@ unix:!macx {
QMAKE_CXXFLAGS += -fopenmp
LIBS += -lgomp
}
macx {
exists(/opt/local/bin/gcc-mp-4.9) {
CONFIG += openmp
QMAKE_CXX = /opt/local/bin/gcc-mp-4.9
QMAKE_CXXFLAGS += -fopenmp
LIBS += -L/opt/local/lib/libgcc
QMAKE_LFLAGS += -fopenmp
} else {
warning("No OpenMP compliant compiler found")
}
}
setpath.sh
View file @
02f80536
...
...
@@ -17,6 +17,7 @@ fi
path
=
${
sources
}
/sources/build
export
ALTA
=
$sources
export
ALTA_LIB
=
$path
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:
$path
export
PATH
=
$PATH
:
$path
export
PYTHONPATH
=
$PYTHONPATH
:
$path
sources/core/SConscript
View file @
02f80536
...
...
@@ -13,7 +13,7 @@ sources = ['common.cpp',
'vertical_segment.cpp'
]
# Special linking flags, defined in the OS dependant configuration file
env
.
AppendUnique
(
env
[
'CORE_LIB'
])
env
.
AppendUnique
(
LIBS
=
env
[
'CORE_LIB'
])
## Known compilation issue. If the core is not compiled with -fvisibility-hidden
## on OSX, the shared libraries and the softwares cannot share vtables. This
...
...
sources/core/plugins_manager.cpp
View file @
02f80536
...
...
@@ -8,6 +8,7 @@
#include <dlfcn.h>
#endif
#include <stdio.h>
#include <list>
//! Add dynamic library extension (.so or .dll) to a dynamic object as well as
//! prepending 'lib' depending on the plateform.
...
...
@@ -41,12 +42,48 @@ std::string library_name(const std::string name)
return
filename
;
}
void
get_library_dirs
(
std
::
list
<
std
::
string
>&
dirs
)
{
dirs
.
push_back
(
""
);
#ifndef _WIN32
std
::
string
obj_str
;
const
char
*
env_str
=
getenv
(
"ALTA_LIB"
)
;
if
(
env_str
==
NULL
)
{
obj_str
=
""
;
}
else
{
obj_str
=
std
::
string
(
env_str
)
+
":"
;
}
while
(
true
)
{
int
lb
=
obj_str
.
find_first_not_of
(
":"
,
0
)
;
int
le
=
obj_str
.
find_first_of
(
":"
,
lb
)
;
if
(
lb
<
le
)
{
dirs
.
push_back
(
obj_str
.
substr
(
lb
,
le
-
lb
))
;
obj_str
=
obj_str
.
substr
(
le
+
1
,
obj_str
.
size
())
;
}
else
{
break
;
}
}
#endif
}
//! \brief Open a dynamic library file (.so or .dll) and extract the associated
//! provide function. The template argument is used to cast the library to a
//! specific type.
template
<
typename
T
>
T
open_library
(
const
std
::
string
&
filename
,
const
char
*
function
)
{
std
::
string
libname
=
library_name
(
filename
);
std
::
list
<
std
::
string
>
basename
;
get_library_dirs
(
basename
);
std
::
list
<
std
::
string
>::
iterator
iter
;
for
(
iter
=
basename
.
begin
();
iter
!=
basename
.
end
();
++
iter
)
{
std
::
string
libname
=
*
iter
;
libname
.
append
(
library_name
(
filename
));
#ifdef _WIN32
HINSTANCE
handle
=
LoadLibraryA
(
libname
.
c_str
());
...
...
@@ -57,7 +94,7 @@ template<typename T> T open_library(const std::string& filename, const char* fun
if
(
res
==
NULL
)
{
std
::
cerr
<<
"<<ERROR>> unable to load the symbol
\"
"
<<
function
<<
"
\"
from "
<<
filename
<<
std
::
endl
;
return
NULL
;
continue
;
}
#ifdef DEBUG_CORE
std
::
cout
<<
"<<DEBUG>> will provide a "
<<
function
<<
" for library
\"
"
<<
filename
<<
"
\"
"
<<
std
::
endl
;
...
...
@@ -68,7 +105,7 @@ template<typename T> T open_library(const std::string& filename, const char* fun
{
std
::
cerr
<<
"<<ERROR>> unable to load the dynamic library file
\"
"
<<
libname
<<
"
\"
"
<<
std
::
endl
;
std
::
cerr
<<
" cause:
\"
"
<<
GetLastError
()
<<
"
\"
"
<<
std
::
endl
;
return
NULL
;
continue
;
}
#else
void
*
handle
=
dlopen
(
libname
.
c_str
(),
RTLD_GLOBAL
|
RTLD_LAZY
);
...
...
@@ -81,7 +118,7 @@ template<typename T> T open_library(const std::string& filename, const char* fun
if
(
dlerror
()
!=
NULL
)
{
std
::
cerr
<<
"<<ERROR>> unable to load the symbol
\"
"
<<
function
<<
"
\"
from "
<<
libname
<<
std
::
endl
;
return
NULL
;
continue
;
}
#ifdef DEBUG_CORE
std
::
cout
<<
"<<DEBUG>> will provide a "
<<
function
<<
" for library
\"
"
<<
libname
<<
"
\"
"
<<
std
::
endl
;
...
...
@@ -92,9 +129,11 @@ template<typename T> T open_library(const std::string& filename, const char* fun
{
std
::
cerr
<<
"<<ERROR>> unable to load the dynamic library file
\"
"
<<
libname
<<
"
\"
"
<<
std
::
endl
;
std
::
cerr
<<
" cause:
\"
"
<<
dlerror
()
<<
"
\"
"
<<
std
::
endl
;
return
NULL
;
continue
;
}
#endif
}
return
NULL
;
}
//! \brief load a function from the ALTA input file.
...
...
sources/python/SConscript
View file @
02f80536
env
=
Environment
()
conf
=
Configure
(
env
)
env
.
Append
(
CPPPATH
=
[
'../../external/build/include'
])
env
.
Append
(
CPPPATH
=
[
'../'
,
'/usr/include/python2.7'
])
...
...
@@ -10,19 +9,25 @@ env.Append(LIBPATH=['../build'])
env
.
Append
(
LIBPATH
=
[
'/usr/lib/x86_64-gnu-linux'
])
env
.
Append
(
LIBPATH
=
[
'/opt/local/lib'
])
conf
=
Configure
(
env
)
boost_python_lib
=
[
'boost_python-mt'
,
'python2.7'
]
build_lib
=
False
if
conf
.
CheckLibWithHeader
(
'boost_python-py27'
,
'boost/python.hpp'
,
'c++'
):
if
conf
.
CheckLibWithHeader
(
boost_python_lib
,
'boost/python.hpp'
,
'c++'
):
env
.
Append
(
LIBS
=
[
'python2.7'
,
'boost_python-py27'
,
'core'
])
env
.
Append
(
LIBS
=
[
'python2.7'
,
boost_python_lib
,
'core'
])
#env.Append(LIBS=['python2.7', 'boost_python-mt', 'core'])
env
[
'SHLIBPREFIX'
]
=
''
build_lib
=
True
else
:
print
"<<ERROR>> Unable to build the Python interface, please install boost-python."
#end
env
=
conf
.
Finish
()
if
build_lib
:
env
.
SharedLibrary
(
'alta'
,
[
'alta.cpp'
])
env
.
SharedLibrary
(
'alta
.so
'
,
[
'alta.cpp'
])
#end
sources/python/alta.cpp
View file @
02f80536
...
...
@@ -122,7 +122,7 @@ BOOST_PYTHON_MODULE(alta)
// Data interface
bp
::
class_
<
Data
,
ptr
<
Data
>
,
boost
::
noncopyable
>
(
"data"
)
// .def("load", bp::pure_virtual(&data::load))
// .def("load", bp::pure_virtual(&data::load))
;
.
def
(
"size"
,
bp
::
pure_virtual
(
&
data
::
size
));
bp
::
def
(
"get_data"
,
plugins_manager
::
get_data
);
bp
::
def
(
"load_data"
,
load_data
);
...
...
sources/softs/data2data/main.cpp
View file @
02f80536
...
...
@@ -124,21 +124,24 @@ int main(int argc, char** argv)
if
(
dynamic_pointer_cast
<
vertical_segment
>
(
d_out
)
||
args
.
is_defined
(
"splat"
))
{
params
::
input
param
=
params
::
parse_input
(
args
[
"param"
]);
if
(
param
==
params
::
UNKNOWN_INPUT
&&
d_in
->
input_parametrization
()
!=
params
::
UNKNOWN_INPUT
)
if
(
dynamic_pointer_cast
<
vertical_segment
>
(
d_out
))
{
std
::
cout
<<
"<<DEBUG>> using the input parametrization of the input file for the output file as well."
<<
std
::
endl
;
param
=
d_in
->
input_parametrization
();
}
else
if
(
param
==
params
::
UNKNOWN_INPUT
)
{
std
::
cerr
<<
"<<ERROR>> no parametrization defined for input and output files."
<<
std
::
endl
;
return
-
1
;
}
params
::
input
param
=
params
::
parse_input
(
args
[
"param"
]);
if
(
param
==
params
::
UNKNOWN_INPUT
&&
d_in
->
input_parametrization
()
!=
params
::
UNKNOWN_INPUT
)
{
std
::
cout
<<
"<<DEBUG>> using the input parametrization of the input file for the output file as well."
<<
std
::
endl
;
param
=
d_in
->
input_parametrization
();
}
else
if
(
param
==
params
::
UNKNOWN_INPUT
)
{
std
::
cerr
<<
"<<ERROR>> no parametrization defined for input and output files."
<<
std
::
endl
;
return
-
1
;
}
d_out
->
setParametrization
(
param
);
d_out
->
setDimX
(
params
::
dimension
(
param
));
d_out
->
setDimY
(
d_in
->
dimY
());
d_out
->
setParametrization
(
param
);
d_out
->
setDimX
(
params
::
dimension
(
param
));
d_out
->
setDimY
(
d_in
->
dimY
());
}
std
::
cout
<<
"<<INFO>> output DIM = "
<<
d_out
->
dimX
()
<<
", "
<<
d_out
->
dimY
()
<<
std
::
endl
;
...
...
@@ -150,7 +153,6 @@ int main(int argc, char** argv)
params
::
convert
(
&
x
[
0
],
d_in
->
parametrization
(),
d_out
->
parametrization
(),
&
temp
[
0
]);
params
::
convert
(
&
x
[
d_in
->
dimX
()],
d_in
->
output_parametrization
(),
d_in
->
dimY
(),
d_out
->
output_parametrization
(),
d_out
->
dimY
(),
&
temp
[
d_out
->
dimX
()]);
d_out
->
set
(
temp
);
}
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment