mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
manually merged PR #270
Former-commit-id: 9d4504942f229a7462d59b292e478ea2289ecfed
This commit is contained in:
@@ -253,6 +253,10 @@ public class App {
|
||||
final String suppressionFile = cli.getSuppressionFile();
|
||||
final boolean jarDisabled = cli.isJarDisabled();
|
||||
final boolean archiveDisabled = cli.isArchiveDisabled();
|
||||
final boolean pyDistDisabled = cli.isPythonDistributionDisabled();
|
||||
final boolean cMakeDisabled = cli.isCmakeDisabled();
|
||||
final boolean pyPkgDisabled = cli.isPythonPackageDisabled();
|
||||
final boolean autoconfDisabled = cli.isAutoconfDisabled();
|
||||
final boolean assemblyDisabled = cli.isAssemblyDisabled();
|
||||
final boolean nuspecDisabled = cli.isNuspecDisabled();
|
||||
final boolean centralDisabled = cli.isCentralDisabled();
|
||||
@@ -320,9 +324,10 @@ public class App {
|
||||
//File Type Analyzer Settings
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !jarDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !archiveDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled());
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled());
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled());
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !pyDistDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !pyPkgDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !autoconfDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cMakeDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !nuspecDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !assemblyDisabled);
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled());
|
||||
|
||||
@@ -384,6 +384,8 @@ public final class CliParser {
|
||||
|
||||
final Option disableOpenSSLAnalyzer = OptionBuilder.withLongOpt(ARGUMENT.DISABLE_OPENSSL)
|
||||
.withDescription("Disable the OpenSSL Analyzer.").create();
|
||||
final Option disableCmakeAnalyzer = OptionBuilder.withLongOpt(ARGUMENT.DISABLE_CMAKE).
|
||||
withDescription("Disable the Cmake Analyzer.").create();
|
||||
|
||||
final Option disableCentralAnalyzer = OptionBuilder.withLongOpt(ARGUMENT.DISABLE_CENTRAL)
|
||||
.withDescription("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable "
|
||||
@@ -412,6 +414,7 @@ public final class CliParser {
|
||||
.addOption(disableArchiveAnalyzer)
|
||||
.addOption(disableAssemblyAnalyzer)
|
||||
.addOption(disablePythonDistributionAnalyzer)
|
||||
.addOption(disableCmakeAnalyzer)
|
||||
.addOption(disablePythonPackageAnalyzer)
|
||||
.addOption(disableAutoconfAnalyzer)
|
||||
.addOption(disableOpenSSLAnalyzer)
|
||||
@@ -431,7 +434,7 @@ public final class CliParser {
|
||||
* @param options a collection of command line arguments
|
||||
* @throws IllegalArgumentException thrown if there is an exception
|
||||
*/
|
||||
@SuppressWarnings("static-access")
|
||||
@SuppressWarnings({"static-access", "deprecation"})
|
||||
private void addDeprecatedOptions(final Options options) throws IllegalArgumentException {
|
||||
|
||||
final Option proxyServer = OptionBuilder.withArgName("url").hasArg().withLongOpt(ARGUMENT.PROXY_URL)
|
||||
@@ -540,6 +543,15 @@ public final class CliParser {
|
||||
return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the disableCmake command line argument was specified.
|
||||
*
|
||||
* @return true if the disableCmake command line argument was specified; otherwise false
|
||||
*/
|
||||
public boolean isCmakeDisabled() {
|
||||
return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the disableAutoconf command line argument was specified.
|
||||
*
|
||||
@@ -735,6 +747,7 @@ public final class CliParser {
|
||||
*
|
||||
* @return the proxy server
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public String getProxyServer() {
|
||||
|
||||
String server = line.getOptionValue(ARGUMENT.PROXY_SERVER);
|
||||
@@ -979,7 +992,7 @@ public final class CliParser {
|
||||
/**
|
||||
* The CLI argument name indicating the proxy url.
|
||||
*
|
||||
* @deprecated use {@link org.owasp.dependencycheck.cli.CliParser.ArgumentName#PROXY_SERVER} instead
|
||||
* @deprecated use {@link #PROXY_SERVER} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PROXY_URL = "proxyurl";
|
||||
@@ -1068,6 +1081,10 @@ public final class CliParser {
|
||||
* Disables the Autoconf Analyzer.
|
||||
*/
|
||||
public static final String DISABLE_AUTOCONF = "disableAutoconf";
|
||||
/**
|
||||
* Disables the Cmake Analyzer.
|
||||
*/
|
||||
public static final String DISABLE_CMAKE = "disableCmake";
|
||||
/**
|
||||
* Disables the Assembly Analyzer.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,7 @@ Short | Argument Name | Paramete
|
||||
| \-\-disablePyPkg | | Sets whether the Python Package Analyzer will be used. | false
|
||||
| \-\-disableAutoconf | | Sets whether the Autoconf Analyzer will be used. | false
|
||||
| \-\-disableOpenSSL | | Sets whether the OpenSSL Analyzer will be used. | false
|
||||
| \-\-disableCmake | | Sets whether the Cmake Analyzer will be used. | false
|
||||
| \-\-disableArchive | | Sets whether the Archive Analyzer will be used. | false
|
||||
| \-\-zipExtensions | \<strings\> | A comma-separated list of additional file extensions to be treated like a ZIP file, the contents will be extracted and analyzed. |
|
||||
| \-\-disableJar | | Sets whether the Jar Analyzer will be used. | false
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* This file is part of dependency-check-core.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
|
||||
*/
|
||||
package org.owasp.dependencycheck.analyzer;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.owasp.dependencycheck.Engine;
|
||||
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
||||
import org.owasp.dependencycheck.dependency.Confidence;
|
||||
import org.owasp.dependencycheck.dependency.Dependency;
|
||||
import org.owasp.dependencycheck.utils.Checksum;
|
||||
import org.owasp.dependencycheck.utils.FileFilterBuilder;
|
||||
import org.owasp.dependencycheck.utils.Settings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>Used to analyze CMake build files, and collect information that can be used to
|
||||
* determine the associated CPE.</p>
|
||||
* <p/>
|
||||
* <p>Note: This analyzer catches straightforward invocations of the project command, plus some other observed
|
||||
* patterns of version inclusion in real CMake projects. Many projects make use of older versions of CMake and/or
|
||||
* use custom "homebrew" ways to insert version information. Hopefully as the newer CMake call pattern grows in usage,
|
||||
* this analyzer allow more CPEs to be identified.</p>
|
||||
*
|
||||
* @author Dale Visser <dvisser@ida.org>
|
||||
*/
|
||||
public class CMakeAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
|
||||
/**
|
||||
* The logger.
|
||||
*/
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CMakeAnalyzer.class);
|
||||
|
||||
/**
|
||||
* Used when compiling file scanning regex patterns.
|
||||
*/
|
||||
private static final int REGEX_OPTIONS = Pattern.DOTALL
|
||||
| Pattern.CASE_INSENSITIVE | Pattern.MULTILINE;
|
||||
|
||||
private static final Pattern PROJECT = Pattern.compile(
|
||||
"^ *project *\\([ \\n]*(\\w+)[ \\n]*.*?\\)", REGEX_OPTIONS);
|
||||
|
||||
// Group 1: Product
|
||||
// Group 2: Version
|
||||
private static final Pattern SET_VERSION = Pattern
|
||||
.compile(
|
||||
"^ *set\\s*\\(\\s*(\\w+)_version\\s+\"?(\\d+(?:\\.\\d+)+)[\\s\"]?\\)",
|
||||
REGEX_OPTIONS);
|
||||
|
||||
/**
|
||||
* Detects files that can be analyzed.
|
||||
*/
|
||||
private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(".cmake")
|
||||
.addFilenames("CMakeLists.txt").build();
|
||||
|
||||
private static MessageDigest sha1 = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
sha1 = MessageDigest.getInstance("SHA1");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the CMake analyzer.
|
||||
*
|
||||
* @return the name of the analyzer
|
||||
**/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "CMake Analyzer";
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell that we are used for information collection.
|
||||
*
|
||||
* @return INFORMATION_COLLECTION
|
||||
*/
|
||||
@Override
|
||||
public AnalysisPhase getAnalysisPhase() {
|
||||
return AnalysisPhase.INFORMATION_COLLECTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of supported file extensions.
|
||||
*
|
||||
* @return the set of supported file extensions
|
||||
*/
|
||||
@Override
|
||||
protected FileFilter getFileFilter() {
|
||||
return FILTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* No-op initializer implementation.
|
||||
*
|
||||
* @throws Exception never thrown
|
||||
*/
|
||||
@Override
|
||||
protected void initializeFileTypeAnalyzer() throws Exception {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyzes python packages and adds evidence to the dependency.
|
||||
*
|
||||
* @param dependency the dependency being analyzed
|
||||
* @param engine the engine being used to perform the scan
|
||||
* @throws AnalysisException thrown if there is an unrecoverable error analyzing the
|
||||
* dependency
|
||||
*/
|
||||
@Override
|
||||
protected void analyzeFileType(Dependency dependency, Engine engine)
|
||||
throws AnalysisException {
|
||||
final File file = dependency.getActualFile();
|
||||
final String parentName = file.getParentFile().getName();
|
||||
final String name = file.getName();
|
||||
dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name));
|
||||
String contents;
|
||||
try {
|
||||
contents = FileUtils.readFileToString(file).trim();
|
||||
} catch (IOException e) {
|
||||
throw new AnalysisException(
|
||||
"Problem occurred while reading dependency file.", e);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(contents)) {
|
||||
Matcher m = PROJECT.matcher(contents);
|
||||
int count = 0;
|
||||
while (m.find()) {
|
||||
count++;
|
||||
LOGGER.debug(String.format(
|
||||
"Found project command match with %d groups: %s",
|
||||
m.groupCount(), m.group(0)));
|
||||
final String group = m.group(1);
|
||||
LOGGER.debug("Group 1: " + group);
|
||||
dependency.getProductEvidence().addEvidence(name, "Project",
|
||||
group, Confidence.HIGH);
|
||||
}
|
||||
LOGGER.debug(String.format("Found %d matches.", count));
|
||||
analyzeSetVersionCommand(dependency, engine, contents);
|
||||
}
|
||||
}
|
||||
|
||||
private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) {
|
||||
final Dependency orig = dependency;
|
||||
Matcher m = SET_VERSION.matcher(contents);
|
||||
int count = 0;
|
||||
while (m.find()) {
|
||||
count++;
|
||||
LOGGER.debug(String.format(
|
||||
"Found project command match with %d groups: %s",
|
||||
m.groupCount(), m.group(0)));
|
||||
String product = m.group(1);
|
||||
final String version = m.group(2);
|
||||
LOGGER.debug("Group 1: " + product);
|
||||
LOGGER.debug("Group 2: " + version);
|
||||
final String alias_prefix = "ALIASOF_";
|
||||
if (product.startsWith(alias_prefix)) {
|
||||
product = product.replaceFirst(alias_prefix, "");
|
||||
}
|
||||
if (count > 1) {
|
||||
dependency = new Dependency(orig.getActualFile());
|
||||
dependency.setDisplayFileName(String.format("%s:%s", orig.getDisplayFileName(), product));
|
||||
final String filePath = String.format("%s:%s", orig.getFilePath(), product);
|
||||
dependency.setFilePath(filePath);
|
||||
|
||||
// prevents coalescing into the dependency provided by engine
|
||||
dependency.setSha1sum(Checksum.getHex(sha1.digest(filePath.getBytes())));
|
||||
engine.getDependencies().add(dependency);
|
||||
}
|
||||
final String source = dependency.getDisplayFileName();
|
||||
dependency.getProductEvidence().addEvidence(source, "Product",
|
||||
product, Confidence.MEDIUM);
|
||||
dependency.getVersionEvidence().addEvidence(source, "Version",
|
||||
version, Confidence.MEDIUM);
|
||||
}
|
||||
LOGGER.debug(String.format("Found %d matches.", count));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAnalyzerEnabledSettingKey() {
|
||||
return Settings.KEYS.ANALYZER_CMAKE_ENABLED;
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,5 @@ org.owasp.dependencycheck.analyzer.AssemblyAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.PythonDistributionAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.AutoconfAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.OpenSSLAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.OpenSSLAnalyzer
|
||||
org.owasp.dependencycheck.analyzer.CMakeAnalyzer
|
||||
@@ -35,6 +35,15 @@ public class BaseTest {
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws Exception {
|
||||
File f = new File("./target/data/dc.h2.db");
|
||||
if (f.exists() && f.isFile() && f.length() < 71680) {
|
||||
System.err.println("------------------------------------------------");
|
||||
System.err.println("------------------------------------------------");
|
||||
System.err.println("I broke the build");
|
||||
System.err.println("------------------------------------------------");
|
||||
System.err.println("------------------------------------------------");
|
||||
}
|
||||
|
||||
Settings.cleanup(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* This file is part of dependency-check-core.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
|
||||
*/
|
||||
package org.owasp.dependencycheck.analyzer;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.owasp.dependencycheck.BaseTest;
|
||||
import org.owasp.dependencycheck.Engine;
|
||||
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
||||
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
|
||||
import org.owasp.dependencycheck.dependency.Dependency;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase;
|
||||
|
||||
/**
|
||||
* Unit tests for CmakeAnalyzer.
|
||||
*
|
||||
* @author Dale Visser <dvisser@ida.org>
|
||||
*/
|
||||
public class CMakeAnalyzerTest extends BaseDBTestCase {
|
||||
|
||||
/**
|
||||
* The package analyzer to test.
|
||||
*/
|
||||
CMakeAnalyzer analyzer;
|
||||
|
||||
/**
|
||||
* Setup the CmakeAnalyzer.
|
||||
*
|
||||
* @throws Exception if there is a problem
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
analyzer = new CMakeAnalyzer();
|
||||
analyzer.setFilesMatched(true);
|
||||
analyzer.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup any resources used.
|
||||
*
|
||||
* @throws Exception if there is a problem
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
analyzer.close();
|
||||
analyzer = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getName method, of class PythonPackageAnalyzer.
|
||||
*/
|
||||
@Test
|
||||
public void testGetName() {
|
||||
assertThat(analyzer.getName(), is(equalTo("CMake Analyzer")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of supportsExtension method, of class PythonPackageAnalyzer.
|
||||
*/
|
||||
@Test
|
||||
public void testAccept() {
|
||||
assertTrue("Should support \"CMakeLists.txt\" name.",
|
||||
analyzer.accept(new File("CMakeLists.txt")));
|
||||
assertTrue("Should support \"cmake\" extension.",
|
||||
analyzer.accept(new File("test.cmake")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether expected evidence is gathered from OpenCV's CMakeLists.txt.
|
||||
*
|
||||
* @throws AnalysisException is thrown when an exception occurs.
|
||||
*/
|
||||
@Test
|
||||
public void testAnalyzeCMakeListsOpenCV() throws AnalysisException {
|
||||
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
|
||||
this, "cmake/opencv/CMakeLists.txt"));
|
||||
analyzer.analyze(result, null);
|
||||
final String product = "OpenCV";
|
||||
assertProductEvidence(result, product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether expected evidence is gathered from OpenCV's CMakeLists.txt.
|
||||
*
|
||||
* @throws AnalysisException is thrown when an exception occurs.
|
||||
*/
|
||||
@Test
|
||||
public void testAnalyzeCMakeListsZlib() throws AnalysisException {
|
||||
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
|
||||
this, "cmake/zlib/CMakeLists.txt"));
|
||||
analyzer.analyze(result, null);
|
||||
final String product = "zlib";
|
||||
assertProductEvidence(result, product);
|
||||
}
|
||||
|
||||
private void assertProductEvidence(Dependency result, String product) {
|
||||
assertTrue("Expected product evidence to contain \"" + product + "\".",
|
||||
result.getProductEvidence().toString().contains(product));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether expected version evidence is gathered from OpenCV's third party cmake files.
|
||||
*
|
||||
* @throws AnalysisException is thrown when an exception occurs.
|
||||
*/
|
||||
@Test
|
||||
public void testAnalyzeCMakeListsOpenCV3rdParty() throws AnalysisException, DatabaseException {
|
||||
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
|
||||
this, "cmake/opencv/3rdparty/ffmpeg/ffmpeg_version.cmake"));
|
||||
final Engine engine = new Engine();
|
||||
analyzer.analyze(result, engine);
|
||||
assertProductEvidence(result, "libavcodec");
|
||||
assertVersionEvidence(result, "55.18.102");
|
||||
assertFalse("ALIASOF_ prefix shouldn't be present.",
|
||||
Pattern.compile("\\bALIASOF_\\w+").matcher(result.getProductEvidence().toString()).find());
|
||||
final List<Dependency> dependencies = engine.getDependencies();
|
||||
assertEquals("Number of additional dependencies should be 4.", 4, dependencies.size());
|
||||
final Dependency last = dependencies.get(3);
|
||||
assertProductEvidence(last, "libavresample");
|
||||
assertVersionEvidence(last, "1.0.1");
|
||||
}
|
||||
|
||||
private void assertVersionEvidence(Dependency result, String version) {
|
||||
assertTrue("Expected version evidence to contain \"" + version + "\".",
|
||||
result.getVersionEvidence().toString().contains(version));
|
||||
}
|
||||
}
|
||||
12
dependency-check-core/src/test/resources/cmake/README.md
Normal file
12
dependency-check-core/src/test/resources/cmake/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
CMakeAnalyzer Test Resources README
|
||||
===================================
|
||||
|
||||
opencv/
|
||||
-------
|
||||
|
||||
Origin: https://github.com/Itseez/opencv/
|
||||
|
||||
zlib/
|
||||
-----
|
||||
|
||||
Origin: https://github.com/madler/zlib
|
||||
13
dependency-check-core/src/test/resources/cmake/opencv/3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
Normal file
13
dependency-check-core/src/test/resources/cmake/opencv/3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
set(HAVE_FFMPEG 1)
|
||||
set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
set(HAVE_FFMPEG_RESAMPLE 0)
|
||||
set(HAVE_GENTOO_FFMPEG 1)
|
||||
|
||||
set(ALIASOF_libavcodec_VERSION 55.18.102)
|
||||
set(ALIASOF_libavformat_VERSION 55.12.100)
|
||||
set(ALIASOF_libavutil_VERSION 52.38.100)
|
||||
set(ALIASOF_libswscale_VERSION 2.3.100)
|
||||
set(ALIASOF_libavresample_VERSION 1.0.1)
|
||||
1185
dependency-check-core/src/test/resources/cmake/opencv/CMakeLists.txt
Normal file
1185
dependency-check-core/src/test/resources/cmake/opencv/CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
By downloading, copying, installing or using the software you agree to this license.
|
||||
If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
|
||||
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
|
||||
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
|
||||
Copyright (C) 2015, OpenCV Foundation, all rights reserved.
|
||||
Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of the contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
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 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.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2007-2009
|
||||
# Scientific Computing and Imaging Institute, University of Utah
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# This converts a file written in makefile syntax into one that can be included
|
||||
# by CMake.
|
||||
|
||||
file(READ ${input_file} depend_text)
|
||||
|
||||
if (NOT "${depend_text}" STREQUAL "")
|
||||
|
||||
# message("FOUND DEPENDS")
|
||||
|
||||
string(REPLACE "\\ " " " depend_text ${depend_text})
|
||||
|
||||
# This works for the nvcc -M generated dependency files.
|
||||
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
|
||||
string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
|
||||
|
||||
set(dependency_list "")
|
||||
|
||||
foreach(file ${depend_text})
|
||||
|
||||
string(REGEX REPLACE "^ +" "" file ${file})
|
||||
|
||||
# OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
|
||||
# instead of '//'. Here we will test to see if the file exists, if it doesn't then
|
||||
# try to prepend another '/' to the path and test again. If it still fails remove the
|
||||
# path.
|
||||
|
||||
if(NOT EXISTS "${file}")
|
||||
if (EXISTS "/${file}")
|
||||
set(file "/${file}")
|
||||
else()
|
||||
message(WARNING " Removing non-existent dependency file: ${file}")
|
||||
set(file "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY "${file}")
|
||||
# If softlinks start to matter, we should change this to REALPATH. For now we need
|
||||
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
|
||||
# just /include.
|
||||
get_filename_component(file_absolute "${file}" ABSOLUTE)
|
||||
list(APPEND dependency_list "${file_absolute}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
# message("FOUND NO DEPENDS")
|
||||
endif()
|
||||
|
||||
# Remove the duplicate entries and sort them.
|
||||
list(REMOVE_DUPLICATES dependency_list)
|
||||
list(SORT dependency_list)
|
||||
|
||||
foreach(file ${dependency_list})
|
||||
set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
|
||||
endforeach()
|
||||
|
||||
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
|
||||
@@ -0,0 +1,109 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2007-2009
|
||||
# Scientific Computing and Imaging Institute, University of Utah
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# Parses a .cubin file produced by nvcc and reports statistics about the file.
|
||||
|
||||
|
||||
file(READ ${input_file} file_text)
|
||||
|
||||
if (NOT "${file_text}" STREQUAL "")
|
||||
|
||||
string(REPLACE ";" "\\;" file_text ${file_text})
|
||||
string(REPLACE "\ncode" ";code" file_text ${file_text})
|
||||
|
||||
list(LENGTH file_text len)
|
||||
|
||||
foreach(line ${file_text})
|
||||
|
||||
# Only look at "code { }" blocks.
|
||||
if(line MATCHES "^code")
|
||||
|
||||
# Break into individual lines.
|
||||
string(REGEX REPLACE "\n" ";" line ${line})
|
||||
|
||||
foreach(entry ${line})
|
||||
|
||||
# Extract kernel names.
|
||||
if (${entry} MATCHES "[^g]name = ([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_1}")
|
||||
|
||||
# Check to see if the kernel name starts with "_"
|
||||
set(skip FALSE)
|
||||
# if (${entry} MATCHES "^_")
|
||||
# Skip the rest of this block.
|
||||
# message("Skipping ${entry}")
|
||||
# set(skip TRUE)
|
||||
# else ()
|
||||
message("Kernel: ${entry}")
|
||||
# endif ()
|
||||
|
||||
endif()
|
||||
|
||||
# Skip the rest of the block if necessary
|
||||
if(NOT skip)
|
||||
|
||||
# Registers
|
||||
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Registers: ${entry}")
|
||||
endif()
|
||||
|
||||
# Local memory
|
||||
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Local: ${entry}")
|
||||
endif()
|
||||
|
||||
# Shared memory
|
||||
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Shared: ${entry}")
|
||||
endif()
|
||||
|
||||
if (${entry} MATCHES "^}")
|
||||
message("")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
# message("FOUND NO DEPENDS")
|
||||
endif()
|
||||
@@ -0,0 +1,288 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
##########################################################################
|
||||
# This file runs the nvcc commands to produce the desired output file along with
|
||||
# the dependency file needed by CMake to compute dependencies. In addition the
|
||||
# file checks the output of each command and if the command fails it deletes the
|
||||
# output files.
|
||||
|
||||
# Input variables
|
||||
#
|
||||
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
|
||||
# ON : Describe each step
|
||||
#
|
||||
# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
|
||||
# RelWithDebInfo, but it should match one of the
|
||||
# entries in CUDA_HOST_FLAGS. This is the build
|
||||
# configuration used when compiling the code. If
|
||||
# blank or unspecified Debug is assumed as this is
|
||||
# what CMake does.
|
||||
#
|
||||
# generated_file:STRING=<> File to generate. This argument must be passed in.
|
||||
#
|
||||
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
|
||||
# in if build_cubin is true.
|
||||
|
||||
if(NOT generated_file)
|
||||
message(FATAL_ERROR "You must specify generated_file on the command line")
|
||||
endif()
|
||||
|
||||
# Set these up as variables to make reading the generated file easier
|
||||
set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
|
||||
set(source_file "@source_file@") # path
|
||||
set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") # path
|
||||
set(cmake_dependency_file "@cmake_dependency_file@") # path
|
||||
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
|
||||
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
|
||||
set(build_cubin @build_cubin@) # bool
|
||||
set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
|
||||
# We won't actually use these variables for now, but we need to set this, in
|
||||
# order to force this file to be run again if it changes.
|
||||
set(generated_file_path "@generated_file_path@") # path
|
||||
set(generated_file_internal "@generated_file@") # path
|
||||
set(generated_cubin_file_internal "@generated_cubin_file@") # path
|
||||
|
||||
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
|
||||
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
|
||||
@CUDA_NVCC_FLAGS_CONFIG@
|
||||
set(nvcc_flags @nvcc_flags@) # list
|
||||
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
|
||||
set(format_flag "@format_flag@") # string
|
||||
|
||||
if(build_cubin AND NOT generated_cubin_file)
|
||||
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
|
||||
endif()
|
||||
|
||||
# This is the list of host compilation flags. It C or CXX should already have
|
||||
# been chosen by FindCUDA.cmake.
|
||||
@CUDA_HOST_FLAGS@
|
||||
|
||||
# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
|
||||
set(nvcc_host_compiler_flags "")
|
||||
# If we weren't given a build_configuration, use Debug.
|
||||
if(NOT build_configuration)
|
||||
set(build_configuration Debug)
|
||||
endif()
|
||||
string(TOUPPER "${build_configuration}" build_configuration)
|
||||
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
|
||||
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
|
||||
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
|
||||
set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
|
||||
endforeach()
|
||||
if (nvcc_host_compiler_flags)
|
||||
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
|
||||
endif()
|
||||
#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
|
||||
# Add the build specific configuration flags
|
||||
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
|
||||
|
||||
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
|
||||
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
|
||||
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
|
||||
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
||||
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
|
||||
set(CCBIN -ccbin "${CCBIN}")
|
||||
else()
|
||||
set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cuda_execute_process - Executes a command with optional command echo and status message.
|
||||
#
|
||||
# status - Status message to print if verbose is true
|
||||
# command - COMMAND argument from the usual execute_process argument structure
|
||||
# ARGN - Remaining arguments are the command with arguments
|
||||
#
|
||||
# CUDA_result - return value from running the command
|
||||
#
|
||||
# Make this a macro instead of a function, so that things like RESULT_VARIABLE
|
||||
# and other return variables are present after executing the process.
|
||||
macro(cuda_execute_process status command)
|
||||
set(_command ${command})
|
||||
if(NOT "x${_command}" STREQUAL "xCOMMAND")
|
||||
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
|
||||
endif()
|
||||
if(verbose)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
|
||||
# Now we need to build up our command string. We are accounting for quotes
|
||||
# and spaces, anything else is left up to the user to fix if they want to
|
||||
# copy and paste a runnable command line.
|
||||
set(cuda_execute_process_string)
|
||||
foreach(arg ${ARGN})
|
||||
# If there are quotes, excape them, so they come through.
|
||||
string(REPLACE "\"" "\\\"" arg ${arg})
|
||||
# Args with spaces need quotes around them to get them to be parsed as a single argument.
|
||||
if(arg MATCHES " ")
|
||||
list(APPEND cuda_execute_process_string "\"${arg}\"")
|
||||
else()
|
||||
list(APPEND cuda_execute_process_string ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
# Echo the command
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
|
||||
endif()
|
||||
# Run the command
|
||||
execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
|
||||
endmacro()
|
||||
|
||||
# Delete the target file
|
||||
cuda_execute_process(
|
||||
"Removing ${generated_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||
)
|
||||
|
||||
# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
|
||||
# for dependency generation and hope for the best.
|
||||
set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
|
||||
set(CUDA_VERSION @CUDA_VERSION@)
|
||||
if(CUDA_VERSION VERSION_LESS "3.0")
|
||||
cmake_policy(PUSH)
|
||||
# CMake policy 0007 NEW states that empty list elements are not
|
||||
# ignored. I'm just setting it to avoid the warning that's printed.
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
# Note that this will remove all occurances of -G.
|
||||
list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
|
||||
# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
|
||||
# can cause incorrect dependencies when #including files based on this macro which is
|
||||
# defined in the generating passes of nvcc invokation. We will go ahead and manually
|
||||
# define this for now until a future version fixes this bug.
|
||||
set(CUDACC_DEFINE -D__CUDACC__)
|
||||
|
||||
# Generate the dependency file
|
||||
cuda_execute_process(
|
||||
"Generating dependency file: ${NVCC_generated_dependency_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
-M
|
||||
${CUDACC_DEFINE}
|
||||
"${source_file}"
|
||||
-o "${NVCC_generated_dependency_file}"
|
||||
${CCBIN}
|
||||
${nvcc_flags}
|
||||
${nvcc_host_compiler_flags}
|
||||
${depends_CUDA_NVCC_FLAGS}
|
||||
-DNVCC
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Generate the cmake readable dependency file to a temp file. Don't put the
|
||||
# quotes just around the filenames for the input_file and output_file variables.
|
||||
# CMake will pass the quotes through and not be able to find the file.
|
||||
cuda_execute_process(
|
||||
"Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
|
||||
-D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
|
||||
-P "${CUDA_make2cmake}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Copy the file if it is different
|
||||
cuda_execute_process(
|
||||
"Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Delete the temporary file
|
||||
cuda_execute_process(
|
||||
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Generate the code
|
||||
cuda_execute_process(
|
||||
"Generating ${generated_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
"${source_file}"
|
||||
${format_flag} -o "${generated_file}"
|
||||
${CCBIN}
|
||||
${nvcc_flags}
|
||||
${nvcc_host_compiler_flags}
|
||||
${CUDA_NVCC_FLAGS}
|
||||
-DNVCC
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
|
||||
cuda_execute_process(
|
||||
"Removing ${generated_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||
)
|
||||
message(FATAL_ERROR "Error generating file ${generated_file}")
|
||||
else()
|
||||
if(verbose)
|
||||
message("Generated ${generated_file} successfully.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Cubin resource report commands.
|
||||
if( build_cubin )
|
||||
# Run with -cubin to produce resource usage report.
|
||||
cuda_execute_process(
|
||||
"Generating ${generated_cubin_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
"${source_file}"
|
||||
${CUDA_NVCC_FLAGS}
|
||||
${nvcc_flags}
|
||||
${CCBIN}
|
||||
${nvcc_host_compiler_flags}
|
||||
-DNVCC
|
||||
-cubin
|
||||
-o "${generated_cubin_file}"
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
# Execute the parser script.
|
||||
cuda_execute_process(
|
||||
"Executing the parser script"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "input_file:STRING=${generated_cubin_file}"
|
||||
-P "${CUDA_parse_cubin}"
|
||||
)
|
||||
|
||||
endif()
|
||||
@@ -0,0 +1,97 @@
|
||||
if(NOT MSVC)
|
||||
message(FATAL_ERROR "CRT options are available only for MSVC")
|
||||
endif()
|
||||
|
||||
#if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore" OR ${CMAKE_SYSTEM_NAME} MATCHES "WindowsPhone")
|
||||
# set(WINRT TRUE)
|
||||
|
||||
if (WINRT)
|
||||
add_definitions(/DWINVER=_WIN32_WINNT_WIN8 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=_WIN32_WINNT_WIN8)
|
||||
endif()
|
||||
|
||||
# Removing LNK4075 warnings for debug WinRT builds
|
||||
# "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification"
|
||||
# "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification"
|
||||
if(MSVC AND WINRT)
|
||||
# Optional verification checks since we don't know existing contents of variables below
|
||||
string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/OPT:REF " "/OPT:NORE F" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
# Mandatory
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
if(${flag_var} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
|
||||
else()
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MT")
|
||||
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
if(${flag_var} MATCHES "/MTd")
|
||||
string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER "2.8.6")
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(N)
|
||||
if(NOT N EQUAL 0)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${N} ")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${N} ")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_WITH_DEBUG_INFO AND NOT MSVC)
|
||||
string(REPLACE "/debug" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/DEBUG" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/debug" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/DEBUG" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/debug" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/DEBUG" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/Zi" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
@@ -0,0 +1,349 @@
|
||||
if(MINGW OR (X86 AND UNIX AND NOT APPLE))
|
||||
# mingw compiler is known to produce unstable SSE code with -O3 hence we are trying to use -O2 instead
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "-O3" "-O2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
|
||||
string(REPLACE "-O3" "-O2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
|
||||
if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT)
|
||||
# override cmake default exception handling option
|
||||
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OPENCV_EXTRA_FLAGS "")
|
||||
set(OPENCV_EXTRA_C_FLAGS "")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "")
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "")
|
||||
|
||||
macro(add_extra_compiler_option option)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
ocv_check_flag_support(CXX "${option}" _varname "${OPENCV_EXTRA_CXX_FLAGS} ${ARGN}")
|
||||
if(${_varname})
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} ${option}")
|
||||
endif()
|
||||
|
||||
ocv_check_flag_support(C "${option}" _varname "${OPENCV_EXTRA_C_FLAGS} ${ARGN}")
|
||||
if(${_varname})
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} ${option}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# OpenCV fails some tests when 'char' is 'unsigned' by default
|
||||
add_extra_compiler_option(-fsigned-char)
|
||||
|
||||
if(MINGW)
|
||||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
|
||||
# here we are trying to workaround the problem
|
||||
add_extra_compiler_option(-mstackrealign)
|
||||
if(NOT HAVE_CXX_MSTACKREALIGN)
|
||||
add_extra_compiler_option(-mpreferred-stack-boundary=2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# High level of warnings.
|
||||
add_extra_compiler_option(-W)
|
||||
add_extra_compiler_option(-Wall)
|
||||
add_extra_compiler_option(-Werror=return-type)
|
||||
add_extra_compiler_option(-Werror=non-virtual-dtor)
|
||||
add_extra_compiler_option(-Werror=address)
|
||||
add_extra_compiler_option(-Werror=sequence-point)
|
||||
add_extra_compiler_option(-Wformat)
|
||||
add_extra_compiler_option(-Werror=format-security -Wformat)
|
||||
add_extra_compiler_option(-Wmissing-declarations)
|
||||
add_extra_compiler_option(-Wmissing-prototypes)
|
||||
add_extra_compiler_option(-Wstrict-prototypes)
|
||||
add_extra_compiler_option(-Wundef)
|
||||
add_extra_compiler_option(-Winit-self)
|
||||
add_extra_compiler_option(-Wpointer-arith)
|
||||
add_extra_compiler_option(-Wshadow)
|
||||
add_extra_compiler_option(-Wsign-promo)
|
||||
|
||||
if(ENABLE_NOISY_WARNINGS)
|
||||
add_extra_compiler_option(-Wcast-align)
|
||||
add_extra_compiler_option(-Wstrict-aliasing=2)
|
||||
else()
|
||||
add_extra_compiler_option(-Wno-narrowing)
|
||||
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
|
||||
add_extra_compiler_option(-Wno-unnamed-type-template-args)
|
||||
endif()
|
||||
add_extra_compiler_option(-fdiagnostics-show-option)
|
||||
|
||||
# The -Wno-long-long is required in 64bit systems when including sytem headers.
|
||||
if(X86_64)
|
||||
add_extra_compiler_option(-Wno-long-long)
|
||||
endif()
|
||||
|
||||
# We need pthread's
|
||||
if(UNIX AND NOT ANDROID AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX))
|
||||
add_extra_compiler_option(-pthread)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANGCXX)
|
||||
add_extra_compiler_option(-Qunused-arguments)
|
||||
endif()
|
||||
|
||||
if(OPENCV_WARNINGS_ARE_ERRORS)
|
||||
add_extra_compiler_option(-Werror)
|
||||
endif()
|
||||
|
||||
if(X86 AND NOT MINGW64 AND NOT X86_64 AND NOT APPLE)
|
||||
add_extra_compiler_option(-march=i686)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_extra_compiler_option(-Wno-semicolon-before-method-body)
|
||||
endif()
|
||||
|
||||
# Other optimizations
|
||||
if(ENABLE_OMIT_FRAME_POINTER)
|
||||
add_extra_compiler_option(-fomit-frame-pointer)
|
||||
else()
|
||||
add_extra_compiler_option(-fno-omit-frame-pointer)
|
||||
endif()
|
||||
if(ENABLE_FAST_MATH)
|
||||
add_extra_compiler_option(-ffast-math)
|
||||
endif()
|
||||
if(ENABLE_POWERPC)
|
||||
add_extra_compiler_option("-mcpu=G3 -mtune=G5")
|
||||
endif()
|
||||
if(ENABLE_SSE)
|
||||
add_extra_compiler_option(-msse)
|
||||
endif()
|
||||
if(ENABLE_SSE2)
|
||||
add_extra_compiler_option(-msse2)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-sse2)
|
||||
endif()
|
||||
if(ENABLE_NEON)
|
||||
add_extra_compiler_option("-mfpu=neon")
|
||||
endif()
|
||||
if(ENABLE_VFPV3 AND NOT ENABLE_NEON)
|
||||
add_extra_compiler_option("-mfpu=vfpv3")
|
||||
endif()
|
||||
|
||||
# SSE3 and further should be disabled under MingW because it generates compiler errors
|
||||
if(NOT MINGW)
|
||||
if(ENABLE_AVX)
|
||||
add_extra_compiler_option(-mavx)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-avx)
|
||||
endif()
|
||||
if(ENABLE_AVX2)
|
||||
add_extra_compiler_option(-mavx2)
|
||||
|
||||
if(ENABLE_FMA3)
|
||||
add_extra_compiler_option(-mfma)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
|
||||
if(NOT OPENCV_EXTRA_CXX_FLAGS MATCHES "-mavx")
|
||||
if(ENABLE_SSE3)
|
||||
add_extra_compiler_option(-msse3)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-sse3)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSSE3)
|
||||
add_extra_compiler_option(-mssse3)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-ssse3)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE41)
|
||||
add_extra_compiler_option(-msse4.1)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-sse4.1)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE42)
|
||||
add_extra_compiler_option(-msse4.2)
|
||||
elseif(X86 OR X86_64)
|
||||
add_extra_compiler_option(-mno-sse4.2)
|
||||
endif()
|
||||
|
||||
if(ENABLE_POPCNT)
|
||||
add_extra_compiler_option(-mpopcnt)
|
||||
endif()
|
||||
endif()
|
||||
endif(NOT MINGW)
|
||||
|
||||
if(X86 OR X86_64)
|
||||
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
if(OPENCV_EXTRA_CXX_FLAGS MATCHES "-m(sse2|avx)")
|
||||
add_extra_compiler_option(-mfpmath=sse)# !! important - be on the same wave with x64 compilers
|
||||
else()
|
||||
add_extra_compiler_option(-mfpmath=387)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Profiling?
|
||||
if(ENABLE_PROFILING)
|
||||
add_extra_compiler_option("-pg -g")
|
||||
# turn off incompatible options
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
|
||||
OPENCV_EXTRA_FLAGS_RELEASE OPENCV_EXTRA_FLAGS_DEBUG OPENCV_EXTRA_C_FLAGS OPENCV_EXTRA_CXX_FLAGS)
|
||||
string(REPLACE "-fomit-frame-pointer" "" ${flags} "${${flags}}")
|
||||
string(REPLACE "-ffunction-sections" "" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
elseif(NOT APPLE AND NOT ANDROID)
|
||||
# Remove unreferenced functions: function level linking
|
||||
add_extra_compiler_option(-ffunction-sections)
|
||||
endif()
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage")
|
||||
endif()
|
||||
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
|
||||
# 64-bit portability warnings, in MSVC80
|
||||
if(MSVC80)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Wp64")
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_DEBUG_INFO)
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
|
||||
endif()
|
||||
|
||||
# Remove unreferenced functions: function level linking
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Gy")
|
||||
if(NOT MSVC_VERSION LESS 1400)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /bigobj")
|
||||
endif()
|
||||
if(BUILD_WITH_DEBUG_INFO)
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi")
|
||||
endif()
|
||||
|
||||
if(ENABLE_AVX2 AND NOT MSVC_VERSION LESS 1800)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX2")
|
||||
endif()
|
||||
if(ENABLE_AVX AND NOT MSVC_VERSION LESS 1600 AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX")
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE4_1 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE4.1")
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE3 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE3")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC64)
|
||||
# 64-bit MSVC compiler uses SSE/SSE2 by default
|
||||
if(ENABLE_SSE2 AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE2")
|
||||
endif()
|
||||
if(ENABLE_SSE AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1 OR ENABLE_AVX OR ENABLE_AVX2)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Oi")
|
||||
endif()
|
||||
|
||||
if(X86 OR X86_64)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND ENABLE_SSE2)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /fp:fast") # !! important - be on the same wave with x64 compilers
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENCV_WARNINGS_ARE_ERRORS)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /WX")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC12 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
|
||||
endif()
|
||||
|
||||
# Extra link libs if the user selects building static libs:
|
||||
if(NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID)
|
||||
# Android does not need these settings because they are already set by toolchain file
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
|
||||
set(OPENCV_EXTRA_FLAGS "-fPIC ${OPENCV_EXTRA_FLAGS}")
|
||||
endif()
|
||||
|
||||
# Add user supplied extra options (optimization, etc...)
|
||||
# ==========================================================
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS}" CACHE INTERNAL "Extra compiler options")
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS}" CACHE INTERNAL "Extra compiler options for C sources")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS}" CACHE INTERNAL "Extra compiler options for C++ sources")
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE}" CACHE INTERNAL "Extra compiler options for Release build")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG}" CACHE INTERNAL "Extra compiler options for Debug build")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS}" CACHE INTERNAL "Extra linker flags")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}" CACHE INTERNAL "Extra linker flags for Release build")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}" CACHE INTERNAL "Extra linker flags for Debug build")
|
||||
|
||||
# set default visibility to hidden
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_OPENCV_GCC_VERSION_NUM GREATER 399)
|
||||
add_extra_compiler_option(-fvisibility=hidden)
|
||||
add_extra_compiler_option(-fvisibility-inlines-hidden)
|
||||
endif()
|
||||
|
||||
#combine all "extra" options
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPENCV_EXTRA_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OPENCV_EXTRA_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OPENCV_EXTRA_FLAGS_DEBUG}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${OPENCV_EXTRA_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENCV_EXTRA_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
if(MSVC)
|
||||
# avoid warnings from MSVC about overriding the /W* option
|
||||
# we replace /W3 with /W4 only for C++ files,
|
||||
# since all the 3rd-party libraries OpenCV uses are in C,
|
||||
# and we do not care about their warnings.
|
||||
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
|
||||
if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
|
||||
endif()
|
||||
|
||||
# allow extern "C" functions throw exceptions
|
||||
foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}")
|
||||
string(REPLACE "/EHsc" "/EHs" ${flags} "${${flags}}")
|
||||
|
||||
string(REPLACE "/Zm1000" "" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4251) # class 'std::XXX' needs to have dll-interface to be used by clients of YYY
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4324) # 'struct_name' : structure was padded due to __declspec(align())
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,173 @@
|
||||
# ===================================================================================
|
||||
# The OpenCV CMake configuration file
|
||||
#
|
||||
# ** File generated automatically, do not modify **
|
||||
#
|
||||
# Usage from an external project:
|
||||
# In your CMakeLists.txt, add these lines:
|
||||
#
|
||||
# FIND_PACKAGE(OpenCV REQUIRED)
|
||||
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
|
||||
#
|
||||
# Or you can search for specific OpenCV modules:
|
||||
#
|
||||
# FIND_PACKAGE(OpenCV REQUIRED core imgcodecs)
|
||||
#
|
||||
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
|
||||
#
|
||||
# This file will define the following variables:
|
||||
# - OpenCV_LIBS : The list of libraries to link against.
|
||||
# - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
|
||||
# with this path is NOT needed.
|
||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
|
||||
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
|
||||
# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0"
|
||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2"
|
||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4"
|
||||
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
|
||||
#
|
||||
# Advanced variables:
|
||||
# - OpenCV_SHARED
|
||||
# - OpenCV_CONFIG_PATH
|
||||
# - OpenCV_LIB_COMPONENTS
|
||||
#
|
||||
# ===================================================================================
|
||||
#
|
||||
# Windows pack specific options:
|
||||
# - OpenCV_STATIC
|
||||
# - OpenCV_CUDA
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.6)
|
||||
get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;")
|
||||
enable_language(CXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OpenCV_STATIC)
|
||||
# look for global setting
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(OpenCV_STATIC OFF)
|
||||
else()
|
||||
set(OpenCV_STATIC ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OpenCV_CUDA)
|
||||
# if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries
|
||||
if(CUDA_FOUND)
|
||||
set(OpenCV_CUDA ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
set(OpenCV_TBB_ARCH intel64)
|
||||
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
|
||||
# see Modules/CmakeGenericSystem.cmake
|
||||
set(OpenCV_ARCH ARM)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
set(OpenCV_TBB_ARCH ia32)
|
||||
endif()
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
set(OpenCV_RUNTIME vc8)
|
||||
elseif(MSVC_VERSION EQUAL 1500)
|
||||
set(OpenCV_RUNTIME vc9)
|
||||
elseif(MSVC_VERSION EQUAL 1600)
|
||||
set(OpenCV_RUNTIME vc10)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
set(MINGW64 1)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.6.2)
|
||||
unset(OpenCV_CONFIG_PATH CACHE)
|
||||
endif()
|
||||
|
||||
if(NOT OpenCV_FIND_QUIETLY)
|
||||
message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}")
|
||||
message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}")
|
||||
message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}")
|
||||
endif()
|
||||
|
||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
|
||||
if(OpenCV_RUNTIME AND OpenCV_ARCH)
|
||||
if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
|
||||
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
|
||||
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
||||
else()
|
||||
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
||||
endif()
|
||||
elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
|
||||
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
|
||||
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
|
||||
else()
|
||||
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
|
||||
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE)
|
||||
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE)
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdparty OpenCV dependencies are located" FORCE)
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdparty OpenCV dependencies are located" FORCE)
|
||||
|
||||
include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
|
||||
|
||||
if(OpenCV_CUDA)
|
||||
set(_OpenCV_LIBS "")
|
||||
foreach(_lib ${OpenCV_LIBS})
|
||||
string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}")
|
||||
if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}")
|
||||
list(APPEND _OpenCV_LIBS "${_lib2}")
|
||||
else()
|
||||
list(APPEND _OpenCV_LIBS "${_lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(OpenCV_LIBS ${_OpenCV_LIBS})
|
||||
endif()
|
||||
set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE)
|
||||
set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE)
|
||||
|
||||
if(NOT OpenCV_FIND_QUIETLY)
|
||||
message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
|
||||
if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
|
||||
get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH)
|
||||
message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.")
|
||||
if(OpenCV_LIB_PATH MATCHES "/gpu/")
|
||||
string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}")
|
||||
message(STATUS "GPU support is enabled so you might also need ${_OpenCV_LIB_PATH2} in your PATH (it must go after the ${_OpenCV_LIB_PATH}).")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(NOT OpenCV_FIND_QUIETLY)
|
||||
message(WARNING
|
||||
"Found OpenCV Windows Pack but it has no binaries compatible with your configuration.
|
||||
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
|
||||
)
|
||||
endif()
|
||||
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||
set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
@@ -0,0 +1,385 @@
|
||||
if(EXISTS "${ANDROID_EXECUTABLE}")
|
||||
set(ANDROID_SDK_DETECT_QUIET TRUE)
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
|
||||
file(TO_CMAKE_PATH "$ENV{HOME}" HOME_ENV_PATH)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(ANDROID_SDK_OS windows)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
set(ANDROID_SDK_OS macosx)
|
||||
else()
|
||||
set(ANDROID_SDK_OS linux)
|
||||
endif()
|
||||
|
||||
#find android SDK: search in ANDROID_SDK first
|
||||
find_host_program(ANDROID_EXECUTABLE
|
||||
NAMES android.bat android
|
||||
PATH_SUFFIXES tools
|
||||
PATHS
|
||||
ENV ANDROID_SDK
|
||||
DOC "Android SDK location"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# Now search default paths
|
||||
find_host_program(ANDROID_EXECUTABLE
|
||||
NAMES android.bat android
|
||||
PATH_SUFFIXES android-sdk-${ANDROID_SDK_OS}/tools
|
||||
android-sdk-${ANDROID_SDK_OS}_x86/tools
|
||||
android-sdk-${ANDROID_SDK_OS}_86/tools
|
||||
android-sdk/tools
|
||||
PATHS /opt
|
||||
"${HOME_ENV_PATH}/NVPACK"
|
||||
"$ENV{SystemDrive}/NVPACK"
|
||||
"${ProgramFiles_ENV_PATH}/Android"
|
||||
DOC "Android SDK location"
|
||||
)
|
||||
|
||||
if(ANDROID_EXECUTABLE)
|
||||
if(NOT ANDROID_SDK_DETECT_QUIET)
|
||||
message(STATUS "Found android tool: ${ANDROID_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH)
|
||||
|
||||
#read source.properties
|
||||
if(EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties")
|
||||
file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$")
|
||||
foreach(line ${ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES})
|
||||
string(REPLACE "\\:" ":" line ${line})
|
||||
string(REPLACE "=" ";" line ${line})
|
||||
list(GET line 0 line_name)
|
||||
list(GET line 1 line_value)
|
||||
string(REPLACE "." "_" line_name ${line_name})
|
||||
SET(ANDROID_TOOLS_${line_name} "${line_value}" CACHE INTERNAL "from ${ANDROID_SDK_TOOLS_PATH}/source.properties")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_${line_name})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
#fix missing revision (SDK tools before r9 don't set revision number correctly)
|
||||
if(NOT ANDROID_TOOLS_Pkg_Revision)
|
||||
SET(ANDROID_TOOLS_Pkg_Revision "Unknown" CACHE INTERNAL "")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Revision)
|
||||
endif()
|
||||
|
||||
#fix missing description
|
||||
if(NOT ANDROID_TOOLS_Pkg_Desc)
|
||||
SET(ANDROID_TOOLS_Pkg_Desc "Android SDK Tools, revision ${ANDROID_TOOLS_Pkg_Revision}." CACHE INTERNAL "")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Desc)
|
||||
endif()
|
||||
|
||||
#warn about outdated SDK
|
||||
if(NOT ANDROID_TOOLS_Pkg_Revision GREATER 13)
|
||||
SET(ANDROID_TOOLS_Pkg_Desc "${ANDROID_TOOLS_Pkg_Desc} It is recommended to update your SDK tools to revision 14 or newer." CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 13)
|
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE project.properties)
|
||||
SET(ANDROID_ANT_PROPERTIES_FILE ant.properties)
|
||||
else()
|
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE default.properties)
|
||||
SET(ANDROID_ANT_PROPERTIES_FILE build.properties)
|
||||
endif()
|
||||
|
||||
set(ANDROID_MANIFEST_FILE AndroidManifest.xml)
|
||||
set(ANDROID_LIB_PROJECT_FILES build.xml local.properties proguard-project.txt ${ANDROID_PROJECT_PROPERTIES_FILE})
|
||||
set(ANDROID_PROJECT_FILES ${ANDROID_LIB_PROJECT_FILES})
|
||||
|
||||
#get installed targets
|
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 11)
|
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target -c
|
||||
RESULT_VARIABLE ANDROID_PROCESS
|
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS
|
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCHALL "[^\n]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}")
|
||||
else()
|
||||
#old SDKs (r11 and older) don't provide compact list
|
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target
|
||||
RESULT_VARIABLE ANDROID_PROCESS
|
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS_FULL
|
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCHALL "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" ANDROID_SDK_TARGETS_FULL "${ANDROID_SDK_TARGETS_FULL}")
|
||||
|
||||
SET(ANDROID_SDK_TARGETS "")
|
||||
if(ANDROID_PROCESS EQUAL 0)
|
||||
foreach(line ${ANDROID_SDK_TARGETS_FULL})
|
||||
string(REGEX REPLACE "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" "\\2" line "${line}")
|
||||
list(APPEND ANDROID_SDK_TARGETS "${line}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_PROCESS EQUAL 0)
|
||||
message(ERROR "Failed to get list of installed Android targets.")
|
||||
set(ANDROID_EXECUTABLE "ANDROID_EXECUTABLE-NOTFOUND")
|
||||
endif()
|
||||
|
||||
# clear ANDROID_SDK_TARGET if no target is provided by user
|
||||
if(NOT ANDROID_SDK_TARGET)
|
||||
set(ANDROID_SDK_TARGET "" CACHE STRING "Android SDK target for the OpenCV Java API and samples")
|
||||
endif()
|
||||
if(ANDROID_SDK_TARGETS)
|
||||
set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} )
|
||||
endif()
|
||||
endif(ANDROID_EXECUTABLE)
|
||||
|
||||
# finds minimal installed SDK target compatible with provided names or API levels
|
||||
# usage:
|
||||
# get_compatible_android_api_level(VARIABLE [level1] [level2] ...)
|
||||
macro(android_get_compatible_target VAR)
|
||||
set(${VAR} "${VAR}-NOTFOUND")
|
||||
if(ANDROID_SDK_TARGETS)
|
||||
list(GET ANDROID_SDK_TARGETS 0 __lvl)
|
||||
string(REGEX MATCH "[0-9]+$" __lvl "${__lvl}")
|
||||
|
||||
#find minimal level mathing to all provided levels
|
||||
foreach(lvl ${ARGN})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level GREATER __lvl)
|
||||
set(__lvl ${__level})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#search for compatible levels
|
||||
foreach(lvl ${ANDROID_SDK_TARGETS})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level EQUAL __lvl)
|
||||
#look for exact match
|
||||
foreach(usrlvl ${ARGN})
|
||||
if("${usrlvl}" STREQUAL "${lvl}")
|
||||
set(${VAR} "${lvl}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if("${${VAR}}" STREQUAL "${lvl}")
|
||||
break() #exact match was found
|
||||
elseif(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
elseif(__level GREATER __lvl)
|
||||
if(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(__lvl)
|
||||
unset(__level)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
unset(__android_project_chain CACHE)
|
||||
|
||||
# add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11)
|
||||
macro(add_android_project target path)
|
||||
# parse arguments
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA IGNORE_MANIFEST COPY_LIBS)
|
||||
set(__varname "android_proj_")
|
||||
foreach(v ${android_proj_arglist})
|
||||
set(${__varname}${v} "")
|
||||
endforeach()
|
||||
foreach(arg ${ARGN})
|
||||
set(__var "${__varname}")
|
||||
foreach(v ${android_proj_arglist})
|
||||
if("${v}" STREQUAL "${arg}")
|
||||
set(__varname "android_proj_${v}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(__var STREQUAL __varname)
|
||||
list(APPEND ${__var} "${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# get compatible SDK target
|
||||
android_get_compatible_target(android_proj_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET})
|
||||
|
||||
if(NOT android_proj_sdk_target)
|
||||
message(WARNING "Can not find any SDK target compatible with: ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET}
|
||||
The project ${target} will not be build")
|
||||
endif()
|
||||
|
||||
# check native dependencies
|
||||
if(android_proj_IGNORE_JAVA)
|
||||
ocv_check_dependencies(${android_proj_NATIVE_DEPS})
|
||||
else()
|
||||
ocv_check_dependencies(${android_proj_NATIVE_DEPS} opencv_java)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${path}/jni/Android.mk" )
|
||||
# find if native_app_glue is used
|
||||
file(STRINGS "${path}/jni/Android.mk" NATIVE_APP_GLUE REGEX ".*(call import-module,android/native_app_glue)" )
|
||||
if(NATIVE_APP_GLUE)
|
||||
if(ANDROID_NATIVE_API_LEVEL LESS 9 OR NOT EXISTS "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
set(OCV_DEPENDENCIES_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND AND android_proj_sdk_target AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND ANDROID_TOOLS_Pkg_Revision GREATER 13 AND EXISTS "${path}/${ANDROID_MANIFEST_FILE}")
|
||||
|
||||
project(${target})
|
||||
set(android_proj_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
|
||||
|
||||
# get project sources
|
||||
file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*")
|
||||
|
||||
if(NOT android_proj_IGNORE_MANIFEST)
|
||||
list(APPEND android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
endif()
|
||||
|
||||
# copy sources out from the build tree
|
||||
set(android_proj_file_deps "")
|
||||
foreach(f ${android_proj_files})
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/${f}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${path}/${f}" "${android_proj_bin_dir}/${f}"
|
||||
MAIN_DEPENDENCY "${path}/${f}"
|
||||
COMMENT "Copying ${f}")
|
||||
list(APPEND android_proj_file_deps "${path}/${f}" "${android_proj_bin_dir}/${f}")
|
||||
endforeach()
|
||||
|
||||
set(android_proj_lib_deps_commands "")
|
||||
set(android_proj_target_files ${ANDROID_PROJECT_FILES})
|
||||
ocv_list_add_prefix(android_proj_target_files "${android_proj_bin_dir}/")
|
||||
|
||||
# process Android library dependencies
|
||||
foreach(dep ${android_proj_LIBRARY_DEPS})
|
||||
file(RELATIVE_PATH __dep "${android_proj_bin_dir}" "${dep}")
|
||||
list(APPEND android_proj_lib_deps_commands
|
||||
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${android_proj_bin_dir}" --library "${__dep}")
|
||||
endforeach()
|
||||
|
||||
# fix Android project
|
||||
add_custom_command(
|
||||
OUTPUT ${android_proj_target_files}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${android_proj_target_files}
|
||||
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${android_proj_bin_dir}" --target "${android_proj_sdk_target}" --name "${target}"
|
||||
${android_proj_lib_deps_commands}
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS "${path}/${ANDROID_MANIFEST_FILE}"
|
||||
COMMENT "Updating Android project at ${path}. SDK target: ${android_proj_sdk_target}"
|
||||
)
|
||||
|
||||
list(APPEND android_proj_file_deps ${android_proj_target_files})
|
||||
|
||||
# build native part
|
||||
file(GLOB_RECURSE android_proj_jni_files "${path}/jni/*.c" "${path}/jni/*.h" "${path}/jni/*.cpp" "${path}/jni/*.hpp")
|
||||
ocv_list_filterout(android_proj_jni_files "\\\\.svn")
|
||||
|
||||
if(android_proj_jni_files AND EXISTS ${path}/jni/Android.mk AND NOT DEFINED JNI_LIB_NAME)
|
||||
# find local module name in Android.mk file to build native lib
|
||||
file(STRINGS "${path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" )
|
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}")
|
||||
|
||||
if(JNI_LIB_NAME)
|
||||
if(NATIVE_APP_GLUE)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes)
|
||||
set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android)
|
||||
endif()
|
||||
|
||||
add_library(${JNI_LIB_NAME} MODULE ${android_proj_jni_files})
|
||||
ocv_target_include_modules_recurse(${JNI_LIB_NAME} ${android_proj_NATIVE_DEPS})
|
||||
ocv_target_include_directories(${JNI_LIB_NAME} "${path}/jni")
|
||||
ocv_target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES
|
||||
OUTPUT_NAME "${JNI_LIB_NAME}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}"
|
||||
)
|
||||
|
||||
get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
|
||||
if (NOT (CMAKE_BUILD_TYPE MATCHES "debug"))
|
||||
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# build java part
|
||||
if(android_proj_IGNORE_JAVA)
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS "${OpenCV_BINARY_DIR}/bin/classes.jar.dephelper" opencv_java # as we are part of OpenCV we can just force this dependency
|
||||
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
|
||||
endif()
|
||||
|
||||
unset(JNI_LIB_NAME)
|
||||
|
||||
add_custom_target(${target} ALL SOURCES "${android_proj_bin_dir}/bin/${target}-debug.apk" )
|
||||
if(NOT android_proj_IGNORE_JAVA)
|
||||
add_dependencies(${target} opencv_java)
|
||||
endif()
|
||||
if(android_proj_native_deps)
|
||||
add_dependencies(${target} ${android_proj_native_deps})
|
||||
endif()
|
||||
|
||||
if (android_proj_COPY_LIBS OR ANDROID_EXAMPLES_WITH_LIBS)
|
||||
message(STATUS "Android project with libs: " ${target})
|
||||
add_custom_target(
|
||||
${target}_copy_libs
|
||||
COMMAND ${CMAKE_COMMAND} -DSRC_DIR=${OpenCV_BINARY_DIR}/lib -DDST_DIR=${android_proj_bin_dir}/libs -P ${OpenCV_SOURCE_DIR}/cmake/copyAndroidLibs.cmake
|
||||
WORKING_DIRECTORY ${OpenCV_BINARY_DIR}/lib
|
||||
)
|
||||
add_dependencies(${target} ${target}_copy_libs)
|
||||
if (ANDROID_EXAMPLES_WITH_LIBS)
|
||||
add_dependencies(${target}_copy_libs "${OpenCV_BINARY_DIR}/bin/classes.jar.dephelper" opencv_java)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(__android_project_chain)
|
||||
add_dependencies(${target} ${__android_project_chain})
|
||||
endif()
|
||||
set(__android_project_chain ${target} CACHE INTERNAL "auxiliary variable used for Android progects chaining")
|
||||
|
||||
# put the final .apk to the OpenCV's bin folder
|
||||
add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${android_proj_bin_dir}/bin/${target}-debug.apk" "${OpenCV_BINARY_DIR}/bin/${target}.apk")
|
||||
if(INSTALL_ANDROID_EXAMPLES AND "${target}" MATCHES "^example-")
|
||||
#apk
|
||||
install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT samples)
|
||||
get_filename_component(sample_dir "${path}" NAME)
|
||||
#java part
|
||||
list(REMOVE_ITEM android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT samples)
|
||||
endforeach()
|
||||
#jni part + eclipse files
|
||||
file(GLOB_RECURSE jni_files RELATIVE "${path}" "${path}/jni/*" "${path}/.cproject")
|
||||
ocv_list_filterout(jni_files "\\\\.svn")
|
||||
foreach(f ${jni_files} ".classpath" ".project" ".settings/org.eclipse.jdt.core.prefs")
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${path}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT samples)
|
||||
endforeach()
|
||||
#update proj
|
||||
if(android_proj_lib_deps_commands)
|
||||
set(inst_lib_opt " --library ../../sdk/java")
|
||||
endif()
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt}
|
||||
WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\"
|
||||
)" COMPONENT samples)
|
||||
#empty 'gen'
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT samples)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,31 @@
|
||||
file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH)
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(ANT_NAME ant.bat)
|
||||
else()
|
||||
set(ANT_NAME ant)
|
||||
endif()
|
||||
|
||||
find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME}
|
||||
PATHS "${ANT_DIR_ENV_PATH}/bin" "${ProgramFiles_ENV_PATH}/apache-ant/bin"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME})
|
||||
|
||||
if(ANT_EXECUTABLE)
|
||||
execute_process(COMMAND ${ANT_EXECUTABLE} -version
|
||||
RESULT_VARIABLE ANT_ERROR_LEVEL
|
||||
OUTPUT_VARIABLE ANT_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (ANT_ERROR_LEVEL)
|
||||
unset(ANT_EXECUTABLE)
|
||||
unset(ANT_EXECUTABLE CACHE)
|
||||
else()
|
||||
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}")
|
||||
set(ANT_VERSION "${ANT_VERSION}" CACHE INTERNAL "Detected ant vesion")
|
||||
|
||||
message(STATUS "Found apache ant ${ANT_VERSION}: ${ANT_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,11 @@
|
||||
if(WIN32)
|
||||
find_path( CSTRIPES_LIB_DIR
|
||||
NAMES "С=.lib"
|
||||
DOC "The path to C= lib and dll")
|
||||
if(CSTRIPES_LIB_DIR)
|
||||
ocv_include_directories("${CSTRIPES_LIB_DIR}/..")
|
||||
link_directories("${CSTRIPES_LIB_DIR}")
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} "C=")
|
||||
set(HAVE_CSTRIPES 1)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,257 @@
|
||||
if(WIN32 AND NOT MSVC)
|
||||
message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(STATUS "CUDA compilation is disabled (due to Clang unsupported on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${OpenCV_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
if(ANDROID)
|
||||
set(CUDA_TARGET_OS_VARIANT "Android")
|
||||
endif()
|
||||
find_host_package(CUDA "${MIN_VER_CUDA}" QUIET)
|
||||
|
||||
list(REMOVE_AT CMAKE_MODULE_PATH 0)
|
||||
|
||||
if(CUDA_FOUND)
|
||||
set(HAVE_CUDA 1)
|
||||
|
||||
if(WITH_CUFFT)
|
||||
set(HAVE_CUFFT 1)
|
||||
endif()
|
||||
|
||||
if(WITH_CUBLAS)
|
||||
set(HAVE_CUBLAS 1)
|
||||
endif()
|
||||
|
||||
if(WITH_NVCUVID)
|
||||
find_cuda_helper_libs(nvcuvid)
|
||||
if(WIN32)
|
||||
find_cuda_helper_libs(nvcuvenc)
|
||||
endif()
|
||||
set(HAVE_NVCUVID 1)
|
||||
endif()
|
||||
|
||||
message(STATUS "CUDA detected: " ${CUDA_VERSION})
|
||||
|
||||
set(_generations "Fermi" "Kepler")
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
list(APPEND _generations "Auto")
|
||||
endif()
|
||||
set(CUDA_GENERATION "" CACHE STRING "Build CUDA device code only for specific GPU architecture. Leave empty to build for all architectures.")
|
||||
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
||||
set_property( CACHE CUDA_GENERATION PROPERTY STRINGS "" ${_generations} )
|
||||
endif()
|
||||
|
||||
if(CUDA_GENERATION)
|
||||
if(NOT ";${_generations};" MATCHES ";${CUDA_GENERATION};")
|
||||
string(REPLACE ";" ", " _generations "${_generations}")
|
||||
message(FATAL_ERROR "ERROR: ${_generations} Generations are suppered.")
|
||||
endif()
|
||||
unset(CUDA_ARCH_BIN CACHE)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
endif()
|
||||
|
||||
set(__cuda_arch_ptx "")
|
||||
if(CUDA_GENERATION STREQUAL "Fermi")
|
||||
set(__cuda_arch_bin "2.0 2.1(2.0)")
|
||||
elseif(CUDA_GENERATION STREQUAL "Kepler")
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "3.0")
|
||||
else()
|
||||
set(__cuda_arch_bin "3.0 3.5")
|
||||
endif()
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
else()
|
||||
set(__cuda_arch_bin "${_nvcc_out}")
|
||||
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED __cuda_arch_bin)
|
||||
if(ANDROID)
|
||||
if(ARM)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
set(__cuda_arch_bin "5.3")
|
||||
set(__cuda_arch_ptx "")
|
||||
endif()
|
||||
else()
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
elseif(${CUDA_VERSION} VERSION_GREATER "6.5")
|
||||
set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5")
|
||||
else()
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
|
||||
endif()
|
||||
set(__cuda_arch_ptx "3.0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
|
||||
set(CUDA_ARCH_PTX ${__cuda_arch_ptx} CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")
|
||||
|
||||
string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")
|
||||
string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}")
|
||||
|
||||
# Ckeck if user specified 1.0 compute capability: we don't support it
|
||||
string(REGEX MATCH "1.0" HAS_ARCH_10 "${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}")
|
||||
set(CUDA_ARCH_BIN_OR_PTX_10 0)
|
||||
if(NOT ${HAS_ARCH_10} STREQUAL "")
|
||||
set(CUDA_ARCH_BIN_OR_PTX_10 1)
|
||||
endif()
|
||||
|
||||
# NVCC flags to be set
|
||||
set(NVCC_FLAGS_EXTRA "")
|
||||
|
||||
# These vars will be passed into the templates
|
||||
set(OPENCV_CUDA_ARCH_BIN "")
|
||||
set(OPENCV_CUDA_ARCH_PTX "")
|
||||
set(OPENCV_CUDA_ARCH_FEATURES "")
|
||||
|
||||
# Tell NVCC to add binaries for the specified GPUs
|
||||
string(REGEX MATCHALL "[0-9()]+" ARCH_LIST "${ARCH_BIN_NO_POINTS}")
|
||||
foreach(ARCH IN LISTS ARCH_LIST)
|
||||
if(ARCH MATCHES "([0-9]+)\\(([0-9]+)\\)")
|
||||
# User explicitly specified PTX for the concrete BIN
|
||||
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1})
|
||||
set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${CMAKE_MATCH_1}")
|
||||
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${CMAKE_MATCH_2}")
|
||||
else()
|
||||
# User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN
|
||||
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=sm_${ARCH})
|
||||
set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${ARCH}")
|
||||
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Tell NVCC to add PTX intermediate code for the specified architectures
|
||||
string(REGEX MATCHALL "[0-9]+" ARCH_LIST "${ARCH_PTX_NO_POINTS}")
|
||||
foreach(ARCH IN LISTS ARCH_LIST)
|
||||
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH})
|
||||
set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}")
|
||||
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")
|
||||
endforeach()
|
||||
|
||||
# These vars will be processed in other scripts
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA})
|
||||
set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}")
|
||||
|
||||
if(ANDROID)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xptxas;-dlcm=ca")
|
||||
endif()
|
||||
|
||||
message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}")
|
||||
|
||||
OCV_OPTION(CUDA_FAST_MATH "Enable --use_fast_math for CUDA compiler " OFF)
|
||||
|
||||
if(CUDA_FAST_MATH)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --use_fast_math)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_VERBOSE_BUILD CUDA_SDK_ROOT_DIR)
|
||||
|
||||
macro(ocv_cuda_compile VAR)
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
set(${var}_backup_in_cuda_compile_ "${${var}}")
|
||||
|
||||
# we remove /EHa as it generates warnings under windows
|
||||
string(REPLACE "/EHa" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
|
||||
string(REPLACE "-ggdb3" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wsign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wno-sign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wno-sign-promo" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler
|
||||
# but NVCC uses C compiler by default
|
||||
string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -frtti because it's used for C++ compiler
|
||||
# but NVCC uses C compiler by default
|
||||
string(REPLACE "-frtti" "" ${var} "${${var}}")
|
||||
|
||||
string(REPLACE "-fvisibility-inlines-hidden" "" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -DCVAPI_EXPORTS)
|
||||
endif()
|
||||
|
||||
if(UNIX OR APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
|
||||
endif()
|
||||
|
||||
# disabled because of multiple warnings during building nvcc auto generated files
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GCC_REGEX_VERSION VERSION_GREATER "4.6.0")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
|
||||
endif()
|
||||
|
||||
CUDA_COMPILE(${VAR} ${ARGN})
|
||||
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
set(${var} "${${var}_backup_in_cuda_compile_}")
|
||||
unset(${var}_backup_in_cuda_compile_)
|
||||
endforeach()
|
||||
endmacro()
|
||||
else()
|
||||
unset(CUDA_ARCH_BIN CACHE)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA)
|
||||
set(CUDA_LIBS_PATH "")
|
||||
foreach(p ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
|
||||
if(HAVE_CUBLAS)
|
||||
foreach(p ${CUDA_cublas_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
foreach(p ${CUDA_cufft_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES CUDA_LIBS_PATH)
|
||||
link_directories(${CUDA_LIBS_PATH})
|
||||
|
||||
set(CUDA_LIBRARIES_ABS ${CUDA_LIBRARIES})
|
||||
ocv_convert_to_lib_name(CUDA_LIBRARIES ${CUDA_LIBRARIES})
|
||||
set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
|
||||
if(HAVE_CUBLAS)
|
||||
set(CUDA_cublas_LIBRARY_ABS ${CUDA_cublas_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,157 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect Microsoft compiler:
|
||||
# ----------------------------------------------------------------------------
|
||||
if(CMAKE_CL_64)
|
||||
set(MSVC64 1)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
set(CMAKE_COMPILER_IS_CLANGCXX 1)
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
set(CMAKE_COMPILER_IS_CLANGCC 1)
|
||||
endif()
|
||||
|
||||
if((CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC) AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
|
||||
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
|
||||
# NOTE: The system needs to determine if the '-fPIC' option needs to be added
|
||||
# for the 3rdparty static libs being compiled. The CMakeLists.txt files
|
||||
# in 3rdparty use the CV_ICC definition being set here to determine if
|
||||
# the -fPIC flag should be used.
|
||||
# ----------------------------------------------------------------------------
|
||||
if(UNIX)
|
||||
if (__ICL)
|
||||
set(CV_ICC __ICL)
|
||||
elseif(__ICC)
|
||||
set(CV_ICC __ICC)
|
||||
elseif(__ECL)
|
||||
set(CV_ICC __ECL)
|
||||
elseif(__ECC)
|
||||
set(CV_ICC __ECC)
|
||||
elseif(__INTEL_COMPILER)
|
||||
set(CV_ICC __INTEL_COMPILER)
|
||||
elseif(CMAKE_C_COMPILER MATCHES "icc")
|
||||
set(CV_ICC icc_matches_c_compiler)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC AND CMAKE_C_COMPILER MATCHES "icc")
|
||||
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect GNU version:
|
||||
# ----------------------------------------------------------------------------
|
||||
if(CMAKE_COMPILER_IS_CLANGCXX)
|
||||
set(CMAKE_GCC_REGEX_VERSION "4.2.1")
|
||||
set(CMAKE_OPENCV_GCC_VERSION_MAJOR 4)
|
||||
set(CMAKE_OPENCV_GCC_VERSION_MINOR 2)
|
||||
set(CMAKE_OPENCV_GCC_VERSION 42)
|
||||
set(CMAKE_OPENCV_GCC_VERSION_NUM 402)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v
|
||||
ERROR_VARIABLE CMAKE_OPENCV_CLANG_VERSION_FULL
|
||||
ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
string(REGEX MATCH "version.*$" CMAKE_OPENCV_CLANG_VERSION_FULL "${CMAKE_OPENCV_CLANG_VERSION_FULL}")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_CLANG_REGEX_VERSION "${CMAKE_OPENCV_CLANG_VERSION_FULL}")
|
||||
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v
|
||||
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"
|
||||
# Look for the version number
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
|
||||
if(NOT CMAKE_GCC_REGEX_VERSION)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
|
||||
endif()
|
||||
|
||||
# Split the three parts:
|
||||
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
|
||||
|
||||
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)
|
||||
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)
|
||||
|
||||
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
|
||||
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
|
||||
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
|
||||
|
||||
if(WIN32)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
set(MINGW64 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC64 OR MINGW64)
|
||||
set(X86_64 1)
|
||||
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
|
||||
set(X86 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
|
||||
set(X86_64 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
|
||||
set(X86 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
|
||||
set(ARM 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
|
||||
set(AARCH64 1)
|
||||
endif()
|
||||
|
||||
|
||||
# Similar code exists in OpenCVConfig.cmake
|
||||
if(NOT DEFINED OpenCV_STATIC)
|
||||
# look for global setting
|
||||
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
|
||||
set(OpenCV_STATIC OFF)
|
||||
else()
|
||||
set(OpenCV_STATIC ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
|
||||
# see Modules/CmakeGenericSystem.cmake
|
||||
set(OpenCV_ARCH ARM)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
endif()
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
set(OpenCV_RUNTIME vc8)
|
||||
elseif(MSVC_VERSION EQUAL 1500)
|
||||
set(OpenCV_RUNTIME vc9)
|
||||
elseif(MSVC_VERSION EQUAL 1600)
|
||||
set(OpenCV_RUNTIME vc10)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
if(MINGW64)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,14 @@
|
||||
if(WIN32)
|
||||
try_compile(__VALID_DIRECTX
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/directx.cpp"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT __VALID_DIRECTX)
|
||||
return()
|
||||
endif()
|
||||
set(HAVE_DIRECTX ON)
|
||||
set(HAVE_D3D11 ON)
|
||||
set(HAVE_D3D10 ON)
|
||||
set(HAVE_D3D9 ON)
|
||||
endif()
|
||||
@@ -0,0 +1,87 @@
|
||||
if(APPLE)
|
||||
set(OPENCL_FOUND YES)
|
||||
set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
|
||||
set(OPENCL_INCLUDE_DIR "" CACHE STRING "OpenCL include directory")
|
||||
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
|
||||
set(HAVE_OPENCL_STATIC ON)
|
||||
else(APPLE)
|
||||
set(OPENCL_FOUND YES)
|
||||
set(HAVE_OPENCL_STATIC OFF)
|
||||
set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2")
|
||||
endif(APPLE)
|
||||
|
||||
if(WINRT)
|
||||
set(OPENCL_FOUND NO)
|
||||
set(HAVE_OPENCL_STATIC OFF)
|
||||
endif(WINRT)
|
||||
|
||||
if(OPENCL_FOUND)
|
||||
if(NOT HAVE_OPENCL_STATIC)
|
||||
try_compile(__VALID_OPENCL
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/opencl.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OPENCL_INCLUDE_DIR}"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT TRY_OUT MATCHES "OpenCL is valid")
|
||||
message(WARNING "Can't use OpenCL")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT WINRT)
|
||||
set(HAVE_OPENCL 1)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCL_SVM)
|
||||
set(HAVE_OPENCL_SVM 1)
|
||||
endif()
|
||||
|
||||
if(HAVE_OPENCL_STATIC)
|
||||
set(OPENCL_LIBRARIES "${OPENCL_LIBRARY}")
|
||||
else()
|
||||
unset(OPENCL_LIBRARIES)
|
||||
endif()
|
||||
|
||||
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
|
||||
|
||||
if(WITH_OPENCLAMDFFT)
|
||||
find_path(CLAMDFFT_ROOT_DIR
|
||||
NAMES include/clAmdFft.h
|
||||
PATHS ENV CLAMDFFT_PATH ENV ProgramFiles
|
||||
PATH_SUFFIXES clAmdFft AMD/clAmdFft
|
||||
DOC "AMD FFT root directory"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(CLAMDFFT_INCLUDE_DIR
|
||||
NAMES clAmdFft.h
|
||||
HINTS ${CLAMDFFT_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "clAmdFft include directory")
|
||||
|
||||
if(CLAMDFFT_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDFFT 1)
|
||||
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDFFT_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCLAMDBLAS)
|
||||
find_path(CLAMDBLAS_ROOT_DIR
|
||||
NAMES include/clAmdBlas.h
|
||||
PATHS ENV CLAMDBLAS_PATH ENV ProgramFiles
|
||||
PATH_SUFFIXES clAmdBlas AMD/clAmdBlas
|
||||
DOC "AMD FFT root directory"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(CLAMDBLAS_INCLUDE_DIR
|
||||
NAMES clAmdBlas.h
|
||||
HINTS ${CLAMDBLAS_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "clAmdFft include directory")
|
||||
|
||||
if(CLAMDBLAS_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDBLAS 1)
|
||||
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDBLAS_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,239 @@
|
||||
# Find specified Python version
|
||||
# Arguments:
|
||||
# preferred_version (value): Version to check for first
|
||||
# min_version (value): Minimum supported version
|
||||
# library_env (value): Name of Python library ENV variable to check
|
||||
# include_dir_env (value): Name of Python include directory ENV variable to check
|
||||
# found (variable): Set if interpreter found
|
||||
# executable (variable): Output of executable found
|
||||
# version_string (variable): Output of found version
|
||||
# version_major (variable): Output of found major version
|
||||
# version_minor (variable): Output of found minor version
|
||||
# libs_found (variable): Set if libs found
|
||||
# libs_version_string (variable): Output of found libs version
|
||||
# libraries (variable): Output of found Python libraries
|
||||
# library (variable): Output of found Python library
|
||||
# debug_libraries (variable): Output of found Python debug libraries
|
||||
# debug_library (variable): Output of found Python debug library
|
||||
# include_path (variable): Output of found Python include path
|
||||
# include_dir (variable): Output of found Python include dir
|
||||
# include_dir2 (variable): Output of found Python include dir2
|
||||
# packages_path (variable): Output of found Python packages path
|
||||
# numpy_include_dirs (variable): Output of found Python Numpy include dirs
|
||||
# numpy_version (variable): Output of found Python Numpy version
|
||||
function(find_python preferred_version min_version library_env include_dir_env
|
||||
found executable version_string version_major version_minor
|
||||
libs_found libs_version_string libraries library debug_libraries
|
||||
debug_library include_path include_dir include_dir2 packages_path
|
||||
numpy_include_dirs numpy_version)
|
||||
|
||||
ocv_check_environment_variables(${executable})
|
||||
if(${executable})
|
||||
set(PYTHON_EXECUTABLE "${${executable}}")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT ${executable})
|
||||
# search for executable with the same bitness as resulting binaries
|
||||
# standard FindPythonInterp always prefers executable from system path
|
||||
# this is really important because we are using the interpreter for numpy search and for choosing the install location
|
||||
foreach(_CURRENT_VERSION ${Python_ADDITIONAL_VERSIONS} "${preferred_version}" "${min_version}")
|
||||
find_host_program(PYTHON_EXECUTABLE
|
||||
NAMES python${_CURRENT_VERSION} python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\${_CURRENT_VERSION}\\\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\${_CURRENT_VERSION}\\\\InstallPath]
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_host_package(PythonInterp "${preferred_version}")
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
find_host_package(PythonInterp "${min_version}")
|
||||
endif()
|
||||
|
||||
if(PYTHONINTERP_FOUND)
|
||||
# Copy outputs
|
||||
set(_found ${PYTHONINTERP_FOUND})
|
||||
set(_executable ${PYTHON_EXECUTABLE})
|
||||
set(_version_string ${PYTHON_VERSION_STRING})
|
||||
set(_version_major ${PYTHON_VERSION_MAJOR})
|
||||
set(_version_minor ${PYTHON_VERSION_MINOR})
|
||||
set(_version_patch ${PYTHON_VERSION_PATCH})
|
||||
|
||||
# Clear find_host_package side effects
|
||||
unset(PYTHONINTERP_FOUND)
|
||||
unset(PYTHON_EXECUTABLE CACHE)
|
||||
unset(PYTHON_VERSION_STRING)
|
||||
unset(PYTHON_VERSION_MAJOR)
|
||||
unset(PYTHON_VERSION_MINOR)
|
||||
unset(PYTHON_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
if(_found)
|
||||
set(_version_major_minor "${_version_major}.${_version_minor}")
|
||||
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
ocv_check_environment_variables(${library_env} ${include_dir_env})
|
||||
if(NOT ${${library_env}} EQUAL "")
|
||||
set(PYTHON_LIBRARY "${${library_env}}")
|
||||
endif()
|
||||
if(NOT ${${include_dir_env}} EQUAL "")
|
||||
set(PYTHON_INCLUDE_DIR "${${include_dir_env}}")
|
||||
endif()
|
||||
|
||||
# not using _version_string here, because it might not conform to the CMake version format
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
# builder version can differ from target, matching base version (e.g. 2.7)
|
||||
find_host_package(PythonLibs "${_version_major_minor}")
|
||||
else()
|
||||
find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}" EXACT)
|
||||
endif()
|
||||
|
||||
if(PYTHONLIBS_FOUND)
|
||||
# Copy outputs
|
||||
set(_libs_found ${PYTHONLIBS_FOUND})
|
||||
set(_libraries ${PYTHON_LIBRARIES})
|
||||
set(_include_path ${PYTHON_INCLUDE_PATH})
|
||||
set(_include_dirs ${PYTHON_INCLUDE_DIRS})
|
||||
set(_debug_libraries ${PYTHON_DEBUG_LIBRARIES})
|
||||
set(_libs_version_string ${PYTHONLIBS_VERSION_STRING})
|
||||
set(_debug_library ${PYTHON_DEBUG_LIBRARY})
|
||||
set(_library ${PYTHON_LIBRARY})
|
||||
set(_library_debug ${PYTHON_LIBRARY_DEBUG})
|
||||
set(_library_release ${PYTHON_LIBRARY_RELEASE})
|
||||
set(_include_dir ${PYTHON_INCLUDE_DIR})
|
||||
set(_include_dir2 ${PYTHON_INCLUDE_DIR2})
|
||||
|
||||
# Clear find_host_package side effects
|
||||
unset(PYTHONLIBS_FOUND)
|
||||
unset(PYTHON_LIBRARIES)
|
||||
unset(PYTHON_INCLUDE_PATH)
|
||||
unset(PYTHON_INCLUDE_DIRS)
|
||||
unset(PYTHON_DEBUG_LIBRARIES)
|
||||
unset(PYTHONLIBS_VERSION_STRING)
|
||||
unset(PYTHON_DEBUG_LIBRARY CACHE)
|
||||
unset(PYTHON_LIBRARY)
|
||||
unset(PYTHON_LIBRARY_DEBUG)
|
||||
unset(PYTHON_LIBRARY_RELEASE)
|
||||
unset(PYTHON_LIBRARY CACHE)
|
||||
unset(PYTHON_LIBRARY_DEBUG CACHE)
|
||||
unset(PYTHON_LIBRARY_RELEASE CACHE)
|
||||
unset(PYTHON_INCLUDE_DIR CACHE)
|
||||
unset(PYTHON_INCLUDE_DIR2 CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
if(CMAKE_HOST_UNIX)
|
||||
execute_process(COMMAND ${_executable} -c "from distutils.sysconfig import *; print(get_python_lib())"
|
||||
RESULT_VARIABLE _cvpy_process
|
||||
OUTPUT_VARIABLE _std_packages_path
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if("${_std_packages_path}" MATCHES "site-packages")
|
||||
set(_packages_path "python${_version_major_minor}/site-packages")
|
||||
else() #debian based assumed, install to the dist-packages.
|
||||
set(_packages_path "python${_version_major_minor}/dist-packages")
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
|
||||
set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
|
||||
else()
|
||||
set(_packages_path "lib/${_packages_path}")
|
||||
endif()
|
||||
elseif(CMAKE_HOST_WIN32)
|
||||
get_filename_component(_path "${_executable}" PATH)
|
||||
file(TO_CMAKE_PATH "${_path}" _path)
|
||||
if(NOT EXISTS "${_path}/Lib/site-packages")
|
||||
unset(_path)
|
||||
get_filename_component(_path "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_version_major_minor}\\InstallPath]" ABSOLUTE)
|
||||
if(NOT _path)
|
||||
get_filename_component(_path "[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_version_major_minor}\\InstallPath]" ABSOLUTE)
|
||||
endif()
|
||||
file(TO_CMAKE_PATH "${_path}" _path)
|
||||
endif()
|
||||
set(_packages_path "${_path}/Lib/site-packages")
|
||||
unset(_path)
|
||||
endif()
|
||||
|
||||
set(_numpy_include_dirs ${${numpy_include_dirs}})
|
||||
|
||||
if(NOT _numpy_include_dirs)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
message(STATUS "Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)")
|
||||
message(STATUS "If you want to enable Python/Numpy support, set the following variables:")
|
||||
message(STATUS " PYTHON2_INCLUDE_PATH")
|
||||
message(STATUS " PYTHON2_LIBRARIES")
|
||||
message(STATUS " PYTHON2_NUMPY_INCLUDE_DIRS")
|
||||
message(STATUS " PYTHON3_INCLUDE_PATH")
|
||||
message(STATUS " PYTHON3_LIBRARIES")
|
||||
message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS")
|
||||
else()
|
||||
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
|
||||
execute_process(COMMAND "${_executable}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
|
||||
RESULT_VARIABLE _numpy_process
|
||||
OUTPUT_VARIABLE _numpy_include_dirs
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT _numpy_process EQUAL 0)
|
||||
unset(_numpy_include_dirs)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(_numpy_include_dirs)
|
||||
file(TO_CMAKE_PATH "${_numpy_include_dirs}" _numpy_include_dirs)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(NOT _numpy_version)
|
||||
set(_numpy_version "undefined - cannot be probed because of the cross-compilation")
|
||||
endif()
|
||||
else()
|
||||
execute_process(COMMAND "${_executable}" -c "import numpy; print(numpy.version.version)"
|
||||
RESULT_VARIABLE _numpy_process
|
||||
OUTPUT_VARIABLE _numpy_version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
endif()
|
||||
endif(NOT ANDROID AND NOT IOS)
|
||||
endif()
|
||||
|
||||
# Export return values
|
||||
set(${found} "${_found}" PARENT_SCOPE)
|
||||
set(${executable} "${_executable}" CACHE FILEPATH "Path to Python interpretor")
|
||||
set(${version_string} "${_version_string}" PARENT_SCOPE)
|
||||
set(${version_major} "${_version_major}" PARENT_SCOPE)
|
||||
set(${version_minor} "${_version_minor}" PARENT_SCOPE)
|
||||
set(${libs_found} "${_libs_found}" PARENT_SCOPE)
|
||||
set(${libs_version_string} "${_libs_version_string}" PARENT_SCOPE)
|
||||
set(${libraries} "${_libraries}" PARENT_SCOPE)
|
||||
set(${library} "${_library}" CACHE FILEPATH "Path to Python library")
|
||||
set(${debug_libraries} "${_debug_libraries}" PARENT_SCOPE)
|
||||
set(${debug_library} "${_debug_library}" CACHE FILEPATH "Path to Python debug")
|
||||
set(${include_path} "${_include_path}" PARENT_SCOPE)
|
||||
set(${include_dir} "${_include_dir}" CACHE PATH "Python include dir")
|
||||
set(${include_dir2} "${_include_dir2}" CACHE PATH "Python include dir 2")
|
||||
set(${packages_path} "${_packages_path}" CACHE PATH "Where to install the python packages.")
|
||||
set(${numpy_include_dirs} ${_numpy_include_dirs} CACHE PATH "Path to numpy headers")
|
||||
set(${numpy_version} "${_numpy_version}" PARENT_SCOPE)
|
||||
endfunction(find_python)
|
||||
|
||||
find_python(2.7 "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
|
||||
PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
|
||||
PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
|
||||
PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
|
||||
PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
|
||||
PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
|
||||
PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
|
||||
|
||||
find_python(3.4 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
|
||||
PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
|
||||
PYTHON3_VERSION_MAJOR PYTHON3_VERSION_MINOR PYTHON3LIBS_FOUND
|
||||
PYTHON3LIBS_VERSION_STRING PYTHON3_LIBRARIES PYTHON3_LIBRARY
|
||||
PYTHON3_DEBUG_LIBRARIES PYTHON3_LIBRARY_DEBUG PYTHON3_INCLUDE_PATH
|
||||
PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH
|
||||
PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION)
|
||||
|
||||
# Use Python 2 as default Python interpreter
|
||||
if(PYTHON2INTERP_FOUND)
|
||||
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
|
||||
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
|
||||
endif()
|
||||
@@ -0,0 +1,92 @@
|
||||
if(BUILD_TBB)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
||||
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||
endif()
|
||||
set(HAVE_TBB 1)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
PKG_CHECK_MODULES(TBB tbb)
|
||||
|
||||
if(TBB_FOUND)
|
||||
set(HAVE_TBB 1)
|
||||
if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
|
||||
ocv_include_directories(${TBB_INCLUDE_DIRS})
|
||||
endif()
|
||||
link_directories(${TBB_LIBRARY_DIRS})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_TBB)
|
||||
set(TBB_DEFAULT_INCLUDE_DIRS
|
||||
"/opt/intel/tbb/include" "/usr/local/include" "/usr/include"
|
||||
"C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
|
||||
"C:/Program Files (x86)/tbb/include"
|
||||
"C:/Program Files (x86)/tbb/include"
|
||||
"${CMAKE_INSTALL_PREFIX}/include")
|
||||
|
||||
find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_INCLUDE_DIR} ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
|
||||
if(TBB_INCLUDE_DIRS)
|
||||
if(UNIX)
|
||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
||||
link_directories("${TBB_LIB_DIR}")
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
|
||||
elseif(ANDROID)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS)
|
||||
elseif (UNIX)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
elseif (WIN32)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
||||
link_directories("${TBB_LIB_DIR}")
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
else()
|
||||
get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIRS}/../lib" ABSOLUTE)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
|
||||
else()
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
|
||||
endif()
|
||||
|
||||
if(MSVC80)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
|
||||
elseif(MSVC90)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
|
||||
elseif(MSVC10)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
|
||||
elseif(MSVC11)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
|
||||
elseif(MSVC12)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc12")
|
||||
endif()
|
||||
set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
|
||||
link_directories("${TBB_LIB_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(HAVE_TBB 1)
|
||||
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
|
||||
ocv_include_directories("${TBB_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif(TBB_INCLUDE_DIRS)
|
||||
endif(NOT HAVE_TBB)
|
||||
|
||||
# get TBB version
|
||||
if(HAVE_TBB)
|
||||
find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
|
||||
mark_as_advanced(TBB _STDDEF_PATH)
|
||||
endif()
|
||||
if(HAVE_TBB AND TBB_STDDEF_PATH)
|
||||
ocv_parse_header("${TBB_STDDEF_PATH}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION)
|
||||
else()
|
||||
unset(TBB_VERSION_MAJOR)
|
||||
unset(TBB_VERSION_MINOR)
|
||||
unset(TBB_INTERFACE_VERSION)
|
||||
endif()
|
||||
@@ -0,0 +1,53 @@
|
||||
if(NOT WITH_VTK OR ANDROID OR IOS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# VTK 6.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
|
||||
# VTK 5.x components
|
||||
if(NOT VTK_FOUND)
|
||||
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE)
|
||||
endif()
|
||||
|
||||
if(NOT VTK_FOUND)
|
||||
set(HAVE_VTK OFF)
|
||||
message(STATUS "VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Don't support ealier VTKs
|
||||
if(${VTK_VERSION} VERSION_LESS "5.8.0")
|
||||
message(STATUS "VTK support is disabled. VTK ver. 5.8.0 is minimum required, but found VTK ver. ${VTK_VERSION}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_LESS "6.0.0")
|
||||
if(VTK_USE_QT)
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(HAVE_VTK ON)
|
||||
message(STATUS "Found VTK ver. ${VTK_VERSION} (usefile: ${VTK_USE_FILE})")
|
||||
@@ -0,0 +1,38 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Uninstall target, for "make uninstall"
|
||||
# ----------------------------------------------------------------------------
|
||||
CONFIGURE_FILE(
|
||||
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ONLY)
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(uninstall PROPERTIES FOLDER "CMakeTargets")
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# target building all OpenCV modules
|
||||
# ----------------------------------------------------------------------------
|
||||
add_custom_target(opencv_modules)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(opencv_modules PROPERTIES FOLDER "extra")
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# targets building all tests
|
||||
# ----------------------------------------------------------------------------
|
||||
if(BUILD_TESTS)
|
||||
add_custom_target(opencv_tests)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(opencv_tests PROPERTIES FOLDER "extra")
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_PERF_TESTS)
|
||||
add_custom_target(opencv_perf_tests)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(opencv_perf_tests PROPERTIES FOLDER "extra")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,266 @@
|
||||
#
|
||||
# The script to detect Intel(R) Integrated Performance Primitives (IPP)
|
||||
# installation/package
|
||||
#
|
||||
# By default, ICV version will be used.
|
||||
# To use standalone IPP update cmake command line:
|
||||
# cmake ... -DIPPROOT=<path> ...
|
||||
#
|
||||
# Note: Backward compatibility is broken, IPPROOT environment path is ignored
|
||||
#
|
||||
#
|
||||
# On return this will define:
|
||||
#
|
||||
# HAVE_IPP - True if Intel IPP found
|
||||
# HAVE_IPP_ICV_ONLY - True if Intel IPP ICV version is available
|
||||
# IPP_ROOT_DIR - root of IPP installation
|
||||
# IPP_INCLUDE_DIRS - IPP include folder
|
||||
# IPP_LIBRARIES - IPP libraries that are used by OpenCV
|
||||
# IPP_VERSION_STR - string with the newest detected IPP version
|
||||
# IPP_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD)
|
||||
# IPP_VERSION_MINOR
|
||||
# IPP_VERSION_BUILD
|
||||
#
|
||||
# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com)
|
||||
#
|
||||
|
||||
unset(HAVE_IPP CACHE)
|
||||
unset(HAVE_IPP_ICV_ONLY)
|
||||
unset(IPP_ROOT_DIR)
|
||||
unset(IPP_INCLUDE_DIRS)
|
||||
unset(IPP_LIBRARIES)
|
||||
unset(IPP_VERSION_STR)
|
||||
unset(IPP_VERSION_MAJOR)
|
||||
unset(IPP_VERSION_MINOR)
|
||||
unset(IPP_VERSION_BUILD)
|
||||
|
||||
if (X86 AND UNIX AND NOT APPLE AND NOT ANDROID AND BUILD_SHARED_LIBS)
|
||||
message(STATUS "On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(IPP_X64 0)
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(IPP_X64 1)
|
||||
endif()
|
||||
if(CMAKE_CL_64)
|
||||
set(IPP_X64 1)
|
||||
endif()
|
||||
|
||||
# This function detects IPP version by analyzing .h file
|
||||
macro(ipp_get_version VERSION_FILE)
|
||||
unset(_VERSION_STR)
|
||||
unset(_MAJOR)
|
||||
unset(_MINOR)
|
||||
unset(_BUILD)
|
||||
|
||||
# read IPP version info from file
|
||||
file(STRINGS ${VERSION_FILE} STR1 REGEX "IPP_VERSION_MAJOR")
|
||||
file(STRINGS ${VERSION_FILE} STR2 REGEX "IPP_VERSION_MINOR")
|
||||
file(STRINGS ${VERSION_FILE} STR3 REGEX "IPP_VERSION_BUILD")
|
||||
if("${STR3}" STREQUAL "")
|
||||
file(STRINGS ${VERSION_FILE} STR3 REGEX "IPP_VERSION_UPDATE")
|
||||
endif()
|
||||
file(STRINGS ${VERSION_FILE} STR4 REGEX "IPP_VERSION_STR")
|
||||
|
||||
# extract info and assign to variables
|
||||
string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1})
|
||||
string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2})
|
||||
string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3})
|
||||
string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4})
|
||||
|
||||
# export info to parent scope
|
||||
set(IPP_VERSION_STR ${_VERSION_STR})
|
||||
set(IPP_VERSION_MAJOR ${_MAJOR})
|
||||
set(IPP_VERSION_MINOR ${_MINOR})
|
||||
set(IPP_VERSION_BUILD ${_BUILD})
|
||||
endmacro()
|
||||
|
||||
macro(_ipp_not_supported)
|
||||
message(STATUS ${ARGN})
|
||||
unset(HAVE_IPP)
|
||||
unset(HAVE_IPP_ICV_ONLY)
|
||||
unset(IPP_VERSION_STR)
|
||||
return()
|
||||
endmacro()
|
||||
|
||||
# This macro uses IPP_ROOT_DIR variable
|
||||
# TODO Cleanup code after ICV package stabilization
|
||||
macro(ipp_detect_version)
|
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include)
|
||||
|
||||
set(__msg)
|
||||
if(EXISTS ${IPP_ROOT_DIR}/include/ippicv_redefs.h)
|
||||
set(__msg " (ICV version)")
|
||||
set(HAVE_IPP_ICV_ONLY 1)
|
||||
elseif(EXISTS ${IPP_ROOT_DIR}/include/ipp.h)
|
||||
# nothing
|
||||
else()
|
||||
_ipp_not_supported("Can't resolve IPP directory: ${IPP_ROOT_DIR}")
|
||||
endif()
|
||||
|
||||
ipp_get_version(${IPP_INCLUDE_DIRS}/ippversion.h)
|
||||
ocv_assert(IPP_VERSION_STR VERSION_GREATER "1.0")
|
||||
|
||||
message(STATUS "found IPP${__msg}: ${_MAJOR}.${_MINOR}.${_BUILD} [${IPP_VERSION_STR}]")
|
||||
message(STATUS "at: ${IPP_ROOT_DIR}")
|
||||
|
||||
if(${IPP_VERSION_STR} VERSION_LESS "7.0")
|
||||
_ipp_not_supported("IPP ${IPP_VERSION_STR} is not supported")
|
||||
endif()
|
||||
|
||||
set(HAVE_IPP 1)
|
||||
|
||||
macro(_ipp_set_library_dir DIR)
|
||||
if(NOT EXISTS ${DIR})
|
||||
_ipp_not_supported("IPP library directory not found")
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIR ${DIR})
|
||||
endmacro()
|
||||
|
||||
if(APPLE)
|
||||
_ipp_set_library_dir(${IPP_ROOT_DIR}/lib)
|
||||
elseif(IPP_X64)
|
||||
_ipp_set_library_dir(${IPP_ROOT_DIR}/lib/intel64)
|
||||
else()
|
||||
_ipp_set_library_dir(${IPP_ROOT_DIR}/lib/ia32)
|
||||
endif()
|
||||
|
||||
macro(_ipp_add_library name)
|
||||
# dynamic linking is only supported for standalone version of IPP
|
||||
if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
|
||||
set(IPP_LIB_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
|
||||
set(IPP_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
else ()
|
||||
set(IPP_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
|
||||
set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
endif ()
|
||||
if (EXISTS ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
|
||||
if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
|
||||
# When using dynamic libraries from standalone IPP it is your responsibility to install those on the target system
|
||||
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
|
||||
else ()
|
||||
add_library(ipp${name} STATIC IMPORTED)
|
||||
set_target_properties(ipp${name} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES ""
|
||||
IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
)
|
||||
list(APPEND IPP_LIBRARIES ipp${name})
|
||||
# CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets
|
||||
install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
string(TOUPPER ${name} uname)
|
||||
set(IPP${uname}_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_3P_LIB_INSTALL_PATH}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}" CACHE INTERNAL "" FORCE)
|
||||
set(IPP${uname}_LOCATION_PATH "${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Can't find IPP library: ${name} at ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(IPP_PREFIX "ipp")
|
||||
if(${IPP_VERSION_STR} VERSION_LESS "8.0")
|
||||
if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
|
||||
set(IPP_SUFFIX "") # dynamic not threaded libs suffix IPP 7.x
|
||||
else ()
|
||||
set(IPP_SUFFIX "_l") # static not threaded libs suffix IPP 7.x
|
||||
endif ()
|
||||
else ()
|
||||
if(WIN32)
|
||||
if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
|
||||
set(IPP_SUFFIX "") # dynamic not threaded libs suffix IPP 8.x for Windows
|
||||
else ()
|
||||
set(IPP_SUFFIX "mt") # static not threaded libs suffix IPP 8.x for Windows
|
||||
endif ()
|
||||
else()
|
||||
set(IPP_SUFFIX "") # static not threaded libs suffix IPP 8.x for Linux/OS X
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_IPP_ICV_ONLY)
|
||||
_ipp_add_library(icv)
|
||||
else()
|
||||
_ipp_add_library(core)
|
||||
_ipp_add_library(s)
|
||||
_ipp_add_library(i)
|
||||
_ipp_add_library(cc)
|
||||
_ipp_add_library(cv)
|
||||
_ipp_add_library(vm)
|
||||
_ipp_add_library(m)
|
||||
|
||||
if(UNIX)
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH)
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR})
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../compiler/lib REALPATH)
|
||||
endif()
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR})
|
||||
_ipp_not_supported("IPP configuration error: can't find Intel compiler library dir ${INTEL_COMPILER_LIBRARY_DIR}")
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
if(IPP_X64)
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||
message(SEND_ERROR "Intel compiler EM64T libraries not found")
|
||||
endif()
|
||||
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||
else()
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||
message(SEND_ERROR "Intel compiler IA32 libraries not found")
|
||||
endif()
|
||||
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(_ipp_add_compiler_library name)
|
||||
if (EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
else()
|
||||
message(STATUS "Can't find compiler library: ${name} at ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_ipp_add_compiler_library(irc)
|
||||
_ipp_add_compiler_library(imf)
|
||||
_ipp_add_compiler_library(svml)
|
||||
endif(UNIX)
|
||||
endif()
|
||||
|
||||
#message(STATUS "IPP libs: ${IPP_LIBRARIES}")
|
||||
endmacro()
|
||||
|
||||
# OPENCV_IPP_PATH is an environment variable for internal usage only, do not use it
|
||||
if(DEFINED ENV{OPENCV_IPP_PATH} AND NOT DEFINED IPPROOT)
|
||||
set(IPPROOT "$ENV{OPENCV_IPP_PATH}")
|
||||
endif()
|
||||
if(NOT DEFINED IPPROOT)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ippicv/downloader.cmake")
|
||||
if(DEFINED OPENCV_ICV_PATH)
|
||||
set(IPPROOT "${OPENCV_ICV_PATH}")
|
||||
else()
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${IPPROOT}" __IPPROOT)
|
||||
if(EXISTS "${__IPPROOT}/include/ippversion.h")
|
||||
set(IPP_ROOT_DIR ${__IPPROOT})
|
||||
ipp_detect_version()
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32 AND MINGW AND NOT IPP_VERSION_MAJOR LESS 7)
|
||||
# Since IPP built with Microsoft compiler and /GS option
|
||||
# ======================================================
|
||||
# From Windows SDK 7.1
|
||||
# (usually in "C:\Program Files\Microsoft Visual Studio 10.0\VC\lib"),
|
||||
# to avoid undefined reference to __security_cookie and _chkstk:
|
||||
set(MSV_RUNTMCHK "RunTmChk")
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_RUNTMCHK}${IPP_LIB_SUFFIX})
|
||||
|
||||
# To avoid undefined reference to _alldiv and _chkstk
|
||||
# ===================================================
|
||||
# NB: it may require a recompilation of w32api (after having modified
|
||||
# the file ntdll.def) to export the required functions
|
||||
# See http://code.opencv.org/issues/1906 for additional details
|
||||
set(MSV_NTDLL "ntdll")
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_NTDLL}${IPP_LIB_SUFFIX})
|
||||
endif()
|
||||
@@ -0,0 +1,45 @@
|
||||
# Main variables:
|
||||
# IPP_A_LIBRARIES and IPP_A_INCLUDE to use IPP Async
|
||||
# HAVE_IPP_A for conditional compilation OpenCV with/without IPP Async
|
||||
|
||||
# IPP_ASYNC_ROOT - root of IPP Async installation
|
||||
|
||||
if(X86_64)
|
||||
find_path(
|
||||
IPP_A_INCLUDE_DIR
|
||||
NAMES ipp_async_defs.h
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel IPP Async interface headers")
|
||||
|
||||
find_file(
|
||||
IPP_A_LIBRARIES
|
||||
NAMES ipp_async_preview.lib
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES lib/intel64
|
||||
DOC "Path to Intel IPP Async interface libraries")
|
||||
|
||||
else()
|
||||
find_path(
|
||||
IPP_A_INCLUDE_DIR
|
||||
NAMES ipp_async_defs.h
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel IPP Async interface headers")
|
||||
|
||||
find_file(
|
||||
IPP_A_LIBRARIES
|
||||
NAMES ipp_async_preview.lib
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES lib/ia32
|
||||
DOC "Path to Intel IPP Async interface libraries")
|
||||
endif()
|
||||
|
||||
if(IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES)
|
||||
set(HAVE_IPP_A TRUE)
|
||||
else()
|
||||
set(HAVE_IPP_A FALSE)
|
||||
message(WARNING "Intel IPP Async library directory (set by IPP_A_LIBRARIES_DIR variable) is not found or does not have Intel IPP Async libraries.")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE IPP_A_LIBRARIES IPP_A_INCLUDE_DIR)
|
||||
@@ -0,0 +1,20 @@
|
||||
# Main variables:
|
||||
# INTELPERC_LIBRARIES and INTELPERC_INCLUDE to link Intel Perceptial Computing SDK modules
|
||||
# HAVE_INTELPERC for conditional compilation OpenCV with/without Intel Perceptial Computing SDK
|
||||
|
||||
if(X86_64)
|
||||
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
|
||||
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/x64" DOC "Path to Intel Perceptual Computing SDK interface libraries")
|
||||
else()
|
||||
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
|
||||
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/Win32" DOC "Path to Intel Perceptual Computing SDK interface libraries")
|
||||
endif()
|
||||
|
||||
if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
|
||||
set(HAVE_INTELPERC TRUE)
|
||||
else()
|
||||
set(HAVE_INTELPERC FALSE)
|
||||
message(WARNING "Intel Perceptual Computing SDK library directory (set by INTELPERC_LIB_DIR variable) is not found or does not have Intel Perceptual Computing SDK libraries.")
|
||||
endif() #if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
|
||||
|
||||
mark_as_advanced(FORCE INTELPERC_LIBRARIES INTELPERC_INCLUDE_DIR)
|
||||
@@ -0,0 +1,114 @@
|
||||
# - Find Latex
|
||||
# This module finds if Latex is installed and determines where the
|
||||
# executables are. This code sets the following variables:
|
||||
#
|
||||
# LATEX_COMPILER: path to the LaTeX compiler
|
||||
# PDFLATEX_COMPILER: path to the PdfLaTeX compiler
|
||||
# BIBTEX_COMPILER: path to the BibTeX compiler
|
||||
# MAKEINDEX_COMPILER: path to the MakeIndex compiler
|
||||
# DVIPS_CONVERTER: path to the DVIPS converter
|
||||
# PS2PDF_CONVERTER: path to the PS2PDF converter
|
||||
# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
|
||||
#
|
||||
|
||||
IF (WIN32)
|
||||
|
||||
# Try to find the MikTex binary path (look for its package manager).
|
||||
|
||||
FIND_PATH(MIKTEX_BINARY_PATH mpm.exe
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
|
||||
DOC
|
||||
"Path to the MikTex binary directory."
|
||||
)
|
||||
MARK_AS_ADVANCED(MIKTEX_BINARY_PATH)
|
||||
|
||||
# Try to find the GhostScript binary path (look for gswin32).
|
||||
|
||||
GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH
|
||||
)
|
||||
|
||||
GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH
|
||||
)
|
||||
|
||||
FIND_PATH(GHOSTSCRIPT_BINARY_PATH gswin32.exe
|
||||
${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00}
|
||||
${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04}
|
||||
DOC "Path to the GhostScript binary directory."
|
||||
)
|
||||
MARK_AS_ADVANCED(GHOSTSCRIPT_BINARY_PATH)
|
||||
|
||||
FIND_PATH(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat
|
||||
"${GHOSTSCRIPT_BINARY_PATH}/../lib"
|
||||
DOC "Path to the GhostScript library directory."
|
||||
)
|
||||
MARK_AS_ADVANCED(GHOSTSCRIPT_LIBRARY_PATH)
|
||||
|
||||
ENDIF (WIN32)
|
||||
|
||||
FIND_HOST_PROGRAM(LATEX_COMPILER
|
||||
NAMES latex
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
FIND_HOST_PROGRAM(PDFLATEX_COMPILER
|
||||
NAMES pdflatex
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
FIND_HOST_PROGRAM(BIBTEX_COMPILER
|
||||
NAMES bibtex
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
FIND_HOST_PROGRAM(MAKEINDEX_COMPILER
|
||||
NAMES makeindex
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
FIND_HOST_PROGRAM(DVIPS_CONVERTER
|
||||
NAMES dvips
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
FIND_HOST_PROGRAM(DVIPDF_CONVERTER
|
||||
NAMES dvipdfm dvipdft dvipdf
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
IF (WIN32)
|
||||
FIND_HOST_PROGRAM(PS2PDF_CONVERTER
|
||||
NAMES ps2pdf14.bat
|
||||
PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
|
||||
)
|
||||
ELSE (WIN32)
|
||||
FIND_HOST_PROGRAM(PS2PDF_CONVERTER
|
||||
NAMES ps2pdf14 ps2pdf
|
||||
PATHS /usr/bin /usr/texbin
|
||||
)
|
||||
ENDIF (WIN32)
|
||||
|
||||
FIND_HOST_PROGRAM(LATEX2HTML_CONVERTER
|
||||
NAMES latex2html
|
||||
PATHS ${MIKTEX_BINARY_PATH}
|
||||
/usr/bin /usr/texbin
|
||||
)
|
||||
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LATEX_COMPILER
|
||||
PDFLATEX_COMPILER
|
||||
BIBTEX_COMPILER
|
||||
MAKEINDEX_COMPILER
|
||||
DVIPS_CONVERTER
|
||||
DVIPDF_CONVERTER
|
||||
PS2PDF_CONVERTER
|
||||
LATEX2HTML_CONVERTER
|
||||
)
|
||||
@@ -0,0 +1,90 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect 3rd-party GUI libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
#--- Win32 UI ---
|
||||
ocv_clear_vars(HAVE_WIN32UI)
|
||||
if(WITH_WIN32UI)
|
||||
try_compile(HAVE_WIN32UI
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/win32uitest.cpp"
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=user32;gdi32")
|
||||
endif()
|
||||
|
||||
# --- QT4 ---
|
||||
ocv_clear_vars(HAVE_QT HAVE_QT5)
|
||||
if(WITH_QT)
|
||||
if(NOT WITH_QT EQUAL 4)
|
||||
find_package(Qt5Core)
|
||||
find_package(Qt5Gui)
|
||||
find_package(Qt5Widgets)
|
||||
find_package(Qt5Test)
|
||||
find_package(Qt5Concurrent)
|
||||
if(Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND AND Qt5Concurrent_FOUND)
|
||||
set(HAVE_QT5 ON)
|
||||
set(HAVE_QT ON)
|
||||
find_package(Qt5OpenGL)
|
||||
if(Qt5OpenGL_FOUND)
|
||||
set(QT_QTOPENGL_FOUND ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT)
|
||||
find_package(Qt4 REQUIRED QtCore QtGui QtTest)
|
||||
if(QT4_FOUND)
|
||||
set(HAVE_QT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- GTK ---
|
||||
ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
|
||||
if(WITH_GTK AND NOT HAVE_QT)
|
||||
if(NOT WITH_GTK_2_X)
|
||||
CHECK_MODULE(gtk+-3.0 HAVE_GTK3)
|
||||
if(HAVE_GTK3)
|
||||
set(HAVE_GTK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_GTK)
|
||||
CHECK_MODULE(gtk+-2.0 HAVE_GTK)
|
||||
if(HAVE_GTK AND (ALIASOF_gtk+-2.0_VERSION VERSION_LESS MIN_VER_GTK))
|
||||
message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)")
|
||||
set(HAVE_GTK FALSE)
|
||||
endif()
|
||||
endif()
|
||||
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
|
||||
if(HAVE_GTK AND NOT HAVE_GTHREAD)
|
||||
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
|
||||
endif()
|
||||
if(WITH_OPENGL AND NOT HAVE_GTK3)
|
||||
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- OpenGl ---
|
||||
ocv_clear_vars(HAVE_OPENGL HAVE_QT_OPENGL)
|
||||
if(WITH_OPENGL)
|
||||
if(WITH_WIN32UI OR (HAVE_QT AND QT_QTOPENGL_FOUND) OR HAVE_GTKGLEXT)
|
||||
find_package (OpenGL QUIET)
|
||||
if(OPENGL_FOUND)
|
||||
set(HAVE_OPENGL TRUE)
|
||||
list(APPEND OPENCV_LINKER_LIBS ${OPENGL_LIBRARIES})
|
||||
if(QT_QTOPENGL_FOUND)
|
||||
set(HAVE_QT_OPENGL TRUE)
|
||||
else()
|
||||
ocv_include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif(WITH_OPENGL)
|
||||
|
||||
# --- Carbon & Cocoa ---
|
||||
if(APPLE)
|
||||
if(WITH_CARBON)
|
||||
set(HAVE_CARBON YES)
|
||||
elseif(NOT IOS AND CMAKE_COMPILER_IS_CLANGCXX)
|
||||
set(HAVE_COCOA YES)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,213 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect 3rd-party image IO libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# --- zlib (required) ---
|
||||
if(BUILD_ZLIB)
|
||||
ocv_clear_vars(ZLIB_FOUND)
|
||||
else()
|
||||
find_package(ZLIB "${MIN_VER_ZLIB}")
|
||||
if(ZLIB_FOUND AND ANDROID)
|
||||
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
|
||||
set(ZLIB_LIBRARIES z)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_FOUND)
|
||||
ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
|
||||
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/zlib")
|
||||
set(ZLIB_INCLUDE_DIRS "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}")
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
||||
|
||||
ocv_parse_header2(ZLIB "${${ZLIB_LIBRARY}_SOURCE_DIR}/zlib.h" ZLIB_VERSION)
|
||||
endif()
|
||||
|
||||
# --- libtiff (optional, should be searched after zlib) ---
|
||||
if(WITH_TIFF)
|
||||
if(BUILD_TIFF)
|
||||
ocv_clear_vars(TIFF_FOUND)
|
||||
else()
|
||||
include(FindTIFF)
|
||||
if(TIFF_FOUND)
|
||||
ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TIFF_FOUND)
|
||||
ocv_clear_vars(TIFF_LIBRARY TIFF_LIBRARIES TIFF_INCLUDE_DIR)
|
||||
|
||||
set(TIFF_LIBRARY libtiff)
|
||||
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
|
||||
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
|
||||
ocv_parse_header("${${TIFF_LIBRARY}_SOURCE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
|
||||
if(TIFF_VERSION_CLASSIC AND NOT TIFF_VERSION)
|
||||
set(TIFF_VERSION ${TIFF_VERSION_CLASSIC})
|
||||
endif()
|
||||
|
||||
if(TIFF_BIGTIFF_VERSION AND NOT TIFF_VERSION_BIG)
|
||||
set(TIFF_VERSION_BIG ${TIFF_BIGTIFF_VERSION})
|
||||
endif()
|
||||
|
||||
if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR)
|
||||
list(GET TIFF_INCLUDE_DIR 0 _TIFF_INCLUDE_DIR)
|
||||
if(EXISTS "${_TIFF_INCLUDE_DIR}/tiffvers.h")
|
||||
file(STRINGS "${_TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
|
||||
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
|
||||
unset(tiff_version_str)
|
||||
endif()
|
||||
unset(_TIFF_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
set(HAVE_TIFF YES)
|
||||
endif()
|
||||
|
||||
# --- libjpeg (optional) ---
|
||||
if(WITH_JPEG)
|
||||
if(BUILD_JPEG)
|
||||
ocv_clear_vars(JPEG_FOUND)
|
||||
else()
|
||||
include(FindJPEG)
|
||||
endif()
|
||||
|
||||
if(NOT JPEG_FOUND)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
|
||||
|
||||
set(JPEG_LIBRARY libjpeg)
|
||||
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
ocv_parse_header("${JPEG_INCLUDE_DIR}/jpeglib.h" JPEG_VERSION_LINES JPEG_LIB_VERSION)
|
||||
set(HAVE_JPEG YES)
|
||||
endif()
|
||||
|
||||
# --- libwebp (optional) ---
|
||||
|
||||
if(WITH_WEBP)
|
||||
if(BUILD_WEBP)
|
||||
ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR)
|
||||
else()
|
||||
include(cmake/OpenCVFindWebP.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- Add libwebp to 3rdparty/libwebp and compile it if not available ---
|
||||
if(WITH_WEBP AND NOT WEBP_FOUND)
|
||||
|
||||
set(WEBP_LIBRARY libwebp)
|
||||
set(WEBP_LIBRARIES ${WEBP_LIBRARY})
|
||||
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libwebp")
|
||||
set(WEBP_INCLUDE_DIR "${${WEBP_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT WEBP_VERSION AND WEBP_INCLUDE_DIR)
|
||||
ocv_clear_vars(ENC_MAJ_VERSION ENC_MIN_VERSION ENC_REV_VERSION)
|
||||
if(EXISTS "${WEBP_INCLUDE_DIR}/enc/vp8enci.h")
|
||||
ocv_parse_header("${WEBP_INCLUDE_DIR}/enc/vp8enci.h" WEBP_VERSION_LINES ENC_MAJ_VERSION ENC_MIN_VERSION ENC_REV_VERSION)
|
||||
set(WEBP_VERSION "${ENC_MAJ_VERSION}.${ENC_MIN_VERSION}.${ENC_REV_VERSION}")
|
||||
elseif(EXISTS "${WEBP_INCLUDE_DIR}/webp/encode.h")
|
||||
file(STRINGS "${WEBP_INCLUDE_DIR}/webp/encode.h" WEBP_ENCODER_ABI_VERSION REGEX "#define[ \t]+WEBP_ENCODER_ABI_VERSION[ \t]+([x0-9a-f]+)" )
|
||||
if(WEBP_ENCODER_ABI_VERSION MATCHES "#define[ \t]+WEBP_ENCODER_ABI_VERSION[ \t]+([x0-9a-f]+)")
|
||||
set(WEBP_ENCODER_ABI_VERSION "${CMAKE_MATCH_1}")
|
||||
set(WEBP_VERSION "encoder: ${WEBP_ENCODER_ABI_VERSION}")
|
||||
else()
|
||||
unset(WEBP_ENCODER_ABI_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- libjasper (optional, should be searched after libjpeg) ---
|
||||
if(WITH_JASPER)
|
||||
if(BUILD_JASPER)
|
||||
ocv_clear_vars(JASPER_FOUND)
|
||||
else()
|
||||
include(FindJasper)
|
||||
endif()
|
||||
|
||||
if(NOT JASPER_FOUND)
|
||||
ocv_clear_vars(JASPER_LIBRARY JASPER_LIBRARIES JASPER_INCLUDE_DIR)
|
||||
|
||||
set(JASPER_LIBRARY libjasper)
|
||||
set(JASPER_LIBRARIES ${JASPER_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
|
||||
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
set(HAVE_JASPER YES)
|
||||
|
||||
if(NOT JASPER_VERSION_STRING)
|
||||
ocv_parse_header2(JASPER "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" JAS_VERSION "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- libpng (optional, should be searched after zlib) ---
|
||||
if(WITH_PNG)
|
||||
if(BUILD_PNG)
|
||||
ocv_clear_vars(PNG_FOUND)
|
||||
else()
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
|
||||
if(HAVE_LIBPNG_PNG_H)
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
else()
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT PNG_FOUND)
|
||||
ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
|
||||
|
||||
set(PNG_LIBRARY libpng)
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
|
||||
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
|
||||
set(PNG_DEFINITIONS "")
|
||||
ocv_parse_header("${PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
|
||||
set(HAVE_PNG YES)
|
||||
set(PNG_VERSION "${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}")
|
||||
endif()
|
||||
|
||||
# --- OpenEXR (optional) ---
|
||||
if(WITH_OPENEXR)
|
||||
if(BUILD_OPENEXR)
|
||||
ocv_clear_vars(OPENEXR_FOUND)
|
||||
else()
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
|
||||
endif()
|
||||
|
||||
if(NOT OPENEXR_FOUND)
|
||||
ocv_clear_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
|
||||
|
||||
set(OPENEXR_LIBRARIES IlmImf)
|
||||
set(OPENEXR_ILMIMF_LIBRARY IlmImf)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/openexr")
|
||||
endif()
|
||||
|
||||
set(HAVE_OPENEXR YES)
|
||||
endif()
|
||||
|
||||
# --- GDAL (optional) ---
|
||||
if(WITH_GDAL)
|
||||
find_package(GDAL)
|
||||
|
||||
if(NOT GDAL_FOUND)
|
||||
ocv_clear_vars(GDAL_LIBRARY GDAL_INCLUDE_DIR)
|
||||
set(HAVE_GDAL NO)
|
||||
else()
|
||||
set(HAVE_GDAL YES)
|
||||
ocv_include_directories(${GDAL_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,131 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect other 3rd-party performance and math libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# --- TBB ---
|
||||
if(WITH_TBB)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectTBB.cmake")
|
||||
endif(WITH_TBB)
|
||||
|
||||
# --- IPP ---
|
||||
if(WITH_IPP)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPP.cmake")
|
||||
if(HAVE_IPP)
|
||||
ocv_include_directories(${IPP_INCLUDE_DIRS})
|
||||
list(APPEND OPENCV_LINKER_LIBS ${IPP_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- IPP Async ---
|
||||
|
||||
if(WITH_IPP_A)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPPAsync.cmake")
|
||||
if(IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES)
|
||||
ocv_include_directories(${IPP_A_INCLUDE_DIR})
|
||||
link_directories(${IPP_A_LIBRARIES})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_A_LIBRARIES})
|
||||
endif()
|
||||
endif(WITH_IPP_A)
|
||||
|
||||
# --- CUDA ---
|
||||
if(WITH_CUDA)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCUDA.cmake")
|
||||
endif(WITH_CUDA)
|
||||
|
||||
# --- Eigen ---
|
||||
if(WITH_EIGEN)
|
||||
find_path(EIGEN_INCLUDE_PATH "Eigen/Core"
|
||||
PATHS /usr/local /opt /usr $ENV{EIGEN_ROOT}/include ENV ProgramFiles ENV ProgramW6432
|
||||
PATH_SUFFIXES include/eigen3 include/eigen2 Eigen/include/eigen3 Eigen/include/eigen2
|
||||
DOC "The path to Eigen3/Eigen2 headers"
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
|
||||
if(EIGEN_INCLUDE_PATH)
|
||||
ocv_include_directories(${EIGEN_INCLUDE_PATH})
|
||||
ocv_parse_header("${EIGEN_INCLUDE_PATH}/Eigen/src/Core/util/Macros.h" EIGEN_VERSION_LINES EIGEN_WORLD_VERSION EIGEN_MAJOR_VERSION EIGEN_MINOR_VERSION)
|
||||
set(HAVE_EIGEN 1)
|
||||
endif()
|
||||
endif(WITH_EIGEN)
|
||||
|
||||
# --- Clp ---
|
||||
# Ubuntu: sudo apt-get install coinor-libclp-dev coinor-libcoinutils-dev
|
||||
ocv_clear_vars(HAVE_CLP)
|
||||
if(WITH_CLP)
|
||||
if(UNIX)
|
||||
PKG_CHECK_MODULES(CLP clp)
|
||||
if(CLP_FOUND)
|
||||
set(HAVE_CLP TRUE)
|
||||
if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "")
|
||||
ocv_include_directories(${CLP_INCLUDE_DIRS})
|
||||
endif()
|
||||
link_directories(${CLP_LIBRARY_DIRS})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CLP_FOUND)
|
||||
find_path(CLP_INCLUDE_PATH "coin"
|
||||
PATHS "/usr/local/include" "/usr/include" "/opt/include"
|
||||
DOC "The path to Clp headers")
|
||||
if(CLP_INCLUDE_PATH)
|
||||
ocv_include_directories(${CLP_INCLUDE_PATH} "${CLP_INCLUDE_PATH}/coin")
|
||||
get_filename_component(_CLP_LIBRARY_DIR "${CLP_INCLUDE_PATH}/../lib" ABSOLUTE)
|
||||
set(CLP_LIBRARY_DIR "${_CLP_LIBRARY_DIR}" CACHE PATH "Full path of Clp library directory")
|
||||
link_directories(${CLP_LIBRARY_DIR})
|
||||
if(UNIX)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils m)
|
||||
else()
|
||||
if(MINGW)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils)
|
||||
else()
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libClp libCoinUtils)
|
||||
endif()
|
||||
endif()
|
||||
set(HAVE_CLP TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif(WITH_CLP)
|
||||
|
||||
# --- C= ---
|
||||
if(WITH_CSTRIPES AND NOT HAVE_TBB)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCStripes.cmake")
|
||||
else()
|
||||
set(HAVE_CSTRIPES 0)
|
||||
endif()
|
||||
|
||||
# --- GCD ---
|
||||
if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
set(HAVE_GCD 1)
|
||||
else()
|
||||
set(HAVE_GCD 0)
|
||||
endif()
|
||||
|
||||
# --- Concurrency ---
|
||||
if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
|
||||
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
file(REMOVE "${_fname}")
|
||||
else()
|
||||
set(HAVE_CONCURRENCY 0)
|
||||
endif()
|
||||
|
||||
# --- OpenMP ---
|
||||
if(WITH_OPENMP)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
set(HAVE_OPENMP "${OPENMP_FOUND}")
|
||||
endif()
|
||||
|
||||
if(UNIX OR ANDROID)
|
||||
if(NOT APPLE AND NOT HAVE_TBB AND NOT HAVE_OPENMP)
|
||||
set(HAVE_PTHREADS_PF 1)
|
||||
else()
|
||||
set(HAVE_PTHREADS_PF 0)
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_PTHREADS_PF 0)
|
||||
endif()
|
||||
@@ -0,0 +1,319 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect 3rd-party video IO libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
ocv_clear_vars(HAVE_VFW)
|
||||
if(WITH_VFW)
|
||||
try_compile(HAVE_VFW
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vfwtest.cpp"
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32")
|
||||
endif(WITH_VFW)
|
||||
|
||||
# --- GStreamer ---
|
||||
ocv_clear_vars(HAVE_GSTREAMER)
|
||||
# try to find gstreamer 1.x first
|
||||
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
||||
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
||||
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
||||
CHECK_MODULE(gstreamer-riff-1.0 HAVE_GSTREAMER_RIFF)
|
||||
CHECK_MODULE(gstreamer-pbutils-1.0 HAVE_GSTREAMER_PBUTILS)
|
||||
|
||||
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
|
||||
set(HAVE_GSTREAMER TRUE)
|
||||
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-1.0_VERSION})
|
||||
set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-1.0_VERSION})
|
||||
set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-1.0_VERSION})
|
||||
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-1.0_VERSION})
|
||||
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
||||
endif()
|
||||
|
||||
endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||
|
||||
# if gstreamer 1.x was not found, or we specified we wanted 0.10, try to find it
|
||||
if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
|
||||
CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER_BASE)
|
||||
CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER_VIDEO)
|
||||
CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER_APP)
|
||||
CHECK_MODULE(gstreamer-riff-0.10 HAVE_GSTREAMER_RIFF)
|
||||
CHECK_MODULE(gstreamer-pbutils-0.10 HAVE_GSTREAMER_PBUTILS)
|
||||
|
||||
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
|
||||
set(HAVE_GSTREAMER TRUE)
|
||||
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-0.10_VERSION})
|
||||
set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-0.10_VERSION})
|
||||
set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-0.10_VERSION})
|
||||
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION})
|
||||
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION})
|
||||
endif()
|
||||
endif(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
|
||||
|
||||
# --- unicap ---
|
||||
ocv_clear_vars(HAVE_UNICAP)
|
||||
if(WITH_UNICAP)
|
||||
CHECK_MODULE(libunicap HAVE_UNICAP_)
|
||||
CHECK_MODULE(libucil HAVE_UNICAP_UCIL)
|
||||
if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)
|
||||
set(HAVE_UNICAP TRUE)
|
||||
endif()
|
||||
endif(WITH_UNICAP)
|
||||
|
||||
# --- PvApi ---
|
||||
ocv_clear_vars(HAVE_PVAPI)
|
||||
if(WITH_PVAPI)
|
||||
find_path(PVAPI_INCLUDE_PATH "PvApi.h"
|
||||
PATHS /usr/local /opt /usr ENV ProgramFiles ENV ProgramW6432
|
||||
PATH_SUFFIXES include "Allied Vision Technologies/GigESDK/inc-pc" "AVT GigE SDK/inc-pc" "GigESDK/inc-pc"
|
||||
DOC "The path to PvAPI header")
|
||||
|
||||
if(PVAPI_INCLUDE_PATH)
|
||||
if(X86 AND NOT WIN32)
|
||||
set(PVAPI_SDK_SUBDIR x86)
|
||||
elseif(X86_64)
|
||||
set(PVAPI_SDK_SUBDIR x64)
|
||||
elseif(ARM)
|
||||
set(PVAPI_SDK_SUBDIR arm)
|
||||
endif()
|
||||
|
||||
get_filename_component(_PVAPI_LIBRARY "${PVAPI_INCLUDE_PATH}/../lib-pc" ABSOLUTE)
|
||||
if(PVAPI_SDK_SUBDIR)
|
||||
set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${PVAPI_SDK_SUBDIR}")
|
||||
endif()
|
||||
if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_OPENCV_GCC_VERSION_MAJOR}.${CMAKE_OPENCV_GCC_VERSION_MINOR}")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
set(PVAPI_DEFINITIONS "-DPVDECL=__stdcall")
|
||||
endif(MINGW)
|
||||
set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/PvAPI.lib" CACHE PATH "The PvAPI library")
|
||||
else(WIN32)
|
||||
set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_STATIC_LIBRARY_PREFIX}PvAPI${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE PATH "The PvAPI library")
|
||||
endif(WIN32)
|
||||
if(EXISTS "${PVAPI_LIBRARY}")
|
||||
set(HAVE_PVAPI TRUE)
|
||||
endif()
|
||||
endif(PVAPI_INCLUDE_PATH)
|
||||
endif(WITH_PVAPI)
|
||||
|
||||
# --- GigEVisionSDK ---
|
||||
ocv_clear_vars(HAVE_GIGE_API)
|
||||
if(WITH_GIGEAPI)
|
||||
find_path(GIGEAPI_INCLUDE_PATH "GigEVisionSDK.h"
|
||||
PATHS /usr/local /var /opt /usr ENV ProgramFiles ENV ProgramW6432
|
||||
PATH_SUFFIXES include "Smartek Vision Technologies/GigEVisionSDK/gige_cpp" "GigEVisionSDK/gige_cpp" "GigEVisionSDK/gige_c"
|
||||
DOC "The path to Smartek GigEVisionSDK header")
|
||||
FIND_LIBRARY(GIGEAPI_LIBRARIES NAMES GigEVisionSDK)
|
||||
if(GIGEAPI_LIBRARIES AND GIGEAPI_INCLUDE_PATH)
|
||||
set(HAVE_GIGE_API TRUE)
|
||||
endif()
|
||||
endif(WITH_GIGEAPI)
|
||||
|
||||
# --- Dc1394 ---
|
||||
ocv_clear_vars(HAVE_DC1394 HAVE_DC1394_2)
|
||||
if(WITH_1394)
|
||||
if(WIN32 AND MINGW)
|
||||
find_path(CMU1394_INCLUDE_PATH "/1394common.h"
|
||||
PATH_SUFFIXES include
|
||||
DOC "The path to cmu1394 headers")
|
||||
find_path(DC1394_2_INCLUDE_PATH "/dc1394/dc1394.h"
|
||||
PATH_SUFFIXES include
|
||||
DOC "The path to DC1394 2.x headers")
|
||||
if(CMU1394_INCLUDE_PATH AND DC1394_2_INCLUDE_PATH)
|
||||
set(CMU1394_LIB_DIR "${CMU1394_INCLUDE_PATH}/../lib" CACHE PATH "Full path of CMU1394 library directory")
|
||||
set(DC1394_2_LIB_DIR "${DC1394_2_INCLUDE_PATH}/../lib" CACHE PATH "Full path of DC1394 2.x library directory")
|
||||
if(EXISTS "${CMU1394_LIB_DIR}/lib1394camera.a" AND EXISTS "${DC1394_2_LIB_DIR}/libdc1394.a")
|
||||
set(HAVE_DC1394_2 TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(HAVE_DC1394_2)
|
||||
ocv_parse_pkg("libdc1394-2" "${DC1394_2_LIB_DIR}/pkgconfig" "")
|
||||
ocv_include_directories(${DC1394_2_INCLUDE_PATH})
|
||||
set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES}
|
||||
"${DC1394_2_LIB_DIR}/libdc1394.a"
|
||||
"${CMU1394_LIB_DIR}/lib1394camera.a")
|
||||
endif(HAVE_DC1394_2)
|
||||
else(WIN32 AND MINGW)
|
||||
CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)
|
||||
if(NOT HAVE_DC1394_2)
|
||||
CHECK_MODULE(libdc1394 HAVE_DC1394)
|
||||
endif()
|
||||
endif(WIN32 AND MINGW)
|
||||
endif(WITH_1394)
|
||||
|
||||
# --- xine ---
|
||||
ocv_clear_vars(HAVE_XINE)
|
||||
if(WITH_XINE)
|
||||
CHECK_MODULE(libxine HAVE_XINE)
|
||||
endif(WITH_XINE)
|
||||
|
||||
# --- V4L ---
|
||||
ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2 HAVE_VIDEOIO)
|
||||
if(WITH_V4L)
|
||||
if(WITH_LIBV4L)
|
||||
CHECK_MODULE(libv4l1 HAVE_LIBV4L1)
|
||||
CHECK_MODULE(libv4l2 HAVE_LIBV4L2)
|
||||
if(HAVE_LIBV4L1 AND HAVE_LIBV4L2)
|
||||
set(HAVE_LIBV4L YES)
|
||||
else()
|
||||
set(HAVE_LIBV4L NO)
|
||||
endif()
|
||||
endif()
|
||||
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
|
||||
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
|
||||
CHECK_INCLUDE_FILE(sys/videoio.h HAVE_VIDEOIO)
|
||||
endif(WITH_V4L)
|
||||
|
||||
# --- OpenNI ---
|
||||
ocv_clear_vars(HAVE_OPENNI HAVE_OPENNI_PRIME_SENSOR_MODULE)
|
||||
if(WITH_OPENNI)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenNI.cmake")
|
||||
endif(WITH_OPENNI)
|
||||
|
||||
ocv_clear_vars(HAVE_OPENNI2)
|
||||
if(WITH_OPENNI2)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenNI2.cmake")
|
||||
endif(WITH_OPENNI2)
|
||||
|
||||
# --- XIMEA ---
|
||||
ocv_clear_vars(HAVE_XIMEA)
|
||||
if(WITH_XIMEA)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindXimea.cmake")
|
||||
if(XIMEA_FOUND)
|
||||
set(HAVE_XIMEA TRUE)
|
||||
endif()
|
||||
endif(WITH_XIMEA)
|
||||
|
||||
# --- FFMPEG ---
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
|
||||
elseif(UNIX)
|
||||
CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
|
||||
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
|
||||
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
|
||||
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
|
||||
CHECK_MODULE(libavresample HAVE_FFMPEG_RESAMPLE)
|
||||
|
||||
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
|
||||
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
|
||||
if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)
|
||||
if(EXISTS /usr/include/ffmpeg/libavformat/avformat.h OR HAVE_FFMPEG_SWSCALE)
|
||||
set(HAVE_GENTOO_FFMPEG TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(HAVE_FFMPEG_CODEC AND HAVE_FFMPEG_FORMAT AND HAVE_FFMPEG_UTIL AND HAVE_FFMPEG_SWSCALE)
|
||||
set(HAVE_FFMPEG TRUE)
|
||||
endif()
|
||||
|
||||
if(HAVE_FFMPEG)
|
||||
# Find the bzip2 library because it is required on some systems
|
||||
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)
|
||||
if(NOT BZIP2_LIBRARIES)
|
||||
# Do an other trial
|
||||
FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)
|
||||
endif()
|
||||
else()
|
||||
find_path(FFMPEG_INCLUDE_DIR "libavformat/avformat.h"
|
||||
PATHS /usr/local /usr /opt
|
||||
PATH_SUFFIXES include
|
||||
DOC "The path to FFMPEG headers")
|
||||
if(FFMPEG_INCLUDE_DIR)
|
||||
set(HAVE_GENTOO_FFMPEG TRUE)
|
||||
set(FFMPEG_LIB_DIR "${FFMPEG_INCLUDE_DIR}/../lib" CACHE PATH "Full path of FFMPEG library directory")
|
||||
find_library(FFMPEG_CODEC_LIB "avcodec" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_FORMAT_LIB "avformat" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_UTIL_LIB "avutil" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_SWSCALE_LIB "swscale" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_RESAMPLE_LIB "avresample" HINTS "${FFMPEG_LIB_DIR}")
|
||||
if(FFMPEG_CODEC_LIB)
|
||||
set(HAVE_FFMPEG_CODEC 1)
|
||||
endif()
|
||||
if(FFMPEG_FORMAT_LIB)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
endif()
|
||||
if(FFMPEG_UTIL_LIB)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
endif()
|
||||
if(FFMPEG_SWSCALE_LIB)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
endif()
|
||||
if(FFMPEG_CODEC_LIB AND FFMPEG_FORMAT_LIB AND
|
||||
FFMPEG_UTIL_LIB AND FFMPEG_SWSCALE_LIB)
|
||||
set(ALIASOF_libavcodec_VERSION "Unknown")
|
||||
set(ALIASOF_libavformat_VERSION "Unknown")
|
||||
set(ALIASOF_libavutil_VERSION "Unknown")
|
||||
set(ALIASOF_libswscale_VERSION "Unknown")
|
||||
set(HAVE_FFMPEG 1)
|
||||
if(FFMPEG_RESAMPLE_LIB)
|
||||
set(HAVE_FFMPEG_RESAMPLE 1)
|
||||
set(ALIASOF_libavresample_VERSION "Unknown")
|
||||
endif()
|
||||
endif()
|
||||
endif(FFMPEG_INCLUDE_DIR)
|
||||
if(HAVE_FFMPEG)
|
||||
set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${FFMPEG_LIB_DIR}/libavcodec.a"
|
||||
"${FFMPEG_LIB_DIR}/libavformat.a" "${FFMPEG_LIB_DIR}/libavutil.a"
|
||||
"${FFMPEG_LIB_DIR}/libswscale.a")
|
||||
if(HAVE_FFMPEG_RESAMPLE)
|
||||
set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${FFMPEG_LIB_DIR}/libavresample.a")
|
||||
endif()
|
||||
ocv_include_directories(${FFMPEG_INCLUDE_DIR})
|
||||
endif(HAVE_FFMPEG)
|
||||
endif()
|
||||
endif()
|
||||
endif(WITH_FFMPEG)
|
||||
|
||||
# --- VideoInput/DirectShow ---
|
||||
if(WITH_DSHOW)
|
||||
# always have VideoInput on Windows
|
||||
set(HAVE_DSHOW 1)
|
||||
endif(WITH_DSHOW)
|
||||
|
||||
# --- VideoInput/Microsoft Media Foundation ---
|
||||
ocv_clear_vars(HAVE_MSMF)
|
||||
if(WITH_MSMF)
|
||||
check_include_file(Mfapi.h HAVE_MSMF)
|
||||
endif(WITH_MSMF)
|
||||
|
||||
# --- Extra HighGUI and VideoIO libs on Windows ---
|
||||
if(WIN32)
|
||||
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32)
|
||||
if(HAVE_VFW)
|
||||
list(APPEND VIDEOIO_LIBRARIES vfw32)
|
||||
endif()
|
||||
if(MINGW64)
|
||||
list(APPEND VIDEOIO_LIBRARIES avifil32 avicap32 winmm msvfw32)
|
||||
list(REMOVE_ITEM VIDEOIO_LIBRARIES vfw32)
|
||||
elseif(MINGW)
|
||||
list(APPEND VIDEOIO_LIBRARIES winmm)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
# --- Apple AV Foundation ---
|
||||
if(WITH_AVFOUNDATION)
|
||||
set(HAVE_AVFOUNDATION YES)
|
||||
endif()
|
||||
|
||||
# --- QuickTime ---
|
||||
if (NOT IOS)
|
||||
if(WITH_QUICKTIME)
|
||||
set(HAVE_QUICKTIME YES)
|
||||
elseif(APPLE AND CMAKE_COMPILER_IS_CLANGCXX)
|
||||
set(HAVE_QTKIT YES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- Intel Perceptual Computing SDK ---
|
||||
if(WITH_INTELPERC)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIntelPerCSDK.cmake")
|
||||
endif(WITH_INTELPERC)
|
||||
|
||||
# --- gPhoto2 ---
|
||||
ocv_clear_vars(HAVE_GPHOTO2)
|
||||
if(WITH_GPHOTO2)
|
||||
CHECK_MODULE(libgphoto2 HAVE_GPHOTO2)
|
||||
endif(WITH_GPHOTO2)
|
||||
@@ -0,0 +1,199 @@
|
||||
# ----- Find Matlab/Octave -----
|
||||
#
|
||||
# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
|
||||
# to extract the mex headers, libraries and shell scripts. If found
|
||||
# successfully, the following variables will be defined
|
||||
#
|
||||
# MATLAB_FOUND: true/false
|
||||
# MATLAB_ROOT_DIR: Root of Matlab installation
|
||||
# MATLAB_BIN: The main Matlab "executable" (shell script)
|
||||
# MATLAB_MEX_SCRIPT: The mex script used to compile mex files
|
||||
# MATLAB_INCLUDE_DIRS:Path to "mex.h"
|
||||
# MATLAB_LIBRARY_DIRS:Path to mex and matrix libraries
|
||||
# MATLAB_LIBRARIES: The Matlab libs, usually mx, mex, mat
|
||||
# MATLAB_MEXEXT: The mex library extension. It will be one of:
|
||||
# mexwin32, mexwin64, mexglx, mexa64, mexmac,
|
||||
# mexmaci, mexmaci64, mexsol, mexs64
|
||||
# MATLAB_ARCH: The installation architecture. It is **usually**
|
||||
# the MEXEXT with the preceding "mex" removed,
|
||||
# though it's different for linux distros.
|
||||
#
|
||||
# There doesn't appear to be an elegant way to detect all versions of Matlab
|
||||
# across different platforms. If you know the matlab path and want to avoid
|
||||
# the search, you can define the path to the Matlab root when invoking cmake:
|
||||
#
|
||||
# cmake -DMATLAB_ROOT_DIR='/PATH/TO/ROOT_DIR' ..
|
||||
|
||||
|
||||
|
||||
# ----- set_library_presuffix -----
|
||||
#
|
||||
# Matlab tends to use some non-standard prefixes and suffixes on its libraries.
|
||||
# For example, libmx.dll on Windows (Windows does not add prefixes) and
|
||||
# mkl.dylib on OS X (OS X uses "lib" prefixes).
|
||||
# On some versions of Windows the .dll suffix also appears to not be checked.
|
||||
#
|
||||
# This function modifies the library prefixes and suffixes used by
|
||||
# find_library when finding Matlab libraries. It does not affect scopes
|
||||
# outside of this file.
|
||||
function(set_libarch_prefix_suffix)
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
|
||||
elseif (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
|
||||
elseif (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----- locate_matlab_root -----
|
||||
#
|
||||
# Attempt to find the path to the Matlab installation. If successful, sets
|
||||
# the absolute path in the variable MATLAB_ROOT_DIR
|
||||
function(locate_matlab_root)
|
||||
|
||||
# --- UNIX/APPLE ---
|
||||
if (UNIX)
|
||||
# possible root locations, in order of likelihood
|
||||
set(SEARCH_DIRS_ /Applications /usr/local /opt/local /usr /opt)
|
||||
foreach (DIR_ ${SEARCH_DIRS_})
|
||||
file(GLOB MATLAB_ROOT_DIR_ ${DIR_}/*matlab*)
|
||||
if (MATLAB_ROOT_DIR_)
|
||||
# sort in order from highest to lowest
|
||||
# normally it's in the format MATLAB_R[20XX][A/B]
|
||||
# TODO: numerical rather than lexicographic sort. However,
|
||||
# CMake does not support floating-point MATH(EXPR ...) at this time.
|
||||
list(SORT MATLAB_ROOT_DIR_)
|
||||
list(REVERSE MATLAB_ROOT_DIR_)
|
||||
list(GET MATLAB_ROOT_DIR_ 0 MATLAB_ROOT_DIR_)
|
||||
set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# --- WINDOWS ---
|
||||
elseif (WIN32)
|
||||
# 1. search the path environment variable
|
||||
find_program(MATLAB_ROOT_DIR_ matlab PATHS ENV PATH)
|
||||
if (MATLAB_ROOT_DIR_)
|
||||
# get the root directory from the full path
|
||||
# /path/to/matlab/rootdir/bin/matlab.exe
|
||||
get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
|
||||
get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
|
||||
set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# 2. search the registry
|
||||
# determine the available Matlab versions
|
||||
set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
|
||||
set(REG_ROOTS_ "HKEY_LOCAL_MACHINE" "HKEY_CURRENT_USER")
|
||||
foreach(REG_ROOT_ ${REG_ROOTS_})
|
||||
execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_)
|
||||
if (QUERY_RESPONSE_)
|
||||
string(REGEX MATCHALL "[0-9]\\.[0-9]" VERSION_STRINGS_ ${QUERY_RESPONSE_})
|
||||
list(APPEND VERSIONS_ ${VERSION_STRINGS_})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# select the highest version
|
||||
list(APPEND VERSIONS_ "0.0")
|
||||
list(SORT VERSIONS_)
|
||||
list(REVERSE VERSIONS_)
|
||||
list(GET VERSIONS_ 0 VERSION_)
|
||||
|
||||
# request the MATLABROOT from the registry
|
||||
foreach(REG_ROOT_ ${REG_ROOTS_})
|
||||
get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
|
||||
if (NOT ${QUERY_RESPONSE_} MATCHES "registry$")
|
||||
set(MATLAB_ROOT_DIR ${QUERY_RESPONSE_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----- locate_matlab_components -----
|
||||
#
|
||||
# Given a directory MATLAB_ROOT_DIR, attempt to find the Matlab components
|
||||
# (include directory and libraries) under the root. If everything is found,
|
||||
# sets the variable MATLAB_FOUND to TRUE
|
||||
function(locate_matlab_components MATLAB_ROOT_DIR)
|
||||
# get the mex extension
|
||||
find_file(MATLAB_MEXEXT_SCRIPT_ NAMES mexext mexext.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
execute_process(COMMAND ${MATLAB_MEXEXT_SCRIPT_}
|
||||
OUTPUT_VARIABLE MATLAB_MEXEXT_
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (NOT MATLAB_MEXEXT_)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# map the mexext to an architecture extension
|
||||
set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" )
|
||||
foreach(ARCHITECTURE_ ${ARCHITECTURES_})
|
||||
if(EXISTS ${MATLAB_ROOT_DIR}/bin/${ARCHITECTURE_})
|
||||
set(MATLAB_ARCH_ ${ARCHITECTURE_})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# get the path to the libraries
|
||||
set(MATLAB_LIBRARY_DIRS_ ${MATLAB_ROOT_DIR}/bin/${MATLAB_ARCH_})
|
||||
|
||||
# get the libraries
|
||||
set_libarch_prefix_suffix()
|
||||
find_library(MATLAB_LIB_MX_ mx PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
find_library(MATLAB_LIB_MEX_ mex PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
find_library(MATLAB_LIB_MAT_ mat PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
set(MATLAB_LIBRARIES_ ${MATLAB_LIB_MX_} ${MATLAB_LIB_MEX_} ${MATLAB_LIB_MAT_})
|
||||
|
||||
# get the include path
|
||||
find_path(MATLAB_INCLUDE_DIRS_ mex.h ${MATLAB_ROOT_DIR}/extern/include)
|
||||
|
||||
# get the mex shell script
|
||||
find_program(MATLAB_MEX_SCRIPT_ NAMES mex mex.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
|
||||
# get the Matlab executable
|
||||
find_program(MATLAB_BIN_ NAMES matlab PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
|
||||
# export into parent scope
|
||||
if (MATLAB_MEX_SCRIPT_ AND MATLAB_LIBRARIES_ AND MATLAB_INCLUDE_DIRS_)
|
||||
set(MATLAB_BIN ${MATLAB_BIN_} PARENT_SCOPE)
|
||||
set(MATLAB_MEX_SCRIPT ${MATLAB_MEX_SCRIPT_} PARENT_SCOPE)
|
||||
set(MATLAB_INCLUDE_DIRS ${MATLAB_INCLUDE_DIRS_} PARENT_SCOPE)
|
||||
set(MATLAB_LIBRARIES ${MATLAB_LIBRARIES_} PARENT_SCOPE)
|
||||
set(MATLAB_LIBRARY_DIRS ${MATLAB_LIBRARY_DIRS_} PARENT_SCOPE)
|
||||
set(MATLAB_MEXEXT ${MATLAB_MEXEXT_} PARENT_SCOPE)
|
||||
set(MATLAB_ARCH ${MATLAB_ARCH_} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# FIND MATLAB COMPONENTS
|
||||
# ----------------------------------------------------------------------------
|
||||
if (NOT MATLAB_FOUND)
|
||||
|
||||
# attempt to find the Matlab root folder
|
||||
if (NOT MATLAB_ROOT_DIR)
|
||||
locate_matlab_root()
|
||||
endif()
|
||||
|
||||
# given the matlab root folder, find the library locations
|
||||
if (MATLAB_ROOT_DIR)
|
||||
locate_matlab_components(${MATLAB_ROOT_DIR})
|
||||
endif()
|
||||
find_package_handle_standard_args(Matlab DEFAULT_MSG
|
||||
MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS
|
||||
MATLAB_ROOT_DIR MATLAB_LIBRARIES
|
||||
MATLAB_LIBRARY_DIRS MATLAB_MEXEXT
|
||||
MATLAB_ARCH MATLAB_BIN)
|
||||
endif()
|
||||
@@ -0,0 +1,108 @@
|
||||
# The script is taken from http://code.google.com/p/nvidia-texture-tools/
|
||||
|
||||
#
|
||||
# Try to find OpenEXR's libraries, and include path.
|
||||
# Once done this will define:
|
||||
#
|
||||
# OPENEXR_FOUND = OpenEXR found.
|
||||
# OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
|
||||
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
|
||||
#
|
||||
|
||||
SET(OPENEXR_LIBRARIES "")
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES "")
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
|
||||
|
||||
if(WIN32)
|
||||
SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")
|
||||
if(CMAKE_CL_64)
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)
|
||||
elseif(MSVC)
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
|
||||
endif()
|
||||
else()
|
||||
set(OPENEXR_ROOT "")
|
||||
endif()
|
||||
|
||||
SET(LIBRARY_PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
"${ProgramFiles_ENV_PATH}/OpenEXR/lib/static"
|
||||
"${OPENEXR_ROOT}/lib")
|
||||
|
||||
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
|
||||
PATH_SUFFIXES OpenEXR
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/sw/include
|
||||
/opt/local/include
|
||||
"${ProgramFiles_ENV_PATH}/OpenEXR/include"
|
||||
"${OPENEXR_ROOT}/include")
|
||||
|
||||
FIND_LIBRARY(OPENEXR_HALF_LIBRARY
|
||||
NAMES Half
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_IEX_LIBRARY
|
||||
NAMES Iex
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
|
||||
NAMES Imath
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
|
||||
NAMES IlmImf
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
|
||||
NAMES IlmThread
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
|
||||
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
|
||||
SET(OPENEXR_FOUND TRUE)
|
||||
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR")
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE)
|
||||
ENDIF ()
|
||||
|
||||
IF(OPENEXR_FOUND)
|
||||
IF(NOT OPENEXR_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}")
|
||||
ENDIF()
|
||||
if(PKG_CONFIG_FOUND AND NOT OPENEXR_VERSION)
|
||||
get_filename_component(OPENEXR_LIB_PATH "${OPENEXR_ILMIMF_LIBRARY}" PATH)
|
||||
if(EXISTS "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc")
|
||||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc"
|
||||
RESULT_VARIABLE PKG_CONFIG_PROCESS
|
||||
OUTPUT_VARIABLE OPENEXR_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
if(NOT PKG_CONFIG_PROCESS EQUAL 0)
|
||||
SET(OPENEXR_VERSION "Unknown")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT OPENEXR_VERSION)
|
||||
SET(OPENEXR_VERSION "Unknown")
|
||||
endif()
|
||||
ELSE()
|
||||
IF(OPENEXR_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find OpenEXR library")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENEXR_INCLUDE_PATHS
|
||||
OPENEXR_LIBRARIES
|
||||
OPENEXR_ILMIMF_LIBRARY
|
||||
OPENEXR_IMATH_LIBRARY
|
||||
OPENEXR_IEX_LIBRARY
|
||||
OPENEXR_HALF_LIBRARY
|
||||
OPENEXR_ILMTHREAD_LIBRARY)
|
||||
@@ -0,0 +1,89 @@
|
||||
# Main variables:
|
||||
# OPENNI_LIBRARY and OPENNI_INCLUDES to link OpenCV modules with OpenNI
|
||||
# HAVE_OPENNI for conditional compilation OpenCV with/without OpenNI
|
||||
|
||||
if(NOT "${OPENNI_LIB_DIR}" STREQUAL "${OPENNI_LIB_DIR_INTERNAL}")
|
||||
unset(OPENNI_LIBRARY CACHE)
|
||||
unset(OPENNI_LIB_DIR CACHE)
|
||||
endif()
|
||||
|
||||
if(NOT "${OPENNI_INCLUDE_DIR}" STREQUAL "${OPENNI_INCLUDE_DIR_INTERNAL}")
|
||||
unset(OPENNI_INCLUDES CACHE)
|
||||
unset(OPENNI_INCLUDE_DIR CACHE)
|
||||
endif()
|
||||
|
||||
if(NOT "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" STREQUAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL}")
|
||||
unset(OPENNI_PRIME_SENSOR_MODULE CACHE)
|
||||
unset(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR CACHE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(NOT (MSVC64 OR MINGW64))
|
||||
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH}Include" DOC "OpenNI c++ interface header")
|
||||
find_library(OPENNI_LIBRARY "OpenNI" PATHS $ENV{OPEN_NI_LIB} DOC "OpenNI library")
|
||||
else()
|
||||
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}Include" DOC "OpenNI c++ interface header")
|
||||
find_library(OPENNI_LIBRARY "OpenNI64" PATHS $ENV{OPEN_NI_LIB64} DOC "OpenNI library")
|
||||
endif()
|
||||
elseif(UNIX OR APPLE)
|
||||
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "/usr/include/ni" "/usr/include/openni" DOC "OpenNI c++ interface header")
|
||||
find_library(OPENNI_LIBRARY "OpenNI" PATHS "/usr/lib" DOC "OpenNI library")
|
||||
endif()
|
||||
|
||||
if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
|
||||
set(HAVE_OPENNI TRUE)
|
||||
# the check: are PrimeSensor Modules for OpenNI installed
|
||||
if(WIN32)
|
||||
if(NOT (MSVC64 OR MINGW64))
|
||||
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/Sensor/Bin" "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/SensorKinect/Bin" DOC "Core library of PrimeSensor Modules for OpenNI")
|
||||
else()
|
||||
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore64.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/Sensor/Bin64" "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/SensorKinect/Bin64" DOC "Core library of PrimeSensor Modules for OpenNI")
|
||||
endif()
|
||||
elseif(UNIX OR APPLE)
|
||||
find_library(OPENNI_PRIME_SENSOR_MODULE "XnCore" PATHS "/usr/lib" DOC "Core library of PrimeSensor Modules for OpenNI")
|
||||
endif()
|
||||
|
||||
if(OPENNI_PRIME_SENSOR_MODULE)
|
||||
set(HAVE_OPENNI_PRIME_SENSOR_MODULE TRUE)
|
||||
endif()
|
||||
endif() #if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
|
||||
|
||||
get_filename_component(OPENNI_LIB_DIR "${OPENNI_LIBRARY}" PATH)
|
||||
get_filename_component(OPENNI_INCLUDE_DIR ${OPENNI_INCLUDES} PATH)
|
||||
get_filename_component(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE}" PATH)
|
||||
|
||||
if(HAVE_OPENNI)
|
||||
set(OPENNI_LIB_DIR "${OPENNI_LIB_DIR}" CACHE PATH "Path to OpenNI libraries" FORCE)
|
||||
set(OPENNI_INCLUDE_DIR "${OPENNI_INCLUDE_DIR}" CACHE PATH "Path to OpenNI headers" FORCE)
|
||||
set(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE PATH "Path to OpenNI PrimeSensor Module binaries" FORCE)
|
||||
endif()
|
||||
|
||||
if(OPENNI_LIBRARY)
|
||||
set(OPENNI_LIB_DIR_INTERNAL "${OPENNI_LIB_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_LIB_DIR was set successfully." FORCE)
|
||||
else()
|
||||
message( WARNING, " OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries." )
|
||||
endif()
|
||||
|
||||
if(OPENNI_INCLUDES)
|
||||
set(OPENNI_INCLUDE_DIR_INTERNAL "${OPENNI_INCLUDE_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_INCLUDE_DIR was set successfully." FORCE)
|
||||
else()
|
||||
message( WARNING, " OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files." )
|
||||
endif()
|
||||
|
||||
if(OPENNI_PRIME_SENSOR_MODULE)
|
||||
set(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_PRIME_SENSOR_MODULE_BIN_DIR was set successfully." FORCE)
|
||||
else()
|
||||
message( WARNING, " PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries." )
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE OPENNI_PRIME_SENSOR_MODULE)
|
||||
mark_as_advanced(FORCE OPENNI_LIBRARY)
|
||||
mark_as_advanced(FORCE OPENNI_INCLUDES)
|
||||
|
||||
if(HAVE_OPENNI)
|
||||
ocv_parse_header("${OPENNI_INCLUDE_DIR}/XnVersion.h" OPENNI_VERSION_LINES XN_MAJOR_VERSION XN_MINOR_VERSION XN_MAINTENANCE_VERSION XN_BUILD_VERSION)
|
||||
if(XN_MAJOR_VERSION)
|
||||
set(OPENNI_VERSION_STRING ${XN_MAJOR_VERSION}.${XN_MINOR_VERSION}.${XN_MAINTENANCE_VERSION} CACHE INTERNAL "OpenNI version")
|
||||
set(OPENNI_VERSION_BUILD ${XN_BUILD_VERSION} CACHE INTERNAL "OpenNI build version")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,61 @@
|
||||
# Main variables:
|
||||
# OPENNI2_LIBRARY and OPENNI2_INCLUDES to link OpenCV modules with OpenNI2
|
||||
# HAVE_OPENNI2 for conditional compilation OpenCV with/without OpenNI2
|
||||
|
||||
if(NOT "${OPENNI2_LIB_DIR}" STREQUAL "${OPENNI2_LIB_DIR_INTERNAL}")
|
||||
unset(OPENNI2_LIBRARY CACHE)
|
||||
unset(OPENNI2_LIB_DIR CACHE)
|
||||
endif()
|
||||
|
||||
if(NOT "${OPENNI2_INCLUDE_DIR}" STREQUAL "${OPENNI2_INCLUDE_DIR_INTERNAL}")
|
||||
unset(OPENNI2_INCLUDES CACHE)
|
||||
unset(OPENNI2_INCLUDE_DIR CACHE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(NOT (MSVC64 OR MINGW64))
|
||||
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH}Include" DOC "OpenNI2 c++ interface header")
|
||||
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS $ENV{OPENNI2_LIB} DOC "OpenNI2 library")
|
||||
else()
|
||||
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS $ENV{OPENNI2_INCLUDE64} "$ENV{OPEN_NI_INSTALL_PATH64}Include" DOC "OpenNI2 c++ interface header")
|
||||
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS $ENV{OPENNI2_LIB64} DOC "OpenNI2 library")
|
||||
endif()
|
||||
elseif(UNIX OR APPLE)
|
||||
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS "/usr/include/ni2" "/usr/include/openni2" $ENV{OPENNI2_INCLUDE} DOC "OpenNI2 c++ interface header")
|
||||
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS "/usr/lib" $ENV{OPENNI2_REDIST} DOC "OpenNI2 library")
|
||||
endif()
|
||||
|
||||
if(OPENNI2_LIBRARY AND OPENNI2_INCLUDES)
|
||||
set(HAVE_OPENNI2 TRUE)
|
||||
endif() #if(OPENNI2_LIBRARY AND OPENNI2_INCLUDES)
|
||||
|
||||
get_filename_component(OPENNI2_LIB_DIR "${OPENNI2_LIBRARY}" PATH)
|
||||
get_filename_component(OPENNI2_INCLUDE_DIR ${OPENNI2_INCLUDES} PATH)
|
||||
|
||||
if(HAVE_OPENNI2)
|
||||
set(OPENNI2_LIB_DIR "${OPENNI2_LIB_DIR}" CACHE PATH "Path to OpenNI2 libraries" FORCE)
|
||||
set(OPENNI2_INCLUDE_DIR "${OPENNI2_INCLUDE_DIR}" CACHE PATH "Path to OpenNI2 headers" FORCE)
|
||||
endif()
|
||||
|
||||
if(OPENNI2_LIBRARY)
|
||||
set(OPENNI2_LIB_DIR_INTERNAL "${OPENNI2_LIB_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_LIB_DIR was set successfully." FORCE)
|
||||
else()
|
||||
message( WARNING, " OpenNI2 library directory (set by OPENNI2_LIB_DIR variable) is not found or does not have OpenNI2 libraries." )
|
||||
endif()
|
||||
|
||||
if(OPENNI2_INCLUDES)
|
||||
set(OPENNI2_INCLUDE_DIR_INTERNAL "${OPENNI2_INCLUDE_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI2_INCLUDE_DIR was set successfully." FORCE)
|
||||
else()
|
||||
message( WARNING, " OpenNI2 include directory (set by OPENNI2_INCLUDE_DIR variable) is not found or does not have OpenNI2 include files." )
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE OPENNI2_LIBRARY)
|
||||
mark_as_advanced(FORCE OPENNI2_INCLUDES)
|
||||
|
||||
if(HAVE_OPENNI2)
|
||||
ocv_parse_header("${OPENNI2_INCLUDE_DIR}/OniVersion.h" ONI_VERSION_LINE ONI_VERSION_MAJOR ONI_VERSION_MINOR ONI_VERSION_MAINTENANCE ONI_VERSION_BUILD)
|
||||
if(ONI_VERSION_MAJOR)
|
||||
set(OPENNI2_VERSION_STRING ${ONI_VERSION_MAJOR}.${ONI_VERSION_MINOR}.${ONI_VERSION_MAINTENANCE} CACHE INTERNAL "OpenNI2 version")
|
||||
set(OPENNI2_VERSION_BUILD ${ONI_VERSION_BUILD} CACHE INTERNAL "OpenNI2 build version")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,33 @@
|
||||
#=============================================================================
|
||||
# Find WebP library
|
||||
#=============================================================================
|
||||
# Find the native WebP headers and libraries.
|
||||
#
|
||||
# WEBP_INCLUDE_DIRS - where to find webp/decode.h, etc.
|
||||
# WEBP_LIBRARIES - List of libraries when using webp.
|
||||
# WEBP_FOUND - True if webp is found.
|
||||
#=============================================================================
|
||||
|
||||
# Look for the header file.
|
||||
|
||||
unset(WEBP_FOUND)
|
||||
|
||||
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
|
||||
|
||||
if(NOT WEBP_INCLUDE_DIR)
|
||||
unset(WEBP_FOUND)
|
||||
else()
|
||||
MARK_AS_ADVANCED(WEBP_INCLUDE_DIR)
|
||||
|
||||
# Look for the library.
|
||||
FIND_LIBRARY(WEBP_LIBRARY NAMES webp)
|
||||
MARK_AS_ADVANCED(WEBP_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set WEBFOUND_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WebP DEFAULT_MSG WEBP_LIBRARY WEBP_INCLUDE_DIR)
|
||||
|
||||
SET(WEBP_LIBRARIES ${WEBP_LIBRARY})
|
||||
SET(WEBP_INCLUDE_DIRS ${WEBP_INCLUDE_DIR})
|
||||
endif()
|
||||
@@ -0,0 +1,52 @@
|
||||
# - Find XIMEA
|
||||
# This module finds if XIMEA Software package is installed
|
||||
# and determines where the binaries and header files are.
|
||||
# This code sets the following variables:
|
||||
#
|
||||
# XIMEA_FOUND - True if XIMEA API found
|
||||
# XIMEA_PATH: - Path to the XIMEA API folder
|
||||
# XIMEA_LIBRARY_DIR - XIMEA libraries folder
|
||||
#
|
||||
# Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
|
||||
# Updated: 25 June 2012 by Igor Kuzmin (parafin@ximea.com)
|
||||
# Updated: 22 October 2012 by Marian Zajko (marian.zajko@ximea.com)
|
||||
#
|
||||
|
||||
set(XIMEA_FOUND)
|
||||
set(XIMEA_PATH)
|
||||
set(XIMEA_LIBRARY_DIR)
|
||||
|
||||
if(WIN32)
|
||||
# Try to find the XIMEA API path in registry.
|
||||
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
|
||||
|
||||
if(EXISTS ${XIMEA_PATH})
|
||||
set(XIMEA_FOUND 1)
|
||||
# set LIB folders
|
||||
if(X86_64)
|
||||
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x64")
|
||||
else()
|
||||
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
|
||||
endif()
|
||||
else()
|
||||
set(XIMEA_FOUND 0)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(EXISTS /Library/Frameworks/m3api.framework)
|
||||
set(XIMEA_FOUND 1)
|
||||
else()
|
||||
set(XIMEA_FOUND 0)
|
||||
endif()
|
||||
else()
|
||||
if(EXISTS /opt/XIMEA)
|
||||
set(XIMEA_FOUND 1)
|
||||
# set folders
|
||||
set(XIMEA_PATH /opt/XIMEA/include)
|
||||
else()
|
||||
set(XIMEA_FOUND 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE XIMEA_FOUND)
|
||||
mark_as_advanced(FORCE XIMEA_PATH)
|
||||
mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)
|
||||
@@ -0,0 +1,49 @@
|
||||
if (NOT GENERATE_ABI_DESCRIPTOR)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(filename "opencv_abi.xml")
|
||||
set(path1 "${CMAKE_BINARY_DIR}/${filename}")
|
||||
|
||||
set(modules "${OPENCV_MODULES_PUBLIC}")
|
||||
ocv_list_filterout(modules "opencv_ts")
|
||||
|
||||
message(STATUS "Generating ABI compliance checker configuration: ${filename}")
|
||||
|
||||
if (OPENCV_VCSVERSION AND NOT OPENCV_VCSVERSION STREQUAL "unknown")
|
||||
set(OPENCV_ABI_VERSION "${OPENCV_VCSVERSION}")
|
||||
else()
|
||||
set(OPENCV_ABI_VERSION "${OPENCV_VERSION}")
|
||||
endif()
|
||||
|
||||
# Headers
|
||||
set(OPENCV_ABI_HEADERS "{RELPATH}/${OPENCV_INCLUDE_INSTALL_PATH}")
|
||||
|
||||
# Libraries
|
||||
set(OPENCV_ABI_LIBRARIES "{RELPATH}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
|
||||
set(OPENCV_ABI_SKIP_HEADERS "")
|
||||
set(OPENCV_ABI_SKIP_LIBRARIES "")
|
||||
foreach(mod ${OPENCV_MODULES_BUILD})
|
||||
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
|
||||
if(NOT "${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
|
||||
# headers
|
||||
foreach(h ${OPENCV_MODULE_opencv_${mod}_HEADERS})
|
||||
file(RELATIVE_PATH h "${OPENCV_MODULE_opencv_${mod}_LOCATION}/include" "${h}")
|
||||
list(APPEND OPENCV_ABI_SKIP_HEADERS "${h}")
|
||||
endforeach()
|
||||
# libraries
|
||||
set(lib_name "")
|
||||
get_target_property(lib_name opencv_${mod} LOCATION)
|
||||
get_filename_component(lib_name "${lib_name}" NAME)
|
||||
list(APPEND OPENCV_ABI_SKIP_LIBRARIES "${lib_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
string(REPLACE ";" "\n " OPENCV_ABI_SKIP_HEADERS "${OPENCV_ABI_SKIP_HEADERS}")
|
||||
string(REPLACE ";" "\n " OPENCV_ABI_SKIP_LIBRARIES "${OPENCV_ABI_SKIP_LIBRARIES}")
|
||||
|
||||
# Options
|
||||
set(OPENCV_ABI_GCC_OPTIONS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REGEX REPLACE "([^ ]) +([^ ])" "\\1\\n \\2" OPENCV_ABI_GCC_OPTIONS "${OPENCV_ABI_GCC_OPTIONS}")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_abi.xml.in" "${path1}")
|
||||
@@ -0,0 +1,66 @@
|
||||
if(ANDROID)
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Installation for Android ndk-build makefile: OpenCV.mk
|
||||
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install"
|
||||
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
|
||||
# build type
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(OPENCV_LIBTYPE_CONFIGMAKE "SHARED")
|
||||
else()
|
||||
set(OPENCV_LIBTYPE_CONFIGMAKE "STATIC")
|
||||
endif()
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(OPENCV_LIBTYPE_CONFIGMAKE "SHARED")
|
||||
set(OPENCV_STATIC_LIBTYPE_CONFIGMAKE "STATIC")
|
||||
else()
|
||||
set(OPENCV_STATIC_LIBTYPE_CONFIGMAKE ${OPENCV_LIBTYPE_CONFIGMAKE})
|
||||
endif()
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
ocv_get_all_libs(OPENCV_MODULES_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE)
|
||||
|
||||
# list -> string
|
||||
string(REPLACE ";" " " OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
string(REPLACE ";" " " OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "${OPENCV_EXTRA_COMPONENTS_CONFIGMAKE}")
|
||||
string(REPLACE ";" " " OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE}")
|
||||
|
||||
# replace 'opencv_<module>' -> '<module>''
|
||||
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
|
||||
|
||||
# prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
|
||||
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
|
||||
foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB})
|
||||
string(REPLACE "tbb" "" OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB}")
|
||||
endforeach()
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java3)
|
||||
else()
|
||||
set(OPENCV_LIBS_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
endif()
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
|
||||
set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${OpenCV_SOURCE_DIR}\"")
|
||||
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/lib/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" @ONLY)
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include\"")
|
||||
set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "")
|
||||
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../libs/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev)
|
||||
endif(ANDROID)
|
||||
@@ -0,0 +1,159 @@
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Installation for CMake Module: OpenCVConfig.cmake
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"
|
||||
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
|
||||
# -------------------------------------------------------------------------------------------
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE TRUE)
|
||||
else()
|
||||
set(OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE FALSE)
|
||||
endif()
|
||||
|
||||
if(NOT OpenCV_CUDA_CC)
|
||||
set(OpenCV_CUDA_CC_CONFIGCMAKE "\"\"")
|
||||
set(OpenCV_CUDA_VERSION "")
|
||||
else()
|
||||
set(OpenCV_CUDA_CC_CONFIGCMAKE "${OpenCV_CUDA_CC}")
|
||||
set(OpenCV_CUDA_VERSION ${CUDA_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_NATIVE_API_LEVEL)
|
||||
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE 0)
|
||||
else()
|
||||
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE "${ANDROID_NATIVE_API_LEVEL}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual" OR CMAKE_GENERATOR MATCHES "Xcode")
|
||||
set(OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE TRUE)
|
||||
else()
|
||||
set(OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE FALSE)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
set(OPENCV_LINK_LIBRARY_SUFFIX ".dll.a")
|
||||
else()
|
||||
set(OPENCV_LINK_LIBRARY_SUFFIX ".lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#build list of modules available for the OpenCV user
|
||||
set(OpenCV_LIB_COMPONENTS "")
|
||||
foreach(m ${OPENCV_MODULES_PUBLIC})
|
||||
list(INSERT OpenCV_LIB_COMPONENTS 0 ${${m}_MODULE_DEPS_OPT} ${m})
|
||||
endforeach()
|
||||
ocv_list_unique(OpenCV_LIB_COMPONENTS)
|
||||
set(OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
|
||||
ocv_list_filterout(OpenCV_LIB_COMPONENTS "^opencv_")
|
||||
if(OpenCV_LIB_COMPONENTS)
|
||||
list(REMOVE_ITEM OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
|
||||
endif()
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
|
||||
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
|
||||
endif()
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
|
||||
|
||||
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "")
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(EXISTS "${OPENCV_MODULE_${m}_LOCATION}/include")
|
||||
list(APPEND OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "${OPENCV_MODULE_${m}_LOCATION}/include")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ANDROID AND NOT BUILD_SHARED_LIBS AND HAVE_TBB)
|
||||
#export TBB headers location because static linkage of TBB might be troublesome if application wants to use TBB itself
|
||||
list(APPEND OpenCV2_INCLUDE_DIRS_CONFIGCMAKE ${TBB_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
set(modules_file_suffix "")
|
||||
if(ANDROID)
|
||||
# the REPLACE here is needed, because OpenCVModules_armeabi.cmake includes
|
||||
# OpenCVModules_armeabi-*.cmake, which would match OpenCVModules_armeabi-v7a*.cmake.
|
||||
string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}")
|
||||
endif()
|
||||
|
||||
export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules${modules_file_suffix}.cmake")
|
||||
|
||||
if(TARGET ippicv)
|
||||
set(USE_IPPICV TRUE)
|
||||
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV ${CMAKE_BINARY_DIR} ${IPPICV_LOCATION_PATH})
|
||||
else()
|
||||
set(USE_IPPICV FALSE)
|
||||
set(INSTALL_PATH_RELATIVE_IPPICV "non-existed-path")
|
||||
endif()
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" @ONLY)
|
||||
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work.
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" @ONLY)
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"")
|
||||
|
||||
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
|
||||
set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"")
|
||||
|
||||
if(UNIX) # ANDROID configuration is created here also
|
||||
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference
|
||||
# For a command "find_package(<name> [major[.minor]] [EXACT] [REQUIRED|QUIET])"
|
||||
# cmake will look in the following dir on unix:
|
||||
# <prefix>/(share|lib)/cmake/<name>*/ (U)
|
||||
# <prefix>/(share|lib)/<name>*/ (U)
|
||||
# <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
|
||||
if(USE_IPPICV)
|
||||
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${IPPICV_INSTALL_PATH})
|
||||
endif()
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" @ONLY)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
|
||||
# --------------------------------------------------------------------------------------------
|
||||
if(WIN32)
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"")
|
||||
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
|
||||
|
||||
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
|
||||
if(USE_IPPICV)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OpenCV_INSTALL_BINARIES_PREFIX}lib" ${IPPICV_INSTALL_PATH})
|
||||
else()
|
||||
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" ${IPPICV_INSTALL_PATH})
|
||||
endif()
|
||||
endif()
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" @ONLY)
|
||||
if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
else()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
endif()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT dev)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/" COMPONENT dev)
|
||||
else ()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/opencv-${OPENCV_VERSION}" COMPONENT dev)
|
||||
endif ()
|
||||
endif()
|
||||
@@ -0,0 +1,28 @@
|
||||
# platform-specific config file
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/cvconfig.h")
|
||||
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# opencv_modules.hpp based on actual modules list
|
||||
# ----------------------------------------------------------------------------
|
||||
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "")
|
||||
|
||||
set(OPENCV_MOD_LIST ${OPENCV_MODULES_PUBLIC})
|
||||
ocv_list_sort(OPENCV_MOD_LIST)
|
||||
foreach(m ${OPENCV_MOD_LIST})
|
||||
string(TOUPPER "${m}" m)
|
||||
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#define HAVE_${m}\n")
|
||||
endforeach()
|
||||
|
||||
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}\n")
|
||||
|
||||
#set(OPENCV_MOD_LIST ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
|
||||
#ocv_list_sort(OPENCV_MOD_LIST)
|
||||
#foreach(m ${OPENCV_MOD_LIST})
|
||||
# string(TOUPPER "${m}" m)
|
||||
# set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#undef HAVE_${m}\n")
|
||||
#endforeach()
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")
|
||||
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev)
|
||||
@@ -0,0 +1,15 @@
|
||||
if(OPENCV_EXTRA_WORLD)
|
||||
set(OPENCV_APPLE_BUNDLE_NAME "OpenCV_contrib")
|
||||
set(OPENCV_APPLE_BUNDLE_ID "org.opencv_contrib")
|
||||
else()
|
||||
set(OPENCV_APPLE_BUNDLE_NAME "OpenCV")
|
||||
set(OPENCV_APPLE_BUNDLE_ID "org.opencv")
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/ios/Info.plist.in"
|
||||
"${CMAKE_BINARY_DIR}/ios/Info.plist")
|
||||
elseif(APPLE)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/osx/Info.plist.in"
|
||||
"${CMAKE_BINARY_DIR}/osx/Info.plist")
|
||||
endif()
|
||||
@@ -0,0 +1,98 @@
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# according to man pkg-config
|
||||
# The package name specified on the pkg-config command line is defined to
|
||||
# be the name of the metadata file, minus the .pc extension. If a library
|
||||
# can install multiple versions simultaneously, it must give each version
|
||||
# its own name (for example, GTK 1.2 might have the package name "gtk+"
|
||||
# while GTK 2.0 has "gtk+-2.0").
|
||||
#
|
||||
# ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
|
||||
macro(fix_prefix lst isown)
|
||||
set(_lst)
|
||||
foreach(item ${${lst}})
|
||||
if(TARGET ${item})
|
||||
get_target_property(item "${item}" LOCATION_${CMAKE_BUILD_TYPE})
|
||||
if("${isown}")
|
||||
get_filename_component(item "${item}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib(.*)" "\\1" item "${item}")
|
||||
endif()
|
||||
endif()
|
||||
if(item MATCHES "^-l")
|
||||
list(APPEND _lst "${item}")
|
||||
elseif(item MATCHES "[\\/]")
|
||||
get_filename_component(libdir "${item}" PATH)
|
||||
get_filename_component(libname "${item}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib(.*)" "\\1" libname "${libname}")
|
||||
list(APPEND _lst "-L${libdir}" "-l${libname}")
|
||||
else()
|
||||
list(APPEND _lst "-l${item}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${lst} ${_lst})
|
||||
unset(_lst)
|
||||
endmacro()
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
ocv_get_all_libs(_modules _extra _3rdparty)
|
||||
|
||||
#build the list of components
|
||||
|
||||
# Note:
|
||||
# when linking against static libraries, if libfoo depends on libbar, then
|
||||
# libfoo must come first in the linker flags.
|
||||
|
||||
# world and contrib_world are special targets whose library should come first,
|
||||
# especially for static link.
|
||||
if(_modules MATCHES "opencv_world")
|
||||
set(_modules "opencv_world")
|
||||
endif()
|
||||
|
||||
if(_modules MATCHES "opencv_contrib_world")
|
||||
list(REMOVE_ITEM _modules "opencv_contrib_world")
|
||||
list(INSERT _modules 0 "opencv_contrib_world")
|
||||
endif()
|
||||
|
||||
fix_prefix(_modules TRUE)
|
||||
fix_prefix(_extra FALSE)
|
||||
fix_prefix(_3rdparty TRUE)
|
||||
|
||||
ocv_list_unique(_modules)
|
||||
ocv_list_unique(_extra)
|
||||
ocv_list_unique(_3rdparty)
|
||||
|
||||
set(OPENCV_PC_LIBS
|
||||
"-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}"
|
||||
"${_modules}"
|
||||
)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(OPENCV_PC_LIBS_PRIVATE "${_extra}")
|
||||
else()
|
||||
set(OPENCV_PC_LIBS_PRIVATE
|
||||
"-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}"
|
||||
"${_3rdparty}"
|
||||
"${_extra}"
|
||||
)
|
||||
endif()
|
||||
string(REPLACE ";" " " OPENCV_PC_LIBS "${OPENCV_PC_LIBS}")
|
||||
string(REPLACE ";" " " OPENCV_PC_LIBS_PRIVATE "${OPENCV_PC_LIBS_PRIVATE}")
|
||||
|
||||
#generate the .pc file
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
set(includedir "\${prefix}/${OPENCV_INCLUDE_INSTALL_PATH}")
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
|
||||
else()
|
||||
set(OPENCV_PC_FILE_NAME opencv.pc)
|
||||
endif()
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}"
|
||||
@ONLY)
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig COMPONENT dev)
|
||||
endif()
|
||||
@@ -0,0 +1,6 @@
|
||||
set(MIN_VER_CMAKE 2.8.7)
|
||||
set(MIN_VER_CUDA 4.2)
|
||||
set(MIN_VER_PYTHON2 2.6)
|
||||
set(MIN_VER_PYTHON3 3.2)
|
||||
set(MIN_VER_ZLIB 1.2.3)
|
||||
set(MIN_VER_GTK 2.18.0)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,372 @@
|
||||
# taken from http://public.kitware.com/Bug/view.php?id=1260 and slightly adjusted
|
||||
|
||||
# - Try to find precompiled headers support for GCC 3.4 and 4.x
|
||||
# Once done this will define:
|
||||
#
|
||||
# Variable:
|
||||
# PCHSupport_FOUND
|
||||
#
|
||||
# Macro:
|
||||
# ADD_PRECOMPILED_HEADER _targetName _input _dowarn
|
||||
# ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use _dowarn
|
||||
# ADD_NATIVE_PRECOMPILED_HEADER _targetName _input _dowarn
|
||||
# GET_NATIVE_PRECOMPILED_HEADER _targetName _input
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
EXEC_PROGRAM(
|
||||
${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
SET(_PCH_include_prefix "-I")
|
||||
SET(_PCH_isystem_prefix "-isystem")
|
||||
SET(_PCH_define_prefix "-D")
|
||||
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
SET(_PCH_include_prefix "/I")
|
||||
SET(_PCH_isystem_prefix "/I")
|
||||
SET(_PCH_define_prefix "/D")
|
||||
ELSE()
|
||||
SET(PCHSupport_FOUND FALSE)
|
||||
ENDIF()
|
||||
|
||||
MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(${_out_compile_flags} ${${_flags_var_name}} )
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
|
||||
IF(${_targetType} STREQUAL SHARED_LIBRARY AND NOT WIN32)
|
||||
LIST(APPEND ${_out_compile_flags} "-fPIC")
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS)
|
||||
if(_target_definitions)
|
||||
foreach(_def ${_target_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} "-D${_def}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
ELSE()
|
||||
## TODO ... ? or does it work out of the box
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
get_target_property(DIRINC ${_PCH_current_target} INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${OpenCV_SOURCE_DIR} DEFINITIONS)
|
||||
#MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" )
|
||||
LIST(APPEND ${_out_compile_flags} ${_directory_flags})
|
||||
LIST(APPEND ${_out_compile_flags} ${_global_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
|
||||
|
||||
SEPARATE_ARGUMENTS(${_out_compile_flags})
|
||||
|
||||
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
|
||||
|
||||
|
||||
MACRO(_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp)
|
||||
|
||||
SET(${_dephelp} ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch_dephelp.cxx)
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "#include \\\"${_include_file}\\\"" > "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "int testfunction();" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "int testfunction()" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "{" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " return 0;" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "}" >> "${${_dephelp}}"
|
||||
DEPENDS "${_include_file}"
|
||||
)
|
||||
else()
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${_include_file}\\\"" > "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "int testfunction\\(\\)\\;" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "int testfunction\\(\\)" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "{" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " \\return 0\\;" >> "${${_dephelp}}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "}" >> "${${_dephelp}}"
|
||||
DEPENDS "${_include_file}"
|
||||
)
|
||||
endif()
|
||||
|
||||
ENDMACRO(_PCH_WRITE_PCHDEP_CXX )
|
||||
|
||||
MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
|
||||
|
||||
FILE(TO_NATIVE_PATH ${_input} _native_input)
|
||||
FILE(TO_NATIVE_PATH ${_output} _native_output)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||
# remove leading space in compiler argument
|
||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||
|
||||
SET(${out_command}
|
||||
${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}
|
||||
)
|
||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
||||
SET(${out_command}
|
||||
${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}
|
||||
)
|
||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
SET(_dummy_str "#include <${_input}>")
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch_dummy.cpp ${_dummy_str})
|
||||
|
||||
SET(${out_command}
|
||||
${CMAKE_CXX_COMPILER} ${_compile_FLAGS} /c /Fp${_native_output} /Yc${_native_input} pch_dummy.cpp
|
||||
)
|
||||
#/out:${_output}
|
||||
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
ENDMACRO(_PCH_GET_COMPILE_COMMAND )
|
||||
|
||||
|
||||
MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
|
||||
|
||||
FILE(TO_NATIVE_PATH ${_pch_path} _native_pch_path)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||
# on all remote machines set
|
||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||
# if you want warnings for invalid header files (which is very inconvenient
|
||||
# if you have different versions of the headers for different build types
|
||||
# you may set _pch_dowarn
|
||||
IF (_dowarn)
|
||||
SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include \"${CMAKE_CURRENT_BINARY_DIR}/${_header_name}\" -Winvalid-pch " )
|
||||
ELSE (_dowarn)
|
||||
SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include \"${CMAKE_CURRENT_BINARY_DIR}/${_header_name}\" " )
|
||||
ENDIF (_dowarn)
|
||||
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
set(${_cflags} "/Fp${_native_pch_path} /Yu${_header_name}" )
|
||||
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
ENDMACRO(_PCH_GET_TARGET_COMPILE_FLAGS )
|
||||
|
||||
|
||||
MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output)
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
GET_FILENAME_COMPONENT(_path ${_input} PATH)
|
||||
SET(${_output} "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch/${_targetName}_${CMAKE_BUILD_TYPE}.gch")
|
||||
|
||||
ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input)
|
||||
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
|
||||
|
||||
# to do: test whether compiler flags match between target _targetName
|
||||
# and _pch_output_to_use
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
|
||||
IF(ARGN STREQUAL "0")
|
||||
SET(_dowarn 0)
|
||||
ELSE()
|
||||
SET(_dowarn 1)
|
||||
ENDIF()
|
||||
|
||||
_PCH_GET_TARGET_COMPILE_FLAGS(_target_cflags ${_name} ${_pch_output_to_use} ${_dowarn})
|
||||
#MESSAGE("Add flags ${_target_cflags} to ${_targetName} " )
|
||||
|
||||
GET_TARGET_PROPERTY(_sources ${_targetName} SOURCES)
|
||||
FOREACH(src ${_sources})
|
||||
if(NOT "${src}" MATCHES "\\.mm$")
|
||||
get_source_file_property(_flags "${src}" COMPILE_FLAGS)
|
||||
if(_flags)
|
||||
set(_flags "${_flags} ${_target_cflags}")
|
||||
else()
|
||||
set(_flags "${_target_cflags}")
|
||||
endif()
|
||||
|
||||
set_source_files_properties("${src}" PROPERTIES COMPILE_FLAGS "${_flags}")
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
|
||||
ADD_CUSTOM_TARGET(pch_Generate_${_targetName}
|
||||
DEPENDS ${_pch_output_to_use}
|
||||
)
|
||||
|
||||
ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName} )
|
||||
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
|
||||
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF(ARGN STREQUAL "0")
|
||||
SET(_dowarn 0)
|
||||
ELSE()
|
||||
SET(_dowarn 1)
|
||||
ENDIF()
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
GET_FILENAME_COMPONENT(_path ${_input} PATH)
|
||||
GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_input} _output)
|
||||
|
||||
_PCH_WRITE_PCHDEP_CXX(${_targetName} "${_input}" _pch_dephelp_cxx)
|
||||
|
||||
ADD_LIBRARY(${_targetName}_pch_dephelp STATIC "${_pch_dephelp_cxx}" "${_input}" )
|
||||
|
||||
set_target_properties(${_targetName}_pch_dephelp PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}"
|
||||
)
|
||||
|
||||
_PCH_GET_COMPILE_FLAGS(_compile_FLAGS)
|
||||
|
||||
get_target_property(type ${_targetName} TYPE)
|
||||
if(type STREQUAL "SHARED_LIBRARY")
|
||||
get_target_property(__DEFINES ${_targetName} DEFINE_SYMBOL)
|
||||
if(NOT __DEFINES MATCHES __DEFINES-NOTFOUND)
|
||||
list(APPEND _compile_FLAGS "${_PCH_define_prefix}${__DEFINES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(DIRINC ${_targetName} INCLUDE_DIRECTORIES)
|
||||
set_target_properties(${_targetName}_pch_dephelp PROPERTIES INCLUDE_DIRECTORIES "${DIRINC}")
|
||||
|
||||
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
|
||||
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc
|
||||
DEPENDS "${_input}"
|
||||
)
|
||||
|
||||
#message("_command ${_input} ${_output}")
|
||||
_PCH_GET_COMPILE_COMMAND(_command ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_output} )
|
||||
|
||||
GET_FILENAME_COMPONENT(_outdir ${_output} PATH)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${_output}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_outdir}"
|
||||
COMMAND ${_command}
|
||||
DEPENDS "${_input}"
|
||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_name}"
|
||||
DEPENDS ${_targetName}_pch_dephelp
|
||||
)
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn})
|
||||
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
|
||||
|
||||
# Generates the use of precompiled in a target,
|
||||
# without using depency targets (2 extra for each target)
|
||||
# Using Visual, must also add ${_targetName}_pch to sources
|
||||
# Not needed by Xcode
|
||||
|
||||
MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||
set(_dummy_str "#include \"${_input}\"\n")
|
||||
|
||||
set(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cpp)
|
||||
if(EXISTS ${${_targetName}_pch})
|
||||
# Check if contents is the same, if not rewrite
|
||||
# todo
|
||||
else()
|
||||
FILE(WRITE ${${_targetName}_pch} ${_dummy_str})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER)
|
||||
|
||||
|
||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
||||
|
||||
IF(ARGN STREQUAL "0")
|
||||
SET(_dowarn 0)
|
||||
ELSE()
|
||||
SET(_dowarn 1)
|
||||
ENDIF()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
# precompiled is specified at the target level
|
||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
if (oldProps MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
endif()
|
||||
|
||||
SET(newProperties "${oldProps} /Yu\"${_input}\" /FI\"${_input}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"")
|
||||
|
||||
elseif (CMAKE_GENERATOR MATCHES Xcode)
|
||||
|
||||
# For Xcode, cmake needs my patch to process
|
||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||
|
||||
# When buiding out of the tree, precompiled may not be located
|
||||
# Use full path instead.
|
||||
GET_FILENAME_COMPONENT(fullPath ${_input} ABSOLUTE)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
|
||||
else()
|
||||
|
||||
#Fallback to the "old" precompiled suppport
|
||||
#ADD_PRECOMPILED_HEADER(${_targetName} ${_input} ${_dowarn})
|
||||
|
||||
endif()
|
||||
|
||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
||||
|
||||
macro(ocv_add_precompiled_header_to_target the_target pch_header)
|
||||
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual" OR CMAKE_GENERATOR MATCHES Xcode)
|
||||
add_native_precompiled_header(${the_target} ${pch_header})
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
|
||||
add_precompiled_header(${the_target} ${pch_header})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,124 @@
|
||||
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
set(CPACK_set_DESTDIR "on")
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library")
|
||||
set(CPACK_PACKAGE_DESCRIPTION
|
||||
"OpenCV (Open Source Computer Vision Library) is an open source computer vision
|
||||
and machine learning software library. OpenCV was built to provide a common
|
||||
infrastructure for computer vision applications and to accelerate the use of
|
||||
machine perception in the commercial products. Being a BSD-licensed product,
|
||||
OpenCV makes it easy for businesses to utilize and modify the code.")
|
||||
set(CPACK_PACKAGE_VENDOR "OpenCV Foundation")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_CONTACT "admin@opencv.org")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
#arch
|
||||
if(X86)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "i386")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
|
||||
elseif(X86_64)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "amd64")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
|
||||
elseif(ARM)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "armhf")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
|
||||
else()
|
||||
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE})
|
||||
elseif(CPACK_GENERATOR STREQUAL "RPM")
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
|
||||
else()
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
|
||||
|
||||
#rpm options
|
||||
set(CPACK_RPM_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
|
||||
set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
|
||||
|
||||
#deb options
|
||||
set(CPACK_DEB_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
|
||||
|
||||
#display names
|
||||
set(CPACK_COMPONENT_DEV_DISPLAY_NAME "Development files")
|
||||
set(CPACK_COMPONENT_DOCS_DISPLAY_NAME "Documentation")
|
||||
set(CPACK_COMPONENT_JAVA_DISPLAY_NAME "Java bindings")
|
||||
set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries and data")
|
||||
set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python bindings")
|
||||
set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples")
|
||||
set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests")
|
||||
|
||||
#depencencies
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
|
||||
set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
|
||||
set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_DEV_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_DOCS_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_JAVA_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_TESTS_DEPENDS libs)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
|
||||
if(${CUDA_VERSION} VERSION_LESS "6.5")
|
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
|
||||
else()
|
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-cudart-${cuda_version_suffix}, cuda-npp-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-cudart-dev-${cuda_version_suffix}, cuda-npp-dev-${cuda_version_suffix}")
|
||||
if(HAVE_CUFFT)
|
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cufft-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cufft-dev-${cuda_version_suffix}")
|
||||
endif()
|
||||
if(HAVE_HAVE_CUBLAS)
|
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cublas-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}")
|
||||
endif()
|
||||
endif()
|
||||
set(CPACK_COMPONENT_dev_DEPENDS libs)
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "lib${CMAKE_PROJECT_NAME}")
|
||||
|
||||
set(CPACK_COMPONENT_PYTHON_DESCRIPTION "Python bindings for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_PYTHON_NAME "lib${CMAKE_PROJECT_NAME}-python")
|
||||
|
||||
set(CPACK_COMPONENT_JAVA_DESCRIPTION "Java bindings for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_JAVA_NAME "lib${CMAKE_PROJECT_NAME}-java")
|
||||
|
||||
set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_DEV_NAME "lib${CMAKE_PROJECT_NAME}-dev")
|
||||
|
||||
set(CPACK_COMPONENT_DOCS_DESCRIPTION "Documentation for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_DOCS_NAME "lib${CMAKE_PROJECT_NAME}-docs")
|
||||
|
||||
set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Samples for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_SAMPLES_NAME "lib${CMAKE_PROJECT_NAME}-samples")
|
||||
|
||||
set(CPACK_COMPONENT_TESTS_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_TESTS_NAME "lib${CMAKE_PROJECT_NAME}-tests")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
include(CPack)
|
||||
|
||||
ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
@@ -0,0 +1,834 @@
|
||||
# Debugging function
|
||||
function(ocv_cmake_dump_vars)
|
||||
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
|
||||
set(regex "${DUMP_UNPARSED_ARGUMENTS}")
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
set(VARS "")
|
||||
foreach(_variableName ${_variableNames})
|
||||
if(_variableName MATCHES "${regex}")
|
||||
set(VARS "${VARS}${_variableName}=${${_variableName}}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
if(DUMP_TOFILE)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${VARS}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "${VARS}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation thess macro should be defined by toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
# assert macro
|
||||
# Note: it doesn't support lists in arguments
|
||||
# Usage samples:
|
||||
# ocv_assert(MyLib_FOUND)
|
||||
# ocv_assert(DEFINED MyLib_INCLUDE_DIRS)
|
||||
macro(ocv_assert)
|
||||
if(NOT (${ARGN}))
|
||||
string(REPLACE ";" " " __assert_msg "${ARGN}")
|
||||
message(AUTHOR_WARNING "Assertion failed: ${__assert_msg}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_debug_message)
|
||||
# string(REPLACE ";" " " __msg "${ARGN}")
|
||||
# message(STATUS "${__msg}")
|
||||
endmacro()
|
||||
|
||||
macro(ocv_check_environment_variables)
|
||||
foreach(_var ${ARGN})
|
||||
if(NOT DEFINED ${_var} AND DEFINED ENV{${_var}})
|
||||
set(__value "$ENV{${_var}}")
|
||||
file(TO_CMAKE_PATH "${__value}" __value) # Assume that we receive paths
|
||||
set(${_var} "${__value}")
|
||||
message(STATUS "Update variable ${_var} from environment: ${${_var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# rename modules target to world if needed
|
||||
macro(_ocv_fix_target target_var)
|
||||
if(BUILD_opencv_world)
|
||||
if(OPENCV_MODULE_${${target_var}}_IS_PART_OF_WORLD)
|
||||
set(${target_var} opencv_world)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
ocv_debug_message("ocv_include_directories( ${ARGN} )")
|
||||
set(__add_before "")
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
|
||||
list(APPEND __add_before "${dir}")
|
||||
else()
|
||||
include_directories(AFTER SYSTEM "${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
include_directories(BEFORE ${__add_before})
|
||||
endfunction()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_target_include_directories target)
|
||||
_ocv_fix_target(target)
|
||||
set(__params "")
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
|
||||
list(APPEND __params "${__abs_dir}")
|
||||
else()
|
||||
list(APPEND __params "${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(HAVE_CUDA OR CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
include_directories(${__params})
|
||||
else()
|
||||
if(TARGET ${target})
|
||||
target_include_directories(${target} PRIVATE ${__params})
|
||||
else()
|
||||
set(__new_inc "${OCV_TARGET_INCLUDE_DIRS_${target}};${__params}")
|
||||
set(OCV_TARGET_INCLUDE_DIRS_${target} "${__new_inc}" CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# clears all passed variables
|
||||
macro(ocv_clear_vars)
|
||||
foreach(_var ${ARGN})
|
||||
unset(${_var} CACHE)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
set(OCV_COMPILER_FAIL_REGEX
|
||||
"command line option .* is valid for .* but not for C\\+\\+" # GNU
|
||||
"command line option .* is valid for .* but not for C" # GNU
|
||||
"unrecognized .*option" # GNU
|
||||
"unknown .*option" # Clang
|
||||
"ignoring unknown option" # MSVC
|
||||
"warning D9002" # MSVC, any lang
|
||||
"option .*not supported" # Intel
|
||||
"[Uu]nknown option" # HP
|
||||
"[Ww]arning: [Oo]ption" # SunPro
|
||||
"command option .* is not recognized" # XL
|
||||
"not supported in this configuration; ignored" # AIX
|
||||
"File with unknown suffix passed to linker" # PGI
|
||||
"WARNING: unknown flag:" # Open64
|
||||
)
|
||||
|
||||
MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
|
||||
if(NOT DEFINED ${RESULT})
|
||||
if("_${LANG}_" MATCHES "_CXX_")
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
|
||||
if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
|
||||
FILE(WRITE "${_fname}" "int main() { return 0; }\n")
|
||||
else()
|
||||
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
|
||||
endif()
|
||||
elseif("_${LANG}_" MATCHES "_C_")
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
|
||||
if("${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
|
||||
FILE(WRITE "${_fname}" "int main(void) { return 0; }\n")
|
||||
else()
|
||||
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
|
||||
endif()
|
||||
elseif("_${LANG}_" MATCHES "_OBJCXX_")
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.mm")
|
||||
if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
|
||||
FILE(WRITE "${_fname}" "int main() { return 0; }\n")
|
||||
else()
|
||||
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
|
||||
endif()
|
||||
else()
|
||||
unset(_fname)
|
||||
endif()
|
||||
if(_fname)
|
||||
MESSAGE(STATUS "Performing Test ${RESULT}")
|
||||
TRY_COMPILE(${RESULT}
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${_fname}"
|
||||
COMPILE_DEFINITIONS "${FLAG}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
|
||||
IF("${OUTPUT}" MATCHES "${_regex}")
|
||||
SET(${RESULT} 0)
|
||||
break()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
IF(${RESULT})
|
||||
SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
|
||||
MESSAGE(STATUS "Performing Test ${RESULT} - Success")
|
||||
ELSE(${RESULT})
|
||||
MESSAGE(STATUS "Performing Test ${RESULT} - Failed")
|
||||
SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}")
|
||||
ENDIF(${RESULT})
|
||||
else()
|
||||
SET(${RESULT} 0)
|
||||
endif()
|
||||
endif()
|
||||
ENDMACRO()
|
||||
|
||||
macro(ocv_check_flag_support lang flag varname)
|
||||
if("_${lang}_" MATCHES "_CXX_")
|
||||
set(_lang CXX)
|
||||
elseif("_${lang}_" MATCHES "_C_")
|
||||
set(_lang C)
|
||||
elseif("_${lang}_" MATCHES "_OBJCXX_")
|
||||
set(_lang OBJCXX)
|
||||
else()
|
||||
set(_lang ${lang})
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${flag}" ${varname})
|
||||
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
|
||||
string(REGEX REPLACE " -|-|=| |\\." "_" ${varname} "${${varname}}")
|
||||
|
||||
ocv_check_compiler_flag("${_lang}" "${ARGN} ${flag}" ${${varname}})
|
||||
endmacro()
|
||||
|
||||
# turns off warnings
|
||||
macro(ocv_warnings_disable)
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
set(_flag_vars "")
|
||||
set(_msvc_warnings "")
|
||||
set(_gxx_warnings "")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg MATCHES "^CMAKE_")
|
||||
list(APPEND _flag_vars ${arg})
|
||||
elseif(arg MATCHES "^/wd")
|
||||
list(APPEND _msvc_warnings ${arg})
|
||||
elseif(arg MATCHES "^-W")
|
||||
list(APPEND _gxx_warnings ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
if(MSVC AND _msvc_warnings AND _flag_vars)
|
||||
foreach(var ${_flag_vars})
|
||||
foreach(warning ${_msvc_warnings})
|
||||
set(${var} "${${var}} ${warning}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
elseif((CMAKE_COMPILER_IS_GNUCXX OR (UNIX AND CV_ICC)) AND _gxx_warnings AND _flag_vars)
|
||||
foreach(var ${_flag_vars})
|
||||
foreach(warning ${_gxx_warnings})
|
||||
if(NOT warning MATCHES "^-Wno-")
|
||||
string(REPLACE "${warning}" "" ${var} "${${var}}")
|
||||
string(REPLACE "-W" "-Wno-" warning "${warning}")
|
||||
endif()
|
||||
ocv_check_flag_support(${var} "${warning}" _varname)
|
||||
if(${_varname})
|
||||
set(${var} "${${var}} ${warning}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_flag_vars)
|
||||
unset(_msvc_warnings)
|
||||
unset(_gxx_warnings)
|
||||
endif(NOT ENABLE_NOISY_WARNINGS)
|
||||
endmacro()
|
||||
|
||||
macro(add_apple_compiler_options the_module)
|
||||
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
|
||||
if(HAVE_OBJC_EXCEPTIONS)
|
||||
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
|
||||
if("${source}" MATCHES "\\.mm$")
|
||||
get_source_file_property(flags "${source}" COMPILE_FLAGS)
|
||||
if(flags)
|
||||
set(flags "${_flags} -fobjc-exceptions")
|
||||
else()
|
||||
set(flags "-fobjc-exceptions")
|
||||
endif()
|
||||
|
||||
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Provides an option that the user can optionally select.
|
||||
# Can accept condition to control when option is available for user.
|
||||
# Usage:
|
||||
# option(<option_variable> "help string describing the option" <initial value or boolean expression> [IF <condition>])
|
||||
macro(OCV_OPTION variable description value)
|
||||
set(__value ${value})
|
||||
set(__condition "")
|
||||
set(__varname "__value")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg STREQUAL "IF" OR arg STREQUAL "if")
|
||||
set(__varname "__condition")
|
||||
else()
|
||||
list(APPEND ${__varname} ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
unset(__varname)
|
||||
if(__condition STREQUAL "")
|
||||
set(__condition 2 GREATER 1)
|
||||
endif()
|
||||
|
||||
if(${__condition})
|
||||
if(__value MATCHES ";")
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
elseif(DEFINED ${__value})
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
else()
|
||||
option(${variable} "${description}" ${__value})
|
||||
endif()
|
||||
else()
|
||||
unset(${variable} CACHE)
|
||||
endif()
|
||||
unset(__condition)
|
||||
unset(__value)
|
||||
endmacro()
|
||||
|
||||
|
||||
# Macros that checks if module have been installed.
|
||||
# After it adds module to build and define
|
||||
# constants passed as second arg
|
||||
macro(CHECK_MODULE module_name define)
|
||||
set(${define} 0)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
set(ALIAS ALIASOF_${module_name})
|
||||
set(ALIAS_FOUND ${ALIAS}_FOUND)
|
||||
set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)
|
||||
set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)
|
||||
set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)
|
||||
|
||||
PKG_CHECK_MODULES(${ALIAS} ${module_name})
|
||||
|
||||
if(${ALIAS_FOUND})
|
||||
set(${define} 1)
|
||||
foreach(P "${ALIAS_INCLUDE_DIRS}")
|
||||
if(${P})
|
||||
list(APPEND VIDEOIO_INCLUDE_DIRS ${${P}})
|
||||
list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(P "${ALIAS_LIBRARY_DIRS}")
|
||||
if(${P})
|
||||
list(APPEND VIDEOIO_LIBRARY_DIRS ${${P}})
|
||||
list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND VIDEOIO_LIBRARIES ${${ALIAS_LIBRARIES}})
|
||||
list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
set(OPENCV_BUILD_INFO_FILE "${OpenCV_BINARY_DIR}/version_string.tmp")
|
||||
file(REMOVE "${OPENCV_BUILD_INFO_FILE}")
|
||||
function(ocv_output_status msg)
|
||||
message(STATUS "${msg}")
|
||||
string(REPLACE "\\" "\\\\" msg "${msg}")
|
||||
string(REPLACE "\"" "\\\"" msg "${msg}")
|
||||
file(APPEND "${OPENCV_BUILD_INFO_FILE}" "\"${msg}\\n\"\n")
|
||||
endfunction()
|
||||
|
||||
macro(ocv_finalize_status)
|
||||
if(NOT OPENCV_SKIP_STATUS_FINALIZATION)
|
||||
if(DEFINED OPENCV_MODULE_opencv_core_BINARY_DIR)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENCV_BUILD_INFO_FILE}" "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string.inc" OUTPUT_QUIET)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Status report function.
|
||||
# Automatically align right column and selects text based on condition.
|
||||
# Usage:
|
||||
# status(<text>)
|
||||
# status(<heading> <value1> [<value2> ...])
|
||||
# status(<heading> <condition> THEN <text for TRUE> ELSE <text for FALSE> )
|
||||
function(status text)
|
||||
set(status_cond)
|
||||
set(status_then)
|
||||
set(status_else)
|
||||
|
||||
set(status_current_name "cond")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg STREQUAL "THEN")
|
||||
set(status_current_name "then")
|
||||
elseif(arg STREQUAL "ELSE")
|
||||
set(status_current_name "else")
|
||||
else()
|
||||
list(APPEND status_${status_current_name} ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(DEFINED status_cond)
|
||||
set(status_placeholder_length 32)
|
||||
string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)
|
||||
string(LENGTH "${text}" status_text_length)
|
||||
if(status_text_length LESS status_placeholder_length)
|
||||
string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)
|
||||
elseif(DEFINED status_then OR DEFINED status_else)
|
||||
ocv_output_status("${text}")
|
||||
set(status_text "${status_placeholder}")
|
||||
else()
|
||||
set(status_text "${text}")
|
||||
endif()
|
||||
|
||||
if(DEFINED status_then OR DEFINED status_else)
|
||||
if(${status_cond})
|
||||
string(REPLACE ";" " " status_then "${status_then}")
|
||||
string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}")
|
||||
ocv_output_status("${status_text} ${status_then}")
|
||||
else()
|
||||
string(REPLACE ";" " " status_else "${status_else}")
|
||||
string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}")
|
||||
ocv_output_status("${status_text} ${status_else}")
|
||||
endif()
|
||||
else()
|
||||
string(REPLACE ";" " " status_cond "${status_cond}")
|
||||
string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}")
|
||||
ocv_output_status("${status_text} ${status_cond}")
|
||||
endif()
|
||||
else()
|
||||
ocv_output_status("${text}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# remove all matching elements from the list
|
||||
macro(ocv_list_filterout lst regex)
|
||||
foreach(item ${${lst}})
|
||||
if(item MATCHES "${regex}")
|
||||
list(REMOVE_ITEM ${lst} "${item}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# stable & safe duplicates removal macro
|
||||
macro(ocv_list_unique __lst)
|
||||
if(${__lst})
|
||||
list(REMOVE_DUPLICATES ${__lst})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# safe list reversal macro
|
||||
macro(ocv_list_reverse __lst)
|
||||
if(${__lst})
|
||||
list(REVERSE ${__lst})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# safe list sorting macro
|
||||
macro(ocv_list_sort __lst)
|
||||
if(${__lst})
|
||||
list(SORT ${__lst})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# add prefix to each item in the list
|
||||
macro(ocv_list_add_prefix LST PREFIX)
|
||||
set(__tmp "")
|
||||
foreach(item ${${LST}})
|
||||
list(APPEND __tmp "${PREFIX}${item}")
|
||||
endforeach()
|
||||
set(${LST} ${__tmp})
|
||||
unset(__tmp)
|
||||
endmacro()
|
||||
|
||||
|
||||
# add suffix to each item in the list
|
||||
macro(ocv_list_add_suffix LST SUFFIX)
|
||||
set(__tmp "")
|
||||
foreach(item ${${LST}})
|
||||
list(APPEND __tmp "${item}${SUFFIX}")
|
||||
endforeach()
|
||||
set(${LST} ${__tmp})
|
||||
unset(__tmp)
|
||||
endmacro()
|
||||
|
||||
|
||||
# gets and removes the first element from list
|
||||
macro(ocv_list_pop_front LST VAR)
|
||||
if(${LST})
|
||||
list(GET ${LST} 0 ${VAR})
|
||||
list(REMOVE_AT ${LST} 0)
|
||||
else()
|
||||
set(${VAR} "")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# simple regex escaping routine (does not cover all cases!!!)
|
||||
macro(ocv_regex_escape var regex)
|
||||
string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
|
||||
endmacro()
|
||||
|
||||
|
||||
# convert list of paths to full paths
|
||||
macro(ocv_convert_to_full_paths VAR)
|
||||
if(${VAR})
|
||||
set(__tmp "")
|
||||
foreach(path ${${VAR}})
|
||||
get_filename_component(${VAR} "${path}" ABSOLUTE)
|
||||
list(APPEND __tmp "${${VAR}}")
|
||||
endforeach()
|
||||
set(${VAR} ${__tmp})
|
||||
unset(__tmp)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# convert list of paths to libraries names without lib prefix
|
||||
macro(ocv_convert_to_lib_name var)
|
||||
set(__tmp "")
|
||||
foreach(path ${ARGN})
|
||||
get_filename_component(__tmp_name "${path}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
|
||||
list(APPEND __tmp "${__tmp_name}")
|
||||
endforeach()
|
||||
set(${var} ${__tmp})
|
||||
unset(__tmp)
|
||||
unset(__tmp_name)
|
||||
endmacro()
|
||||
|
||||
|
||||
# add install command
|
||||
function(ocv_install_target)
|
||||
install(TARGETS ${ARGN})
|
||||
|
||||
set(isPackage 0)
|
||||
unset(__package)
|
||||
unset(__target)
|
||||
foreach(e ${ARGN})
|
||||
if(NOT DEFINED __target)
|
||||
set(__target "${e}")
|
||||
endif()
|
||||
if(isPackage EQUAL 1)
|
||||
set(__package "${e}")
|
||||
break()
|
||||
endif()
|
||||
if(e STREQUAL "EXPORT")
|
||||
set(isPackage 1)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(DEFINED __package)
|
||||
list(APPEND ${__package}_TARGETS ${__target})
|
||||
set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
set(__target "${ARGV0}")
|
||||
|
||||
set(isArchive 0)
|
||||
set(isDst 0)
|
||||
unset(__dst)
|
||||
foreach(e ${ARGN})
|
||||
if(isDst EQUAL 1)
|
||||
set(__dst "${e}")
|
||||
break()
|
||||
endif()
|
||||
if(isArchive EQUAL 1 AND e STREQUAL "DESTINATION")
|
||||
set(isDst 1)
|
||||
endif()
|
||||
if(e STREQUAL "ARCHIVE")
|
||||
set(isArchive 1)
|
||||
else()
|
||||
set(isArchive 0)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# message(STATUS "Process ${__target} dst=${__dst}...")
|
||||
if(DEFINED __dst)
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
get_target_property(fname ${__target} LOCATION_DEBUG)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
|
||||
endif()
|
||||
|
||||
get_target_property(fname ${__target} LOCATION_RELEASE)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
|
||||
endif()
|
||||
else()
|
||||
# CMake 2.8.12 brokes PDB support in STATIC libraries for MSVS
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# read set of version defines from the header file
|
||||
macro(ocv_parse_header FILENAME FILE_VAR)
|
||||
set(vars_regex "")
|
||||
set(__parnet_scope OFF)
|
||||
set(__add_cache OFF)
|
||||
foreach(name ${ARGN})
|
||||
if("${name}" STREQUAL "PARENT_SCOPE")
|
||||
set(__parnet_scope ON)
|
||||
elseif("${name}" STREQUAL "CACHE")
|
||||
set(__add_cache ON)
|
||||
elseif(vars_regex)
|
||||
set(vars_regex "${vars_regex}|${name}")
|
||||
else()
|
||||
set(vars_regex "${name}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(EXISTS "${FILENAME}")
|
||||
file(STRINGS "${FILENAME}" ${FILE_VAR} REGEX "#define[ \t]+(${vars_regex})[ \t]+[0-9]+" )
|
||||
else()
|
||||
unset(${FILE_VAR})
|
||||
endif()
|
||||
foreach(name ${ARGN})
|
||||
if(NOT "${name}" STREQUAL "PARENT_SCOPE" AND NOT "${name}" STREQUAL "CACHE")
|
||||
if(${FILE_VAR})
|
||||
if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
|
||||
string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
|
||||
else()
|
||||
set(${name} "")
|
||||
endif()
|
||||
if(__add_cache)
|
||||
set(${name} ${${name}} CACHE INTERNAL "${name} parsed from ${FILENAME}" FORCE)
|
||||
elseif(__parnet_scope)
|
||||
set(${name} "${${name}}" PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
unset(${name} CACHE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# read single version define from the header file
|
||||
macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME)
|
||||
ocv_clear_vars(${LIBNAME}_VERSION_MAJOR
|
||||
${LIBNAME}_VERSION_MAJOR
|
||||
${LIBNAME}_VERSION_MINOR
|
||||
${LIBNAME}_VERSION_PATCH
|
||||
${LIBNAME}_VERSION_TWEAK
|
||||
${LIBNAME}_VERSION_STRING)
|
||||
set(${LIBNAME}_H "")
|
||||
if(EXISTS "${HDR_PATH}")
|
||||
file(STRINGS "${HDR_PATH}" ${LIBNAME}_H REGEX "^#define[ \t]+${VARNAME}[ \t]+\"[^\"]*\".*$" LIMIT_COUNT 1)
|
||||
endif()
|
||||
|
||||
if(${LIBNAME}_H)
|
||||
string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MAJOR "${${LIBNAME}_H}")
|
||||
string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MINOR "${${LIBNAME}_H}")
|
||||
string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_PATCH "${${LIBNAME}_H}")
|
||||
set(${LIBNAME}_VERSION_MAJOR ${${LIBNAME}_VERSION_MAJOR} ${ARGN})
|
||||
set(${LIBNAME}_VERSION_MINOR ${${LIBNAME}_VERSION_MINOR} ${ARGN})
|
||||
set(${LIBNAME}_VERSION_PATCH ${${LIBNAME}_VERSION_PATCH} ${ARGN})
|
||||
set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_MAJOR}.${${LIBNAME}_VERSION_MINOR}.${${LIBNAME}_VERSION_PATCH}")
|
||||
|
||||
# append a TWEAK version if it exists:
|
||||
set(${LIBNAME}_VERSION_TWEAK "")
|
||||
if("${${LIBNAME}_H}" MATCHES "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
|
||||
set(${LIBNAME}_VERSION_TWEAK "${CMAKE_MATCH_1}" ${ARGN})
|
||||
endif()
|
||||
if(${LIBNAME}_VERSION_TWEAK)
|
||||
set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_STRING}.${${LIBNAME}_VERSION_TWEAK}" ${ARGN})
|
||||
else()
|
||||
set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_STRING}" ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# read single version info from the pkg file
|
||||
macro(ocv_parse_pkg LIBNAME PKG_PATH SCOPE)
|
||||
if(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
|
||||
file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
|
||||
STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ALIASOF_${LIBNAME}_VERSION "${line_to_parse}" )
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
################################################################################################
|
||||
# short command to setup source group
|
||||
function(ocv_source_group group)
|
||||
if(BUILD_opencv_world AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
|
||||
set(group "${the_module}\\${group}")
|
||||
endif()
|
||||
cmake_parse_arguments(SG "" "DIRBASE" "GLOB;GLOB_RECURSE;FILES" ${ARGN})
|
||||
set(files "")
|
||||
if(SG_FILES)
|
||||
list(APPEND files ${SG_FILES})
|
||||
endif()
|
||||
if(SG_GLOB)
|
||||
file(GLOB srcs ${SG_GLOB})
|
||||
list(APPEND files ${srcs})
|
||||
endif()
|
||||
if(SG_GLOB_RECURSE)
|
||||
file(GLOB_RECURSE srcs ${SG_GLOB_RECURSE})
|
||||
list(APPEND files ${srcs})
|
||||
endif()
|
||||
if(SG_DIRBASE)
|
||||
foreach(f ${files})
|
||||
file(RELATIVE_PATH fpart "${SG_DIRBASE}" "${f}")
|
||||
if(fpart MATCHES "^\\.\\.")
|
||||
message(AUTHOR_WARNING "Can't detect subpath for source_group command: Group=${group} FILE=${f} DIRBASE=${SG_DIRBASE}")
|
||||
set(fpart "")
|
||||
else()
|
||||
get_filename_component(fpart "${fpart}" PATH)
|
||||
if(fpart)
|
||||
set(fpart "/${fpart}") # add '/'
|
||||
string(REPLACE "/" "\\" fpart "${fpart}")
|
||||
endif()
|
||||
endif()
|
||||
source_group("${group}${fpart}" FILES ${f})
|
||||
endforeach()
|
||||
else()
|
||||
source_group(${group} FILES ${files})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_target_link_libraries target)
|
||||
_ocv_fix_target(target)
|
||||
set(LINK_DEPS ${ARGN})
|
||||
# process world
|
||||
if(BUILD_opencv_world)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
|
||||
if(";${LINK_DEPS};" MATCHES ";${m};")
|
||||
list(REMOVE_ITEM LINK_DEPS ${m})
|
||||
if(NOT (";${LINK_DEPS};" MATCHES ";opencv_world;"))
|
||||
list(APPEND LINK_DEPS opencv_world)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
target_link_libraries(${target} ${LINK_DEPS})
|
||||
endfunction()
|
||||
|
||||
function(_ocv_append_target_includes target)
|
||||
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
|
||||
target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
|
||||
if (TARGET ${target}_object)
|
||||
target_include_directories(${target}_object PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
|
||||
endif()
|
||||
unset(OCV_TARGET_INCLUDE_DIRS_${target} CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_executable target)
|
||||
add_executable(${target} ${ARGN})
|
||||
_ocv_append_target_includes(${target})
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_library target)
|
||||
set(cuda_objs "")
|
||||
if(HAVE_CUDA)
|
||||
set(cuda_srcs "")
|
||||
|
||||
foreach(var ${ARGN})
|
||||
if(var MATCHES ".cu")
|
||||
list(APPEND cuda_srcs ${var})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(cuda_srcs)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
endif()
|
||||
set(OPENCV_MODULE_${target}_CUDA_OBJECTS ${cuda_objs} CACHE INTERNAL "Compiled CUDA object files")
|
||||
endif()
|
||||
|
||||
add_library(${target} ${ARGN} ${cuda_objs})
|
||||
|
||||
# Add OBJECT library (added in cmake 2.8.8) to use in compound modules
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "2.8.8"
|
||||
AND NOT OPENCV_MODULE_${target}_CHILDREN
|
||||
AND NOT OPENCV_MODULE_${target}_CLASS STREQUAL "BINDINGS"
|
||||
AND NOT ${target} STREQUAL "opencv_ts"
|
||||
)
|
||||
set(sources ${ARGN})
|
||||
ocv_list_filterout(sources "\\\\.(cl|inc)$")
|
||||
add_library(${target}_object OBJECT ${sources})
|
||||
set_target_properties(${target}_object PROPERTIES
|
||||
EXCLUDE_FROM_ALL True
|
||||
EXCLUDE_FROM_DEFAULT_BUILD True
|
||||
POSITION_INDEPENDENT_CODE True
|
||||
)
|
||||
if (ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${target}_object PROPERTIES FOLDER "object_libraries")
|
||||
endif()
|
||||
unset(sources)
|
||||
endif()
|
||||
|
||||
_ocv_append_target_includes(${target})
|
||||
endfunction()
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
# _modules - variable to hold list of all modules
|
||||
# _extra - variable to hold list of extra dependencies
|
||||
# _3rdparty - variable to hold list of prebuilt 3rdparty libraries
|
||||
macro(ocv_get_all_libs _modules _extra _3rdparty)
|
||||
set(${_modules} "")
|
||||
set(${_extra} "")
|
||||
set(${_3rdparty} "")
|
||||
foreach(m ${OPENCV_MODULES_PUBLIC})
|
||||
get_target_property(deps ${m} INTERFACE_LINK_LIBRARIES)
|
||||
if(NOT deps)
|
||||
set(deps "")
|
||||
endif()
|
||||
list(INSERT ${_modules} 0 ${deps} ${m})
|
||||
foreach (dep ${deps} ${OPENCV_LINKER_LIBS})
|
||||
if (NOT DEFINED OPENCV_MODULE_${dep}_LOCATION)
|
||||
if (TARGET ${dep})
|
||||
get_target_property(_output ${dep} ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if ("${_output}" STREQUAL "${3P_LIBRARY_OUTPUT_PATH}")
|
||||
list(INSERT ${_3rdparty} 0 ${dep})
|
||||
else()
|
||||
list(INSERT ${_extra} 0 ${dep})
|
||||
endif()
|
||||
else()
|
||||
list(INSERT ${_extra} 0 ${dep})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# ippicv specific handling
|
||||
list(FIND ${_extra} "ippicv" ippicv_idx)
|
||||
if (${ippicv_idx} GREATER -1)
|
||||
list(REMOVE_ITEM ${_extra} "ippicv")
|
||||
list(INSERT ${_3rdparty} 0 "ippicv")
|
||||
endif()
|
||||
|
||||
# split 3rdparty libs and modules
|
||||
list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}})
|
||||
|
||||
# convert CMake lists to makefile literals
|
||||
foreach(lst ${_modules} ${_3rdparty} ${_extra})
|
||||
ocv_list_unique(${lst})
|
||||
ocv_list_reverse(${lst})
|
||||
endforeach()
|
||||
endmacro()
|
||||
@@ -0,0 +1,18 @@
|
||||
SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp")
|
||||
file(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_VERSION_[A-Z]+[ ]+" )
|
||||
|
||||
string(REGEX REPLACE ".+CV_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+CV_VERSION_MINOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+CV_VERSION_STATUS[ ]+\"([^\"]*)\".*" "\\1" OPENCV_VERSION_STATUS "${OPENCV_VERSION_PARTS}")
|
||||
|
||||
set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
|
||||
set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}")
|
||||
|
||||
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
||||
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
|
||||
# create a dependency on version file
|
||||
# we never use output of the following command but cmake will rerun automatically if the version file changes
|
||||
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
int count = 0;
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)){return -1;}
|
||||
if (count == 0) {return -1;}
|
||||
for (int device = 0; device < count; ++device)
|
||||
{
|
||||
cudaDeviceProp prop;
|
||||
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue;}
|
||||
printf("%d.%d ", prop.major, prop.minor);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
#pragma comment (lib, "d3d11.lib")
|
||||
|
||||
HINSTANCE g_hInst = NULL;
|
||||
D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL;
|
||||
D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0;
|
||||
ID3D11Device* g_pd3dDevice = NULL;
|
||||
ID3D11DeviceContext* g_pImmediateContext = NULL;
|
||||
IDXGISwapChain* g_pSwapChain = NULL;
|
||||
|
||||
static HRESULT InitDevice()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
UINT width = 640;
|
||||
UINT height = 480;
|
||||
|
||||
UINT createDeviceFlags = 0;
|
||||
|
||||
D3D_DRIVER_TYPE driverTypes[] =
|
||||
{
|
||||
D3D_DRIVER_TYPE_HARDWARE,
|
||||
D3D_DRIVER_TYPE_WARP,
|
||||
D3D_DRIVER_TYPE_REFERENCE,
|
||||
};
|
||||
UINT numDriverTypes = ARRAYSIZE(driverTypes);
|
||||
|
||||
D3D_FEATURE_LEVEL featureLevels[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
};
|
||||
UINT numFeatureLevels = ARRAYSIZE(featureLevels);
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC sd;
|
||||
ZeroMemory( &sd, sizeof( sd ) );
|
||||
sd.BufferCount = 1;
|
||||
sd.BufferDesc.Width = width;
|
||||
sd.BufferDesc.Height = height;
|
||||
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
sd.BufferDesc.RefreshRate.Numerator = 60;
|
||||
sd.BufferDesc.RefreshRate.Denominator = 1;
|
||||
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
sd.OutputWindow = NULL; //g_hWnd;
|
||||
sd.SampleDesc.Count = 1;
|
||||
sd.SampleDesc.Quality = 0;
|
||||
sd.Windowed = TRUE;
|
||||
|
||||
for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
|
||||
{
|
||||
g_driverType = driverTypes[driverTypeIndex];
|
||||
hr = D3D11CreateDeviceAndSwapChain(NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
|
||||
D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext);
|
||||
if (SUCCEEDED(hr))
|
||||
break;
|
||||
}
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
InitDevice();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#if defined __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifdef CL_VERSION_1_2
|
||||
#error OpenCL is valid
|
||||
#else
|
||||
#error OpenCL check failed
|
||||
#endif
|
||||
#else
|
||||
#ifdef CL_VERSION_1_2
|
||||
#pragma message ("OpenCL is valid")
|
||||
#else
|
||||
#pragma message ("OpenCL check failed")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <vfw.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
AVIFileInit();
|
||||
AVIFileExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <windows.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/,
|
||||
0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/,
|
||||
NULL /*hInstance*/, NULL /*lpParam*/);
|
||||
DeleteDC(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
file(GLOB cl_list "${CL_DIR}/*.cl" )
|
||||
list(SORT cl_list)
|
||||
|
||||
string(REPLACE ".cpp" ".hpp" OUTPUT_HPP "${OUTPUT}")
|
||||
get_filename_component(OUTPUT_HPP_NAME "${OUTPUT_HPP}" NAME)
|
||||
|
||||
if("${MODULE_NAME}" STREQUAL "ocl")
|
||||
set(nested_namespace_start "")
|
||||
set(nested_namespace_end "")
|
||||
else()
|
||||
set(new_mode ON)
|
||||
set(nested_namespace_start "namespace ${MODULE_NAME}\n{")
|
||||
set(nested_namespace_end "}")
|
||||
endif()
|
||||
|
||||
set(STR_CPP "// This file is auto-generated. Do not edit!
|
||||
|
||||
#include \"precomp.hpp\"
|
||||
#include \"${OUTPUT_HPP_NAME}\"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
${nested_namespace_start}
|
||||
|
||||
")
|
||||
|
||||
set(STR_HPP "// This file is auto-generated. Do not edit!
|
||||
|
||||
#include \"opencv2/core/ocl.hpp\"
|
||||
#include \"opencv2/core/ocl_genbase.hpp\"
|
||||
#include \"opencv2/core/opencl/ocl_defs.hpp\"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
${nested_namespace_start}
|
||||
|
||||
")
|
||||
|
||||
foreach(cl ${cl_list})
|
||||
get_filename_component(cl_filename "${cl}" NAME_WE)
|
||||
#message("${cl_filename}")
|
||||
|
||||
file(READ "${cl}" lines)
|
||||
|
||||
string(REPLACE "\r" "" lines "${lines}\n")
|
||||
string(REPLACE "\t" " " lines "${lines}")
|
||||
|
||||
string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" "" lines "${lines}") # multiline comments
|
||||
string(REGEX REPLACE "/\\*([^\n])*\\*/" "" lines "${lines}") # single-line comments
|
||||
string(REGEX REPLACE "[ ]*//[^\n]*\n" "\n" lines "${lines}") # single-line comments
|
||||
string(REGEX REPLACE "\n[ ]*(\n[ ]*)*" "\n" lines "${lines}") # empty lines & leading whitespace
|
||||
string(REGEX REPLACE "^\n" "" lines "${lines}") # leading new line
|
||||
|
||||
string(REPLACE "\\" "\\\\" lines "${lines}")
|
||||
string(REPLACE "\"" "\\\"" lines "${lines}")
|
||||
string(REPLACE "\n" "\\n\"\n\"" lines "${lines}")
|
||||
|
||||
string(REGEX REPLACE "\"$" "" lines "${lines}") # unneeded " at the eof
|
||||
|
||||
string(MD5 hash "${lines}")
|
||||
|
||||
set(STR_CPP_DECL "const struct ProgramEntry ${cl_filename}={\"${cl_filename}\",\n\"${lines}, \"${hash}\"};\n")
|
||||
set(STR_HPP_DECL "extern const struct ProgramEntry ${cl_filename};\n")
|
||||
if(new_mode)
|
||||
set(STR_CPP_DECL "${STR_CPP_DECL}ProgramSource ${cl_filename}_oclsrc(${cl_filename}.programStr);\n")
|
||||
set(STR_HPP_DECL "${STR_HPP_DECL}extern ProgramSource ${cl_filename}_oclsrc;\n")
|
||||
endif()
|
||||
|
||||
set(STR_CPP "${STR_CPP}${STR_CPP_DECL}")
|
||||
set(STR_HPP "${STR_HPP}${STR_HPP_DECL}")
|
||||
endforeach()
|
||||
|
||||
set(STR_CPP "${STR_CPP}}\n${nested_namespace_end}}\n")
|
||||
set(STR_HPP "${STR_HPP}}\n${nested_namespace_end}}\n")
|
||||
|
||||
file(WRITE "${OUTPUT}" "${STR_CPP}")
|
||||
|
||||
if(EXISTS "${OUTPUT_HPP}")
|
||||
file(READ "${OUTPUT_HPP}" hpp_lines)
|
||||
endif()
|
||||
if("${hpp_lines}" STREQUAL "${STR_HPP}")
|
||||
message(STATUS "${OUTPUT_HPP} contains same content")
|
||||
else()
|
||||
file(WRITE "${OUTPUT_HPP}" "${STR_HPP}")
|
||||
endif()
|
||||
@@ -0,0 +1,8 @@
|
||||
# helper file for Android samples build
|
||||
|
||||
file(GLOB_RECURSE LIBS RELATIVE ${SRC_DIR} "*.so")
|
||||
|
||||
foreach(l ${LIBS})
|
||||
message(STATUS " Copying: ${l} ...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC_DIR}/${l} ${DST_DIR}/${l})
|
||||
endforeach()
|
||||
@@ -0,0 +1,121 @@
|
||||
# In order to compile your application under cygwin
|
||||
# you might need to define NDK_USE_CYGPATH=1 before calling the ndk-build
|
||||
|
||||
USER_LOCAL_PATH:=$(LOCAL_PATH)
|
||||
|
||||
USER_LOCAL_C_INCLUDES:=$(LOCAL_C_INCLUDES)
|
||||
USER_LOCAL_CFLAGS:=$(LOCAL_CFLAGS)
|
||||
USER_LOCAL_STATIC_LIBRARIES:=$(LOCAL_STATIC_LIBRARIES)
|
||||
USER_LOCAL_SHARED_LIBRARIES:=$(LOCAL_SHARED_LIBRARIES)
|
||||
USER_LOCAL_LDLIBS:=$(LOCAL_LDLIBS)
|
||||
|
||||
LOCAL_PATH:=$(subst ?,,$(firstword ?$(subst \, ,$(subst /, ,$(call my-dir)))))
|
||||
|
||||
OPENCV_TARGET_ARCH_ABI:=$(TARGET_ARCH_ABI)
|
||||
OPENCV_THIS_DIR:=$(patsubst $(LOCAL_PATH)\\%,%,$(patsubst $(LOCAL_PATH)/%,%,$(call my-dir)))
|
||||
OPENCV_MK_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||
OPENCV_LIBS_DIR:=@OPENCV_LIBS_DIR_CONFIGCMAKE@
|
||||
OPENCV_3RDPARTY_LIBS_DIR:=@OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE@
|
||||
OPENCV_BASEDIR:=@OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE@
|
||||
OPENCV_LOCAL_C_INCLUDES:=@OPENCV_INCLUDE_DIRS_CONFIGCMAKE@
|
||||
OPENCV_MODULES:=@OPENCV_MODULES_CONFIGMAKE@
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),)
|
||||
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
OPENCV_LIBS:=@OPENCV_LIBS_CONFIGMAKE@
|
||||
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
|
||||
else
|
||||
OPENCV_LIBS:=$(OPENCV_MODULES)
|
||||
OPENCV_LIB_TYPE:=@OPENCV_STATIC_LIBTYPE_CONFIGMAKE@
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=
|
||||
OPENCV_EXTRA_COMPONENTS:=
|
||||
else
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),mips)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
OPENCV_LIB_SUFFIX:=so
|
||||
else
|
||||
OPENCV_LIB_SUFFIX:=a
|
||||
OPENCV_INSTALL_MODULES:=on
|
||||
endif
|
||||
|
||||
define add_opencv_module
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=opencv_$1
|
||||
LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libopencv_$1.$(OPENCV_LIB_SUFFIX)
|
||||
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
|
||||
endef
|
||||
|
||||
define add_opencv_3rdparty_component
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=$1
|
||||
LOCAL_SRC_FILES:=$(OPENCV_3RDPARTY_LIBS_DIR)/lib$1.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
endef
|
||||
|
||||
ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
|
||||
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
||||
$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
|
||||
endif
|
||||
|
||||
$(foreach module,$(OPENCV_3RDPARTY_COMPONENTS),$(eval $(call add_opencv_3rdparty_component,$(module))))
|
||||
|
||||
ifneq ($(OPENCV_BASEDIR),)
|
||||
OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include)
|
||||
endif
|
||||
|
||||
#turn off module installation to prevent their redefinition
|
||||
OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED:=on
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LOCAL_CFLAGS),)
|
||||
OPENCV_LOCAL_CFLAGS := -fPIC -DANDROID -fsigned-char
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_C_INCLUDES:=$(USER_LOCAL_C_INCLUDES)
|
||||
LOCAL_CFLAGS:=$(USER_LOCAL_CFLAGS)
|
||||
LOCAL_STATIC_LIBRARIES:=$(USER_LOCAL_STATIC_LIBRARIES)
|
||||
LOCAL_SHARED_LIBRARIES:=$(USER_LOCAL_SHARED_LIBRARIES)
|
||||
LOCAL_LDLIBS:=$(USER_LOCAL_LDLIBS)
|
||||
|
||||
LOCAL_C_INCLUDES += $(OPENCV_LOCAL_C_INCLUDES)
|
||||
LOCAL_CFLAGS += $(OPENCV_LOCAL_CFLAGS)
|
||||
|
||||
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
||||
LOCAL_$(OPENCV_LIB_TYPE)_LIBRARIES += $(foreach mod, $(OPENCV_LIBS), opencv_$(mod))
|
||||
else
|
||||
LOCAL_LDLIBS += -L$(call host-path,$(LOCAL_PATH)/$(OPENCV_LIBS_DIR)) $(foreach lib, $(OPENCV_LIBS), -lopencv_$(lib))
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),STATIC)
|
||||
LOCAL_STATIC_LIBRARIES += $(OPENCV_3RDPARTY_COMPONENTS)
|
||||
endif
|
||||
|
||||
LOCAL_LDLIBS += $(foreach lib,$(OPENCV_EXTRA_COMPONENTS), -l$(lib))
|
||||
|
||||
#restore the LOCAL_PATH
|
||||
LOCAL_PATH:=$(USER_LOCAL_PATH)
|
||||
@@ -0,0 +1,14 @@
|
||||
set(OpenCV_VERSION @OPENCV_VERSION_PLAIN@)
|
||||
set(PACKAGE_VERSION ${OpenCV_VERSION})
|
||||
|
||||
set(PACKAGE_VERSION_EXACT False)
|
||||
set(PACKAGE_VERSION_COMPATIBLE False)
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
@@ -0,0 +1,391 @@
|
||||
# ===================================================================================
|
||||
# The OpenCV CMake configuration file
|
||||
#
|
||||
# ** File generated automatically, do not modify **
|
||||
#
|
||||
# Usage from an external project:
|
||||
# In your CMakeLists.txt, add these lines:
|
||||
#
|
||||
# find_package(OpenCV REQUIRED)
|
||||
# include_directories(${OpenCV_INCLUDE_DIRS})
|
||||
# target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
|
||||
#
|
||||
# Or you can search for specific OpenCV modules:
|
||||
#
|
||||
# find_package(OpenCV REQUIRED core videoio)
|
||||
#
|
||||
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
|
||||
#
|
||||
# This file will define the following variables:
|
||||
# - OpenCV_LIBS : The list of all imported targets for OpenCV modules.
|
||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability.
|
||||
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
|
||||
# - OpenCV_VERSION : The version of this OpenCV build: "@OPENCV_VERSION_PLAIN@"
|
||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
|
||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@"
|
||||
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "@OPENCV_VERSION_PATCH@"
|
||||
# - OpenCV_VERSION_STATUS : Development status of this build: "@OPENCV_VERSION_STATUS@"
|
||||
#
|
||||
# Advanced variables:
|
||||
# - OpenCV_SHARED : Use OpenCV as shared library
|
||||
# - OpenCV_CONFIG_PATH : Path to this OpenCVConfig.cmake
|
||||
# - OpenCV_INSTALL_PATH : OpenCV location (not set on Windows)
|
||||
# - OpenCV_LIB_COMPONENTS : Present OpenCV modules list
|
||||
# - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag
|
||||
# - OpenCV_MODULES_SUFFIX : The suffix for OpenCVModules-XXX.cmake file
|
||||
#
|
||||
# Deprecated variables:
|
||||
# - OpenCV_VERSION_TWEAK : Always "0"
|
||||
#
|
||||
# ===================================================================================
|
||||
|
||||
# Search packages for host system instead of packages for target system.
|
||||
# in case of cross compilation thess macro should be defined by toolchain file
|
||||
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OpenCV_MODULES_SUFFIX)
|
||||
if(ANDROID)
|
||||
string(REPLACE - _ OpenCV_MODULES_SUFFIX "_${ANDROID_NDK_ABI_NAME}")
|
||||
else()
|
||||
set(OpenCV_MODULES_SUFFIX "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("@USE_IPPICV@" STREQUAL "TRUE") # value is defined by package builder (use STREQUAL to comply new CMake policy CMP0012)
|
||||
if(NOT TARGET ippicv)
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PATH_RELATIVE_IPPICV@")
|
||||
add_library(ippicv STATIC IMPORTED)
|
||||
set_target_properties(ippicv PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES ""
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PATH_RELATIVE_IPPICV@"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET opencv_core)
|
||||
# Extract directory name from full path of the file currently being processed.
|
||||
# Note that CMake 2.8.3 introduced CMAKE_CURRENT_LIST_DIR. We reimplement it
|
||||
# for older versions of CMake to support these as well.
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
|
||||
endif()
|
||||
|
||||
# TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)
|
||||
|
||||
# Version Compute Capability from which OpenCV has been compiled is remembered
|
||||
set(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC_CONFIGCMAKE@)
|
||||
|
||||
set(OpenCV_CUDA_VERSION @OpenCV_CUDA_VERSION@)
|
||||
set(OpenCV_USE_CUBLAS @HAVE_CUBLAS@)
|
||||
set(OpenCV_USE_CUFFT @HAVE_CUFFT@)
|
||||
set(OpenCV_USE_NVCUVID @HAVE_NVCUVID@)
|
||||
|
||||
# Android API level from which OpenCV has been compiled is remembered
|
||||
if(ANDROID)
|
||||
set(OpenCV_ANDROID_NATIVE_API_LEVEL @OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE@)
|
||||
else()
|
||||
set(OpenCV_ANDROID_NATIVE_API_LEVEL 0)
|
||||
endif()
|
||||
|
||||
# Some additional settings are required if OpenCV is built as static libs
|
||||
set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
|
||||
|
||||
# Enables mangled install paths, that help with side by side installs
|
||||
set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@)
|
||||
|
||||
# Extract the directory where *this* file has been installed (determined at cmake run-time)
|
||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
|
||||
|
||||
if(NOT WIN32 OR ANDROID)
|
||||
if(ANDROID)
|
||||
set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..")
|
||||
else()
|
||||
set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../..")
|
||||
endif()
|
||||
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
|
||||
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8)
|
||||
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" ABSOLUTE)
|
||||
else()
|
||||
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" REALPATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ======================================================
|
||||
# Include directories to add to the user project:
|
||||
# ======================================================
|
||||
|
||||
# Provide the include directories to the caller
|
||||
set(OpenCV_INCLUDE_DIRS @OpenCV_INCLUDE_DIRS_CONFIGCMAKE@)
|
||||
|
||||
# ======================================================
|
||||
# Link directories to add to the user project:
|
||||
# ======================================================
|
||||
|
||||
# Provide the libs directories to the caller
|
||||
set(OpenCV_LIB_DIR_OPT @OpenCV_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where release OpenCV libraries are located")
|
||||
set(OpenCV_LIB_DIR_DBG @OpenCV_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where debug OpenCV libraries are located")
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_OPT @OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where release 3rdparty OpenCV dependencies are located")
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_DBG @OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where debug 3rdparty OpenCV dependencies are located")
|
||||
mark_as_advanced(FORCE OpenCV_LIB_DIR_OPT OpenCV_LIB_DIR_DBG OpenCV_3RDPARTY_LIB_DIR_OPT OpenCV_3RDPARTY_LIB_DIR_DBG OpenCV_CONFIG_PATH)
|
||||
|
||||
# ======================================================
|
||||
# Version variables:
|
||||
# ======================================================
|
||||
SET(OpenCV_VERSION @OPENCV_VERSION_PLAIN@)
|
||||
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
|
||||
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
|
||||
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)
|
||||
SET(OpenCV_VERSION_TWEAK 0)
|
||||
SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@")
|
||||
|
||||
# ====================================================================
|
||||
# Link libraries: e.g. opencv_core;opencv_imgproc; etc...
|
||||
# ====================================================================
|
||||
|
||||
SET(OpenCV_LIB_COMPONENTS @OPENCV_MODULES_CONFIGCMAKE@)
|
||||
SET(OpenCV_WORLD_COMPONENTS @OPENCV_WORLD_MODULES@)
|
||||
|
||||
# ==============================================================
|
||||
# Extra include directories, needed by OpenCV 2 new structure
|
||||
# ==============================================================
|
||||
SET(OpenCV2_INCLUDE_DIRS @OpenCV2_INCLUDE_DIRS_CONFIGCMAKE@)
|
||||
if(OpenCV2_INCLUDE_DIRS)
|
||||
list(APPEND OpenCV_INCLUDE_DIRS ${OpenCV2_INCLUDE_DIRS})
|
||||
|
||||
set(OpenCV_ADD_DEBUG_RELEASE @OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE@)
|
||||
if(OpenCV_ADD_DEBUG_RELEASE)
|
||||
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_DIR_OPT}/Release")
|
||||
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_DIR_DBG}/Debug")
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_3RDPARTY_LIB_DIR_OPT}/Release")
|
||||
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_3RDPARTY_LIB_DIR_DBG}/Debug")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ==============================================================
|
||||
# Check OpenCV availability
|
||||
# ==============================================================
|
||||
if(ANDROID AND OpenCV_ANDROID_NATIVE_API_LEVEL GREATER ANDROID_NATIVE_API_LEVEL)
|
||||
message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
||||
#always FATAL_ERROR because we can't say to the caller that OpenCV is not found
|
||||
#http://www.mail-archive.com/cmake@cmake.org/msg37831.html
|
||||
if(OpenCV_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
||||
elseif(NOT OpenCV_FIND_QUIETLY)
|
||||
message(WARNING "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
||||
endif()
|
||||
set(OpenCV_FOUND "OpenCV_FOUND-NOTFOUND")
|
||||
return()#Android toolchain requires CMake > 2.6
|
||||
endif()
|
||||
|
||||
# ==============================================================
|
||||
# Form list of modules (components) to find
|
||||
# ==============================================================
|
||||
if(NOT OpenCV_FIND_COMPONENTS)
|
||||
set(OpenCV_FIND_COMPONENTS ${OpenCV_LIB_COMPONENTS})
|
||||
list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_java)
|
||||
if(GTest_FOUND OR GTEST_FOUND)
|
||||
list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_ts)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# expand short module names and see if requested components exist
|
||||
set(OpenCV_FIND_COMPONENTS_ "")
|
||||
foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
||||
if(NOT __cvcomponent MATCHES "^opencv_")
|
||||
set(__cvcomponent opencv_${__cvcomponent})
|
||||
endif()
|
||||
list(FIND OpenCV_LIB_COMPONENTS ${__cvcomponent} __cvcomponentIdx)
|
||||
if(__cvcomponentIdx LESS 0)
|
||||
#requested component is not found...
|
||||
if(OpenCV_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "${__cvcomponent} is required but was not found")
|
||||
elseif(NOT OpenCV_FIND_QUIETLY)
|
||||
message(WARNING "${__cvcomponent} is required but was not found")
|
||||
endif()
|
||||
#indicate that module is NOT found
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponentUP)
|
||||
set(${__cvcomponentUP}_FOUND "${__cvcomponentUP}_FOUND-NOTFOUND")
|
||||
else()
|
||||
list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent})
|
||||
# Not using list(APPEND) here, because OpenCV_LIBS may not exist yet.
|
||||
# Also not clearing OpenCV_LIBS anywhere, so that multiple calls
|
||||
# to find_package(OpenCV) with different component lists add up.
|
||||
set(OpenCV_LIBS ${OpenCV_LIBS} "${__cvcomponent}")
|
||||
#indicate that module is found
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponentUP)
|
||||
set(${__cvcomponentUP}_FOUND 1)
|
||||
endif()
|
||||
if(OpenCV_SHARED AND ";${OpenCV_WORLD_COMPONENTS};" MATCHES ";${__cvcomponent};" AND NOT TARGET ${__cvcomponent})
|
||||
get_target_property(__implib_dbg opencv_world IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(__implib_release opencv_world IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(__location_dbg opencv_world IMPORTED_LOCATION_DEBUG)
|
||||
get_target_property(__location_release opencv_world IMPORTED_LOCATION_RELEASE)
|
||||
add_library(${__cvcomponent} SHARED IMPORTED)
|
||||
if(__location_dbg)
|
||||
set_property(TARGET ${__cvcomponent} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(${__cvcomponent} PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${__implib_dbg}"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG ""
|
||||
IMPORTED_LOCATION_DEBUG "${__location_dbg}"
|
||||
)
|
||||
endif()
|
||||
if(__location_release)
|
||||
set_property(TARGET ${__cvcomponent} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(${__cvcomponent} PROPERTIES
|
||||
IMPORTED_IMPLIB_RELEASE "${__implib_release}"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE ""
|
||||
IMPORTED_LOCATION_RELEASE "${__location_release}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
|
||||
|
||||
# ==============================================================
|
||||
# Resolve dependencies
|
||||
# ==============================================================
|
||||
if(OpenCV_USE_MANGLED_PATHS)
|
||||
set(OpenCV_LIB_SUFFIX ".${OpenCV_VERSION_MAJOR}.${OpenCV_VERSION_MINOR}.${OpenCV_VERSION_PATCH}")
|
||||
else()
|
||||
set(OpenCV_LIB_SUFFIX "")
|
||||
endif()
|
||||
|
||||
foreach(__opttype OPT DBG)
|
||||
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
|
||||
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
|
||||
|
||||
# CUDA
|
||||
if(OpenCV_CUDA_VERSION)
|
||||
if(NOT CUDA_FOUND)
|
||||
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
|
||||
else()
|
||||
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
|
||||
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
|
||||
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.5")
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
|
||||
else()
|
||||
find_cuda_helper_libs(nppc)
|
||||
find_cuda_helper_libs(nppi)
|
||||
find_cuda_helper_libs(npps)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUBLAS)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUFFT)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_NVCUVID)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set(OpenCV_CUDA_LIBS_RELPATH "")
|
||||
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
|
||||
get_filename_component(_tmp ${l} PATH)
|
||||
if(NOT ${_tmp} MATCHES "-Wl.*")
|
||||
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
|
||||
link_directories(${OpenCV_CUDA_LIBS_RELPATH})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# ==============================================================
|
||||
# Compatibility stuff
|
||||
# ==============================================================
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_DBG} ${OpenCV_3RDPARTY_LIB_DIR_DBG})
|
||||
else()
|
||||
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT})
|
||||
endif()
|
||||
set(OpenCV_LIBRARIES ${OpenCV_LIBS})
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND OpenCV_SHARED AND (CMAKE_SYSTEM_NAME MATCHES "Linux"))
|
||||
foreach(dir ${OpenCV_LIB_DIR})
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Some macroses for samples
|
||||
#
|
||||
macro(ocv_check_dependencies)
|
||||
set(OCV_DEPENDENCIES_FOUND TRUE)
|
||||
foreach(d ${ARGN})
|
||||
if(NOT TARGET ${d})
|
||||
message(WARNING "OpenCV: Can't resolve dependency: ${d}")
|
||||
set(OCV_DEPENDENCIES_FOUND FALSE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
set(__add_before "")
|
||||
file(TO_CMAKE_PATH "${OpenCV_DIR}" __baseDir)
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${__baseDir}")
|
||||
list(APPEND __add_before "${dir}")
|
||||
else()
|
||||
include_directories(AFTER SYSTEM "${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
include_directories(BEFORE ${__add_before})
|
||||
endfunction()
|
||||
|
||||
macro(ocv_include_modules)
|
||||
include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
|
||||
endmacro()
|
||||
|
||||
macro(ocv_include_modules_recurse)
|
||||
include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
|
||||
endmacro()
|
||||
|
||||
macro(ocv_target_link_libraries)
|
||||
target_link_libraries(${ARGN})
|
||||
endmacro()
|
||||
|
||||
# remove all matching elements from the list
|
||||
macro(ocv_list_filterout lst regex)
|
||||
foreach(item ${${lst}})
|
||||
if(item MATCHES "${regex}")
|
||||
list(REMOVE_ITEM ${lst} "${item}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
@@ -0,0 +1,25 @@
|
||||
# -----------------------------------------------
|
||||
# File that provides "make uninstall" target
|
||||
# We use the file 'install_manifest.txt'
|
||||
# -----------------------------------------------
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
IF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
ENDIF(NOT "${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "$ENV{DESTDIR}${file}")
|
||||
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
ENDFOREACH(file)
|
||||
@@ -0,0 +1,183 @@
|
||||
/* OpenCV compiled as static or dynamic libs */
|
||||
#cmakedefine BUILD_SHARED_LIBS
|
||||
|
||||
/* Compile for 'real' NVIDIA GPU architectures */
|
||||
#define CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN}"
|
||||
|
||||
/* Create PTX or BIN for 1.0 compute capability */
|
||||
#cmakedefine CUDA_ARCH_BIN_OR_PTX_10
|
||||
|
||||
/* NVIDIA GPU features are used */
|
||||
#define CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES}"
|
||||
|
||||
/* Compile for 'virtual' NVIDIA PTX architectures */
|
||||
#define CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX}"
|
||||
|
||||
/* AVFoundation video libraries */
|
||||
#cmakedefine HAVE_AVFOUNDATION
|
||||
|
||||
/* V4L capturing support */
|
||||
#cmakedefine HAVE_CAMV4L
|
||||
|
||||
/* V4L2 capturing support */
|
||||
#cmakedefine HAVE_CAMV4L2
|
||||
|
||||
/* Carbon windowing environment */
|
||||
#cmakedefine HAVE_CARBON
|
||||
|
||||
/* AMD's Basic Linear Algebra Subprograms Library*/
|
||||
#cmakedefine HAVE_CLAMDBLAS
|
||||
|
||||
/* AMD's OpenCL Fast Fourier Transform Library*/
|
||||
#cmakedefine HAVE_CLAMDFFT
|
||||
|
||||
/* Clp support */
|
||||
#cmakedefine HAVE_CLP
|
||||
|
||||
/* Cocoa API */
|
||||
#cmakedefine HAVE_COCOA
|
||||
|
||||
/* C= */
|
||||
#cmakedefine HAVE_CSTRIPES
|
||||
|
||||
/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
|
||||
#cmakedefine HAVE_CUBLAS
|
||||
|
||||
/* NVidia Cuda Runtime API*/
|
||||
#cmakedefine HAVE_CUDA
|
||||
|
||||
/* NVidia Cuda Fast Fourier Transform (FFT) API*/
|
||||
#cmakedefine HAVE_CUFFT
|
||||
|
||||
/* IEEE1394 capturing support */
|
||||
#cmakedefine HAVE_DC1394
|
||||
|
||||
/* IEEE1394 capturing support - libdc1394 v2.x */
|
||||
#cmakedefine HAVE_DC1394_2
|
||||
|
||||
/* DirectX */
|
||||
#cmakedefine HAVE_DIRECTX
|
||||
#cmakedefine HAVE_D3D11
|
||||
#cmakedefine HAVE_D3D10
|
||||
#cmakedefine HAVE_D3D9
|
||||
|
||||
/* DirectShow Video Capture library */
|
||||
#cmakedefine HAVE_DSHOW
|
||||
|
||||
/* Eigen Matrix & Linear Algebra Library */
|
||||
#cmakedefine HAVE_EIGEN
|
||||
|
||||
/* FFMpeg video library */
|
||||
#cmakedefine HAVE_FFMPEG
|
||||
|
||||
/* ffmpeg's libswscale */
|
||||
#cmakedefine HAVE_FFMPEG_SWSCALE
|
||||
|
||||
/* ffmpeg in Gentoo */
|
||||
#cmakedefine HAVE_GENTOO_FFMPEG
|
||||
|
||||
/* Geospatial Data Abstraction Library */
|
||||
#cmakedefine HAVE_GDAL
|
||||
|
||||
/* GStreamer multimedia framework */
|
||||
#cmakedefine HAVE_GSTREAMER
|
||||
|
||||
/* GTK+ 2.0 Thread support */
|
||||
#cmakedefine HAVE_GTHREAD
|
||||
|
||||
/* GTK+ 2.x toolkit */
|
||||
#cmakedefine HAVE_GTK
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
/* Intel Perceptual Computing SDK library */
|
||||
#cmakedefine HAVE_INTELPERC
|
||||
|
||||
/* Intel Integrated Performance Primitives */
|
||||
#cmakedefine HAVE_IPP
|
||||
#cmakedefine HAVE_IPP_ICV_ONLY
|
||||
|
||||
/* Intel IPP Async */
|
||||
#cmakedefine HAVE_IPP_A
|
||||
|
||||
/* JPEG-2000 codec */
|
||||
#cmakedefine HAVE_JASPER
|
||||
|
||||
/* IJG JPEG codec */
|
||||
#cmakedefine HAVE_JPEG
|
||||
|
||||
/* libpng/png.h needs to be included */
|
||||
#cmakedefine HAVE_LIBPNG_PNG_H
|
||||
|
||||
/* V4L/V4L2 capturing support via libv4l */
|
||||
#cmakedefine HAVE_LIBV4L
|
||||
|
||||
/* Microsoft Media Foundation Capture library */
|
||||
#cmakedefine HAVE_MSMF
|
||||
|
||||
/* NVidia Video Decoding API*/
|
||||
#cmakedefine HAVE_NVCUVID
|
||||
|
||||
/* OpenCL Support */
|
||||
#cmakedefine HAVE_OPENCL
|
||||
#cmakedefine HAVE_OPENCL_STATIC
|
||||
#cmakedefine HAVE_OPENCL_SVM
|
||||
|
||||
/* OpenEXR codec */
|
||||
#cmakedefine HAVE_OPENEXR
|
||||
|
||||
/* OpenGL support*/
|
||||
#cmakedefine HAVE_OPENGL
|
||||
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI
|
||||
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI2
|
||||
|
||||
/* PNG codec */
|
||||
#cmakedefine HAVE_PNG
|
||||
|
||||
/* Qt support */
|
||||
#cmakedefine HAVE_QT
|
||||
|
||||
/* Qt OpenGL support */
|
||||
#cmakedefine HAVE_QT_OPENGL
|
||||
|
||||
/* QuickTime video libraries */
|
||||
#cmakedefine HAVE_QUICKTIME
|
||||
|
||||
/* QTKit video libraries */
|
||||
#cmakedefine HAVE_QTKIT
|
||||
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Unicap video capture library */
|
||||
#cmakedefine HAVE_UNICAP
|
||||
|
||||
/* Video for Windows support */
|
||||
#cmakedefine HAVE_VFW
|
||||
|
||||
/* V4L2 capturing support in videoio.h */
|
||||
#cmakedefine HAVE_VIDEOIO
|
||||
|
||||
/* Win32 UI */
|
||||
#cmakedefine HAVE_WIN32UI
|
||||
|
||||
/* XIMEA camera support */
|
||||
#cmakedefine HAVE_XIMEA
|
||||
|
||||
/* Xine video library */
|
||||
#cmakedefine HAVE_XINE
|
||||
|
||||
/* Define if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
/* gPhoto2 library */
|
||||
#cmakedefine HAVE_GPHOTO2
|
||||
@@ -0,0 +1,14 @@
|
||||
# Package Information for pkg-config
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir_old=@includedir@/opencv
|
||||
includedir_new=@includedir@
|
||||
|
||||
Name: OpenCV
|
||||
Description: Open Source Computer Vision Library
|
||||
Version: @OPENCV_VERSION_PLAIN@
|
||||
Libs: @OPENCV_PC_LIBS@
|
||||
Libs.private: @OPENCV_PC_LIBS_PRIVATE@
|
||||
Cflags: -I${includedir_old} -I${includedir_new}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is auto-generated
|
||||
|
||||
-->
|
||||
|
||||
<descriptor>
|
||||
|
||||
<version>
|
||||
@OPENCV_ABI_VERSION@
|
||||
</version>
|
||||
|
||||
<headers>
|
||||
@OPENCV_ABI_HEADERS@
|
||||
</headers>
|
||||
|
||||
<libs>
|
||||
@OPENCV_ABI_LIBRARIES@
|
||||
</libs>
|
||||
|
||||
<skip_headers>
|
||||
opencv2/hal/intrin*
|
||||
opencv2/core/cuda*
|
||||
opencv2/core/private*
|
||||
opencv/cxeigen.hpp
|
||||
opencv2/core/eigen.hpp
|
||||
opencv2/flann/hdf5.h
|
||||
opencv2/imgcodecs/ios.h
|
||||
opencv2/videoio/cap_ios.h
|
||||
opencv2/ts.hpp
|
||||
opencv2/ts/*
|
||||
opencv2/xobjdetect/private.hpp
|
||||
@OPENCV_ABI_SKIP_HEADERS@
|
||||
</skip_headers>
|
||||
|
||||
<skip_libs>
|
||||
@OPENCV_ABI_SKIP_LIBRARIES@
|
||||
</skip_libs>
|
||||
|
||||
<gcc_options>
|
||||
@OPENCV_ABI_GCC_OPTIONS@
|
||||
</gcc_options>
|
||||
|
||||
</descriptor>
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* ** File generated automatically, do not modify **
|
||||
*
|
||||
* This file defines the list of modules available in current build configuration
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@OPENCV_MODULE_DEFINITIONS_CONFIGMAKE@
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
BASE_DIR=`dirname $0`
|
||||
OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
|
||||
OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Device architecture is not preset in command line"
|
||||
echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
|
||||
echo "Usage: $0 <target_device_arch>"
|
||||
return 1
|
||||
else
|
||||
TARGET_ARCH=$1
|
||||
fi
|
||||
|
||||
if [ -z `which adb` ]; then
|
||||
echo "adb command was not found in PATH"
|
||||
return 1
|
||||
fi
|
||||
|
||||
adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata
|
||||
|
||||
adb shell "mkdir -p /data/local/tmp/opencv_test"
|
||||
SUMMARY_STATUS=0
|
||||
for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
adb push $t /data/local/tmp/opencv_test/
|
||||
adb shell "export OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata && /data/local/tmp/opencv_test/$test_name --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:/data/local/tmp/opencv_test/$report"
|
||||
adb pull "/data/local/tmp/opencv_test/$report" $report
|
||||
TEST_STATUS=0
|
||||
if [ -e $report ]; then
|
||||
if [ `grep -c "<fail" $report` -ne 0 ]; then
|
||||
TEST_STATUS=2
|
||||
fi
|
||||
else
|
||||
TEST_STATUS=3
|
||||
fi
|
||||
if [ $TEST_STATUS -ne 0 ]; then
|
||||
SUMMARY_STATUS=$TEST_STATUS
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then
|
||||
echo "All OpenCV tests finished successfully"
|
||||
else
|
||||
echo "OpenCV tests finished with status $SUMMARY_STATUS"
|
||||
fi
|
||||
|
||||
return $SUMMARY_STATUS
|
||||
@@ -0,0 +1,142 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage info
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
This script runs the OpenCV tests on linux device.
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message
|
||||
-c Color output
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse options
|
||||
|
||||
COLOR_OUTPUT=0
|
||||
while getopts “hc” OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
c)
|
||||
COLOR_OUTPUT=1
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Text style
|
||||
|
||||
if [ $COLOR_OUTPUT -eq 1 ]; then
|
||||
TEXT_RED="$(tput setaf 1)"
|
||||
TEXT_GREEN="$(tput setaf 2)"
|
||||
TEXT_CYAN="$(tput setaf 6)"
|
||||
TEXT_RESET="$(tput sgr0)"
|
||||
else
|
||||
TEXT_RED=""
|
||||
TEXT_GREEN=""
|
||||
TEXT_CYAN=""
|
||||
TEXT_RESET=""
|
||||
fi
|
||||
|
||||
# Test binaries and data paths
|
||||
|
||||
OPENCV_TEST_PATH=@CMAKE_INSTALL_PREFIX@/@OPENCV_TEST_INSTALL_PATH@
|
||||
OPENCV_PYTHON_TESTS=@OPENCV_PYTHON_TESTS_LIST@
|
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
|
||||
|
||||
# Run tests
|
||||
|
||||
SUMMARY_STATUS=0
|
||||
FAILED_TESTS=""
|
||||
PASSED_TESTS=""
|
||||
|
||||
for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
|
||||
cmd="$t --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:\"$report\""
|
||||
|
||||
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
|
||||
if [ $COLOR_OUTPUT -eq 1 ]; then
|
||||
seg_reg="${seg_reg};s/\[==========\]/${TEXT_GREEN}&${TEXT_RESET}/g" # green for [==========]
|
||||
seg_reg="${seg_reg};s/\[----------\]/${TEXT_GREEN}&${TEXT_RESET}/g" # green for [----------]
|
||||
seg_reg="${seg_reg};s/\[ RUN \]/${TEXT_GREEN}&${TEXT_RESET}/g" # green for [ RUN ]
|
||||
seg_reg="${seg_reg};s/\[ OK \]/${TEXT_GREEN}&${TEXT_RESET}/g" # green for [ OK ]
|
||||
seg_reg="${seg_reg};s/\[ FAILED \]/${TEXT_RED}&${TEXT_RESET}/g" # red for [ FAILED ]
|
||||
seg_reg="${seg_reg};s/\[ PASSED \]/${TEXT_GREEN}&${TEXT_RESET}/g" # green for [ PASSED ]
|
||||
fi
|
||||
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
|
||||
$cmd | sed -r "$seg_reg"
|
||||
ret=${PIPESTATUS[0]}
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
|
||||
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} ${TEXT_RED}FAILED${TEXT_RESET}"
|
||||
SUMMARY_STATUS=1
|
||||
FAILED_TESTS="$FAILED_TESTS $test_name"
|
||||
else
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} ${TEXT_GREEN}OK${TEXT_RESET}"
|
||||
PASSED_TESTS="$PASSED_TESTS $test_name"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
done
|
||||
|
||||
for t in $OPENCV_PYTHON_TESTS;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
|
||||
cmd="py.test --junitxml $report \"$OPENCV_TEST_PATH\"/$t"
|
||||
|
||||
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
|
||||
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
|
||||
eval "$cmd" | sed -r "$seg_reg"
|
||||
|
||||
ret=${PIPESTATUS[0]}
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
|
||||
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} ${TEXT_RED}FAILED${TEXT_RESET}"
|
||||
SUMMARY_STATUS=1
|
||||
FAILED_TESTS="$FAILED_TESTS $test_name"
|
||||
else
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} ${TEXT_GREEN}OK${TEXT_RESET}"
|
||||
PASSED_TESTS="$PASSED_TESTS $test_name"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
done
|
||||
|
||||
# Remove temporary test files
|
||||
|
||||
rm -f /tmp/__opencv_temp.*
|
||||
|
||||
# Report final status
|
||||
|
||||
echo "${TEXT_CYAN}===============================================================${TEXT_RESET}"
|
||||
echo "${TEXT_CYAN}PASSED TESTS : $PASSED_TESTS${TEXT_RESET}"
|
||||
echo "${TEXT_CYAN}FAILED TESTS : $FAILED_TESTS${TEXT_RESET}"
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then
|
||||
echo "${TEXT_GREEN}STATUS : OK${TEXT_RESET}"
|
||||
echo "${TEXT_GREEN}STATUS : All OpenCV tests finished successfully${TEXT_RESET}"
|
||||
else
|
||||
echo "${TEXT_RED}STATUS : FAIL${TEXT_RESET}"
|
||||
echo "${TEXT_RED}STATUS : OpenCV tests finished with status $SUMMARY_STATUS${TEXT_RESET}"
|
||||
fi
|
||||
|
||||
exit $SUMMARY_STATUS
|
||||
@@ -0,0 +1,74 @@
|
||||
@echo OFF
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
|
||||
rem Process command line
|
||||
|
||||
rem This script is designed to allow situations when the tests are installed in
|
||||
rem a different directory from the library.
|
||||
|
||||
set OPENCV_DIR=%~1
|
||||
|
||||
if "%OPENCV_DIR%" == "" (
|
||||
echo>&2 This script runs the OpenCV tests on Windows.
|
||||
echo>&2
|
||||
echo>&2 usage: %0 ^<OpenCV install directory^>
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if NOT EXIST "%OPENCV_DIR%" (
|
||||
echo>&2 error: "%OPENCV_DIR%" doesn't exist
|
||||
)
|
||||
|
||||
rem Set up paths
|
||||
|
||||
set PATH=%OPENCV_DIR%\@OPENCV_BIN_INSTALL_PATH@;%PATH%
|
||||
set OPENCV_TEST_PATH=%~dp0
|
||||
set OPENCV_TEST_DATA_PATH=%OPENCV_TEST_PATH%\..\testdata
|
||||
|
||||
rem Run tests
|
||||
|
||||
set SUMMARY_STATUS=0
|
||||
set FAILED_TESTS=
|
||||
set PASSED_TESTS=
|
||||
|
||||
for %%t IN ("%OPENCV_TEST_PATH%\opencv_test_*.exe" "%OPENCV_TEST_PATH%\opencv_perf_*.exe") DO (
|
||||
set test_name=%%~nt
|
||||
set report=!test_name!.xml
|
||||
|
||||
set cmd="%%t" --perf_min_samples=1 --perf_force_samples=1 "--gtest_output=xml:!report!"
|
||||
|
||||
echo [!test_name!] RUN : !cmd!
|
||||
!cmd!
|
||||
set ret=!errorlevel!
|
||||
echo [!test_name!] RETURN_CODE : !ret!
|
||||
|
||||
if !ret! EQU 0 (
|
||||
echo [!test_name!] OK
|
||||
set PASSED_TESTS=!PASSED_TESTS! !test_name!
|
||||
) ELSE (
|
||||
echo [!test_name!] FAILED
|
||||
set SUMMARY_STATUS=1
|
||||
set FAILED_TESTS=!FAILED_TESTS! !test_name!
|
||||
)
|
||||
|
||||
echo.
|
||||
)
|
||||
|
||||
rem Remove temporary test files
|
||||
|
||||
del /F /Q "%TMP%\ocv*.tmp*"
|
||||
|
||||
rem Report final status
|
||||
|
||||
echo ===============================================================
|
||||
echo PASSED TESTS : %PASSED_TESTS%
|
||||
echo FAILED TESTS : %FAILED_TESTS%
|
||||
if %SUMMARY_STATUS% EQU 0 (
|
||||
echo STATUS : OK
|
||||
echo STATUS : All OpenCV tests finished successfully
|
||||
) ELSE (
|
||||
echo STATUS : FAIL
|
||||
echo STATUS : OpenCV tests finished with status %SUMMARY_STATUS%
|
||||
)
|
||||
|
||||
exit /B %SUMMARY_STATUS%
|
||||
@@ -0,0 +1,249 @@
|
||||
cmake_minimum_required(VERSION 2.4.4)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||
|
||||
project(zlib C)
|
||||
|
||||
set(VERSION "1.2.8")
|
||||
|
||||
option(ASM686 "Enable building i686 assembly implementation")
|
||||
option(AMD64 "Enable building amd64 assembly implementation")
|
||||
|
||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
||||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
||||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
||||
|
||||
include(CheckTypeSize)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckCSourceCompiles)
|
||||
enable_testing()
|
||||
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
|
||||
#
|
||||
# Check to see if we have large file support
|
||||
#
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
||||
# We add these other definitions here because CheckTypeSize.cmake
|
||||
# in CMake 2.4.x does not automatically do so and we want
|
||||
# compatibility with CMake 2.4.x.
|
||||
if(HAVE_SYS_TYPES_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
||||
endif()
|
||||
if(HAVE_STDINT_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
||||
endif()
|
||||
if(HAVE_STDDEF_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
||||
endif()
|
||||
check_type_size(off64_t OFF64_T)
|
||||
if(HAVE_OFF64_T)
|
||||
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
||||
|
||||
#
|
||||
# Check for fseeko
|
||||
#
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
if(NOT HAVE_FSEEKO)
|
||||
add_definitions(-DNO_FSEEKO)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Check for unistd.h
|
||||
#
|
||||
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
# If we're doing an out of source build and the user has a zconf.h
|
||||
# in their source tree...
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
|
||||
message(STATUS "Renaming")
|
||||
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
|
||||
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
|
||||
message(STATUS "but CMake generates it automatically in the build directory.")
|
||||
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
||||
${ZLIB_PC} @ONLY)
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||
|
||||
|
||||
#============================================================================
|
||||
# zlib
|
||||
#============================================================================
|
||||
|
||||
set(ZLIB_PUBLIC_HDRS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
|
||||
zlib.h
|
||||
)
|
||||
set(ZLIB_PRIVATE_HDRS
|
||||
crc32.h
|
||||
deflate.h
|
||||
gzguts.h
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.h
|
||||
inftrees.h
|
||||
trees.h
|
||||
zutil.h
|
||||
)
|
||||
set(ZLIB_SRCS
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
gzclose.c
|
||||
gzlib.c
|
||||
gzread.c
|
||||
gzwrite.c
|
||||
inflate.c
|
||||
infback.c
|
||||
inftrees.c
|
||||
inffast.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
)
|
||||
|
||||
if(NOT MINGW)
|
||||
set(ZLIB_DLL_SRCS
|
||||
win32/zlib1.rc # If present will override custom build rule below.
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(ASM686)
|
||||
set(ZLIB_ASMS contrib/asm686/match.S)
|
||||
elseif (AMD64)
|
||||
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
|
||||
endif ()
|
||||
|
||||
if(ZLIB_ASMS)
|
||||
add_definitions(-DASMV)
|
||||
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(ASM686)
|
||||
ENABLE_LANGUAGE(ASM_MASM)
|
||||
set(ZLIB_ASMS
|
||||
contrib/masmx86/inffas32.asm
|
||||
contrib/masmx86/match686.asm
|
||||
)
|
||||
elseif (AMD64)
|
||||
ENABLE_LANGUAGE(ASM_MASM)
|
||||
set(ZLIB_ASMS
|
||||
contrib/masmx64/gvmat64.asm
|
||||
contrib/masmx64/inffasx64.asm
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_ASMS)
|
||||
add_definitions(-DASMV -DASMINF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
|
||||
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
||||
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
|
||||
|
||||
if(MINGW)
|
||||
# This gets us DLL resource information when compiling on MinGW.
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
set(CMAKE_RC_COMPILER windres.exe)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||
COMMAND ${CMAKE_RC_COMPILER}
|
||||
-D GCC_WINDRES
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-I ${CMAKE_CURRENT_BINARY_DIR}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
|
||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||
endif(MINGW)
|
||||
|
||||
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
|
||||
if(NOT CYGWIN)
|
||||
# This property causes shared libraries on Linux to have the full version
|
||||
# encoded into their final filename. We disable this on Cygwin because
|
||||
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
|
||||
# seems to be the default.
|
||||
#
|
||||
# This has no effect with MSVC, on that platform the version info for
|
||||
# the DLL comes from the resource file win32/zlib1.rc
|
||||
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
# On unix-like platforms the library is almost always called libz
|
||||
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||
if(NOT APPLE)
|
||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||
endif()
|
||||
elseif(BUILD_SHARED_LIBS AND WIN32)
|
||||
# Creates zlib1.dll when building shared library version
|
||||
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
install(TARGETS zlib zlibstatic
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
||||
endif()
|
||||
|
||||
#============================================================================
|
||||
# Example binaries
|
||||
#============================================================================
|
||||
|
||||
add_executable(example test/example.c)
|
||||
target_link_libraries(example zlib)
|
||||
add_test(example example)
|
||||
|
||||
add_executable(minigzip test/minigzip.c)
|
||||
target_link_libraries(minigzip zlib)
|
||||
|
||||
if(HAVE_OFF64_T)
|
||||
add_executable(example64 test/example.c)
|
||||
target_link_libraries(example64 zlib)
|
||||
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
add_test(example64 example64)
|
||||
|
||||
add_executable(minigzip64 test/minigzip.c)
|
||||
target_link_libraries(minigzip64 zlib)
|
||||
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
115
dependency-check-core/src/test/resources/cmake/zlib/README
Normal file
115
dependency-check-core/src/test/resources/cmake/zlib/README
Normal file
@@ -0,0 +1,115 @@
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
|
||||
zlib 1.2.8 is a general purpose data compression library. All the code is
|
||||
thread safe. The data format used by the zlib library is described by RFCs
|
||||
(Request for Comments) 1950 to 1952 in the files
|
||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||
rfc1952 (gzip format).
|
||||
|
||||
All functions of the compression library are documented in the file zlib.h
|
||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
||||
of the library is given in the file test/example.c which also tests that
|
||||
the library is working correctly. Another example is given in the file
|
||||
test/minigzip.c. The compression library itself is composed of all source
|
||||
files in the root directory.
|
||||
|
||||
To compile all files and run the test program, follow the instructions given at
|
||||
the top of Makefile.in. In short "./configure; make test", and if that goes
|
||||
well, "make install" should work for most flavors of Unix. For Windows, use
|
||||
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
||||
make_vms.com.
|
||||
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
||||
http://zlib.net/ . Before reporting a problem, please check this site to
|
||||
verify that you have the latest version of zlib; otherwise get the latest
|
||||
version and check whether the problem still exists or not.
|
||||
|
||||
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
||||
|
||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||
|
||||
The changes made in version 1.2.8 are documented in the file ChangeLog.
|
||||
|
||||
Unsupported third party contributions are provided in directory contrib/ .
|
||||
|
||||
zlib is available in Java using the java.util.zip package, documented at
|
||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
||||
|
||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
||||
|
||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||
available in Python 1.5 and later versions, see
|
||||
http://docs.python.org/library/zlib.html .
|
||||
|
||||
zlib is built into tcl: http://wiki.tcl.tk/4610 .
|
||||
|
||||
An experimental package to read and write files in .zip format, written on top
|
||||
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
||||
contrib/minizip directory of zlib.
|
||||
|
||||
|
||||
Notes for some targets:
|
||||
|
||||
- For Windows DLL versions, please see win32/DLL_FAQ.txt
|
||||
|
||||
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
|
||||
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
|
||||
compiler flag). The compiler bug has been reported to SGI.
|
||||
|
||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
||||
when compiled with cc.
|
||||
|
||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
||||
necessary to get gzprintf working correctly. This is done by configure.
|
||||
|
||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||
other compilers. Use "make test" to check your compiler.
|
||||
|
||||
- gzdopen is not supported on RISCOS or BEOS.
|
||||
|
||||
- For PalmOs, see http://palmzlib.sourceforge.net/
|
||||
|
||||
|
||||
Acknowledgments:
|
||||
|
||||
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
||||
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||
people who reported problems and suggested various improvements in zlib; they
|
||||
are too numerous to cite here.
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
If you use the zlib library in a product, we would appreciate *not* receiving
|
||||
lengthy legal documents to sign. The sources are provided for free but without
|
||||
warranty of any kind. The library has been entirely written by Jean-loup
|
||||
Gailly and Mark Adler; it does not include third-party code.
|
||||
|
||||
If you redistribute modified sources, we would appreciate that you include in
|
||||
the file ChangeLog history information documenting your changes. Please read
|
||||
the FAQ for more information on the distribution of modified source versions.
|
||||
BIN
dependency-check-core/src/test/resources/hibernate3.jar
Normal file
BIN
dependency-check-core/src/test/resources/hibernate3.jar
Normal file
Binary file not shown.
156821
dependency-check-core/src/test/resources/nvdcve-2.0-2014.xml
Normal file
156821
dependency-check-core/src/test/resources/nvdcve-2.0-2014.xml
Normal file
File diff suppressed because it is too large
Load Diff
25227
dependency-check-core/src/test/resources/nvdcve-2.0-modified.xml
Normal file
25227
dependency-check-core/src/test/resources/nvdcve-2.0-modified.xml
Normal file
File diff suppressed because it is too large
Load Diff
77521
dependency-check-core/src/test/resources/nvdcve-2014.xml
Normal file
77521
dependency-check-core/src/test/resources/nvdcve-2014.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
dependency-check-core/src/test/resources/stagedhttp-modified.tar
Normal file
BIN
dependency-check-core/src/test/resources/stagedhttp-modified.tar
Normal file
Binary file not shown.
BIN
dependency-check-core/src/test/resources/uber-1.0-SNAPSHOT.jar
Normal file
BIN
dependency-check-core/src/test/resources/uber-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
@@ -197,6 +197,10 @@ public final class Settings {
|
||||
* The properties key for whether the Autoconf analyzer is enabled.
|
||||
*/
|
||||
public static final String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled";
|
||||
/**
|
||||
* The properties key for whether the CMake analyzer is enabled.
|
||||
*/
|
||||
public static final String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled";
|
||||
/**
|
||||
* The properties key for whether the .NET Assembly analyzer is enabled.
|
||||
*/
|
||||
|
||||
BIN
src/test/resources/axis-1.4.jar
Normal file
BIN
src/test/resources/axis-1.4.jar
Normal file
Binary file not shown.
BIN
src/test/resources/data.zip
Normal file
BIN
src/test/resources/data.zip
Normal file
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ae6196ee0e28a3fc1a015742b53da308ecbc1059
|
||||
BIN
src/test/resources/jaxb-xercesImpl-1.5.jar
Normal file
BIN
src/test/resources/jaxb-xercesImpl-1.5.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user