|
1 | | -# Copyright (c) 2012-2013: G-CSC, Goethe University Frankfurt |
2 | | -# Author: Sebastian Reiter |
3 | | -# |
4 | | -# This file is part of UG4. |
5 | | -# |
6 | | -# UG4 is free software: you can redistribute it and/or modify it under the |
7 | | -# terms of the GNU Lesser General Public License version 3 (as published by the |
8 | | -# Free Software Foundation) with the following additional attribution |
9 | | -# requirements (according to LGPL/GPL v3 §7): |
10 | | -# |
11 | | -# (1) The following notice must be displayed in the Appropriate Legal Notices |
12 | | -# of covered and combined works: "Based on UG4 (www.ug4.org/license)". |
13 | | -# |
14 | | -# (2) The following notice must be displayed at a prominent place in the |
15 | | -# terminal output of covered works: "Based on UG4 (www.ug4.org/license)". |
16 | | -# |
17 | | -# (3) The following bibliography is recommended for citation and must be |
18 | | -# preserved in all covered files: |
19 | | -# "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively |
20 | | -# parallel geometric multigrid solver on hierarchically distributed grids. |
21 | | -# Computing and visualization in science 16, 4 (2013), 151-164" |
22 | | -# "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel |
23 | | -# flexible software system for simulating pde based models on high performance |
24 | | -# computers. Computing and visualization in science 16, 4 (2013), 165-179" |
25 | | -# |
26 | | -# This program is distributed in the hope that it will be useful, |
27 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | | -# GNU Lesser General Public License for more details. |
30 | | - |
31 | | -cmake_minimum_required(VERSION 2.8.12) |
32 | | - |
33 | | -################################################ |
34 | | -# ug4 - compile-info |
35 | | -################################################ |
36 | | - |
37 | | -project(P_UG4_COMPILE_INFO) |
38 | | - |
39 | | -# set global output paths for UG4 |
40 | | -# They are relative to the source dir for which cmake was executed. |
41 | | -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) |
42 | | -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) |
43 | | -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) |
44 | | - |
45 | | -include("${UG_ROOT_CMAKE_PATH}/ug_includes.cmake") |
46 | | - |
47 | | -# Name of the file that will contain the compile-info variables |
48 | | -set(infoFileName ${CMAKE_BINARY_DIR}/compile_info_vars.cpp) |
49 | | - |
50 | | -# we write this file to make sure that it exists... |
51 | | -# Note that on UNIX systems the file is updated with each build through |
52 | | -# the add_custom_build_target and add_custom_command calls below. |
53 | | -# on windows we currently don't support updated compile-infos. |
54 | | -# check out, whether this can be improved using special windows-scripting... |
55 | | - |
56 | | -#set(infoFileFound "infoFileFound-NOTFOUND") |
57 | | -#find_file(infoFileFound compile_info_vars.cpp PATHS ${CMAKE_BINARY_DIR}) |
58 | | - |
59 | | -#if(${infoFileFound} STREQUAL "infoFileFound-NOTFOUND") |
60 | | - file(WRITE ${infoFileName} |
61 | | - "namespace ug\n" |
62 | | - "{\n" |
63 | | - "const char *UG_SVN_REVISION=\"UNKNOWN\";\n" |
64 | | - "const char *UG_GIT_REVISION=\"UNKNOWN\";\n" |
65 | | - "const char *UG_BUILD_HOST=\"UNKNOWN\";\n" |
66 | | - "const char *UG_COMPILE_DATE=\"UNKNOWN\";\n" |
67 | | - "}\n") |
68 | | -#endif(${infoFileFound} STREQUAL "infoFileFound-NOTFOUND") |
69 | | - |
70 | | -if(UNIX AND buildCompileInfo) |
71 | | -# The custom target is always considered out of date and will be rebuilt |
72 | | -# every time make is executed. |
73 | | - add_custom_target(updateCompileInfo) |
74 | | -# The build of the custom target triggers this custom command, which updates |
75 | | -# the compile_info.cpp file. |
76 | | - add_custom_command(TARGET updateCompileInfo PRE_BUILD COMMAND bash ${UG_ROOT_PATH}/ugcore/scripts/shell/generate_compile_info ${UG_ROOT_PATH} ${infoFileName}) |
77 | | -endif(UNIX AND buildCompileInfo) |
78 | | - |
79 | | -# Export sources to the file which contains the info-access-methods. |
80 | | -# Note that this is not the auto-generated file which contains |
81 | | -# the actual variable definitions. |
82 | | -EXPORTSOURCES(ugbase/compile_info compile_info.cpp) |
83 | | - |
84 | | -if(buildEmbeddedPlugins OR NOT buildCompileInfo) |
85 | | - EXPORTSOURCES("" ${infoFileName}) |
86 | | -# Note that a dependency to updateCompileInfo is created in the main CMakeLists.txt |
87 | | -# file for this case. |
88 | | - |
89 | | -else(buildEmbeddedPlugins OR NOT buildCompileInfo) |
90 | | - if(buildDynamicLib) |
91 | | - add_library(CompileInfo SHARED ${infoFileName}) |
92 | | - set(compileInfoLibName CompileInfo) |
93 | | - install(TARGETS ${compileInfoLibName} |
94 | | - LIBRARY |
95 | | - DESTINATION lib) |
96 | | - else(buildDynamicLib) |
97 | | - # no dynamic lib |
98 | | - add_library(CompileInfo_s STATIC ${infoFileName}) |
99 | | - set(compileInfoLibName CompileInfo_s) |
100 | | - endif(buildDynamicLib) |
101 | | - |
102 | | - if(UNIX AND buildCompileInfo) |
103 | | - # The dependency makes sure, that the compile_info file is written before |
104 | | - # the CompileInfo lib is being rebuilt. |
105 | | - add_dependencies(${compileInfoLibName} updateCompileInfo) |
106 | | - endif(UNIX AND buildCompileInfo) |
107 | | -endif(buildEmbeddedPlugins OR NOT buildCompileInfo) |
| 1 | +# Copyright (c) 2012-2013: G-CSC, Goethe University Frankfurt |
| 2 | +# Author: Sebastian Reiter |
| 3 | +# |
| 4 | +# This file is part of UG4. |
| 5 | +# |
| 6 | +# UG4 is free software: you can redistribute it and/or modify it under the |
| 7 | +# terms of the GNU Lesser General Public License version 3 (as published by the |
| 8 | +# Free Software Foundation) with the following additional attribution |
| 9 | +# requirements (according to LGPL/GPL v3 §7): |
| 10 | +# |
| 11 | +# (1) The following notice must be displayed in the Appropriate Legal Notices |
| 12 | +# of covered and combined works: "Based on UG4 (www.ug4.org/license)". |
| 13 | +# |
| 14 | +# (2) The following notice must be displayed at a prominent place in the |
| 15 | +# terminal output of covered works: "Based on UG4 (www.ug4.org/license)". |
| 16 | +# |
| 17 | +# (3) The following bibliography is recommended for citation and must be |
| 18 | +# preserved in all covered files: |
| 19 | +# "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively |
| 20 | +# parallel geometric multigrid solver on hierarchically distributed grids. |
| 21 | +# Computing and visualization in science 16, 4 (2013), 151-164" |
| 22 | +# "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel |
| 23 | +# flexible software system for simulating pde based models on high performance |
| 24 | +# computers. Computing and visualization in science 16, 4 (2013), 165-179" |
| 25 | +# |
| 26 | +# This program is distributed in the hope that it will be useful, |
| 27 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 29 | +# GNU Lesser General Public License for more details. |
| 30 | + |
| 31 | +cmake_minimum_required(VERSION 2.8.12) |
| 32 | + |
| 33 | +################################################ |
| 34 | +# ug4 - compile-info |
| 35 | +################################################ |
| 36 | + |
| 37 | +project(P_UG4_COMPILE_INFO) |
| 38 | + |
| 39 | +# set global output paths for UG4 |
| 40 | +# They are relative to the source dir for which cmake was executed. |
| 41 | +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) |
| 42 | +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) |
| 43 | +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) |
| 44 | + |
| 45 | +include("${UG_ROOT_CMAKE_PATH}/ug_includes.cmake") |
| 46 | + |
| 47 | +# Name of the file that will contain the compile-info variables |
| 48 | +set(infoFileName ${CMAKE_BINARY_DIR}/compile_info_vars.cpp) |
| 49 | + |
| 50 | +# we write this file to make sure that it exists... |
| 51 | +# Note that on UNIX systems the file is updated with each build through |
| 52 | +# the add_custom_build_target and add_custom_command calls below. |
| 53 | +# on windows we currently don't support updated compile-infos. |
| 54 | +# check out, whether this can be improved using special windows-scripting... |
| 55 | + |
| 56 | +#set(infoFileFound "infoFileFound-NOTFOUND") |
| 57 | +#find_file(infoFileFound compile_info_vars.cpp PATHS ${CMAKE_BINARY_DIR}) |
| 58 | + |
| 59 | +#if(${infoFileFound} STREQUAL "infoFileFound-NOTFOUND") |
| 60 | + file(WRITE ${infoFileName} |
| 61 | + "namespace ug\n" |
| 62 | + "{\n" |
| 63 | + "const char *UG_SVN_REVISION=\"UNKNOWN\";\n" |
| 64 | + "const char *UG_GIT_REVISION=\"UNKNOWN\";\n" |
| 65 | + "const char *UG_BUILD_HOST=\"UNKNOWN\";\n" |
| 66 | + "const char *UG_COMPILE_DATE=\"UNKNOWN\";\n" |
| 67 | + "}\n") |
| 68 | +#endif(${infoFileFound} STREQUAL "infoFileFound-NOTFOUND") |
| 69 | + |
| 70 | +if(UNIX AND buildCompileInfo) |
| 71 | +# The custom target is always considered out of date and will be rebuilt |
| 72 | +# every time make is executed. |
| 73 | + add_custom_target(updateCompileInfo) |
| 74 | +# The build of the custom target triggers this custom command, which updates |
| 75 | +# the compile_info.cpp file. |
| 76 | + add_custom_command(TARGET updateCompileInfo PRE_BUILD COMMAND bash ${UG_ROOT_PATH}/ugcore/scripts/shell/generate_compile_info ${UG_ROOT_PATH} ${infoFileName}) |
| 77 | +endif(UNIX AND buildCompileInfo) |
| 78 | + |
| 79 | +# Export sources to the file which contains the info-access-methods. |
| 80 | +# Note that this is not the auto-generated file which contains |
| 81 | +# the actual variable definitions. |
| 82 | +EXPORTSOURCES(ugbase/compile_info compile_info.cpp) |
| 83 | + |
| 84 | +if(buildEmbeddedPlugins OR NOT buildCompileInfo) |
| 85 | + EXPORTSOURCES("" ${infoFileName}) |
| 86 | +# Note that a dependency to updateCompileInfo is created in the main CMakeLists.txt |
| 87 | +# file for this case. |
| 88 | + |
| 89 | +else(buildEmbeddedPlugins OR NOT buildCompileInfo) |
| 90 | + if(buildDynamicLib) |
| 91 | + # dynamic lib |
| 92 | + add_library(CompileInfo SHARED ${infoFileName}) |
| 93 | + set(compileInfoLibName CompileInfo) |
| 94 | + install(TARGETS ${compileInfoLibName} |
| 95 | + LIBRARY DESTINATION lib |
| 96 | + COMPONENT libraries) |
| 97 | + else(buildDynamicLib) |
| 98 | + # static lib |
| 99 | + add_library(CompileInfo_s STATIC ${infoFileName}) |
| 100 | + set(compileInfoLibName CompileInfo_s) |
| 101 | + endif(buildDynamicLib) |
| 102 | + |
| 103 | + if(UNIX AND buildCompileInfo) |
| 104 | + # The dependency makes sure, that the compile_info file is written before |
| 105 | + # the CompileInfo lib is being rebuilt. |
| 106 | + add_dependencies(${compileInfoLibName} updateCompileInfo) |
| 107 | + endif(UNIX AND buildCompileInfo) |
| 108 | +endif(buildEmbeddedPlugins OR NOT buildCompileInfo) |
0 commit comments