Skip to content

Commit

Permalink
Merge pull request #78 from alicevision/devWindozeFixes
Browse files Browse the repository at this point in the history
Windows build
  • Loading branch information
fabiencastan committed Jul 16, 2019
2 parents 9fc303b + cdd97d2 commit 7768c18
Show file tree
Hide file tree
Showing 100 changed files with 1,129 additions and 1,366 deletions.
85 changes: 19 additions & 66 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ addons:
- libtiff4-dev
- libtbb-dev
- libatlas-base-dev
- libboost-atomic1.55-dev
- libboost-chrono1.55-dev
- libboost-filesystem1.55-dev
- libboost-date-time1.55-dev
- libboost-program-options1.55-dev
- libboost-serialization1.55-dev
- libboost-system1.55-dev
- libboost-test1.55-dev
- libboost-thread1.55-dev
- libboost-timer1.55-dev

matrix:
include:
Expand All @@ -50,52 +40,25 @@ env:
- BUILD_TYPE="RELEASE"
- BUILD_SYSTEM="`uname -s`"
- BUILD_PROCESSOR="`uname -p`"
- DEPS_INSTALL_PATH=${TRAVIS_BUILD_DIR}/../AliceVisionDependencies/install-deps
- CCTAG_SOURCE=${TRAVIS_BUILD_DIR}
- CCTAG_BUILD=${TRAVIS_BUILD_DIR}/build
- CCTAG_INSTALL=${CCTAG_BUILD}/install
- CCTAG_BUILD_VARIANT=${TRAVIS_BUILD_DIR}/build
- CCTAG_INSTALL_VARIANT=${CCTAG_BUILD_VARIANT}/install
- CCTAG_SOURCE_APP=$CCTAG_SOURCE/src/applications
- CCTAG_BUILD_APP=${CCTAG_SOURCE_APP}/build
# OPENCV
- OPENCV_ROOT=${HOME}/opencv3
- OPENCV_SOURCE=${OPENCV_ROOT}/source
- OPENCV_CONTRIB=${OPENCV_ROOT}/contrib
- OPENCV_BUILD=${OPENCV_ROOT}/build
- OPENCV_INSTALL=${OPENCV_ROOT}/install
# CMAKE
- CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz"
- CMAKE_ROOT=${HOME}/cmake
- CMAKE_SOURCE=${CMAKE_ROOT}/source
- CMAKE_INSTALL=${CMAKE_ROOT}/install

before_install:
- date -u
- uname -a
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
lsb_release -a;
elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
sw_vers -productVersion;
fi
- ccache -s
- gem install coveralls-lcov
# OPENCV
- >
if [ "$(ls -A $OPENCV_INSTALL)" ]; then
echo "OpenCV found in cache.";
else
mkdir --parent $OPENCV_SOURCE
mkdir --parent $OPENCV_BUILD
mkdir --parent $OPENCV_INSTALL
git clone --recursive --branch 3.0.0 --depth 1 https://github.com/Itseez/opencv.git $OPENCV_SOURCE;
fi
# CMAKE most recent version
- >
if [ "$(ls -A ${CMAKE_INSTALL})" ]; then
echo "CMake found in cache.";
ls -A ${CMAKE_INSTALL}
export PATH=${CMAKE_INSTALL}/bin:${PATH};
cmake --version
else
mkdir --parent ${CMAKE_SOURCE}
mkdir --parent ${CMAKE_INSTALL}
ls -A ${CMAKE_INSTALL}
travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_INSTALL}
export PATH=${CMAKE_INSTALL}/bin:${PATH};
cmake --version
fi

install:
# CUDA (only if needed)
Expand All @@ -109,23 +72,13 @@ install:
sudo apt-get install -y --no-install-recommends cuda-core-$CUDA_PKG_VERSION cuda-cudart-dev-$CUDA_PKG_VERSION cuda-cublas-dev-$CUDA_PKG_VERSION cuda-curand-dev-$CUDA_PKG_VERSION
sudo ln -s /usr/local/cuda-${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} /usr/local/cuda
fi
# OPENCV
- >
if [ ! "$(ls -A $OPENCV_INSTALL)" ]; then
cd $OPENCV_BUILD
cmake \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$OPENCV_INSTALL \
-DWITH_CUDA=OFF \
-DBUILD_opencv_ts=0 \
$OPENCV_SOURCE;
make -j 2 > null;
make install;
fi
- ./ci/install-cmake.sh
- ./ci/install-dependencies.sh

before_script:
- . ./ci/env.sh
- export CMAKE_PREFIX_PATH="${DEPS_INSTALL_PATH}"
- export CTEST_OUTPUT_ON_FAILURE=1
# patch tbb
# https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/431422
- sudo sed -i '345s/.*/\#if \(__GNUC__==4 \&\& __GNUC_MINOR__>=4 \&\& __GXX_EXPERIMENTAL_CXX0X__\) || __clang_major__ >= 3/' /usr/include/tbb/pipeline.h
Expand All @@ -140,7 +93,9 @@ before_script:
-DCMAKE_INSTALL_PREFIX:PATH=$CCTAG_INSTALL \
-DCCTAG_WITH_CUDA:BOOL=$CCTAG_WITH_CUDA \
-DCMAKE_BUILD_TYPE:BOOL=$BUILD_TYPE \
-DOpenCV_DIR:PATH=$OPENCV_INSTALL/share/OpenCV \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DOpenCV_DIR:PATH="${DEPS_INSTALL_PATH}/share/OpenCV" \
-DEIGEN_INCLUDE_DIR_HINTS="${DEPS_INSTALL_PATH}" \
. $CCTAG_SOURCE
script:
Expand All @@ -155,6 +110,7 @@ script:
- >
cmake -DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCCTag_DIR:PATH=/$CCTAG_INSTALL/lib/cmake/CCTag/ \
-DOpenCV_DIR:PATH=$OPENCV_INSTALL/share/OpenCV \
-DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install \
Expand All @@ -170,6 +126,7 @@ script:
cmake \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=$CCTAG_INSTALL_VARIANT \
-DCCTAG_WITH_CUDA:BOOL=$CCTAG_WITH_CUDA \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
Expand All @@ -190,7 +147,3 @@ before_cache:

cache:
ccache: true

directories:
- $OPENCV_INSTALL
- $CMAKE_INSTALL
36 changes: 19 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 3,4 is the first that supports separable compilation on Linux.
# Version 3,. is the first that supports separable compilation on Linux.
# Windows requires more work, and Mac is probably still hopeless.
cmake_minimum_required(VERSION 3.4)
# Version 3.14 is needed for boost-stacktrace
cmake_minimum_required(VERSION 3.14)

include(ExternalProject)

Expand All @@ -11,6 +12,7 @@ option(CCTAG_SERIALIZE "Store all the output" OFF)
option(CCTAG_VISUAL_DEBUG "Enable visual debug" OFF)
option(CCTAG_NO_COUT "Disable output stream" ON)
option(CCTAG_WITH_CUDA "Compile the library with CUDA support" ON)
option(BUILD_APPS "Build the sample applications" ON)

option(CCTAG_USE_POSITION_INDEPENDENT_CODE "Generate position independent code." ON)
option(CCTAG_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
Expand All @@ -27,6 +29,10 @@ if(CCTAG_ENABLE_SIMD_AVX2)
message(STATUS "CCTAG: AVX2 optimizations enabled.")
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_definitions(/EHsc) # Enable Exception Handling
endif()

# load local machine config <hostname>.cmake
site_name(MACHINE_NAME)

Expand Down Expand Up @@ -68,15 +74,21 @@ if(APPLE)
endif(APPLE)

# FIND BOOST
# TODO: determine minimal version and minimal components
set(BOOST_REQUIRED_COMPONENTS "date_time;chrono;thread;serialization;system;filesystem;atomic;program_options;timer")
set(BOOST_REQUIRED_COMPONENTS "atomic;chrono;date_time;filesystem;program_options;serialization;system;thread;timer")
if(WIN32)
set(BOOST_REQUIRED_COMPONENTS "${BOOST_REQUIRED_COMPONENTS};stacktrace_windbg")
else()
set(BOOST_REQUIRED_COMPONENTS "${BOOST_REQUIRED_COMPONENTS};stacktrace_basic")
endif()

if(BUILD_TESTS)
set(BOOST_REQUIRED_COMPONENTS "${BOOST_REQUIRED_COMPONENTS};unit_test_framework")
enable_testing()
include(BoostTestHelper)
endif()

find_package(Boost 1.53.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
find_package(Boost 1.66.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_COMPONENTS})


if(CCTAG_WITH_CUDA)
message( STATUS "Try finding CUDA" )
Expand Down Expand Up @@ -138,18 +150,6 @@ if(CCTAG_WITH_CUDA)
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode=arch=compute_52,code=sm_52;-gencode=arch=compute_52,code=compute_52;--default-stream;per-thread;-Xptxas;--warn-on-local-memory-usage;-Xptxas;--warn-on-spills")
cuda_find_library_local_first(CUDA_CUDADEVRT_LIBRARY cudadevrt "\"cudadevrt\" library")

# Boost >= 1.60.0 and CUDA != 7.5 failed when used with C++11
# seen with boost 1.60.0 - 1.62.0 (atm latest) and CUDA 7.0, 8.0 (atm latest)
# CUDA 7.5 works without a workaround
# from https://github.com/ComputationalRadiationPhysics/picongpu/pull/1603
if( (Boost_VERSION GREATER 105999) AND
(NOT CUDA_VERSION VERSION_EQUAL 7.5) AND
(NOT CMAKE_CXX_STANDARD EQUAL 98) )
# Boost Bug https://svn.boost.org/trac/boost/ticket/11897
message(STATUS "Boost: Disable template aliases")
add_definitions(-DBOOST_NO_CXX11_TEMPLATE_ALIASES)
endif()

else(CCTAG_WITH_CUDA)
message( STATUS "Building without CUDA" )
endif(CCTAG_WITH_CUDA)
Expand All @@ -161,6 +161,8 @@ find_package(OpenCV REQUIRED core videoio imgproc imgcodecs)
find_package(Eigen REQUIRED)

# FIND Intel TBB
# With MVSC, CMAKE_BUILD_TYPE will always be None, so TBB_USE_DEBUG_BUILD will always be false.
string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" Debug TBB_USE_DEBUG_BUILD)
find_package(TBB 4 REQUIRED)

add_subdirectory(src)
Expand Down
20 changes: 12 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@


Required tools:
* CMake >= 3.4 to build the code
* git
* CMake >= 3.14 to build the code
* Git
* C/C++ compiler (gcc >= 4.6 or visual studio or clang)
For CUDA
* CUDA 7.0 (CUDA 7.5 is currently not recommended (see Note 1))

Optional tool:
* CUDA >= 7.0 (CUDA 7.5 is currently not recommended (see Note 1))
Note: On Windows, there are compatibility issues to build the GPU part due to conflicts between msvc/nvcc/thrust/eigen/boost.

### Getting the sources:

```shell
$ git clone https://github.com/alicevision/CCTag.git
```
Expand All @@ -20,12 +23,13 @@ $ git clone https://github.com/alicevision/CCTag.git
Most of the dependencies can be installed from the common repositories (apt, yum etc):

- Eigen3 (libeigen3-dev)
- Boost >= 1.53 ([core, thread, system, filesystem, serialization, thread, exception, chrono, date-time, program-options, timer]-dev)
- Boost >= 1.66 ([accumulators, atomic, chrono, core, date-time, exception, filesystem, math, program-options, ptr-container, system, serialization, stacktrace, timer, thread]-dev)
- OpenCV >= 3.1
- TBB >= 4.0

On a recent Ubuntu-like distribution (e.g. 14.04), you may want to try to run:
```shell
$ sudo apt-get install g++ git-all libpng12-dev libjpeg-dev libeigen3-dev libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev libboost-dev libboost-program-options-dev libboost-exception-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev libboost-timer-dev
$ sudo apt-get install g++ git-all libpng12-dev libjpeg-dev libeigen3-dev libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev libboost-dev libboost-program-options-dev libboost-exception-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev libboost-timer-dev libtbb-dev
```

OpenCV need to be compiled separately and installed in some `OPENCV_INSTALL` path. Then, when running cmake you need to provide the path to the location where `OpenCVConfig.cmake` is installed, usually `${OPENCV_INSTALL}/share/share/OpenCV/` (see below).
Expand All @@ -41,7 +45,7 @@ You now just need to be in the CCTag folder and run cmake:
$ mkdir build && cd build
$ cmake .. -DOpenCV_DIR=${OPENCV_INSTALL}/share/share/OpenCV/
$ make -j `nproc`
```
```

If you want to install the library to, say, a CCTAG_INSTALL path, just add `-DCMAKE_INSTALL_PREFIX=$CCTAG_INSTALL` at cmake command line.
If you want to build CCTag as a shared library: `-DBUILD_SHARED_LIBS=ON`.
Expand All @@ -54,7 +58,7 @@ When you install CCTag a file `CCTagConfig.cmake` is installed in `$CCTAG_INSTAL
In your `CMakeLists.txt` file you can add the dependency in this way:

```cmake
# Find the package from the CCTagConfig.cmake
# Find the package from the CCTagConfig.cmake
# in <prefix>/lib/cmake/CCTag/. Under the namespace CCTag::
# it exposes the target CCTag that allows you to compile
# and link with the library
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Lilian Calvet (CPU, lilian.calvet@gmail.com)
Carsten Griwodz (GPU, griff@simula.no)
Stian Vrba (CPU, vrba@mixedrealities.no)
Cyril Pichard (pih@mikrosimage.eu)

Simone Gasparini (simone.gasparini@gmail.com)

Acknowledgments
---------
Expand Down
58 changes: 58 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: '1.0.{build}'

image: Visual Studio 2015

platform:
- x64

configuration:
- Release

install:
# - cmd: >-
# call cudaInstallAppveyor.cmd

- vcpkg upgrade --no-dry-run
- vcpkg list
- vcpkg install
boost-accumulators
boost-algorithm
boost-container
boost-date-time
boost-exception
boost-filesystem
boost-iterator
boost-lexical-cast
boost-math
boost-mpl
boost-multi-array
boost-ptr-container
boost-program-options
boost-serialization
boost-spirit
boost-static-assert
boost-test
boost-thread
boost-throw-exception
boost-timer
boost-type-traits
boost-unordered
opencv
tbb
eigen3
--triplet %PLATFORM%-windows
- vcpkg list

before_build:
- md build
- cd build
- cmake -G "Visual Studio 14 2015" -A x64 -T v140,host=x64 -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_APPS:BOOL=ON -DWITH_CUDA:BOOL=OFF -DCCTAG_SERIALIZE:BOOL=ON -DVISUAL_DEBUG:BOOL=ON ..
- ls -l

build:
verbosity: detailed
project: $(APPVEYOR_BUILD_FOLDER)\build\CCTag.sln
parallel: true

cache:
c:\tools\vcpkg\installed\

0 comments on commit 7768c18

Please sign in to comment.