This commit is contained in:
2021-10-14 13:47:35 +02:00
commit 6625a8dfaa
4026 changed files with 844291 additions and 0 deletions
@@ -0,0 +1,219 @@
# ---------------------------------
# Finds OpenViBE SDK binary distribution
# Adds library to target, include path and execute install commands
# Also add library specific compiler flags
# This should be used with a defined INCLUDED_OV_SDK_COMPONENTS variable in scope
# Value should be a list of libraries to include
# They are organized into groups, and group name can also be used to add all members of said group
# This include :
# ALL : will include groups BASE, ALLPLUGINS and ALLMODULES
# BASE : MAIN KERNEL
# ALLPLUGINS : CLASSIFICATION DATA_GENERATION FEATURE_EXTRACTION FILE_IO SIGNAL_PROCESSING STIMULATION STREAM_CODECS STREAMING TOOLS
# ALLMODULES : EBML SYSTEM FS SOCKET XML DATE CSV TOOLKIT
# ---------------------------------
option(DYNAMIC_LINK_OPENVIBE_SDK "Dynamically link OpenViBE SDK" ON)
if(NOT CMAKE_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio*")
set(MULTI_BUILD TRUE)
elseif(CMAKE_BUILD_TYPE AND OV_PACKAGE)
set(SOLO_PACKAGE TRUE)
elseif(CMAKE_BUILD_TYPE)
set(SOLO_BUILD TRUE)
else()
message(FATAL_ERROR "Build should specify a type or use a multi-type generator (like Visual Studio)")
endif()
include_directories(${OPENVIBE_SDK_PATH}/include/)# TODO ?
if(DYNAMIC_LINK_OPENVIBE_SDK)
set(OPENVIBE_SDK_LINKING "")
set(LINKING_SUFFIX Shared)
add_definitions(-DOV_Shared)
else()
set(OPENVIBE_SDK_LINKING "-static")
set(LINKING_SUFFIX Static)
endif()
if("${INCLUDED_OV_SDK_COMPONENTS}" STREQUAL "ALL")
list(REMOVE_ITEM INCLUDED_OV_SDK_COMPONENTS "ALL")
list(APPEND INCLUDED_OV_SDK_COMPONENTS BASE ALLPLUGINS ALLMODULES)
endif()
if(BASE IN_LIST INCLUDED_OV_SDK_COMPONENTS)
list(REMOVE_ITEM INCLUDED_OV_SDK_COMPONENTS BASE)
list(APPEND INCLUDED_OV_SDK_COMPONENTS MAIN KERNEL)
endif()
if(ALLPLUGINS IN_LIST INCLUDED_OV_SDK_COMPONENTS)
list(REMOVE_ITEM INCLUDED_OV_SDK_COMPONENTS ALLPLUGINS)
list(APPEND INCLUDED_OV_SDK_COMPONENTS CLASSIFICATION DATA_GENERATION FEATURE_EXTRACTION FILE_IO SIGNAL_PROCESSING STIMULATION STREAM_CODECS STREAMING TOOLS)
endif()
if(ALLMODULES IN_LIST INCLUDED_OV_SDK_COMPONENTS)
list(REMOVE_ITEM INCLUDED_OV_SDK_COMPONENTS ALLMODULES)
list(APPEND INCLUDED_OV_SDK_COMPONENTS EBML SYSTEM FS SOCKET XML DATE CSV TOOLKIT COMMUNICATION)
endif()
if(WIN32)
set(LIB_PREFIX "")
set(ORIG_LIB_DIR bin)
set(DEST_LIB_DIR ${DIST_BINDIR})
set(LIB_EXT lib)
set(DLL_EXT dll)
set(EXE_EXT .exe)
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/ DESTINATION ${DIST_BINDIR} CONFIGURATIONS ${OUTPUTCONFIG} FILES_MATCHING PATTERN "*cmd")
endforeach()
else()
install(DIRECTORY ${OPENVIBE_SDK_PATH}/bin/ DESTINATION ${DIST_BINDIR} FILES_MATCHING PATTERN "*cmd")
endif()
elseif(UNIX)
set(LIB_PREFIX lib)
set(ORIG_LIB_DIR lib)
set(DEST_LIB_DIR ${DIST_LIBDIR})
if(DYNAMIC_LINK_OPENVIBE_SDK)
set(LIB_EXT "so")
if(APPLE)
set(LIB_EXT "dylib")
endif()
else()
set(LIB_EXT "a")
endif()
set(DLL_EXT "${LIB_EXT}*")
set(EXE_EXT "")
endif()
function(add_component TOKEN MODULE_NAME)
if(${TOKEN} IN_LIST INCLUDED_OV_SDK_COMPONENTS)
target_link_libraries(${PROJECT_NAME} "${OPENVIBE_SDK_PATH}/lib/${LIB_PREFIX}${MODULE_NAME}${OPENVIBE_SDK_LINKING}.${LIB_EXT}")
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/${ORIG_LIB_DIR}/ DESTINATION ${DEST_LIB_DIR} CONFIGURATIONS ${OUTPUTCONFIG} FILES_MATCHING PATTERN "*${MODULE_NAME}*${DLL_EXT}")
endforeach()
else()
install(DIRECTORY ${OPENVIBE_SDK_PATH}/${ORIG_LIB_DIR}/ DESTINATION ${DEST_LIB_DIR} FILES_MATCHING PATTERN "*${MODULE_NAME}*${DLL_EXT}")
endif()
set(FLAGS_LIST ${ARGV})
list(REMOVE_AT FLAGS_LIST 0 1) # Remove mandatory args to get only optional args
foreach(COMPILE_FLAG IN LISTS FLAGS_LIST)
add_definitions(-D${COMPILE_FLAG})
endforeach()
endif()
endfunction(add_component)
function(add_plugin TOKEN MODULE_NAME)
if(${TOKEN} IN_LIST INCLUDED_OV_SDK_COMPONENTS)
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/${ORIG_LIB_DIR}/ DESTINATION ${DEST_LIB_DIR} CONFIGURATIONS ${OUTPUTCONFIG} FILES_MATCHING PATTERN "*${MODULE_NAME}*${DLL_EXT}")
endforeach()
else()
install(DIRECTORY ${OPENVIBE_SDK_PATH}/${ORIG_LIB_DIR}/ DESTINATION ${DEST_LIB_DIR} FILES_MATCHING PATTERN "*${MODULE_NAME}*${DLL_EXT}")
endif()
endif()
endfunction(add_plugin)
add_component(MAIN "openvibe" "TARGET_HAS_OpenViBE")
add_component(KERNEL "openvibe-kernel") #TODO TARGET_HAS_
add_component(TOOLKIT "openvibe-toolkit" "TARGET_HAS_OpenViBEToolkit" "OVTK_${LINKING_SUFFIX}")
#modules
add_component(EBML "openvibe-module-ebml" "TARGET_HAS_EBML" "EBML_${LINKING_SUFFIX}")
add_component(SYSTEM "openvibe-module-system" "TARGET_HAS_System" "System_${LINKING_SUFFIX}")
add_component(FS "openvibe-module-fs" "TARGET_HAS_FS" "FS_${LINKING_SUFFIX}")
add_component(SOCKET "openvibe-module-socket" "TARGET_HAS_Socket" "Socket_${LINKING_SUFFIX}")
add_component(XML "openvibe-module-xml" "TARGET_HAS_XML" "XML_${LINKING_SUFFIX}")
add_component(CSV "openvibe-module-csv" "TARGET_HAS_CSV" "CSV_${LINKING_SUFFIX}")
add_component(DATE "openvibe-module-date" "TARGET_HAS_DATE" "DATE_${LINKING_SUFFIX}")
add_component(COMMUNICATION "openvibe-module-communication" "TARGET_HAS_COMMUNICATION" "COMMUNICATION_${LINKING_SUFFIX}")
#plugins
add_plugin(CLASSIFICATION "openvibe-plugins-base-classification")
add_plugin(DATA_GENERATION "openvibe-plugins-base-data-generation")
add_plugin(FEATURE_EXTRACTION "openvibe-plugins-base-feature-extraction")
add_plugin(FILE_IO "openvibe-plugins-base-file-io")
add_plugin(SIGNAL_PROCESSING "openvibe-plugins-base-signal-processing")
add_plugin(STIMULATION "openvibe-plugins-base-stimulation")
add_plugin(STREAM_CODECS "openvibe-plugins-base-stream-codecs")
add_plugin(STREAMING "openvibe-plugins-base-streaming")
add_plugin(TOOLS "openvibe-plugins-base-tools")
add_definitions(-DTARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines)
# Install binary dependencies if requested
if(DEPENDENCIES IN_LIST INCLUDED_OV_SDK_COMPONENTS)
if(WIN32)
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(FILES
${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/libexpat.dll
${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/xerces-c_3_1.dll
${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/xerces-c_3_1D.dll
DESTINATION ${DEST_LIB_DIR} CONFIGURATIONS ${OUTPUTCONFIG})
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/include/ DESTINATION ${DIST_INCLUDEDIR} CONFIGURATIONS ${OUTPUTCONFIG})
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/lib/ DESTINATION ${DIST_LIBDIR} CONFIGURATIONS ${OUTPUTCONFIG})
endforeach()
else()
install(FILES
${OPENVIBE_SDK_PATH}/bin/libexpat.dll
${OPENVIBE_SDK_PATH}/bin/xerces-c_3_1.dll
${OPENVIBE_SDK_PATH}/bin/xerces-c_3_1D.dll
DESTINATION ${DEST_LIB_DIR})
install(DIRECTORY ${OPENVIBE_SDK_PATH}/include/ DESTINATION ${DIST_INCLUDEDIR})
install(DIRECTORY ${OPENVIBE_SDK_PATH}/lib/ DESTINATION ${DIST_LIBDIR})
endif()
endif()
endif()
# Install applications if required
if(DEVELOPER_TOOLS IN_LIST INCLUDED_OV_SDK_COMPONENTS)
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(FILES
${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/openvibe-id-generator${EXE_EXT}
${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/openvibe-plugin-inspector${EXE_EXT}
DESTINATION ${DIST_BINDIR} CONFIGURATIONS ${OUTPUTCONFIG} FILE_PERMISSIONS OWNER_EXECUTE)
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/include/ DESTINATION ${DIST_INCLUDEDIR} CONFIGURATIONS ${OUTPUTCONFIG})
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/lib/ DESTINATION ${DIST_BINDIR} CONFIGURATIONS ${OUTPUTCONFIG})
endforeach()
else()
install(FILES
${OPENVIBE_SDK_PATH}/bin/openvibe-id-generator${EXE_EXT}
${OPENVIBE_SDK_PATH}/bin/openvibe-plugin-inspector${EXE_EXT}
DESTINATION ${DIST_BINDIR} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
install(DIRECTORY ${OPENVIBE_SDK_PATH}/include/ DESTINATION ${DIST_INCLUDEDIR})
install(DIRECTORY ${OPENVIBE_SDK_PATH}/lib/ DESTINATION ${DIST_BINDIR})
endif()
endif()
# if we link with the module socket in Static, we must link the project with the dependency on win32
if(WIN32 AND SOCKET IN_LIST INCLUDED_OV_SDK_COMPONENTS AND NOT DYNAMIC_LINK_OPENVIBE_SDK)
include("FindThirdPartyWinsock2")
include("FindThirdPartyFTDI")
endif()
if(MULTI_BUILD) # Replace with generator expression in CMake 3.5+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU )
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/share/ DESTINATION ${DIST_DATADIR} CONFIGURATIONS ${OUTPUTCONFIG})
install(DIRECTORY ${OPENVIBE_SDK_PATH_${OUTPUTCONFIGU}}/bin/
USE_SOURCE_PERMISSIONS
DESTINATION ${DIST_BINDIR}
CONFIGURATIONS ${OUTPUTCONFIG}
FILES_MATCHING PATTERN "*example*")
endforeach()
else()
install(DIRECTORY ${OPENVIBE_SDK_PATH}/share/ DESTINATION ${DIST_DATADIR})
install(DIRECTORY ${OPENVIBE_SDK_PATH}/bin/
USE_SOURCE_PERMISSIONS
DESTINATION ${DIST_BINDIR}
FILES_MATCHING PATTERN "*example*")
endif()
@@ -0,0 +1,89 @@
#!/usr/bin/perl
# Intended to be run from linux-install_dependencies.pl which defines the dependencies_dir variable.
#
# Variables are wrt that parent scope
#
use strict;
use warnings;
use Getopt::Long;
use English;
use FindBin;
use File::Copy;
use File::Spec;
# Version of CMake to install if needed (latest as of 08/2020)
my $version_major = 3;
my $version_minor = 18;
my $version_patch = 1;
# Minimum version needed for the project.
# 3.12 for FindPython functionalities.
my $minimum_major = 3;
my $minimum_minor = 15;
my $install_dir = $dependencies_dir;
# Updating path with potentially installed cmake before looking for it.
if ("$dependencies_dir/cmake") {
print "Found cmake folder in deps\n";
my $path = $ENV{'PATH'};
$path = "$dependencies_dir/cmake/bin:$path";
$ENV{'PATH'} = $path;
#system("PATH=$dependencies_dir/cmake/bin:$PATH")
}
# Checking for CMake presence
my $major_found = 0;
my $minor_found = 0;
if (`which cmake`) {
`cmake --version` =~ /.*(\d)\.(\d\d)\.*/;
print "cmake version found: $1.$2\n";
$major_found = $1;
$minor_found = $2;
}
# Minimum cmake version required for the project: 3.12
if (int($major_found) < $minimum_major || int($minor_found) < $minimum_minor) {
my $old_dir = Cwd::getcwd();
my $cmake_archive = "cmake-${version_major}.${version_minor}.${version_patch}.tar.gz";
my $cmake_folder = "cmake-${version_major}.${version_minor}.${version_patch}";
print "CMake version too low. Installing newer one in $install_dir\n";
if (! -d $install_dir) {
mkdir($install_dir) or die("Failed to create directory [$install_dir]");
}
# Download
print "Downloading ${cmake_archive}\n";
system("wget http://www.cmake.org/files/v${version_major}.${version_minor}/${cmake_archive}") == 0
or die "Could not download the CMake sources - err $?";
# Extract
system("tar -xzf ${cmake_archive}") == 0
or die ("Could not extract the CMake archive - err $?");
# Configure, compile and install
chdir $cmake_folder;
system("./configure --prefix=$install_dir/cmake") == 0
or die("Failed to configure for cmake - err $?");
system("make install") == 0
or die ("Failed make install cmake - err $?");
# Go back to previous folder
chdir $old_dir;
#Clear
system("rm -r ${cmake_archive} ${cmake_folder}") == 0
or die ("Failed to clear after install - err $?");
}
@@ -0,0 +1,53 @@
#!/usr/bin/perl
# Intended to be run from linux-install_dependencies.pl
#
# Variables are wrt that parent scope
#
# Installation of packages not available in the apt database or PPA
# Eigen installation
if (!$no_install && $distribution eq 'Ubuntu 16.04') {
# Install eigen 3.2.9 from source if it is not already
# This is because Ubuntu 16.04 has a beta version of the Eigen package by default
# and it does not work
if (-e "/usr/local/include/eigen3") {
print STDERR "Warning: eigen3 is already installed in /usr/local\n";
} else {
my $old_dir = Cwd::getcwd();
my $eigen_build_folder = $dependencies_dir . "/eigen-build";
my $eigen_extracted_folder = $eigen_build_folder . "/eigen-eigen-dc6cfdf9bcec";
if (! -e $dependencies_dir) {
mkdir($dependencies_dir) or die("Failed to create directory [$dependencies_dir]");
}
if (! -e $eigen_build_folder) {
mkdir($eigen_build_folder) or die("Failed to create directory [$eigen_build_folder]");
}
chdir $eigen_build_folder;
if (! -e "3.2.9.tar.bz2") {
system('wget "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2"');
($CHILD_ERROR != 0) and die ("Could not download the Eigen sources [$CHILD_ERROR]");
}
if (! -e $eigen_extracted_folder) {
system('tar -xjf "3.2.9.tar.bz2"');
($CHILD_ERROR != 0) and die ("Could not extract the eigen archive");
}
chdir $eigen_extracted_folder;
mkdir $eigen_extracted_folder . "/build" or die ("Failed to create directory [$eigen_extracted_folder/build]");
chdir $eigen_extracted_folder . "/build";
system("cmake ..");
($CHILD_ERROR != 0) and die("Failed to run CMake for Eigen [$CHILD_ERROR]");
system("sudo make install");
($CHILD_ERROR != 0) and die("Failed install Eigen [$CHILD_ERROR]");
# Go back to the scripts folder
chdir $old_dir;
}
}
@@ -0,0 +1,36 @@
#!/usr/bin/perl
# Intended to be run from linux-install_dependencies.pl
#
# Variables are wrt that parent scope
#
if (!$no_gtest) {
my $old_dir = Cwd::getcwd();
my $gtest_build_folder = $dependencies_dir . "/gtest-build";
my $gtest_lib_folder = $dependencies_dir . "/libgtest/";
if (! -e $dependencies_dir) {
mkdir($dependencies_dir) or die("Failed to create directory [$dependencies_dir]");
}
if (! -e $gtest_build_folder) {
mkdir($gtest_build_folder) or die("Failed to create directory [$gtest_build_folder]");
}
if (! -e $gtest_lib_folder) {
mkdir($gtest_lib_folder) or die("Failed to create directory [$gtest_lib_folder]");
}
# build gtest
chdir $gtest_build_folder;
system("cmake -GNinja /usr/src/gtest");
system("ninja all");
system("rm CMakeCache.txt");
my @lib_files = glob "*.a";
foreach my $lib_cur (@lib_files) {
copy($lib_cur, $gtest_lib_folder) or die "Could not copy lib $lib_cur $!\n";
}
chdir $old_dir;
}
@@ -0,0 +1,12 @@
#!/usr/bin/perl
# Intended to be run from linux-install_dependencies.pl
#
# Variables are wrt that parent scope
#
if (!$no_install && $distribution eq 'Ubuntu 14.04') {
system('sudo add-apt-repository ppa:fkrull/deadsnakes');
($CHILD_ERROR != 0) and die("Adding PPA repository for Python 3.5 failed [$CHILD_ERROR]");
}
@@ -0,0 +1,11 @@
doxygen
make
gcc
gcc-c++
expat-devel
openssl-devel
boost-devel
ninja-build
zziplib-devel
xerces-c-devel
gtest-devel
@@ -0,0 +1,16 @@
doxygen
make
gcc
g++
libexpat1-dev
libncurses5-dev
libeigen3-dev
libboost-dev
libboost-thread-dev
libboost-regex-dev
libboost-chrono-dev
libboost-filesystem1.54-dev
ninja-build
libzzip-dev
libxerces-c-dev
libgtest-dev
@@ -0,0 +1,16 @@
doxygen
make
gcc
g++
libssl-dev
libexpat1-dev
libncurses5-dev
libboost-dev
libboost-thread-dev
libboost-regex-dev
libboost-chrono-dev
libboost-filesystem-dev
ninja-build
libzzip-dev
libxerces-c-dev
libgtest-dev
@@ -0,0 +1,201 @@
#!/usr/bin/perl
=pod
This script will install dependencies for OpenViBE SDK.
The installer uses the native package manager.
Currently supported Linux Distributions are:
- Ubuntu 14.04 LTS
- Ubuntu 16.04 LTS
Operating on the specified manifest folder,
1) Carries out preliminary steps by running scripts matching
^linux-preinstall-.*pl from linux-dep-helpers/
2) Installs packages from distro-specific files
(like linux-dependencies-ubuntu1404.txt)
3) May compile/fetch packages with perl scripts matching
^linux-compile-.*pl from linux-dep-helpers/
n.b. The script globs all .pl scripts present that match the prefixes. If you don't want some dependency, remove the corresponding script.
=cut
use strict;
use English;
use FindBin;
use File::Copy;
use File::Spec;
use Getopt::Long;
sub usage {
print "$0 [-h][-y]\n";
print "Install OpenViBE SDK build dependencies\n";
print " Options:\n";
print " -h: this help\n";
print " -y: assume 'yes' to all prompts. Make it possible to run non-interactively.\n";
print " --no-gtest: will not compile gtest if set.\n";
print " --no-install: will not do any installation if set.\n";
print " --dependencies-dir [folder]: path to the dependencies\n";
print " --manifest-dir [folder]: path to the manifest files (default: scripts folder/linux-dep-helpers/)\n";
};
my $assume_yes = 0;
my $no_gtest = 0;
my $no_install = 0;
my $manifest_dir = "$FindBin::Bin";
my $print_help = 0;
my $dependencies_dir = "$FindBin::Bin/../dependencies/";
GetOptions (
"assume-yes" => \$assume_yes,
"y" => \$assume_yes,
"dependencies-dir=s" => \$dependencies_dir,
"manifest-dir=s" => \$manifest_dir,
"h" => \$print_help,
"help" => \$print_help,
"no-install" => \$no_install,
"no-gtest" => \$no_gtest)
or usage() and die("Error in command line arguments\n");
if($print_help) {
usage();
exit(1);
}
$dependencies_dir = File::Spec->rel2abs($dependencies_dir);
my $dependencies_arch_dir = "$dependencies_dir/arch";
my $helper_script_dir = "$manifest_dir/linux-dep-helpers/";
if (! -e $dependencies_dir) {
mkdir($dependencies_dir) or die("Failed to create directory [$dependencies_dir]");
}
if (! -e $dependencies_arch_dir) {
mkdir($dependencies_arch_dir) or die("Failed to create directory [$dependencies_arch_dir]");
}
# Check for the release version and set the update and install commands
my $unsupported_distribution = 'Unsupported';
my $distribution = $unsupported_distribution;
my $update_packages_command = '';
my $package_install_command = '';
my $add_repository_command = '';
my $os_release = `cat /etc/os-release`;
# Check for NAME= and VERSION_ID=
# Take into account distros placing quotes around values
my ($lsb_distributor, $lsb_release) = ($os_release =~ m/NAME=["'\`]*([a-zA-Z]+).*VERSION_ID=["'\`]*([0-9.]+)/s);
if ($lsb_distributor =~ 'Ubuntu') {
if (!$no_install) {
$update_packages_command = 'sudo apt-get update';
if ($assume_yes) {
$package_install_command = 'sudo apt-get -y install';
$add_repository_command = 'sudo add-apt-repository -y universe';
} else {
$package_install_command = 'sudo apt-get install';
$add_repository_command = 'sudo add-apt-repository universe';
}
}
if ($lsb_release =~ '14.04'
|| $lsb_release =~ '16.04'
|| $lsb_release =~ '18.04'
|| $lsb_release =~ '19.10') {
$distribution = 'Ubuntu ' . $lsb_release;
}
} elsif ($lsb_distributor =~ 'Fedora') {
if (!$no_install) {
if ($assume_yes) {
$package_install_command = 'sudo dnf -y install';
} else {
$package_install_command = 'sudo dnf install';
}
}
$distribution = 'Fedora';
}
$distribution eq $unsupported_distribution and die('This distribution is unsupported');
print "Installing dependencies for: $distribution\n";
print "Install command: $package_install_command\n";
# Perform steps before installing packages
opendir(my $dir_handle, $helper_script_dir) or die("unable to open $helper_script_dir");
while(my $filename = readdir($dir_handle)) {
if($filename =~ /^linux-preinstall.*pl/) {
open(my $pl_file_handle, '<', "$helper_script_dir/$filename")
or die "Unable to open file, $helper_script_dir/$filename";
undef $/;
my $program = <$pl_file_handle>;
eval " $program "; warn $@ if $@;
}
}
closedir($dir_handle);
# Create the list of packages to install
my $pkg_file = "";
if ($distribution eq 'Ubuntu 14.04') {
$pkg_file = "$manifest_dir/linux-dependencies-ubuntu1404.txt";
} elsif ($distribution =~ 'Ubuntu') {
$pkg_file = "$manifest_dir/linux-dependencies-ubuntu16_plus.txt";
} elsif ($distribution eq 'Fedora') {
$pkg_file = "$manifest_dir/linux-dependencies-fedora.txt";
}
# Install actual packages
print "Opening package manifest file $pkg_file ...\n";
# read package list to memory
open(my $pkg_file_handle, '<:encoding(UTF-8)', $pkg_file)
or die "Unable to open file, $pkg_file";
my @packages = ();
local $INPUT_RECORD_SEPARATOR = "\n";
for my $line (<$pkg_file_handle>) {
$line =~ s/\r?\n$//;
push @packages, $line;
}
close($pkg_file_handle) or warn "Unable to close $pkg_file";
if (!$no_install) {
# Update package list
if ($add_repository_command) {
print "Updating package database...\n";
system($add_repository_command);
($CHILD_ERROR != 0) and die('Failed to add additional repositories');
}
if ($update_packages_command) {
system($update_packages_command);
($CHILD_ERROR != 0) and die('Failed to update the package databases');
}
# Install the packages
print "Will install following packages:\n";
print (join ' ', @packages), "\n";
my $pkgs = (join ' ', @packages);
system("$package_install_command " . (join ' ', @packages));
($CHILD_ERROR != 0) and die('Failed to install the required packages');
}
# Obtain specific dependencies that we dont get from packages
opendir(my $dir_handle, $helper_script_dir) or die("unable to open $helper_script_dir");
while(my $filename = readdir($dir_handle)) {
if($filename =~ /^linux-compile.*pl/) {
print "Running $helper_script_dir/$filename ...\n";
open(my $pl_file_handle, '<', "$helper_script_dir/$filename")
or die "Unable to open file, $helper_script_dir/$filename";
undef $/;
my $program = <$pl_file_handle>;
eval " $program "; warn $@ if $@;
}
}
closedir($dir_handle);
print("OpenViBE SDK dependencies were successfully installed\n");
@@ -0,0 +1,3 @@
data/bci-motor-imagery.zip;test-input;2.0.0
data/openvibe-classification-lda.zip;test-input;2.0.0
data/openvibe-regularized-csp-2.0.0.zip;test-input;2.0.0
+229
View File
@@ -0,0 +1,229 @@
#!/bin/bash
# This is the build script to configure and build OpenViBE on
# unix-based platform.
# Functions definition
function usage()
{
echo "usage: ./unix-build [options]"
echo ""
echo "-h | --help : usage"
echo "-v | --verbose : verbose output at building step"
echo "--build-type <Debug|Release|RelWithDebInfo> : build type"
echo "--build-dir <dirname> : build directory"
echo "--install-dir <dirname> : binaries deployment directory"
echo "--dependencies-dir <dirname> : directory where dependencies are located"
echo "--test-data-dir <dirname> : test data directory"
echo "--make-package : a package will be created in build directory"
echo "--hide-error-location : do not display complete error locations"
echo "--userdata-subdir <dirname> name of the userdata sub directory"
echo "--brand-name <brand-name> name of the brand to prefix titles and documentation"
echo "--build-unit : if set, unit tests will be built"
echo "--build-validation : if set, validation tests will be builts"
echo "--gtest-lib-dir <dirname> : gtest libraries directory (default: \$\{dependencies_dir\}/libgtest)"
echo "--gtest-include-dir <dirname> : gtest include directory (default: /usr/src/gtest/src)"
echo "--test-output-dir <dirname> : test output files directory"
echo "--python-exec <path> : path to python executable to use"
}
# Script starting point
# As options are not mandatory, set some default values for each target
# variables
ov_script_dir="$(readlink -m $(dirname $0))"
ov_build_type=Release
verbose=0
package_option="FALSE"
display_error_location="ON"
BrandName=OpenViBE
ov_build_unit=0
ov_build_validation=0
gtest_include_dir="/usr/src/gtest/src"
# Parse arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h | --help)
usage
exit
;;
-v | --verbose)
verbose=1
;;
--build-type)
ov_build_type="$2"
shift
;;
--build-dir)
ov_build_dir="$2"
shift
;;
--install-dir)
ov_install_dir="$2"
shift
;;
--dependencies-dir)
dependencies_dir_token="-DOV_CUSTOM_DEPENDENCIES_PATH=$2"
dependencies_dir=$2
shift
;;
--test-data-dir)
ov_test_data_dir_token="-DOVT_TEST_DATA_DIR=$2"
shift
;;
--make-package)
package_option="TRUE"
display_error_location="OFF"
;;
--hide-error-location)
display_error_location=OFF
;;
--userdata-subdir)
UserDataSubdir="-DOV_CONFIG_SUBDIR=$2"
shift
;;
--brand-name)
BrandName="$2"
shift
;;
--build-unit)
ov_build_unit=1
;;
--build-validation)
ov_build_validation=1
;;
--gtest-lib-dir)
gtest_lib_dir_token="-DGTEST_LIBRARY=$2/libgtest.a"
gtest_mainlib_dir_token="-DGTEST_MAIN_LIBRARY=$2/libgtest_main.a"
shift
;;
--gtest-include-dir)
gtest_include_dir="$2"
shift
;;
--test-output-dir)
ov_cmake_test_output="$2"
shift
;;
--python-exec)
python_exec="-DPYTHON_EXECUTABLE=$2"
shift;;
*)
echo "ERROR: Unknown parameter $key"
exit 1
;;
esac
shift # past argument or value
done
# Check parameters validity
if [[ ${ov_build_type} != "Debug" ]] \
&& [[ ${ov_build_type} != "Release" ]] \
&& [[ ${ov_build_type} != "RelWithDebInfo" ]]
then
echo "ERROR: ${ov_build_type} not handled as build type"
exit 1
fi
# Update directories only if they point to the default one
if [[ ! -v ov_build_dir ]]; then
ov_build_dir="${ov_script_dir}/../../openvibe-sdk-build/build-${ov_build_type}"
fi
if [[ ! -v ov_install_dir ]]; then
ov_install_dir="${ov_script_dir}/../../openvibe-sdk-build/dist-${ov_build_type}"
fi
if [[ ! -v ov_cmake_test_output ]]; then
ov_cmake_test_output="${ov_build_dir}/validation-test-output/"
fi
echo "**************************************"
echo "Build with parameters:"
echo "[build-type] = ${ov_build_type}"
echo "[build-dir] = ${ov_build_dir}"
echo "[dependencies-dir token] = ${dependencies_dir_token}"
echo "[install-dir] = ${ov_install_dir}"
echo "[test data directory token] = ${ov_test_data_dir_token}"
echo "[test output files directory] = ${ov_cmake_test_output}"
echo "[build unit] = ${ov_build_unit}"
echo "[build validation] = ${ov_build_validation}"
echo "[brand name] = ${BrandName}"
echo "[user data subdirectory] = ${UserDataSubdir}"
echo "[display-error-location] = ${display_error_location}"
echo "**************************************"
echo ""
echo ""
# Special configuration for MacOS
uname_string=$(uname)
if [[ "$uname_string" == 'Darwin' ]]; then
export PKG_CONFIG_PATH="/opt/X11/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
# Create necessary directories
mkdir -p "${ov_build_dir}" &> /dev/null
# Change directory to build directory as cmake has to be run from build
# directory
pushd "${ov_build_dir}" &> /dev/null
echo "Generating build system files with cmake..."
cmake ${ov_script_dir}/.. \
-G Ninja \
-DCMAKE_BUILD_TYPE=${ov_build_type} \
-DCMAKE_INSTALL_PREFIX=${ov_install_dir} \
${ov_test_data_dir_token} \
${dependencies_dir_token} \
-DOV_PACKAGE=${package_option} \
-DOV_DISPLAY_ERROR_LOCATION=${display_error_location} \
-DBUILD_UNIT_TEST=${ov_build_unit} \
-DBUILD_VALIDATION_TEST=${ov_build_validation} \
-DGTEST_INCLUDE_DIR=${gtest_include_dir} \
${gtest_lib_dir_token} \
${gtest_mainlib_dir_token} \
-DOVT_VALIDATION_TEST_OUTPUT_DIR=${ov_cmake_test_output} \
${UserDataSubdir} \
-DBRAND_NAME=${BrandName} \
${python_exec}
if [[ $? == 0 ]]; then
echo "Generation succeeded!"
else
echo "ERROR: Generation failed"
exit 1
fi
echo "Building project..."
if [[ $verbose == 1 ]]; then
ninja -v install
else
ninja install
fi
if [[ $? == 0 ]]; then
echo "Build succeeded!"
else
echo "ERROR: Build failed"
exit 1
fi
if [[ ${package_option} == "TRUE" ]]; then
cmake --build . --target package
if [[ $? == 0 ]]; then
echo "Package succeeded!"
else
echo "ERROR: Package failed"
exit 1
fi
fi
popd &> /dev/null
exit
@@ -0,0 +1,25 @@
#!/bin/bash
# Set path to OpenViBE shared libraries
uname_string=$(uname)
export OV_PATH_ROOT="@DIST_BINDIR@/.."
if [[ "$uname_string" == 'Darwin' ]]; then
export DYLD_LIBRARY_PATH="@DIST_LIBDIR@/:$DYLD_LIBRARY_PATH"
else
export LD_LIBRARY_PATH="@DIST_LIBDIR@/:$LD_LIBRARY_PATH"
fi
# Execute ctest forwarding the arguments
if [ -d unit-test ]; then
pushd unit-test
ctest $@
popd
fi
if [ -d validation-test ]; then
pushd validation-test
ctest $@
popd
fi
@@ -0,0 +1,106 @@
#! /bin/bash
## Get needed dependencies from cache or remote server and unzip into
## dest folder.
#
DEPENDENCIES="./tests-data.txt"
CACHE_DIR="../dependencies/arch"
if [ ! -z $DEPENDENCY_CACHE ]; then
CACHE_DIR=$DEPENDENCY_CACHE
fi
OUTPUT_DIR="../dependencies"
function usage () {
cat <<EOF
Usage: $0 --manifest dependencies-file --cache cache_folder [--out output-folder]
[Options]
--manifest: file listing dependencies
--cache: dependency cache
--out: output destination folder [default: ../dependencies]
Example:
$0 --manifest dependencies.txt --cache /media/dependencies
EOF
}
while test -n "$1"; do
case "$1" in
--help)
usage
exit 0
;;
-h)
usage
exit 0
;;
--manifest)
DEPENDENCIES=$2
shift
;;
--cache)
CACHE_DIR=$2
shift
;;
--out)
OUTPUT_DIR=$2
shift
;;
esac
shift
done
if [ -z ${DEPENDENCIES} ] || [ -z ${CACHE_DIR} ]; then
usage
exit 1
fi
if [ -z ${DEPENDENCY_SERVER} ]; then
echo "If your dependencies are not up-to-date, you won't be able to download new files."
else
echo "Download dependencies from server [$DEPENDENCY_SERVER]."
fi
if [ -z ${PROXYPASS} ]; then
echo "Credentials were not provided. If your dependencies are not up-to-date, you won't be able to download new files."
else
user=`echo ${PROXYPASS} | cut -d ':' -f 1`
pass=`echo ${PROXYPASS} | cut -d ':' -f 2`
echo "Credentials are provided. Try to download from server with username [$user]."
fi
if [ ! -d ${CACHE_DIR} ]; then
echo "${CACHE_DIR} does not exist"
exit 2
fi
function get_dependency() {
local _dep=$1
if [ ! -f ${CACHE_DIR}/${_dep} ]; then
echo "Download zip archive: [${DEPENDENCY_SERVER}/${_dep}]"
wget --user=$user --password=$pass -nv -P ${CACHE_DIR}/${_dep%/*} ${DEPENDENCY_SERVER}/${_dep}
fi
}
function install_dependency() {
local _dep=$1 _dir=$2
get_dependency ${_dep}
echo "Unzip ${CACHE_DIR}/${_dep} to ${OUTPUT_DIR}/${_dir}"
if [ ! -f ${CACHE_DIR}/${_dep} ]; then
echo "Dependency ${_dep} does not exist in cache ${CACHE_DIR}"
exit 3
fi
mkdir -p ${OUTPUT_DIR}/${_dir}
unzip -q -o ${CACHE_DIR}/${_dep} -d ${OUTPUT_DIR}/${_dir}
}
mkdir -p ${OUTPUT_DIR}
echo "Get and unzip dependencies. Read dependencies from manifest [$DEPENDENCIES]"
cat ${DEPENDENCIES} | while read d; do
dep=`echo $d | cut -d ';' -f 1`
dir=`echo $d | cut -d ';' -f 2`
install_dependency ${dep} ${dir}
done
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# This script performs any environment initialisation needed for the build of OpenViBE.
function usage()
{
echo "usage: ./unix-init-env.sh [options]"
echo ""
echo "-h | --help : usage"
echo "-v | --verbose : verbose output at building step"
echo "--dependencies-dir <dirname> : directory where dependencies are located"
}
# variable inits
dependencies_dir=""
# arg parsing
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h | --help)
usage
exit 0
;;
-v | --verbose)
verbose=1
;;
--dependencies-dir)
dependencies_dir=$2
shift
;;
*)
echo "ERROR: Unknown parameter $key"
exit 1
;;
esac
shift # past argument or value
done
if [ -z "$dependencies_dir" ]
then
echo "Missing --dependencies-dir"
usage
else
echo "unix-init-env: adding dependencies to path"
# Add to the front of PATH any needed dependency.
export PATH=$dependencies_dir/cmake/bin:$PATH
fi
@@ -0,0 +1,2 @@
build/windows/cmake-3.18.0.zip;cmake;3.18.0
build/windows/ninja-1.4.0.zip;ninja;1.4.0
+262
View File
@@ -0,0 +1,262 @@
@echo off
setlocal EnableDelayedExpansion
setlocal enableextensions
set BuildType=Release
set PauseCommand=pause
set RerunCmake=false
set PackageOption=FALSE
set BrandName=OpenViBE
set DisplayErrorLocation=ON
set DependenciesPath=
set init_env_cmd=windows-initialize-environment.cmd
set generator=-G"Ninja"
set builder=Ninja
set script_dir=%~dp0
set PlatformTarget=x86
goto parameter_parse
:print_help
echo Usage: %0 [options]
echo.
echo -h ^|--help usage
echo --no-pause will not pause during script execution
echo -d^|--debug build in debug mode
echo -r^|--release build in release mode
echo --make-package make packages at the end
echo --hide-error-location do not display complete error locations
echo --rerun-cmake force cmake rerun
echo --userdata-subdir [dirname] name of the userdata sub directory
echo --brand-name [brand name] name of the brand to prefix titles and documentation
echo --build-unit build unit tests
echo --build-validation build validation tests
echo --build-dir [dirname] build directory
echo --install-dir [dirname] binaries deployment directory
echo --dependencies-dir [dirname] directory where dependencies are located
echo --test-data-dir [dirname] test data directory
echo --test-output-dir [dirname] test output files directory
echo --python-exec [path] path to the python executable to use
echo --vsproject Create visual studio project (.sln)
echo --vsbuild Create visual studio project (.sln) and compiles it
echo --platform-target [x86 or x64] Create a 32 or 64 bit. 32bit is the default
echo.
exit /b
:parameter_parse
if /i "%1" == "-h" (
goto print_help
) else if /i "%1" == "--help" (
goto print_help
) else if /i "%1" == "--no-pause" (
set PauseCommand=echo ""
SHIFT
Goto parameter_parse
) else if /i "%1" == "-d" (
set BuildType=Debug
SHIFT
Goto parameter_parse
) else if /i "%1" == "--debug" (
set BuildType=Debug
SHIFT
Goto parameter_parse
) else if /i "%1" == "-r" (
set BuildType=Release
SHIFT
Goto parameter_parse
) else if /i "%1" == "--release" (
set BuildType=Release
SHIFT
Goto parameter_parse
) else if /i "%1" == "--make-package" (
set PackageOption=TRUE
set DisplayErrorLocation=OFF
SHIFT
Goto parameter_parse
) else if /i "%1" == "--hide-error-location" (
set DisplayErrorLocation=OFF
SHIFT
Goto parameter_parse
) else if /i "%1" == "--rerun-cmake" (
set RerunCmake="true"
SHIFT
Goto parameter_parse
) else if /i "%1" == "--build-unit" (
set ov_build_unit=true
SHIFT
Goto parameter_parse
) else if /i "%1" == "--build-validation" (
set ov_build_validation=true
SHIFT
Goto parameter_parse
) else if /i "%1" == "--test-data-dir" (
set ov_cmake_test_data="-DOVT_TEST_DATA_DIR=%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1" == "--test-output-dir" (
set ov_cmake_test_output="%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1" == "--python-exec" (
set python_exec="-DPYTHON_EXECUTABLE=%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1" == "--userdata-subdir" (
set UserDataSubdir="-DOV_CONFIG_SUBDIR=%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1" == "--brand-name" (
set BrandName="%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1"=="--build-dir" (
set build_dir=%2
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1"=="--install-dir" (
set install_dir=%2
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1"=="--dependencies-dir" (
set DependenciesPath="-DOV_CUSTOM_DEPENDENCIES_PATH=%2"
set init_env_cmd=windows-initialize-environment.cmd --dependencies-dir %2
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1"=="--vsproject" (
set vsgenerate=TRUE
set builder=None
SHIFT
Goto parameter_parse
) else if /i "%1"=="--vsbuild" (
set vsgenerate=TRUE
set builder=Visual
SHIFT
Goto parameter_parse
) else if /i "%1"=="--platform-target" (
set PlatformTarget=%2
SHIFT
SHIFT
Goto parameter_parse
)else if not "%1" == "" (
echo unrecognized option [%1]
Goto terminate_error
)
if defined vsgenerate (
echo Build type is set to: MultiType.
) else (
echo Build type is set to: %BuildType%.
)
setlocal
call %init_env_cmd% --platform-target %PlatformTarget%
echo Compiler is: %VSCMake%
if defined vsgenerate (
if /i "%PlatformTarget%" == "x64" (
set generator=-G"%VSCMake% Win64" -T "v120"
) else (
set generator=-G"%VSCMake%" -T "v120"
)
if not defined build_dir (
set build_dir=%script_dir%\..\..\openvibe-sdk-build\vs-project-%PlatformTarget%
)
if not defined install_dir (
set install_dir=%script_dir%\..\..\openvibe-sdk-build\dist-%PlatformTarget%
)
) else (
set build_type="-DCMAKE_BUILD_TYPE=%BuildType%"
if not defined build_dir (
set build_dir=%script_dir%\..\..\openvibe-sdk-build\build-%BuildType%-%PlatformTarget%
)
if not defined install_dir (
set install_dir=%script_dir%\..\..\openvibe-sdk-build\dist-%BuildType%-%PlatformTarget%
)
)
if not defined ov_cmake_test_output (
set ov_cmake_test_output=%build_dir%\validation-test-output\
)
mkdir %build_dir% 2>NUL
pushd %build_dir%
set CallCmake=false
if not exist "%build_dir%\CMakeCache.txt" set CallCmake="true"
if %RerunCmake%=="true" set CallCmake="true"
if %CallCmake%=="true" (
cmake %script_dir%\.. %generator% ^
%build_type% ^
-DCMAKE_INSTALL_PREFIX=%install_dir% ^
-DOV_PACKAGE=%PackageOption% ^
-DOV_DISPLAY_ERROR_LOCATION=%DisplayErrorLocation% ^
-DBUILD_UNIT_TEST=%ov_build_unit% ^
-DBUILD_VALIDATION_TEST=%ov_build_validation% ^
%ov_cmake_test_data% ^
-DBRAND_NAME=%BrandName% ^
%UserDataSubdir% ^
-DOVT_VALIDATION_TEST_OUTPUT_DIR=%ov_cmake_test_output% ^
%python_exec% ^
%DependenciesPath%
)
if not "!ERRORLEVEL!" == "0" goto terminate_error
if !builder! == None (
goto terminate_success
) else if !builder! == Ninja (
ninja install
if not "!ERRORLEVEL!" == "0" goto terminate_error
) else if !builder! == Visual (
if %PlatformTarget% == x86 (
set msplatform=Win32
) else (
set msplatform=%PlatformTarget%
)
msbuild OpenVIBE.sln /p:Configuration=%BuildType% /p:Platform="!msplatform!"
if not "!ERRORLEVEL!" == "0" goto terminate_error
cmake --build . --config %BuildType% --target install
if not "!ERRORLEVEL!" == "0" goto terminate_error
)
if %PackageOption% == TRUE (
cmake --build . --target package
if not "!ERRORLEVEL!" == "0" goto terminate_error
)
goto terminate_success
:terminate_error
echo An error occured during building process !
%PauseCommand%
goto terminate
:terminate_success
%PauseCommand%
goto terminate
:terminate
popd
endlocal
@@ -0,0 +1,30 @@
@echo off
setlocal
REM Set test environment
set OV_PATH_ROOT=@DIST_BINDIR_ABSOLUTE@\..
set "PATH=@DIST_BINDIR_ABSOLUTE@;@OV_CUSTOM_DEPENDENCIES_PATH@\cmake\bin\;%PATH%"
if /i "%1" == "--python-dir" (
set "PYTHONHOME="
set "PYTHONPATH="
set "PATH=%2;%PATH%"
for /f "tokens=2,* delims= " %%a in ("%*") do set remaining_args=%%b
) else (
set remaining_args=%*
)
IF EXIST unit-test\NUL (
PUSHD unit-test
REM Execute ctest forwarding the arguments
ctest %remaining_args%
POPD
)
IF EXIST validation-test\NUL (
PUSHD validation-test
REM Execute ctest forwarding the arguments
ctest %remaining_args%
POPD
)
@@ -0,0 +1,7 @@
build/windows/boost_1.58_x64_vc120_dev.zip;boost;1.58
build/windows/eigen-3.3.7.zip;eigen;3.3.7
build/windows/expat_2.1.0.1_x64_vc120_dev.zip;expat;2.1.0.1
build/windows/gtest_1.7.0_x64_vc120_dev.zip;gtest;1.7.0
build/windows/pthread_2.9.1_x64_vc120_dev.zip;pthread;2.9.1
build/windows/xerces-c_3.1.3_x64_vc120_dev.zip;xerces-c;3.1.3
build/windows/vcredist_x64_vc120.zip;vcredist;1.0
@@ -0,0 +1,7 @@
build/windows/boost_1.58_x86_vc120_dev.zip;boost;1.58
build/windows/eigen-3.3.7.zip;eigen;3.3.7
build/windows/expat_2.1.0.1_x86_vc120_dev.zip;expat;2.1.0.1
build/windows/gtest_1.7.0_x86_vc120_dev.zip;gtest;1.7.0
build/windows/pthread_2.9.1_x86_vc120_dev.zip;pthread;2.9.1
build/windows/xerces-c_3.1.3_x86_vc120_dev.zip;xerces-c;3.1.3
build/windows/vcredist_x86_vc120.zip;vcredist;1.0
@@ -0,0 +1,3 @@
@echo off
call windows-build.cmd --vsproject %*
@@ -0,0 +1,269 @@
<#
.SYNOPSIS
This script aims at installing dependencies from a manifest file.
.DESCRIPTION
Script workflow is as follows:
- Check for a cache directory
- Parse input dependencies manifest
- Download dependencies if: (Currently does not download!)
* cache found but dependency not found in the cache
* cache not found (old archives are overwritten)
- Extract dependencies in destination folder (old dependencies are overwritten) if:
* dependencies were never unzipped
* the version of unzipped dependency is correct (read from manifest version file)
- write manifest version file, named after the manifest file name and suffixed with "-version",
it contains the version of lastly unzipped dependencies such as:
folder_to_unzip=version_number
.PARAMETER dependencies_file
The manifest file containing the required archives to install.
First line is the base URL of the dependencies, following lines are formatted as:
archive_name;folder_to_unzip;version_number
archive_name;folder_to_unzip;version_number
...
The `folder_to_unzip` can be the same for several dependencies, but in this case you have to make sure
that the archives share the same `version_number`.
If this is not the case an error will be thrown.
.PARAMETER dest_dir
Optional: if unspecified then by default it will be set to $script_root\..\dependencies
Destination directory for extracted archives. Each archive found in the manifest file
is extracted in 'dest_dir\folder_to_unzip'.
Note that if no cache is found, archives are also downloaded in 'dest_dir\arch'.
.PARAMETER cache_dir
Cache directory for extracted archives. Each archive found in the manifest file
is extracted from cache_dir to 'dest_dir\folder_to_unzip'.
.NOTES
File Name : windows-get-dependencies.ps1
Prerequisite : Tested with PS v4.0 on windows 10 pro.
Environment variables will be used if set:
* PROXYPASS: Used to set credentials, should be formed as user:passwd
* ZIP_EXECUTABLE: should be set to the path to 7zip executable. If unset, script will try to read registry keys.
.LINK
Detailed specifications:
https://jira.mensiatech.com/confluence/pages/viewpage.action?spaceKey=CT&title=Dependency+management
.EXAMPLE
powershell.exe -NoExit -NoProfile -ExecutionPolicy Bypass -File \absolute\path\to\windows-get-dependencies.ps1 -manifest_file .\windows-dependencies.txt
.EXAMPLE
powershell.exe -NoExit -NoProfile -ExecutionPolicy Bypass -File \absolute\path\to\windows-get-dependencies.ps1 -manifest_file .\windows-dependencies.txt
-dest_dir \absolute\path\to\dep\ -cache_dir \absolute\path\to\cache
#>
#
# script parameters
#
Param(
[parameter(Mandatory=$true)][ValidateScript({Test-Path $_ })][string]$manifest_file,
[parameter(Mandatory=$false)][string]$cache_dir,
[parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string]$dest_dir = ".\..\dependencies"
)
$manifest_file = [System.IO.Path]::GetFullPath($manifest_file)
$dest_dir = [System.IO.Path]::GetFullPath($dest_dir)
#
# input validation
#
Write-Host "===Input validation==="
if (Test-Path $dest_dir){
Write-Host "Destination directory found"
} else {
Write-Host "Destination directory not found"
New-Item $dest_dir -itemtype directory | Out-Null
Write-Host "Created destination directory: " $dest_dir
}
# if -cache_dir is specified, use its value, otherwise check if an environment variable exists
if($cache_dir) {
Write-Host "Cache directory provided by parameter: $cache_dir"
} elseif ($env:DEPENDENCY_CACHE -and (Test-Path $env:DEPENDENCY_CACHE)) {
Write-Host "Found cache directory: " ($env:DEPENDENCY_CACHE)
$cache_dir = $env:DEPENDENCY_CACHE
} else {
$cache_dir = $dest_dir + "\arch"
Write-Host "Found no cache directory. Set it to default value: $cache_dir"
}
if(-Not (Test-Path $cache_dir)) {
New-Item $cache_dir -itemtype directory | Out-Null
Write-Host "Created archive directory in destination: " $cache_dir
}
Write-Host "All archives will be downloaded in " $cache_dir
Write-Host ""
Write-Host "Configure Web client"
# Base URL of dependency server is read in environment variable
$Script:dependency_server = $env:URL
$WebClient = New-Object System.Net.WebClient
if($env:PROXYPASS){
$Username, $Password = $env:PROXYPASS.split(':',2)
Write-Host "Credentials are provided. Try to download from server with username [$Username]."
$WebClient.Credentials = New-Object System.Net.Networkcredential($Username, $Password)
} else {
Write-Host "Credentials were not provided. If your dependencies are not up-to-date, you won't be able to download new files."
}
Write-Host ""
if ($env:ZIP_EXECUTABLE) {
$Script:7zip_executable=$env:ZIP_EXECUTABLE
} else {
Try {
$Script:7zip_executable=(Get-ItemProperty HKLM:\Software\7-Zip).Path + "\7z.exe"
} Catch {
Write-Host "7-Zip was not found in register keys. Install it will fasten unzip."
}
}
if ($Script:7zip_executable -and (Test-Path $Script:7zip_executable)) {
Write-Host "Found 7-Zip in registry keys. It will be used to unzip archives."
} else {
Write-Host "7-Zip was not found in register keys. Install it will quicken the unzipping."
$Script:7zip_executable=""
}
Write-Host "===Parameters==="
Write-Host "Dependencies file = $manifest_file"
Write-Host "Destination directory = $dest_dir"
Write-Host ""
#
# script variables
#
# monitoring variables
$Script:extract_count = 0
$Script:download_count = 0
$Script:new_versions = @{}
#
# script functions
#
function ExpandZipFile($zip, $dest)
{
Write-Host "Extract: [" $zip "] -> [" $dest "]"
$shell = New-Object -ComObject Shell.Application
if ([string]::IsNullOrEmpty($Script:7zip_executable)){
# create dest if it does not exists
if(-Not (Test-Path $dest)) {
New-Item $dest -itemtype directory | Out-Null
}
$zip = $zip -replace "/", "\"
$folder = $shell.NameSpace("$zip")
# Progress based on count is pretty dumb. However
# the sizes retrieved by $folder.GetDetailsOf($item, 2)
# or $item.Size are unreliable. At least, it allows the script
# user to see something is going on.
$count = 0
$total_count = $folder.Items().Count
ForEach($item in $folder.Items()) {
$item_name = $folder.GetDetailsOf($item, 0)
$percent_complete = [System.Math]::Floor(100 * $count / $total_count)
Write-Progress `
-Status "Progress: $percent_complete%" `
-Activity ("Extracting " + (Split-Path -Leaf $zip) + " to " + (Split-Path -Leaf $dest)) `
-CurrentOperation "Copying $item_name (this can take a long time...)" `
-PercentComplete $percent_complete
# 0x14 = sum of options 4 (donnot display windows box) and 16 (answer yes to all)
$shell.Namespace("$dest").CopyHere($item, 0x14)
$count++
}
} else {
$7z_Arguments = @(
'x' ## extract files with full paths
'-y' ## assume Yes on all queries
$zip ## archive path
"`"-o$dest`"" ## dest path
)
& $7zip_executable $7z_Arguments
}
$Script:extract_count++
}
function InstallDeps($arch, $dir, $version)
{
$zip = $Script:cache_dir + "\" + $arch
if(-Not (Test-Path $zip)) {
if($Username -and $Script:dependency_server){
$url = $Script:dependency_server + "/" + $arch
} else {
Write-Error "- Credentials or $Script:dependency_server are not specified, can not download dependency. "
Write-Error "- They have to be set through environment variables: PROXYPASS and URL."
exit
}
Write-Host "Download: [" $url "] -> [" $zip "]."
$Script:WebClient.DownloadFile( $url, $zip )
$Script:download_count++
}
if(-Not (Test-Path $zip)) {
Write-Error "Archive [$zip] was not found in cache and could not be downloaded."
exit
}
if(Test-Path $dest_dir\$dir-version.txt) {
$old_dep_version=$(Get-Content $dest_dir\$dir-version.txt)
}
if((Test-Path ($Script:dest_dir + "\" + $dir)) -and ($old_dep_version -eq $version)) {
Write-Host "No need to unzip dependency. Already at the good version: " $old_dep_version "."
} else {
Write-Host "Dependency version is not the good one: [" $old_dep_version "]. Should be " $version
if((Test-Path ($Script:dest_dir + "\" + $dir)) -and (-Not $Script:new_versions.ContainsKey($dir))) {
Remove-item ($Script:dest_dir + "\" + $dir) -Force -Recurse
}
ExpandZipFile $zip ($Script:dest_dir + "\" + $dir)
}
# Add new version to table
if($Script:new_versions.ContainsKey($dir)) {
# If (during this install process) an archive was already extracted to this folder and its version is
# not the same as new version, we raise an error
if($Script:new_versions[$dir] -ne $version) {
Write-Error "- Several dependencies are extracted in the same folder with different versions.
You have to make sure that they carry the same version."
exit
}
} else {
$Script:new_versions.Add($dir, $version)
}
}
#
# core script
#
Write-Host ""
Write-Host "===Installing dependencies==="
$Script:timer = [System.Diagnostics.Stopwatch]::StartNew()
foreach ($dep in Get-Content $manifest_file) {
$arch, $dir, $version = $dep.split(';',3)
InstallDeps $arch $dir $version
}
$timer.Stop()
Write-Host "Write token version files, to quicken next dependencies "
foreach ($new_version in $Script:new_versions.GetEnumerator()) {
$new_version.Value > $dest_dir\$($new_version.Key)-version.txt
}
Write-Host ""
Write-Host "===Install Summary==="
Write-Host "State = Success"
Write-Host "Number of archives downloaded = $Script:download_count"
Write-Host "Number of archives extracted = $Script:extract_count"
Write-Host "Installation time = " $([string]::Format("{0:d2}h:{1:d2}mn:{2:d2}s", $timer.Elapsed.hours, $timer.Elapsed.minutes, $timer.Elapsed.seconds)) -nonewline
Write-Host ""
@@ -0,0 +1,115 @@
@echo off
set PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;%PATH%
set "SCRIPT_PATH=%~dp0"
:parameter_parse
if /i "%1" == "--dependencies-dir" (
set "PATH_DEPENDENCIES=%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1" == "--platform-target" (
if "%2"=="x64" (
set PLATFORM=x64
set VSPLATFORMGENERATOR=Win64
) else if "%2"=="x86" (
set PLATFORM=x86
set VSPLATFORMGENERATOR=
) else (
echo Unknown platform %2 target
Goto terminate
)
SHIFT
SHIFT
Goto parameter_parse
) else if not "%1" == "" (
echo unrecognized option [%1]
Goto terminate_error
)
if not defined PATH_DEPENDENCIES (
if %PLATFORM%==x64 (
SET "PATH_DEPENDENCIES=%SCRIPT_PATH%../dependencies_x64"
) else (
SET "PATH_DEPENDENCIES=%SCRIPT_PATH%../dependencies"
)
)
set PATH=%PATH_DEPENDENCIES%/boost/bin;%PATH%
set PATH=%PATH_DEPENDENCIES%/cmake/bin;%PATH%
set PATH=%PATH_DEPENDENCIES%/expat/bin;%PATH%
set PATH=%PATH_DEPENDENCIES%/ninja;%PATH%
set PATH=%PATH_DEPENDENCIES%/tvicport/bin;%PATH%
set PATH=%PATH_DEPENDENCIES%/vcredist;%PATH%
set PATH=%PATH_DEPENDENCIES%/zip;%PATH%
set PATH=%PATH_DEPENDENCIES%/xerces-c/lib;%PATH%
REM ########################################################################################################################
REM # Set to 1 to skip new compilers.
if not defined SKIP_VS2017 (
SET SKIP_VS2017=1
)
if not defined SKIP_VS2015 (
SET SKIP_VS2015=1
)
if not defined SKIP_VS2013 (
SET SKIP_VS2013=0
)
SET VSTOOLS=
SET VSCMake=
set VCVARSALLPATH=../../VC/vcvarsall.bat
if %SKIP_VS2017% == 0 (
set "VSTOOLS=%VS150COMNTOOLS%"
set VSCMake=Visual Studio 15 2017
) else if %SKIP_VS2015% == 0 (
echo Visual Studio 2017 detection skipped as requested
set "VSTOOLS=%VS140COMNTOOLS%"
set VSCMake=Visual Studio 14 2015
) else (
echo Visual Studio 2017 detection skipped as requested
echo Visual Studio 2015 detection skipped as requested
set "VSTOOLS=%VS120COMNTOOLS%"
set VSCMake=Visual Studio 12 2013
)
echo VStools: %VSTOOLS%, VSCMake: %VSCMake%.
if exist "!VSTOOLS!%VCVARSALLPATH%" (
if %PlatformTarget% == x64 (
if exist "!VSTOOLS!../../VC/bin/x64" (
echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% %PlatformTarget%
call "!VSTOOLS!%VCVARSALLPATH%" %PlatformTarget%
) else (
echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% x86_amd64
call "!VSTOOLS!%VCVARSALLPATH%" x86_amd64
)
) else (
echo Found %VSCMake% tools: !VSTOOLS!vsvars32.bat
call "!VSTOOLS!vsvars32.bat"
)
goto terminate
)
set VSCMake=!VSCMake! %VSPLATFORMGENERATOR%
goto terminate_success
:terminate_error
echo An error occured during environment initializing !
pause
exit 1
REM #######################################################################################
:terminate_success
goto terminate
REM #######################################################################################
:terminate
@@ -0,0 +1,23 @@
REM Install OV SDK dependencies
REM This script can be copied, renamed as `windows-install-dependencies-custom.cmd`
REM and updated with the right credentials in PROXYPASS, such as username:password
REM
@echo off
echo Install all dependencies
REM In order to download dependencies, PROXYPASS must be changed with appropriate credentials
REM set PROXYPASS=XXX:XXX
set URL=https://extranet.mensiatech.com/dependencies
if not exist "..\dependencies_x64\arch\build\windows" ( mkdir "..\dependencies_x64\arch\build\windows" )
if not exist "..\dependencies\arch\data" ( mkdir "..\dependencies\arch\data" )
REM Install build tools, CMake, Ninja, comment line if you already have an instance of CMake installed
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\windows-build-tools.txt -dest_dir .\..\dependencies_x64
REM Install OV SDK dependencies
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\windows-dependencies-x64.txt -dest_dir .\..\dependencies_x64
REM Retrieve test data
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\tests-data.txt
pause
@@ -0,0 +1,23 @@
REM Install OV SDK dependencies
REM This script can be copied, renamed as `windows-install-dependencies-custom.cmd`
REM and updated with the right credentials in PROXYPASS, such as username:password
REM
@echo off
echo Install all dependencies
REM In order to download dependencies, PROXYPASS must be changed with appropriate credentials
REM set PROXYPASS=XXX:XXX
set URL=https://extranet.mensiatech.com/dependencies
if not exist "..\dependencies\arch\build\windows" ( mkdir "..\dependencies\arch\build\windows" )
if not exist "..\dependencies\arch\data" ( mkdir "..\dependencies\arch\data" )
REM Install build tools, CMake, Ninja, comment line if you already have an instance of CMake installed
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\windows-build-tools.txt
REM Install OV SDK dependencies
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\windows-dependencies-x86.txt
REM Retrieve test data
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\tests-data.txt
pause
@@ -0,0 +1,3 @@
@echo off
call windows-launch-visual-studio.cmd --debug
@@ -0,0 +1,64 @@
@echo off
setlocal EnableDelayedExpansion
setlocal enableextensions
pushd %~dp0\..
set root_dir=%CD%
popd
set VerboseOuptut=OFF
set PlatformTarget=x86
set PATH_DEPENDENCIES=
set BuildType=Release
goto parameter_parse
:print_help
echo Usage: windows-launch-visual-studio.cmd [--debug] [--dependencies-dir ^<path to dependencies^>]
exit /b
:parameter_parse
if /i "%1" == "--dependencies-dir" (
set "PATH_DEPENDENCIES=%2"
SHIFT
SHIFT
Goto parameter_parse
) else if /i "%1"=="--debug" (
set BuildType=Debug
SHIFT
) else if /i "%1" == "--platform-target" (
if "%2"=="x64" (
set PlatformTarget=%2
SHIFT
SHIFT
Goto parameter_parse
)
)
call "windows-initialize-environment.cmd" --platform-target %PlatformTarget%
SET "OV_PATH_ROOT=%root_dir%\..\openvibe-sdk-build\dist-%PlatformTarget%"
SET "PATH=%OV_PATH_ROOT%\bin;%PATH%"
REM for visual studio express...
if not defined USE_EXPRESS (
SET USE_EXPRESS=1
)
set SolutionPath=%root_dir%\..\openvibe-sdk-build\vs-project-%PlatformTarget%\OpenViBE.sln
if %USE_EXPRESS% == 1 (
echo Use %VSCMake% Express Edition
if "%VSCMake%"=="Visual Studio 12 2013" (
start /b "%VSINSTALLDIR%\Common7\IDE\WDExpress.exe" %SolutionPath%
) else (
"%VSINSTALLDIR%\Common7\IDE\VCExpress.exe" %SolutionPath%
)
) else (
echo Use %VSCMake% Community Edition
"%VSINSTALLDIR%\Common7\IDE\devenv.exe" %SolutionPath%
)