Skip to content

Commit

Permalink
Sync with 31b6b34
Browse files Browse the repository at this point in the history
  • Loading branch information
HasKha committed Jun 1, 2021
1 parent b24c2f4 commit 8ed20cd
Show file tree
Hide file tree
Showing 309 changed files with 20,179 additions and 20,572 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/LagrangeOptions.cmake)
endif()

################################################################################
project(Lagrange VERSION 4.3.0)
project(Lagrange VERSION 5.0.0)

# Detects whether internal libs are available
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/recipes/internal")
Expand Down
11 changes: 6 additions & 5 deletions cmake/lagrange/lagrange_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ function(lagrange_add_test)
# Create test executable
file(GLOB_RECURSE SRC_FILES "*.cpp" "*.h")
include(lagrange_add_executable)
lagrange_add_executable(test_${module_name} ${SRC_FILES})
set_target_properties(test_${module_name} PROPERTIES FOLDER "Lagrange//Tests")
set(test_target "test_lagrange_${module_name}")
lagrange_add_executable(${test_target} ${SRC_FILES})
set_target_properties(${test_target} PROPERTIES FOLDER "Lagrange//Tests")

# Dependencies
lagrange_include_modules(testing)
target_link_libraries(test_${module_name} PUBLIC
target_link_libraries(${test_target} PUBLIC
lagrange::${module_name}
lagrange::testing
)

# Output directory
set_target_properties(test_${module_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
set_target_properties(${test_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")

# Register tests
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/reports")
catch_discover_tests(test_${module_name}
catch_discover_tests(${test_target}
REPORTER junit
OUTPUT_DIR "${CMAKE_BINARY_DIR}/reports"
OUTPUT_SUFFIX ".xml"
Expand Down
3 changes: 2 additions & 1 deletion cmake/recipes/external/assimp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include(FetchContent)
FetchContent_Declare(
assimp
GIT_REPOSITORY https://github.com/assimp/assimp.git
GIT_TAG 63f1b66224a02bf1aca76d06d420a8c8113e9b44
GIT_TAG 40f9d37a38209f0dbd10b71361bc905d314f10a7
)

option(BUILD_SHARED_LIBS "Build package with shared libraries." OFF)
Expand All @@ -34,6 +34,7 @@ option(ASSIMP_BUILD_TESTS "If the test suite for Assimp is built in addition to
option(ASSIMP_INSTALL "Disable this if you want to use assimp as a submodule." OFF)
option(ASSIMP_INSTALL_PBD "" OFF)
option(ASSIMP_INJECT_DEBUG_POSTFIX "Inject debug postfix in .a/.so/.dll lib names" OFF)
option(ASSIMP_BUILD_PBRT_EXPORTER "Build Assimp with PBRT importer" OFF)

# Use a CACHE variable to prevent Assimp from building with its embedded clipper
set(Clipper_SRCS "" CACHE STRING "" FORCE)
Expand Down
10 changes: 8 additions & 2 deletions cmake/recipes/external/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include(FetchContent)
FetchContent_Declare(
boost-cmake
GIT_REPOSITORY https://github.com/Orphis/boost-cmake.git
GIT_TAG 70b12f62da331dd402b78102ec8f6a15d59a7af9
GIT_TAG 7f97a08b64bd5d2e53e932ddf80c40544cf45edf
)

set(PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
Expand All @@ -28,7 +28,13 @@ set(OLD_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# This guy will download boost using FetchContent
FetchContent_MakeAvailable(boost-cmake)
FetchContent_GetProperties(boost-cmake)
if(NOT boost-cmake_POPULATED)
FetchContent_Populate(boost-cmake)
# File lcid.cpp from Boost_locale.cpp doesn't compile on MSVC, so we exclude them from the default
# targets being built by the project (only targets explicitly used by other targets will be built).
add_subdirectory(${boost-cmake_SOURCE_DIR} ${boost-cmake_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ${OLD_CMAKE_POSITION_INDEPENDENT_CODE})
set(CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
26 changes: 26 additions & 0 deletions cmake/recipes/external/entt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# 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 EnTT::EnTT)
return()
endif()

message(STATUS "Third-party (external): creating target 'EnTT::EnTT'")

include(FetchContent)
FetchContent_Declare(
entt
GIT_REPOSITORY https://github.com/skypjack/entt.git
GIT_TAG v3.6.0
)

FetchContent_MakeAvailable(entt)
2 changes: 1 addition & 1 deletion cmake/recipes/external/gl3w.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(TARGET gl3w::gl3w)
return()
endif()

message(STATUS "Third-party (internal): creating target 'gl3w::gl3w'")
message(STATUS "Third-party (external): creating target 'gl3w::gl3w'")

include(FetchContent)
FetchContent_Declare(
Expand Down
46 changes: 4 additions & 42 deletions cmake/recipes/external/imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,57 +23,19 @@ if(TARGET imgui::imgui)
return()
endif()

include(glfw)
include(gl3w)

message(STATUS "Third-party (external): creating target 'imgui::imgui' ('docking' branch)")

include(FetchContent)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/adobe/imgui.git
GIT_TAG ee9ae8bae5a453749baea58f65e275f438cfb6e2
GIT_TAG 3f1593b28346da2ad34edbab9432b93deb305f42
)
FetchContent_MakeAvailable(imgui)

add_library(imgui
"${imgui_SOURCE_DIR}/imgui.h"
"${imgui_SOURCE_DIR}/imgui_internal.h"
"${imgui_SOURCE_DIR}/imgui.cpp"
"${imgui_SOURCE_DIR}/imgui_demo.cpp"
"${imgui_SOURCE_DIR}/imgui_draw.cpp"
"${imgui_SOURCE_DIR}/imgui_widgets.cpp"
"${imgui_SOURCE_DIR}/imgui_spectrum.h"
"${imgui_SOURCE_DIR}/imgui_spectrum.cpp"
"${imgui_SOURCE_DIR}/imgui_tables.cpp"
"${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h"
"${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp"
"${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h"
"${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp"
"${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.h"
"${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp"
)
add_library(imgui::imgui ALIAS imgui)


# Dark theme option
option(IMGUI_USE_DARK_THEME "Use Dark ImGui Spectrum Theme" OFF)
if(IMGUI_USE_DARK_THEME)
target_compile_definitions(imgui PUBLIC SPECTRUM_USE_DARK_THEME)
endif()

target_compile_definitions(imgui PUBLIC
IMGUI_IMPL_OPENGL_LOADER_GL3W=1

IMGUI_DISABLE_OBSOLETE_FUNCTIONS # to check for obsolete functions

# IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/path/to/imconfig.h" # to use your own imconfig.h
)


target_include_directories(imgui PUBLIC "${imgui_SOURCE_DIR}")

include(glfw)
include(gl3w)
target_link_libraries(imgui PUBLIC glfw::glfw gl3w::gl3w)

set_target_properties(imgui PROPERTIES FOLDER third_party)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Expand Down
2 changes: 1 addition & 1 deletion cmake/recipes/external/lagrange-assets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(FetchContent)
FetchContent_Declare(
lagrange-assets
GIT_REPOSITORY https://github.com/adobe/lagrange-assets.git
GIT_TAG ffd7bf726ac08921948d9e8495eda8d03e381c9d
GIT_TAG f3407b0eb8266111c720b28577050e9a8f7901a5
)
message(STATUS "Lagrange: creating target 'lagrange::assets'")
FetchContent_MakeAvailable(lagrange-assets)
Expand Down
42 changes: 39 additions & 3 deletions cmake/recipes/external/openvdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,42 @@ set(OPENVDB_SIMD AVX CACHE STRING "")
# - https://gitlab.kitware.com/cmake/cmake/issues/17735
# - https://crascit.com/2018/09/14/do-not-redefine-cmake-commands/
function(openvdb_import_target)
macro(push_variable var value)
if(DEFINED CACHE{${var}})
set(OPENVDB_OLD_${var}_VALUE "${${var}}")
set(OPENVDB_OLD_${var}_TYPE CACHE_TYPE)
elseif(DEFINED ${var})
set(OPENVDB_OLD_${var}_VALUE "${${var}}")
set(OPENVDB_OLD_${var}_TYPE NORMAL_TYPE)
else()
set(OPENVDB_OLD_${var}_TYPE NONE_TYPE)
endif()
set(${var} "${value}" CACHE PATH "" FORCE)
endmacro()

macro(pop_variable var)
if(OPENVDB_OLD_${var}_TYPE STREQUAL CACHE_TYPE)
set(${var} "${OPENVDB_OLD_${var}_VALUE}" CACHE PATH "" FORCE)
elseif(OPENVDB_OLD_${var}_TYPE STREQUAL NORMAL_TYPE)
unset(${var} CACHE)
set(${var} "${OPENVDB_OLD_${var}_VALUE}")
elseif(OPENVDB_OLD_${var}_TYPE STREQUAL NONE_TYPE)
unset(${var} CACHE)
else()
message(FATAL_ERROR "Trying to pop a variable that has not been pushed: ${var}")
endif()
endmacro()

macro(ignore_package NAME)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${NAME}Config.cmake "")
set(${NAME}_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NAME} CACHE PATH "")
set(${NAME}_ROOT ${CMAKE_CURRENT_BINARY_DIR}/${NAME} CACHE PATH "")
set(OPENVDB_DUMMY_DIR "${CMAKE_CURRENT_BINARY_DIR}/openvdb_cmake/${NAME}")
file(WRITE ${OPENVDB_DUMMY_DIR}/${NAME}Config.cmake "")
push_variable(${NAME}_DIR ${OPENVDB_DUMMY_DIR})
push_variable(${NAME}_ROOT ${OPENVDB_DUMMY_DIR})
endmacro()

macro(unignore_package NAME)
pop_variable(${NAME}_DIR)
pop_variable(${NAME}_ROOT)
endmacro()

# Prefer Config mode before Module mode to prevent embree from loading its own FindTBB.cmake
Expand All @@ -82,6 +114,10 @@ function(openvdb_import_target)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/openvdb ${openvdb_BINARY_DIR})
endif()

unignore_package(TBB)
unignore_package(Boost)
unignore_package(IlmBase)

# Forward ALIAS target for openvdb
get_target_property(_aliased openvdb ALIASED_TARGET)
if(_aliased)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_include_directories(lagrange_core PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

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
Loading

0 comments on commit 8ed20cd

Please sign in to comment.