forked from ome/bioformats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
152 lines (133 loc) · 5.46 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# #%L
# Bio-Formats C++ libraries (cmake build infrastructure)
# %%
# Copyright © 2006 - 2016 Open Microscopy Environment:
# - Massachusetts Institute of Technology
# - National Institutes of Health
# - University of Dundee
# - Board of Regents of the University of Wisconsin-Madison
# - Glencoe Software, Inc.
# %%
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of any organization.
# #L%
cmake_minimum_required(VERSION 3.2.0)
# Default policy is from 3.2.0
cmake_policy(VERSION 3.2.0)
# For MSVC
enable_language(CXX)
# For feature tests with CMake 2.8.x
enable_language(C)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cpp/cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cpp/cmake/BioFormatsCommon.cmake")
project(ome-xml)
message(STATUS "Configuring OME-XML C++")
include(cpp/cmake/Version.cmake)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-tree builds are not supported; please run cmake from a separate build directory.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
enable_language(CXX)
set(BUILD_SHARED_LIBS_DEFAULT ON)
if(MSVC)
set(BUILD_SHARED_LIBS_DEFAULT OFF)
endif()
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_DEFAULT} CACHE BOOL "Use shared libraries")
include(GNUInstallDirs)
include(CompilerChecks)
include(PlatformChecks)
include(BoostChecks)
include(RegexChecks)
include(ThreadChecks)
include(XercesChecks)
include(XalanChecks)
include(XsdFu)
include(GTest)
include(Doxygen)
include(HeaderTest)
# This is a hack to generate the model sources without having to have
# ome-common available. It will be removed or moved once the model
# has been split out.
option(model-source-only "Generate model source only" OFF)
if(NOT model-source-only)
find_package(OME 5.2.0 REQUIRED Compat Common)
else()
add_library(OME::Compat INTERFACE IMPORTED)
add_library(OME::Common INTERFACE IMPORTED)
endif()
if(MSVC)
# Debug library suffix.
set(CMAKE_DEBUG_POSTFIX "d")
# Require dynamic linking and disable autolinking.
add_definitions(-DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB)
# To prevent a lot of spam warnings about standard POSIX functions
# and unsafe use of the standard library.
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
endif()
if(NOT DEFINED OME_XML_INSTALL_PKGDATADIR)
set(OME_XML_INSTALL_PKGDATADIR "${CMAKE_INSTALL_DATADIR}/ome/xml"
CACHE PATH "OME-XML-specific datadir")
endif()
if (NOT DEFINED OME_XML_INSTALL_SCHEMADIR)
set(OME_XML_INSTALL_SCHEMADIR "${CMAKE_INSTALL_DATADIR}/xml/ome"
CACHE PATH "OME-XML schema directory")
endif()
if (NOT DEFINED OME_XML_INSTALL_TRANSFORMDIR)
set(OME_XML_INSTALL_TRANSFORMDIR "${CMAKE_INSTALL_DATADIR}/xsl/ome"
CACHE PATH "OME-XML transform directory")
endif()
if (NOT DEFINED OME_XML_INSTALL_SAMPLEDIR)
set(OME_XML_INSTALL_SAMPLEDIR "${OME_XML_INSTALL_PKGDATADIR}/samples"
CACHE PATH "OME XML sample directory")
endif()
foreach(dir
DATADIR
SCHEMADIR
TRANSFORMDIR
SAMPLEDIR
)
mark_as_advanced(OME_XML_INSTALL_${dir})
endforeach()
add_subdirectory(docs/doxygen)
add_subdirectory(cpp)
set(LIBRARY_PREFIX OME)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/cpp/bin")
configure_file(${PROJECT_SOURCE_DIR}/cpp/cmake/TemplateShellConfig.cmake.in
${PROJECT_BINARY_DIR}/config @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/cpp/cmake/TemplateInternalShellWrapper.cmake.in
${PROJECT_BINARY_DIR}/cpp/cmake/bf-test @ONLY)
file(COPY ${PROJECT_BINARY_DIR}/cpp/cmake/bf-test
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
if(WIN32)
configure_file(${PROJECT_SOURCE_DIR}/cpp/cmake/TemplateCmdConfig.cmake.in
${PROJECT_BINARY_DIR}/config.bat @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/cpp/cmake/TemplateInternalCmdWrapper.cmake.in
${PROJECT_BINARY_DIR}/bf-test.bat @ONLY)
endif()
return()
message("NOTE: The Bio-Formats ${OME_VERSION_SHORT} C++ library is new in version 5.1")
message("NOTE: API stability will not be guaranteed until version 5.2")