-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created ignition-cmake package with refactored cmake modules from ign…
…-common
- Loading branch information
Showing
34 changed files
with
2,912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
syntax: glob | ||
|
||
build | ||
build_* | ||
.DS_Store | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) | ||
|
||
#============================================================================ | ||
# Initialize the project | ||
#============================================================================ | ||
|
||
#-------------------------------------- | ||
# Initialize the IGNITION_CMAKE_DIR variable with the location of the cmake | ||
# directory that sits next to this find-module. | ||
set(IGNITION_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake") | ||
|
||
#-------------------------------------- | ||
# Add the location of this package's cmake directory to the CMAKE_MODULE_PATH | ||
list(APPEND CMAKE_MODULE_PATH "${IGNITION_CMAKE_DIR}") | ||
|
||
#-------------------------------------- | ||
# include the master IgnCMake module | ||
include(IgnCMake) | ||
|
||
#-------------------------------------- | ||
# Set up the project | ||
ign_configure_project(cmake 0 1 0) | ||
|
||
|
||
#============================================================================ | ||
# Configure the package to be installed | ||
#============================================================================ | ||
|
||
#-------------------------------------- | ||
# Create configuration and installation variables | ||
set(ign_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake-config.cmake.in") | ||
set(ign_config_output "${PROJECT_NAME_LOWER}-config.cmake") | ||
set(ign_version_output "${PROJECT_NAME_LOWER}-config-version.cmake") | ||
set(ign_config_install_dir "${IGN_LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER}") | ||
|
||
#-------------------------------------- | ||
# Configure and install the config file | ||
configure_package_config_file( | ||
${ign_config_input} | ||
${ign_config_output} | ||
INSTALL_DESTINATION ${ign_config_install_dir} | ||
NO_CHECK_REQUIRED_COMPONENTS_MACRO) | ||
|
||
#-------------------------------------- | ||
# Configure and install the version file | ||
write_basic_package_version_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/${ign_version_output} | ||
VERSION "${PROJECT_VERSION_FULL}" | ||
COMPATIBILITY SameMajorVersion) | ||
|
||
install( | ||
FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/${ign_config_output} | ||
${CMAKE_CURRENT_BINARY_DIR}/${ign_version_output} | ||
DESTINATION ${ign_config_install_dir} | ||
COMPONENT cmake) | ||
|
||
|
||
#============================================================================ | ||
# Install the files for this package | ||
#============================================================================ | ||
set(ign_modules_install_dir "${ign_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}") | ||
|
||
file(GLOB modules "cmake/*.cmake") | ||
file(GLOB templates "cmake/*.in") | ||
|
||
install( | ||
FILES ${modules} ${templates} | ||
DESTINATION ${ign_modules_install_dir} | ||
COMPONENT modules) | ||
|
||
file(GLOB pkgconfig_templates "cmake/pkgconfig/*.in") | ||
|
||
install( | ||
FILES ${pkgconfig_templates} | ||
DESTINATION ${ign_modules_install_dir}/pkgconfig | ||
COMPONENT modules) | ||
|
||
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find avcodec | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(AVCODEC libavcodec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find AV device. | ||
set(av_major ${AVDEVICE_FIND_VERSION_MAJOR}) | ||
set(av_minor ${AVDEVICE_FIND_VERSION_MINOR}) | ||
set(av_patch ${AVDEVICE_FIND_VERSION_PATCH}) | ||
|
||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(AVDEVICE libavdevice>=${av_major}.${av_minor}.${av_patch}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find AV format | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(AVFORMAT libavformat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find avutil | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(AVUTIL libavutil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find libdl | ||
|
||
# NOTE: libdl is a system library, so it does not come with pkgconfig metadata | ||
|
||
# If we cannot find the header or the library, we will switch this to false | ||
set(DL_FOUND true) | ||
|
||
# Search for the header | ||
find_path(DL_INCLUDE_DIRS dlfcn.h) | ||
if(DL_INCLUDE_DIRS) | ||
message(STATUS "Looking for dlfcn.h - found") | ||
else(DL_INCLUDE_DIRS) | ||
message(STATUS "Looking for dlfcn.h - not found") | ||
set(DL_FOUND false) | ||
endif() | ||
|
||
# Search for the library | ||
find_library(DL_LIBRARIES dl) | ||
if(DL_LIBRARIES) | ||
message(STATUS "Looking for libdl - found") | ||
else(DL_LIBRARIES) | ||
message(STATUS "Looking for libdl - not found") | ||
set(DL_FOUND false) | ||
endif() | ||
|
||
if(DL_FOUND) | ||
include(IgnImportTarget) | ||
ign_import_target(DL) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
DL | ||
REQUIRED_VARS DL_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find FreeImage | ||
|
||
# Grab the version numbers requested by the call to find_package(~) | ||
set(major_version ${FreeImage_FIND_VERSION_MAJOR}) | ||
set(minor_version ${FreeImage_FIND_VERSION_MINOR}) | ||
|
||
# Set the full version number | ||
set(full_version ${major_version}.${minor_version}) | ||
|
||
# See if we have PkgConfig | ||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules_quiet(FreeImage FreeImage>=${full_version}) | ||
if(NOT FreeImage_FOUND) | ||
message(STATUS "FreeImage.pc not found, we will search for FreeImage_INCLUDE_DIRS and FreeImage_LIBRARIES") | ||
endif(NOT FreeImage_FOUND) | ||
endif(PKG_CONFIG_FOUND) | ||
|
||
# If we don't have PkgConfig, or if PkgConfig failed, then do a manual search | ||
if(NOT FreeImage_FOUND) | ||
find_path(FreeImage_INCLUDE_DIRS FreeImage.h) | ||
if(NOT FreeImage_INCLUDE_DIRS) | ||
message(STATUS "Looking for FreeImage.h - not found") | ||
message(STATUS "Missing: Unable to find FreeImage.h") | ||
else(NOT FreeImage_INCLUDE_DIRS) | ||
# Check the FreeImage header for the right version | ||
set(testFreeImageSource ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/test_freeimage.cc) | ||
set(FreeImage_test_output "") | ||
set(FreeImage_compile_output "") | ||
file(WRITE ${testFreeImageSource} | ||
"#include <FreeImage.h>\nint main () { if (FREEIMAGE_MAJOR_VERSION >= ${major_version} && FREEIMAGE_MINOR_VERSION >= ${minor_version}) return 1; else return 0;} \n") | ||
|
||
try_run(FREEIMAGE_RUNS | ||
FREEIMAGE_COMPILES | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${testFreeImageSource} | ||
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${FreeImage_INCLUDE_DIRS} | ||
RUN_OUTPUT_VARIABLE FreeImage_test_output | ||
COMPILE_OUTPUT_VARIABLE FreeImage_compile_output) | ||
|
||
if(NOT FREEIMAGE_COMPILES) | ||
message(STATUS "FreeImage test failed to compile - This may indicate a build system bug") | ||
return() | ||
endif(NOT FREEIMAGE_COMPILES) | ||
|
||
if(NOT FREEIMAGE_RUNS) | ||
message(STATUS "Invalid FreeImage Version. Requires ${major_version}.${minor_version}") | ||
endif(NOT FREEIMAGE_RUNS) | ||
endif(NOT FreeImage_INCLUDE_DIRS) | ||
|
||
find_library(FreeImage_LIBRARIES freeimage) | ||
if(FreeImage_LIBRARIES) | ||
set(FreeImage_FOUND true) | ||
else() | ||
set("Looking for libfreeimage - not found") | ||
message(STATUS "Missing: Unable to find libfreeimage") | ||
endif(FreeImage_LIBRARIES) | ||
|
||
if(FreeImage_FOUND) | ||
# Create the imported target for FreeImage if we found it | ||
include(IgnImportTarget) | ||
ign_import_target(FreeImage) | ||
endif() | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find GNU Triangulation Surface Library | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(GTS gts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#=============================================================================== | ||
# Copyright (C) 2017 Open Source Robotics Foundation | ||
# | ||
# 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. | ||
# | ||
######################################## | ||
# Find libswscale format | ||
include(IgnPkgConfig) | ||
ign_pkg_check_modules(SWSCALE libswscale) |
Oops, something went wrong.