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
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
6269133d
Commit
6269133d
authored
Jul 08, 2010
by
Sebastian Eichelbaum
Browse files
[CHANGE] - adopted CMake files to be portable
parent
efc9404e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
7 deletions
+35
-7
src/common/CMakeLists.txt
src/common/CMakeLists.txt
+6
-1
src/common/WSharedLib.cpp
src/common/WSharedLib.cpp
+11
-0
src/common/WSharedLib.h
src/common/WSharedLib.h
+14
-0
src/kernel/WModuleLoader.cpp
src/kernel/WModuleLoader.cpp
+4
-6
No files found.
src/common/CMakeLists.txt
View file @
6269133d
...
...
@@ -8,8 +8,13 @@ ADD_SUBDIRECTORY( constraints )
ADD_SUBDIRECTORY
(
math
)
ADD_LIBRARY
(
common
${
COMMON_SRC
}
${
COMMON_DATASTRUCTURES_SRC
}
${
COMMON_EXCEPTIONS_SRC
}
${
MATH_SRC
}
${
FIBERSIMILARITY_SRC
}
)
TARGET_LINK_LIBRARIES
(
common
${
Boost_LIBRARIES
}
"dl"
)
TARGET_LINK_LIBRARIES
(
common
${
Boost_LIBRARIES
}
${
CMAKE_DL_LIBS
}
)
# Set the prefix and suffix of dynamically loadable modules to match
# CMAKEs naming of them. The quotes are necessary so the shell doesn't mess
# with these defines.
add_definitions
(
'-DW_LIB_PREFIX=
"
${
CMAKE_SHARED_MODULE_PREFIX
}
"
'
)
add_definitions
(
'-DW_LIB_SUFFIX=
"
${
CMAKE_SHARED_MODULE_SUFFIX
}
"
'
)
# Unit tests
IF
(
OW_COMPILE_TESTS
)
...
...
src/common/WSharedLib.cpp
View file @
6269133d
...
...
@@ -263,3 +263,14 @@ void* WSharedLib::findVariable( const std::string& name ) const
{
return
m_data
->
findVariable
(
name
);
}
std
::
string
WSharedLib
::
getSystemPrefix
()
{
return
W_LIB_PREFIX
;
}
std
::
string
WSharedLib
::
getSystemSuffix
()
{
return
W_LIB_SUFFIX
;
}
src/common/WSharedLib.h
View file @
6269133d
...
...
@@ -110,6 +110,20 @@ public:
template
<
typename
PtrType
>
void
fetchVariable
(
const
std
::
string
&
name
,
PtrType
&
variable
)
const
;
/**
* Returns the prefix used for libraries on the system. On Unix this mostly is "lib".
*
* \return the prefix.
*/
static
std
::
string
getSystemPrefix
();
/**
* Returns the suffix for libraries used on the system. On Unix this mostly is "so", Windows uses "dll" and Mac something like "dylib".
*
* \return the suffix.
*/
static
std
::
string
getSystemSuffix
();
protected:
private:
...
...
src/kernel/WModuleLoader.cpp
View file @
6269133d
...
...
@@ -51,9 +51,7 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
i
!=
boost
::
filesystem
::
directory_iterator
();
++
i
)
{
std
::
string
suffix
=
wiotools
::
getSuffix
(
i
->
leaf
()
);
if
(
!
boost
::
filesystem
::
is_directory
(
*
i
)
&&
(
(
suffix
==
".so"
)
||
(
suffix
==
".dll"
)
||
(
suffix
==
".dylib"
)
)
)
// This prefix has been defined by our build system
if
(
!
boost
::
filesystem
::
is_directory
(
*
i
)
&&
(
suffix
==
WSharedLib
::
getSystemSuffix
()
)
)
{
try
{
...
...
@@ -70,14 +68,14 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
// could the prototype be created?
if
(
!
m
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"Load failed for module
\"
"
+
i
->
path
().
native_file_string
()
+
"
\"
. Could not create "
+
WLogger
::
getLogger
()
->
addLogMessage
(
"Load failed for module
\"
"
+
i
->
leaf
()
+
"
\"
. Could not create "
+
"prototype instance."
,
"Module Loader"
,
LL_ERROR
);
continue
;
}
else
{
// yes, add it to the list of prototypes
WLogger
::
getLogger
()
->
addLogMessage
(
"Loaded "
+
i
->
path
().
native_file_string
(),
"Module Loader"
,
LL_INFO
);
WLogger
::
getLogger
()
->
addLogMessage
(
"Loaded "
+
i
->
leaf
(),
"Module Loader"
,
LL_INFO
);
ticket
->
get
().
insert
(
m
);
m_libs
.
push_back
(
l
);
}
...
...
@@ -86,7 +84,7 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
}
catch
(
const
WException
&
e
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"Load failed for module
\"
"
+
i
->
path
().
native_file_string
()
+
"
\"
. "
+
e
.
what
()
+
". Ignoring."
,
WLogger
::
getLogger
()
->
addLogMessage
(
"Load failed for module
\"
"
+
i
->
leaf
()
+
"
\"
. "
+
e
.
what
()
+
". Ignoring."
,
"Module Loader"
,
LL_ERROR
);
}
}
...
...
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