Skip to content

Commit

Permalink
Merge pull request #155 from alicevision/dev/c++14
Browse files Browse the repository at this point in the history
Switch to c++14
  • Loading branch information
simogasp authored Apr 17, 2021
2 parents ba0daba + 533cef0 commit cad8271
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SpaceInEmptyParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: "c++11"
Standard: "c++14"
IncludeCategories:
- Regex: '^".*"'
Priority: 1
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.0.0] - YYYY-MM-DD

- Support for OpenCV 3.4.9 [PR](https://github.com/alicevision/CCTag/pull/121)
- Switch to C++14 standard [PR](https://github.com/alicevision/CCTag/pull/155)


## 2019
Expand Down
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ if(MSVC AND CMAKE_GENERATOR MATCHES "Ninja")
list(APPEND CUDA_NVCC_FLAGS -Xcompiler ${CCTAG_MVSC_LINKER})
endif()

set(CMAKE_CXX_STANDARD 11)
set(CCTAG_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD ${CCTAG_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD ${CCTAG_CXX_STANDARD})
set(CMAKE_CUDA_STANDARD_REQUIRED ON)


Expand All @@ -94,12 +95,6 @@ endif()
# set the path where we can find the findXXX.cmake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# -Wno-c++11-narrowing to solve "non-type template argument evaluates to -1" error in boost::gil
# -Wno-deprecated-register to avoid the noise of some older eigen versions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-extensions -Wno-c++11-narrowing -Wno-deprecated-register")
endif()

if(APPLE)

# avoid the cmake policy warning about @rpath in MacOSX
Expand Down Expand Up @@ -186,7 +181,7 @@ if(CCTAG_WITH_CUDA)
LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})

if(NOT MSVC)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-std=c++11")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-std=c++${CCTAG_CXX_STANDARD}")
endif()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;per-thread")

Expand All @@ -204,6 +199,12 @@ if(CCTAG_WITH_CUDA)
endif()
endif()

# This is needed on windows for the multi-threaded compilation, typically ninja and vcpkg
# it avoids the error C1041: cannot open program database, write to the same .PDB file because of concurrent access
if(MSVC)
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler" "-FS")
endif()

if(CCTAG_NVCC_WARNINGS)
list(APPEND CUDA_NVCC_FLAGS -Xptxas --warn-on-local-memory-usage)
list(APPEND CUDA_NVCC_FLAGS -Xptxas --warn-on-spills)
Expand Down
6 changes: 4 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
Required tools:
* CMake >= 3.14 to build the code
* Git
* C/C++ compiler (gcc >= 4.6 or visual studio or clang)
* C/C++ compiler with C++14 support
* see here: https://en.cppreference.com/w/cpp/compiler_support
* TLDR gcc >= 5, clang >= 3.4, msvc >= 2017

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

### Getting the sources:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ Running
-------

Once compiled, you might want to run the CCTag detection on a sample image:

```bash
$ build/src/detection -n 3 -i sample/01.png
```
For the library interface, see [ICCTag.hpp](src/cctag/ICCTag.hpp).

Documentation
-------------

The documentation can be found on the [Read the Docs page](https://cctag.readthedocs.io/en/doc-first/index.html)


License
-------

Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx/source/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ Required tools:

* CMake >= 3.14 to build the code
* Git
* C/C++ compiler supporting the C++11 standard (gcc >= 4.6 or visual studio or clang)
* C/C++ compiler supporting the C++14 standard (gcc >= 5, clang >= 3.4, msvc >= 2017)

Optional tool:

* CUDA >= 7.0 (CUDA 7.5 is currently not recommended)
* CUDA >= 9.0


.. note::
Expand Down
7 changes: 3 additions & 4 deletions src/applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# if this is used as a stand-alone project we need to tell whether to use PIC
Expand Down Expand Up @@ -62,10 +65,6 @@ else()
message(STATUS "TBB already there")
endif()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


set(CCTagRegression_cpp
./regression/main.cpp
./regression/TestLog.cpp
Expand Down

0 comments on commit cad8271

Please sign in to comment.