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

Windows build #78

Merged
merged 72 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
7642122
[cmake] add NOMINMAX flag for windows build
simogasp Jun 9, 2018
990f6a9
[utils] update pcg to a recent version MSVC compliant
simogasp Jun 9, 2018
59d32b3
[cctag] unused includes
simogasp Jun 9, 2018
79d621d
[utils] new definition for ssize_t
simogasp Jun 9, 2018
1769949
[cctag] fix float for hardcoded values
simogasp Jun 9, 2018
06746b3
[utils] win does not support "not"
simogasp Jun 9, 2018
4d0b39c
[c++] variable size array not standard (only gcc/clang?)
simogasp Jun 9, 2018
b7c711b
[cctag] use boost for M_PI
simogasp Jun 9, 2018
c56da4c
[cctag] std::numeric_limits<float>::max() instead of arbitrary value
simogasp Jun 9, 2018
36ee94f
[cctag] type coherence
simogasp Jun 9, 2018
68cb46b
[cctag] using std c++ exceptions
simogasp Jun 9, 2018
22ed609
[cctag] casting
simogasp Jun 9, 2018
260595b
[utils] missing return statement
simogasp Jun 9, 2018
750f77a
[cctag] using boost filesystem instead of posix to create directories
simogasp Jun 9, 2018
5a38092
[cctag] using struct for params, they were mixed between hpp and cpp
simogasp Jun 9, 2018
fb796ec
[applications] using string() instead of native()
simogasp Jun 9, 2018
7f97e00
[applications] CmdLine using boost instead gnu getopt
simogasp Jun 9, 2018
444cf20
[cmake] add option to build the application
simogasp Jun 9, 2018
3a54fc7
[ci] test build on appveyor
simogasp Jun 9, 2018
41c9ff1
[doc] update dependencies
simogasp Jun 10, 2018
2804564
[applications] missing return
simogasp Jun 10, 2018
c51fc04
[cmake] pthread and dl only for *nix
simogasp Jun 10, 2018
cbaa9fb
[cuda] "not" is not supported
simogasp Jun 10, 2018
cc49a54
[cuda] removed unused *nix header
simogasp Jun 10, 2018
f16c560
fixup! [cmake] pthread and dl only for *nix
simogasp Jun 10, 2018
09f59c3
[cctag] better refactoring
simogasp Jun 10, 2018
24de6a2
[ci] enable apps on windows
simogasp Jun 10, 2018
1c43ccb
[ci] test boost on vcpkg
simogasp Jun 15, 2018
a168b06
Merge branch 'develop' into devWindozeFixes
fabiencastan Oct 6, 2018
e1d58cd
Merge remote-tracking branch 'origin/develop' into devWindozeFixes
yann-lty May 15, 2019
04e0fd8
minor syntax fix: remove "not" keyword
fabiencastan May 15, 2019
3069ab8
ssize_t compatibility with MSVC
fabiencastan May 15, 2019
4295529
Replace boost thread by std thread
fabiencastan May 15, 2019
c934a11
Compatibility: use std::rand
fabiencastan May 15, 2019
086d9a5
minor includes clean
fabiencastan May 15, 2019
560850d
[windows] new cctag_cuda_runtime.h header to set define for compatibi…
fabiencastan May 19, 2019
32c094f
[windows] workaround for MSVC compatibility
fabiencastan May 19, 2019
d1e18a2
[utils] replace custom code for backtrace with boost::stacktrace
fabiencastan May 19, 2019
0efae48
[cmake] workaround for TBB build error on windows
fabiencastan May 19, 2019
e4b3b88
[travis] update cmake version to 3.14.4
fabiencastan May 19, 2019
30d09fc
[cuda] always use cctag_cuda_runtime.h
fabiencastan Jul 2, 2019
9f31170
[cuda] define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS on linux
fabiencastan Jul 2, 2019
02b0fc1
[cctag] minor include fixes
fabiencastan Jul 2, 2019
48ff995
[cmake] change boost::stacktrace link on linux
fabiencastan Jul 2, 2019
60588ca
[travis] update dependencies versions
fabiencastan Jul 2, 2019
a224fe8
[travis] use boost 1.70
fabiencastan Jul 3, 2019
4f4005c
[travis] enable build_shared_libs
fabiencastan Jul 3, 2019
b1c940e
Update deprecated boost include
fabiencastan Jul 3, 2019
e631622
[cmake] same check for boost in top level and app folder
fabiencastan Jul 3, 2019
b2b8b1a
[travis] build lib without apps first
fabiencastan Jul 3, 2019
8525049
[cmake] fix minimum cmake version
fabiencastan Jul 3, 2019
ae285e9
[cmake] print boost variables
fabiencastan Jul 3, 2019
f6a5621
[build] replace usage of "not" keyword for windows compatibility
fabiencastan Jul 3, 2019
6f653cd
[build] windows compatibility: use VirtualLock as an equivalent to mlock
fabiencastan Jul 3, 2019
88697d6
[cmake] Boost 1.70 compatibility workaround
fabiencastan Jul 4, 2019
2aa76ed
[doc] fix merge error in INSTALL.md
fabiencastan Jul 4, 2019
3b8fea2
[travis] add CTEST_OUTPUT_ON_FAILURE
fabiencastan Jul 4, 2019
237727d
[cmake] use boost TARGETS
fabiencastan Jul 4, 2019
57033b7
[cmake] only use boost TARGETS
fabiencastan Jul 4, 2019
d2a34cc
[cmake] remove undefined boost targets
fabiencastan Jul 4, 2019
0331bec
[cmake] use only boost TARGETS
fabiencastan Jul 4, 2019
0e9e8ed
[test] disable test_throw_repeated_points for now
fabiencastan Jul 4, 2019
eb9f8c8
[cmake] fix boost targets in applications
fabiencastan Jul 4, 2019
b9dce30
[cmake] fix USE_DEVIL define
fabiencastan Jul 5, 2019
a480b9a
Replace deprecated boost::timer
fabiencastan Jul 5, 2019
93dc0eb
[cmake] add missing dep
fabiencastan Jul 5, 2019
8fbd8bf
[travis] check build of applications in the global context
fabiencastan Jul 6, 2019
b9106c5
[doc] Update INSTALL.md requirements
fabiencastan Jul 6, 2019
2b8a942
[doc] Readme: add Simone Gasparini to authors list
fabiencastan Jul 11, 2019
678dded
[doc] Update INSTALL.md: Cuda is optional and GPU part is problematic…
fabiencastan Jul 11, 2019
ee16bc5
Use throw instead of BOOST_THROW_EXCEPTION
fabiencastan Jul 11, 2019
cdd97d2
[cmake] enable exception handling on windows
fabiencastan Jul 11, 2019
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
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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.14 is overkilling, 3.5 is the first one with Boost:boost targets


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\