Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake dep refactor #969

Merged
merged 19 commits into from Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,38 @@
Here we document changes that affect the public API or changes that needs to be communicated to other developers.

## 2020-06-26 Vcpkg support
Most of our external dependencies can now provided by vcpkg. Just install the corresponding vcpkg package and set `IVW_USE_EXTERNAL_<package>` to `TRUE`
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
`cmake/vcpkghelpers.cmake` provides functions for installing the vcpkg packages needed to create installers.

## 2020-06-26 CMake `IVW_CFG_DEFAULT`
A new options `IVW_CFG_DEFAULT` was added to enable including a file with user provided defaults options before the initial configure. To use just set IVW_CFG_DEFAULT to a file path to a cmake file with defaults, for example:
```cmake
# Config
set(IVW_CFG_CMAKE_DEBUG ON)
set(IVW_CFG_PROFILING ON)
set(IVW_CFG_PRECOMPILED_HEADERS OFF)
set(IVW_CFG_FORCE_ASSERTIONS ON)
```
before the first cmake configure call.

## 2020-06-26 CMake refactor
We have renamed many cmake options to make the naming more consistent and the options easier to find. But you might need to review your cmake settings when updating to make sure you have the correct settings.
We now group the cmake settings like this:
* `IVW_APP_*` Enable disable building various apps
* `IVV_CFG_*` All configuration options, like PRECOMPILED_HEADERS and PROFILING
* `IVW_DOXYGEN_*` Doxygen options
* `IVW_EXTERNAL_*` Add external modules / projects
* `IVW_MODULE_*` enable/disable modules
* `IVW_PACKAGE_*` options for installing/cretings installers
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
* `IVW_TEST_*` option for unit test, integration test, regressions test.
* `IVW_USE_*` options for enabling/disabling some libraries / tools (sigar, openmp, openexr)
* `IVW_USE_EXTERNAL_*` enable/disable building various dependences. if off then dependences must be provided externally

Notable changes include:
* `PRECOMPILED_HEADERS -> IVW_CFG_PRECOMPILED_HEADERS`
* `IVW_PROFILING -> IVW_CFG_PROFILING`
* `IVW_OPENMP_ON -> IVW_USE_OPENMP`

## 2020-06-16 StipplingProperty now in BaseGL
Moved StipplingProperty and associated settings from Base module to BaseGL.

Expand Down
2 changes: 1 addition & 1 deletion apps/inviwo/packaging/packaging.cmake
Expand Up @@ -42,7 +42,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${IVW_ROOT_DIR}/LICENSE")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-v${IVW_VERSION}")

set(CPACK_MONOLITHIC_INSTALL OFF)
ivw_get_target_property_recursive(install_list inviwo IVW_INSTALL_LIST OFF)
ivw_get_target_property_recursive(install_list inviwo INTERFACE_IVW_INSTALL_LIST OFF)
ivw_filter_install_list(LIST install_list REMOVE_COMPONENTS Development Testing)
list(TRANSFORM install_list REPLACE "\\|%\\|" ";")
set(CPACK_INSTALL_CMAKE_PROJECTS ${install_list})
Expand Down
22 changes: 17 additions & 5 deletions cmake/installutils.cmake
Expand Up @@ -68,22 +68,28 @@ else()
set(IVW_RESOURCE_INSTALL_PREFIX "")
endif()


# the INTERFACE_IVW_INSTALL_LIST is a property to hold a list of projects/components to install
# it is used in the packaging to creata a list of items to install. this list will be
# passed to CPACK_INSTALL_CMAKE_PROJECTS after a potential filtering
# The property can be set in GLOBAL, DIRECTORY and TARGET scope.
define_property(
GLOBAL PROPERTY IVW_INSTALL_LIST INHERITED
GLOBAL PROPERTY INTERFACE_IVW_INSTALL_LIST INHERITED
BRIEF_DOCS "List of global intstallation components to install"
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
FULL_DOCS "List of global intstallation components to install"
)
define_property(
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
DIRECTORY PROPERTY IVW_INSTALL_LIST INHERITED
DIRECTORY PROPERTY INTERFACE_IVW_INSTALL_LIST INHERITED
BRIEF_DOCS "List of intstallation components to install for directory"
FULL_DOCS "List of intstallation components to install for directory"
)
define_property(
TARGET PROPERTY IVW_INSTALL_LIST INHERITED
TARGET PROPERTY INTERFACE_IVW_INSTALL_LIST INHERITED
BRIEF_DOCS "List of intstallation components to install for target"
FULL_DOCS "List of intstallation components to install for target"
)

# Adds the current project to the INTERFACE_IVW_INSTALL_LIST of the given scope
function(ivw_append_install_list)
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
set(options DIRECTORY GLOBAL)
set(oneValueArgs TARGET)
Expand All @@ -100,7 +106,7 @@ function(ivw_append_install_list)
message(ERROR "Error either TARGET, DIRECTORY, or GLOBAL must be specified")
endif()

get_property(install_list ${scope} PROPERTY IVW_INSTALL_LIST)
get_property(install_list ${scope} PROPERTY INTERFACE_IVW_INSTALL_LIST)
if(NOT install_list)
set(install_list "")
endif()
Expand All @@ -110,9 +116,15 @@ function(ivw_append_install_list)
"${CMAKE_CURRENT_BINARY_DIR}|%|${CMAKE_PROJECT_NAME}|%|Testing|%|/"
"${CMAKE_CURRENT_BINARY_DIR}|%|${CMAKE_PROJECT_NAME}|%|Development|%|/"
)
set_property(${scope} PROPERTY IVW_INSTALL_LIST ${install_list})
set_property(${scope} PROPERTY INTERFACE_IVW_INSTALL_LIST ${install_list})
endfunction()

# Filders the given INTERFACE_IVW_INSTALL_LIST for specified components
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
# List should be creted by calls to ivw_append_install_list
# see apps/inviwo/packaging.cmake for an example use
# Params:
# * LIST an instace of INTERFACE_IVW_INSTALL_LIST to filter
# * REMOVE_COMPONENTS list of components to remove from the given list
function(ivw_filter_install_list)
petersteneteg marked this conversation as resolved.
Show resolved Hide resolved
set(options "")
set(oneValueArgs LIST)
Expand Down
18 changes: 18 additions & 0 deletions cmake/vcpkghelpers.cmake
Expand Up @@ -27,6 +27,13 @@
#
#################################################################################


# A helper function to get to various vcpkg paths
# If vcpkg is not used we just return empty strings
# There are not "offically" exposed so we always use this helper to get then if needed
# then we only need to update here if vcpkg changes.
# This is mostly used to provide hints when trying to find headers etc for libs that don't have
# a proper FindFoo.cmake of FooConfig.cmake.
function(ivw_vcpkg_paths)
set(options "")
set(oneValueArgs BIN INCLUDE LIB SHARE)
Expand Down Expand Up @@ -63,6 +70,17 @@ function(ivw_vcpkg_paths)
endif()
endfunction()


# A helper function to install vcpkg libs. Will install dll/so, lib, pdb, stc. into the
# correspnding folders by globing the vcpkg package folders.
# It will also try and install eny transitive dependencies autoamtically
# We also autoamtically register the licence file using the metadata found in vcpkg
# Params:
# * COPYRIGHT a special copytight file, default to "copyright" some vcpkg libs use other files.
# * OUT_COPYRIGHT retrive the path the the COPYRIGHT file
# * OUT_VERSION get the package version from the vcpkg metadata
# * MODULE the module to use for ivw_register_license_file
# * EXT pass on to ivw_register_license_file
function(ivw_vcpkg_install name)
if(NOT VCPKG_TOOLCHAIN)
return()
Expand Down
6 changes: 3 additions & 3 deletions ext/CMakeLists.txt
Expand Up @@ -149,7 +149,7 @@ if(NOT IVW_USE_EXTERNAL_TINYDIR)
FILES ${IVW_EXTENSIONS_DIR}/tinydir/COPYING
)
else()
ivw_vcpkg_paths(INCLUDE vcpkgInclude)
ivw_vcpkg_paths(INCLUDE vcpkgInclude) # get the vcpkg include path as a hint if available
find_path(TINYDIR_INCLUDE_DIR NAMES tinydir.h HINTS ${vcpkgInclude} REQUIRED)
add_library(tinydir INTERFACE)
add_library(inviwo::tinydir ALIAS tinydir)
Expand All @@ -170,13 +170,13 @@ ivw_register_license_file(NAME "half" VERSION 1.12.0 MODULE Core EXT
option(IVW_USE_EXTERNAL_UTFCPP "UTFCPP is provided externaly" OFF)
if(NOT IVW_USE_EXTERNAL_UTFCPP)
add_subdirectory(utf)
ivw_register_license_file(NAME "UTF8-CPP" TARGET utfcpp MODULE Core EXT
ivw_register_license_file(NAME "UTF8-CPP" VERSION ${utf8cpp_VERSION} MODULE Core EXT
URL "https://github.com/nemtrif/utfcpp"
TYPE "Boost Software License"
FILES ${IVW_EXTENSIONS_DIR}/utf/LICENSE
)
else()
ivw_vcpkg_paths(INCLUDE vcpkgInclude)
ivw_vcpkg_paths(INCLUDE vcpkgInclude) # get the vcpkg include path as a hint if available
find_path(UTFCPP_INCLUDE_DIR NAMES utf8.h utf8/core.h HINTS ${vcpkgInclude} REQUIRED)
add_library(utf8cpp INTERFACE)
add_library(utf8::cpp ALIAS utf8cpp)
Expand Down
27 changes: 8 additions & 19 deletions ext/tinydir/CMakeLists.txt
@@ -1,28 +1,17 @@
# Following
# http://stackoverflow.com/a/29214327/3214598

set(HEADER_FILES
${IVW_EXTENSIONS_DIR}/tinydir/tinydir.h
)
set(HEADER_FILES tinydir.h)
ivw_group("Header Files" ${HEADER_FILES})
source_group("CMake Files" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)

add_library(tinydir INTERFACE) # 'moduleA' is an INTERFACE pseudo target
add_library(inviwo::tinydir ALIAS tinydir)
target_include_directories(tinydir INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
#$<INSTALL_INTERFACE:???>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

# From here, the target 'moduleA' can be customised
#target_include_directories(moduleA ...) # Transitively forwarded
#install(TARGETS moduleA ...)

# HACK: have the files showing in the IDE, under the name 'tinydircpp'
add_custom_target(tinydircpp SOURCES ${HEADER_FILES})

# Creates VS folder structure
ivw_folder(tinydircpp ext)
# HACK: have the files showing in the IDE, under the name 'tinydir_dummy'
add_custom_target(tinydir_dummy SOURCES ${HEADER_FILES})
ivw_folder(tinydir_dummy ext)

#ivw_default_install_targets(tinydir)
ivw_make_package(tinydir tinydir)
ivw_default_install_targets(tinydir)
ivw_make_package(tinydir tinydir)
8 changes: 6 additions & 2 deletions ext/tinydir/COPYING
@@ -1,4 +1,8 @@
Copyright (c) 2013, Cong Xu
Copyright (c) 2013-2016, tinydir authors:
- Cong Xu
- Lautis Sun
- Baudouin Feildel
- Andargor <andargor@yahoo.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -19,4 +23,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 6 additions & 8 deletions ext/tinydir/README.md
@@ -1,9 +1,12 @@
TinyDir
=======
[![Build Status](https://travis-ci.org/cxong/tinydir.svg?branch=master)](https://travis-ci.org/cxong/tinydir)[![Project Stats](https://www.openhub.net/p/tinydir/widgets/project_thin_badge.gif)](https://www.openhub.net/p/tinydir)
[![Build Status](https://travis-ci.org/cxong/tinydir.svg?branch=master)](https://travis-ci.org/cxong/tinydir)
[![Release](http://img.shields.io/github/release/cxong/tinydir.svg)](https://github.com/cxong/tinydir/releases/latest)

Lightweight, portable and easy to integrate C directory and file reader. TinyDir wraps dirent for POSIX and FindFirstFile for Windows.

Windows unicode is supported by defining `UNICODE` and `_UNICODE` before including `tinydir.h`.

Example
=======

Expand Down Expand Up @@ -64,18 +67,13 @@ Platforms

POSIX and Windows supported. Open to the possibility of supporting other platforms.

Links
=====
Available Archlinux AUR package : https://aur.archlinux.org/packages/tinydir-git/

License
=======

Simplified BSD.
Simplified BSD; if you use tinydir you can comply by including `tinydir.h` or `COPYING` somewhere in your package.

Known Limitations
=================

- Not threadsafe
- Limited path and filename sizes
- No wide char support
- [Possible race condition bug if folder being read has changing content](https://github.com/cxong/tinydir/issues/13)