comparison Plugins/Samples/WebSkeleton/Framework/Framework.cmake @ 1181:17302d83abfd

Sample plugin framework to serve static resources
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Sep 2014 14:13:20 +0200
parents
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1180:dea1c786e1c6 1181:17302d83abfd
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
3 # Belgium
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # In addition, as a special exception, the copyright holders of this
11 # program give permission to link the code of its release with the
12 # OpenSSL project's "OpenSSL" library (or with modified versions of it
13 # that use the same license as the "OpenSSL" library), and distribute
14 # the linked executables. You must obey the GNU General Public License
15 # in all respects for all of the code used other than "OpenSSL". If you
16 # modify file(s) with this exception, you may extend this exception to
17 # your version of the file(s), but you are not obligated to do so. If
18 # you do not wish to do so, delete this exception statement from your
19 # version. If you delete this exception statement from all source files
20 # in the program, then also delete it here.
21 #
22 # This program is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 # General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29
30
31 if (${CMAKE_COMPILER_IS_GNUCXX})
32 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wno-unused-function")
33 endif()
34
35 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
36 # Linking with "pthread" is necessary, otherwise the software might crash
37 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
38 link_libraries(pthread dl)
39 endif()
40
41 if (STANDALONE_BUILD)
42 add_definitions(-DORTHANC_PLUGIN_STANDALONE=1)
43
44 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
45 set(AUTOGENERATED_SOURCES "${AUTOGENERATED_DIR}/EmbeddedResources.cpp")
46
47 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
48 include_directories(${AUTOGENERATED_DIR})
49
50 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
51 add_custom_command(
52 OUTPUT
53 "${AUTOGENERATED_DIR}/EmbeddedResources.h"
54 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
55 COMMAND
56 python
57 "${CMAKE_CURRENT_SOURCE_DIR}/Framework/EmbedResources.py"
58 "${AUTOGENERATED_DIR}/EmbeddedResources"
59 STATIC_RESOURCES
60 ${RESOURCES_ROOT}
61 DEPENDS
62 "${CMAKE_CURRENT_SOURCE_DIR}/Framework/EmbedResources.py"
63 ${STATIC_RESOURCES}
64 )
65
66 else()
67 add_definitions(
68 -DORTHANC_PLUGIN_STANDALONE=0
69 -DORTHANC_PLUGIN_RESOURCES_ROOT="${RESOURCES_ROOT}"
70 )
71 endif()
72
73
74 list(APPEND AUTOGENERATED_SOURCES
75 "${CMAKE_CURRENT_SOURCE_DIR}/Framework/Plugin.cpp"
76 )