Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98704369
LibMultiScaleMacros.cmake
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jan 15, 18:53
Size
6 KB
Mime Type
text/x-c
Expires
Fri, Jan 17, 18:53 (1 d, 20 h)
Engine
blob
Format
Raw Data
Handle
23623395
Attached To
rLIBMULTISCALE LibMultiScale
LibMultiScaleMacros.cmake
View Options
#===============================================================================
# @file LibMultiScaleMacros.cmake
#
# @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
# @author Nicolas Richart <nicolas.richart@epfl.ch>
#
# @date Sun Jan 06 01:16:34 2013
#
# @brief General Macros for CMake build system of LM
#
# @section LICENSE
#
# Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# LibMultiScale is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
#
#===============================================================================
#===============================================================================
function
(
compare_lists
list1
list2
result
)
endfunction
()
#===============================================================================
include
(
CMakeDebugMessages
)
cmake_register_debug_message_module
(
ListGenerator
)
function
(
generate_list
type
file
)
string
(
TOUPPER
${
type
}
_type
)
package_get_all_activated_packages
(
activated_list
)
foreach
(
_pkg
${
activated_list
}
)
_package_get_real_name
(
${
_pkg
}
pkg
)
# message(AAAA " , " ${_type} " , " ${_pkg} " , " ${pkg} " , " "${_type_list}")
get_boost_list_from_package
(
${
_type
}
${
pkg
}
_type_list
)
foreach
(
_line
${
_type_list
}
)
list
(
APPEND
_list
${
_line
}
)
endforeach
()
endforeach
()
if
(
NOT
"${_list}"
STREQUAL
"${LIBMULTISCALE_${_type}_LIST}"
OR
(
NOT
EXISTS
${
file
}
))
cmake_debug_message
(
ListGenerator
"Generating LIBMULTISCALE_${_type}_LIST in ${file}"
)
cmake_debug_message
(
ListGenerator
" -- new list: ${_list}"
)
cmake_debug_message
(
ListGenerator
" -- old list: ${LIBMULTISCALE_${_type}_LIST}"
)
file
(
WRITE
"${file}"
"#define LIST_${_type} \\"
)
set
(
LIBMULTISCALE_
${
_type
}
_LIST
${
_list
}
CACHE
INTERNAL
""
)
foreach
(
_line
${
LIBMULTISCALE_${_type
}
_LIST}
)
file
(
APPEND
"${file}"
"
${_line} \\"
)
endforeach
()
file
(
APPEND
"${file}"
"
/* File Generated by CMake */"
)
endif
()
endfunction
()
#===============================================================================
cmake_register_debug_message_module
(
HeaderListGenerator
)
function
(
generate_module_header_file
module
file
)
string
(
TOUPPER
${
module
}
_module
)
cmake_debug_message
(
HeaderListGenerator
"${module} - Package ${LIBMULTISCALE_PACKAGE_LIST}"
)
package_get_all_activated_packages
(
activated_list
)
foreach
(
_pkg
${
activated_list
}
)
_package_get_real_name
(
${
_pkg
}
pkg
)
cmake_debug_message
(
HeaderListGenerator
"${module} - Package ${_pkg}"
)
get_module_headers_from_package
(
${
_module
}
${
pkg
}
_public_headers
)
foreach
(
_line
${
_public_headers
}
)
get_filename_component
(
_hdrs
"${_line}"
NAME
)
cmake_debug_message
(
HeaderListGenerator
"${module} - ${_hdrs}"
)
list
(
APPEND
_list
${
_hdrs
}
)
endforeach
()
endforeach
()
if
(
NOT
"${_list}"
STREQUAL
"${LIBMULTISCALE_${_module}_HDR_LIST}"
OR
(
NOT
EXISTS
${
file
}
))
# message(HeaderListGenerator "Generating LIBMULTISCALE_${_module}_HDR_LIST in ${file}")
# message(HeaderListGenerator " -- new list: ${_list}")
# message(HeaderListGenerator " -- old list: ${LIBMULTISCALE_${_module}_HDR_LIST}")
set
(
LIBMULTISCALE_
${
_module
}
_HDR_LIST
${
_list
}
CACHE
INTERNAL
""
)
get_filename_component
(
_file_we
"${file}"
NAME_WE
)
string
(
TOUPPER
${
_file_we
}
_file_we
)
file
(
WRITE
"${file}"
"#ifndef __LIBMULTISCALE_${_file_we}_HH__
#define __LIBMULTISCALE_${_file_we}_HH__
/* -------------------------------------------------------------------------- */"
)
foreach
(
_pkg
${
activated_list
}
)
_package_get_real_name
(
${
_pkg
}
pkg
)
get_module_headers_from_package
(
${
_module
}
${
pkg
}
_public_headers
)
if
(
_public_headers
)
file
(
APPEND
"${file}"
"
/* ${_pkg} */"
)
foreach
(
_line
${
_public_headers
}
)
get_filename_component
(
_hdrs
"${_line}"
NAME
)
file
(
APPEND
"${file}"
"
#include \"
${
_hdrs
}
\"")
endforeach(
)
endif
()
endforeach
()
file
(
APPEND
"${file}"
"
/* -------------------------------------------------------------------------- */
#endif // __LIBMULTISCALE_${_file_we}_HH__"
)
endif
()
endfunction
()
#===============================================================================
function
(
get_module_headers_from_package
module
package
HEADERS
)
string
(
TOUPPER
${
module
}
_module
)
package_get_name
(
${
package
}
_package
)
# message("fetch " ${_module}_HEADERS_${_package} " " ${${_module}_HEADERS_${_package}})
set
(
${
HEADERS
}
${
${_module
}
_HEADERS_
${
_package
}
}
PARENT_SCOPE
)
endfunction
()
#===============================================================================
function
(
set_module_headers_from_package
module
package
)
string
(
TOUPPER
${
module
}
_module
)
package_get_name
(
${
package
}
_package
)
# message(setting " " ${_module}_HEADERS_${_package} " to " ${ARGN})
set
(
${
_module
}
_HEADERS_
${
_package
}
${
_headers
}
${
ARGN
}
CACHE
INTERNAL
""
FORCE
)
endfunction
()
#===============================================================================
function
(
declare_boost_list_from_package
type
package
)
string
(
TOUPPER
${
type
}
_type
)
package_get_name
(
${
package
}
_package
)
set
(
_list
${
ARGN
}
)
# message(setting " " ${_type}_BOOST_LIST_${_package} " to " ${_list})
set
(
${
_type
}
_BOOST_LIST_
${
_package
}
${
_list
}
CACHE
INTERNAL
""
FORCE
)
endfunction
()
#===============================================================================
function
(
get_boost_list_from_package
type
package
LIST
)
string
(
TOUPPER
${
type
}
_type
)
package_get_name
(
${
package
}
_package
)
# message("fetch " ${_type}_BOOST_LIST_${_package})
set
(
${
LIST
}
${
${_type
}
_BOOST_LIST_
${
_package
}
}
PARENT_SCOPE
)
endfunction
()
Event Timeline
Log In to Comment