Skip to content

Commit

Permalink
Sync with 13e162a
Browse files Browse the repository at this point in the history
  • Loading branch information
jdumas committed Apr 6, 2022
1 parent 5e5a93d commit 3592739
Show file tree
Hide file tree
Showing 58 changed files with 13,438 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ __pycache__
/.vs
/.idea
/.clangd
/.cache
/3rdparty
/cmake-build-*
/build*
Expand All @@ -62,3 +63,6 @@ LagrangeOptions.cmake

# CMake user presets
/CMakeUserPresets.json

# clangd
compile_commands.json
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if(LAGRANGE_WITH_CCACHE AND CCACHE_PROGRAM)
endif()

################################################################################
project(Lagrange VERSION 5.9.0)
project(Lagrange VERSION 6.0.0)

# Detects whether internal libs are available
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/recipes/internal")
Expand Down Expand Up @@ -124,6 +124,9 @@ option(LAGRANGE_EXTERNAL_ONLY "Third-party libs: only download from public m
# Artifactory key file
set(LAGRANGE_ARTIFACTORY_KEYFILE "" CACHE FILEPATH "Path to secret artifactory key.")

# Website repository (extract & check code)
set(LAGRANGE_WEBSITE_REPO "" CACHE FILEPATH "Path to the website repository for markdown code extraction")

# Set default minimum C++ standard
if(LAGRANGE_TOPLEVEL_PROJECT)
set(CMAKE_CXX_STANDARD 14)
Expand Down Expand Up @@ -230,6 +233,11 @@ if(LAGRANGE_DOCUMENTATION)
add_subdirectory(docs)
endif()

# Build code extracted from markdown documentation
if(LAGRANGE_WEBSITE_REPO)
add_subdirectory(docs/code)
endif()

# Copy shared dependencies for executables created by Lagrange. Clients using Lagrange as a subfolder must use their
# own mechanism to copy shared dlls into their executable folder. One possibility is to register their executable using
# `lagrange_add_executable`, and install dependencies by calling `lagrange_copy_all_runtime_dependencies` at the end of
Expand Down
16 changes: 16 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ This codebase contains a modified portion of code from Floating-point exception
Revised: 22-Sep-09
Revised: 30-Sep-09 (comment typo)

-------------------------------------------------------------------------------
This codebase contains a modified portion of code from function_ref which can be obtained at:
* SOURCE:
* https://github.com/TartanLlama/function_ref

* LICENSE:
* https://github.com/TartanLlama/function_ref/blob/master/COPYING

-------------------------------------------------------------------------------
This codebase contains a modified portion of code from Geogram which can be obtained at:
* SOURCE:
Expand Down Expand Up @@ -128,3 +136,11 @@ This codebase contains a modified portion of code from Shewchuk's predicates whi
This file, the paper listed above, and other information are available
from the Web page http://www.cs.cmu.edu/~quake/robust.html.

-------------------------------------------------------------------------------
This codebase contains a modified portion of code from valuable which can be obtained at:
* SOURCE:
* https://github.com/LoopPerfect/valuable

* LICENSE:
* https://github.com/LoopPerfect/valuable/blob/master/LICENSE

20 changes: 16 additions & 4 deletions cmake/lagrange/lagrange_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# https://docs.microsoft.com/en-us/previous-versions/thxezb7y(v=vs.140)
"/W3"

# disabling "Unknown pragma" warnings
"/wd4068"
"/wd4068" # disable: "Unknown pragma" warnings
"/wd26812" # disable: Prefer 'enum class' over 'enum'
"/wd26439" # disable: This kind of function may not throw (issues with Catch2)

# Adding /bigobj. This is currently required to build Lagrange on
# windows with debug info.
Expand Down Expand Up @@ -127,7 +128,6 @@ else()
-Wlogical-op
-Wnoexcept
-Woverloaded-virtual
-Wundef
-Wnoexcept-type

-Wnon-virtual-dtor
Expand All @@ -152,7 +152,11 @@ else()
# Enabled by -Weverything #
###########################

-Wdocumentation
# Useless until the following false positives are fixed:
# https://github.com/llvm/llvm-project/issues/34492
# https://github.com/llvm/llvm-project/issues/52977
# -Wdocumentation

-Wdocumentation-pedantic
-Wdocumentation-html
-Wdocumentation-deprecated-sync
Expand Down Expand Up @@ -187,6 +191,14 @@ else()
-Wundeclared-selector
-Wunreachable-code
)

if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND options
# GCC pragma currently cannot silence -Wundef via #pragma, so we only enable this warning for clang
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
-Wundef
)
endif()
endif()

lagrange_filter_flags(options)
Expand Down
31 changes: 31 additions & 0 deletions cmake/recipes/external/span-lite.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright 2021 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
#
if(TARGET nonstd::span-lite)
return()
endif()

message(STATUS "Third-party (external): creating target 'nonstd::span-lite'")

include(FetchContent)
FetchContent_Declare(
span-lite
GIT_REPOSITORY https://github.com/martinmoene/span-lite.git
GIT_TAG 1d79b2325f176979aea526fb76a3692e011049a5
)
FetchContent_MakeAvailable(span-lite)

set_target_properties(span-lite PROPERTIES FOLDER third_party)

# On Windows, enable natvis files to improve debugging experience
if(WIN32)
target_sources(span-lite INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/span-lite.natvis>)
endif()
17 changes: 17 additions & 0 deletions cmake/recipes/external/span-lite.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

<Type Name="nonstd::span_lite::span&lt;*,*&gt;">
<DisplayString Condition="size_ == 0">empty</DisplayString>
<DisplayString Condition="size_ != 0">[{size_}] (span)</DisplayString>
<Expand>
<Item Name="[size]">size_</Item>
<ArrayItems>
<Size>size_</Size>
<ValuePointer>data_</ValuePointer>
</ArrayItems>
</Expand>
</Type>

</AutoVisualizer>
12 changes: 8 additions & 4 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2166,15 +2166,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2206,7 +2206,9 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = \
LA_IGNORE_DOCUMENTATION_WARNING_BEGIN="" \
LA_IGNORE_DOCUMENTATION_WARNING_END="" \

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand All @@ -2215,7 +2217,9 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = \
LA_IGNORE_DOCUMENTATION_WARNING_BEGIN \
LA_IGNORE_DOCUMENTATION_WARNING_END

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
41 changes: 41 additions & 0 deletions docs/code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Find console script for code extraction
find_program(CODE_EXTRACT_PATH NAMES code-extract)

if(NOT CODE_EXTRACT_PATH)
message(WARNING "Could not find code-extract script. Please make sure it is installed via conda/pip.")
return()
endif()

message(STATUS "Code extract: ${CODE_EXTRACT_PATH}")

# Custom target for code extraction
set(extracted_code_dir "${CMAKE_CURRENT_BINARY_DIR}/extracted_code")
file(MAKE_DIRECTORY "${extracted_code_dir}")

add_custom_target(lagrange_extract_code_script
COMMAND ${CODE_EXTRACT_PATH}
${LAGRANGE_WEBSITE_REPO}
${extracted_code_dir}
)
set_target_properties(lagrange_extract_code_script PROPERTIES FOLDER "${LAGRANGE_IDE_PREFIX}Lagrange/Utils")

# Additionally execute this process at CMake time so we can capture the list of extracted files (very hacky approach)
execute_process(COMMAND ${CODE_EXTRACT_PATH} ${LAGRANGE_WEBSITE_REPO} ${extracted_code_dir})

# New target to compile extracted code
file(GLOB_RECURSE SRC_FILES "${extracted_code_dir}/*.cpp")
source_group(TREE "${extracted_code_dir}/" PREFIX "Source Files" FILES ${SRC_FILES})
add_library(lagrange_extracted_code ${SRC_FILES})

# Dependencies. For now we only enable the core module. But once we cover more files on the website
# we will have to include additional modules.
lagrange_include_modules(core)
# lagrange_include_modules(autouv core primitive raycasting ui)
target_link_libraries(lagrange_extracted_code PRIVATE
lagrange::core
# lagrange::autouv
# lagrange::primitive
# lagrange::raycasting
# lagrange::ui
)
add_dependencies(lagrange_extracted_code lagrange_extract_code_script)
6 changes: 4 additions & 2 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# 1. define module
lagrange_add_module()
target_compile_features(lagrange_core PUBLIC cxx_std_14)
target_compile_features(lagrange_core PUBLIC cxx_std_17)

set_target_properties(lagrange_core PROPERTIES POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -50,12 +50,14 @@ endif()
# 2. dependencies
include(eigen)
include(libigl)
include(span-lite)
include(spdlog)
include(tbb)
target_link_libraries(lagrange_core PUBLIC
lagrange::warnings
Eigen3::Eigen
igl::core
lagrange::warnings
nonstd::span-lite
spdlog::spdlog
TBB::tbb
)
Expand Down
5 changes: 3 additions & 2 deletions modules/core/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Core Module
@namespace lagrange
@brief Main namespace for Lagrange.

@defgroup core
@defgroup module-core Core Module
@brief Core module for Lagrange.

### Quick links

- [Mesh](@ref lagrange::Mesh)
- [SurfaceMesh](@ref group-surfacemesh)
- [Mesh](@ref lagrange::Mesh) [deprecated]
Loading

0 comments on commit 3592739

Please sign in to comment.