Skip to content

Commit

Permalink
Merge pull request #384 from cgogn/develop
Browse files Browse the repository at this point in the history
Merge Develop
  • Loading branch information
Lionel Untereiner authored Oct 10, 2024
2 parents 16109e3 + 75cf248 commit 078d4d7
Show file tree
Hide file tree
Showing 220 changed files with 7,823 additions and 3,748 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,21 @@ script:
- mkdir build
- cd build
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cmake ..
cmake ..
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=ON
-DCMAKE_CXX_COMPILER=g++-5
-DCMAKE_C_COMPILER=gcc-5
-DCGOGN_BUILD_TESTS:BOOL=ON
-DCGOGN_BUILD_EXAMPLES:BOOL=ON ;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cmake ..
cmake ..
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=ON
-DCMAKE_PREFIX_PATH:PATH=$(brew --prefix qt)
-DCGOGN_BUILD_TESTS:BOOL=ON
-DCGOGN_BUILD_EXAMPLES:BOOL=ON ;
fi
- make -j2
- make test
- sudo make install
- sudo make uninstall
25 changes: 23 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ project(CGoGN
foreach(p
CMP0048 # version
CMP0054 # CMake 3.1
CMP0072 # opengl
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()


#### Default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
Expand Down Expand Up @@ -55,7 +57,7 @@ endif()
option(CGOGN_EXTERNAL_TEMPLATES "Use external templates to reduce compile time" OFF)

### C++ 11/14/17
set(CGOGN_CPP_STD "11" CACHE STRING "The version of the c++ standard to use.")
set(CGOGN_CPP_STD "17" CACHE STRING "The version of the c++ standard to use.")
if (NOT MSVC)
set_property(CACHE CGOGN_CPP_STD PROPERTY STRINGS "11" "14" "17") # drop down list with cmake-gui
endif(NOT MSVC)
Expand All @@ -65,10 +67,15 @@ if (CGOGN_CPP_STD STREQUAL "11")
set(CMAKE_CXX_STANDARD 11)
elseif(CGOGN_CPP_STD STREQUAL "14")
set(CMAKE_CXX_STANDARD 14)
else(CGOGN_CPP_STD STREQUAL "11")
else(CGOGN_CPP_STD STREQUAL "17")
set(CMAKE_CXX_STANDARD 17)
endif(CGOGN_CPP_STD STREQUAL "11")

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(BUILD_SHARED_LIBS "Build a shared library" ON)

#### ThirdParty options
set(CGOGN_THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
option(CGOGN_BUILD_TESTS "Build cgogn unit tests using google test framework." OFF)
Expand Down Expand Up @@ -199,4 +206,18 @@ foreach(subdir ${CGOGN_CONFIGURED_MODULES})
endif()
endforeach()


# uninstall target
# see https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()


unset(CGOGN_SYSTEM_MODULE_PATH)
9 changes: 8 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ init:
- echo %GENERATOR%
- echo %QT_DIR%

cache: c:\tools\vcpkg\installed\

install:
- vcpkg remove --outdated --recurse
- vcpkg install --recurse
Expand All @@ -58,11 +60,16 @@ install:
tinyxml2
--triplet %arch%-windows

matrix:
allow_failures:
- image: Visual Studio 2015

build_script:
- md build
- cd build
- cmake --version
- cmake -Wno-dev -Wno-deprecated -G %GENERATOR% .. -DCMAKE_SUPPRESS_REGENERATION=1 %CMAKE_TOOLCHAIN_FILE% -DQt5_DIR=%QT_DIR% -DCGOGN_BUILD_TESTS=ON -DCGOGN_BUILD_EXAMPLES=ON
- cmake -Wno-dev -Wno-deprecated -G %GENERATOR% .. -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=ON -DCMAKE_SUPPRESS_REGENERATION=1 %CMAKE_TOOLCHAIN_FILE% -DQt5_DIR=%QT_DIR% -DCGOGN_BUILD_TESTS=ON -DCGOGN_BUILD_EXAMPLES=ON
- cmake --build . --config "%CONFIGURATION%" -- /verbosity:minimal
- cmake --build . --config "%CONFIGURATION%" --target RUN_TESTS -- /verbosity:minimal
- cmake --build . --config "%CONFIGURATION%" --target INSTALL -- /verbosity:minimal
- cmake --build . --config "%CONFIGURATION%" --target UNINSTALL -- /verbosity:minimal
33 changes: 22 additions & 11 deletions cgogn/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ project(cgogn_core
LANGUAGES CXX
)

# Hide symbols by default
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

add_library(${PROJECT_NAME} SHARED "")

add_library(${PROJECT_NAME} "")
add_library(cgogn::core ALIAS cgogn_core)

target_sources(${PROJECT_NAME}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/dll.h"
"${CMAKE_CURRENT_LIST_DIR}/basic/dart.h"
"${CMAKE_CURRENT_LIST_DIR}/basic/dart_marker.h"
"${CMAKE_CURRENT_LIST_DIR}/basic/cell.h"
Expand All @@ -22,7 +24,9 @@ target_sources(${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/cmap/map_base_data.cpp"
"${CMAKE_CURRENT_LIST_DIR}/cmap/map_base.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap0.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap0_builder.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap1.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap1_builder.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap2.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap2_builder.h"
"${CMAKE_CURRENT_LIST_DIR}/cmap/cmap3.h"
Expand All @@ -45,6 +49,7 @@ target_sources(${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/utils/assert.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/assert.cpp"
"${CMAKE_CURRENT_LIST_DIR}/utils/buffers.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/color_maps.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/definitions.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/endian.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/unique_ptr.h"
Expand Down Expand Up @@ -185,12 +190,10 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:_USE_MATH_DEFINES>
$<$<CXX_COMPILER_ID:MSVC>:CGOGN_WIN_VER=${WIN_VERSION}>)


if(CGOGN_USE_SIMD)
CGOGN_CHECK_FOR_SSE()
endif(CGOGN_USE_SIMD)


if(${CGOGN_USE_OPENMP})
if(OpenMP_FOUND OR OPENMP_FOUND OR OpenMP_CXX_FOUND)

Expand All @@ -210,8 +213,6 @@ if(${CGOGN_USE_OPENMP})
endif()
endif()



# Profiler compilation flags
if(CGOGN_WITH_GPROF)
message(STATUS "Building for code profiling")
Expand Down Expand Up @@ -250,17 +251,19 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
DEBUG_POSTFIX "_d"
EXPORT_NAME core)

target_compile_definitions(${PROJECT_NAME} PRIVATE "CGOGN_CORE_DLL_EXPORT")

target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CGOGN_SOURCE_DIR}>
$<BUILD_INTERFACE:${CGOGN_THIRDPARTY_TERMCOLOR_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cgogn/thirdparty>
)

# Write out cgogn_core_export.h to the current binary directory
generate_export_header(cgogn_core)

if(${CGOGN_EXTERNAL_TEMPLATES})
target_compile_definitions(${PROJECT_NAME} PUBLIC "CGOGN_USE_EXTERNAL_TEMPLATES")
endif()
Expand All @@ -275,16 +278,24 @@ else()
endif()

configure_file(${PROJECT_SOURCE_DIR}/cgogn_core.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cgogn_core.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cgogn_core.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cgogn_core.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT cgogn_core_libraries
)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cgogn/core
COMPONENT cgogn_core_headers
FILES_MATCHING PATTERN "*.h"
REGEX "(examples|tests)" EXCLUDE
)

cgogn_create_package("${CMAKE_CURRENT_SOURCE_DIR}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cgogn_core_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cgogn/core
COMPONENT cgogn_core_headers
)

cgogn_create_package("${CMAKE_CURRENT_SOURCE_DIR}")

# VisualStudio nice source organisation
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER cgogn)
17 changes: 13 additions & 4 deletions cgogn/core/basic/dart.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ struct Dart
*/
inline bool operator!=(Dart rhs) const { return index != rhs.index; }

// To remove
// operator < is needed if we want to use std::set<Dart>
// inline bool operator<(Dart rhs) const { return index < rhs.index; }

/**
* \brief Prints a dart to a stream.
* \param[out] out the stream to print on
Expand Down Expand Up @@ -140,6 +136,19 @@ struct Dart
}
};


} // namespace cgogn

// hash function to use with the std (i.e unordered set)
namespace std {
template <>
struct hash<cgogn::Dart>
{
size_t operator()(const cgogn::Dart& x) const
{
return std::hash<cgogn::numerics::uint32>()(x.index);
}
};
}

#endif // CGOGN_CORE_BASIC_DART_H_
22 changes: 12 additions & 10 deletions cgogn/core/cmap/cmap0.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#define CGOGN_CORE_CMAP_CMAP0_H_

#include <cgogn/core/cmap/map_base.h>
#include <cgogn/core/cmap/cmap0_builder.h>

namespace cgogn
{

template <typename MAP2>
class CMap0Builder_T;

template <typename MAP_TYPE>
class CMap0_T : public MapBase<MAP_TYPE>
{
Expand Down Expand Up @@ -178,7 +180,7 @@ class CMap0_T : public MapBase<MAP_TYPE>
template <Orbit ORBIT, typename FUNC>
inline void foreach_dart_of_orbit(Cell<ORBIT> c, const FUNC& f) const
{
static_assert(ORBIT == Orbit::DART, "Orbit not supported in a CMap0");
//static_assert(ORBIT == Orbit::DART, "Orbit not supported in a CMap0");
f(c.dart);
}

Expand Down Expand Up @@ -219,14 +221,14 @@ struct CMap0Type
using CMap0 = CMap0_T<CMap0Type>;

#if defined(CGOGN_USE_EXTERNAL_TEMPLATES) && (!defined(CGOGN_CORE_EXTERNAL_TEMPLATES_CPP_))
extern template class CGOGN_CORE_API CMap0_T<CMap0Type>;
extern template class CGOGN_CORE_API DartMarker<CMap0>;
extern template class CGOGN_CORE_API DartMarkerStore<CMap0>;
extern template class CGOGN_CORE_API DartMarkerNoUnmark<CMap0>;
extern template class CGOGN_CORE_API CellMarker<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_API CellMarkerNoUnmark<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_API CellMarkerStore<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_API QuickTraversor<CMap0>;
extern template class CGOGN_CORE_EXPORT CMap0_T<CMap0Type>;
extern template class CGOGN_CORE_EXPORT DartMarker<CMap0>;
extern template class CGOGN_CORE_EXPORT DartMarkerStore<CMap0>;
extern template class CGOGN_CORE_EXPORT DartMarkerNoUnmark<CMap0>;
extern template class CGOGN_CORE_EXPORT CellMarker<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_EXPORT CellMarkerNoUnmark<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_EXPORT CellMarkerStore<CMap0, CMap0::Vertex::ORBIT>;
extern template class CGOGN_CORE_EXPORT QuickTraversor<CMap0>;
#endif // defined(CGOGN_USE_EXTERNAL_TEMPLATES) && (!defined(CGOGN_CORE_EXTERNAL_TEMPLATES_CPP_))

} // namespace cgogn
Expand Down
1 change: 1 addition & 0 deletions cgogn/core/cmap/cmap0_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define CGOGN_CORE_CMAP_CMAP0_BUILDER_H_

#include <cgogn/core/cmap/map_base.h>
#include <cgogn/core/cmap/cmap0.h>

namespace cgogn
{
Expand Down
Loading

0 comments on commit 078d4d7

Please sign in to comment.