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

Build improvements #1317

Merged
merged 1 commit into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ cmake_minimum_required (VERSION 3.22)

project (yocto_gl VERSION 4.0)

option(YOCTO_OPENGL "Build OpenGL apps" ON)
option(YOCTO_DENOISE "Build denoise app based on Intel OIDN" OFF)
option(YOCTO_EMBREE "Use Intel's Embree raytracer" OFF)
option(YOCTO_TESTING "Enable testing" ON)
option(YOCTO_APPS "Build apps" ON)
option(YOCTO_OPENGL "Enable OpenGL" ON)
option(YOCTO_DENOISE "Enable denoising with Intel's OIDN" OFF)
option(YOCTO_EMBREE "Enable ray casting with Intel's Embree" OFF)
option(YOCTO_TESTING "Enable testing" OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand All @@ -28,4 +29,6 @@ endif(GENERATOR_IS_MULTI_CONFIG)

add_subdirectory(exts)
add_subdirectory(libs)
add_subdirectory(apps)
if(YOCTO_APPS)
add_subdirectory(apps)
endif(YOCTO_APPS)
4 changes: 4 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"YOCTO_APPS": "ON",
"YOCTO_EMBREE": "ON",
"YOCTO_DENOISE": "ON",
"YOCTO_OPENGL": "ON"
Expand All @@ -29,6 +30,7 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"YOCTO_APPS": "ON",
"YOCTO_EMBREE": "ON",
"YOCTO_DENOISE": "ON",
"YOCTO_OPENGL": "ON"
Expand All @@ -45,6 +47,7 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"YOCTO_APPS": "ON",
"YOCTO_EMBREE": "OFF",
"YOCTO_DENOISE": "OFF",
"YOCTO_OPENGL": "ON"
Expand All @@ -61,6 +64,7 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"YOCTO_APPS": "ON",
"YOCTO_EMBREE": "OFF",
"YOCTO_DENOISE": "OFF",
"YOCTO_OPENGL": "ON"
Expand Down
1 change: 1 addition & 0 deletions libs/yocto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ add_library(yocto STATIC

set_target_properties(yocto PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES)
target_include_directories(yocto PRIVATE ext/)
target_include_directories(yocto PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")

if(UNIX AND NOT APPLE)
find_package(Threads REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions libs/yocto/yocto_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ pair<bool, vec2f> point_in_triangle(const vector<vec3i>& triangles,
if (d == 0) return {false, zero2f};

b[2] = (d00 * d21 - d01 * d20) / d;
assert(!isnan(b[2]));
assert(!std::isnan(b[2]));
b[1] = (d11 * d20 - d01 * d21) / d;
assert(!isnan(b[1]));
assert(!std::isnan(b[1]));
b[0] = 1 - b[1] - b[2];
assert(!isnan(b[0]));
assert(!std::isnan(b[0]));

for (auto i = 0; i < 3; ++i) {
if (b[i] < -tol || b[i] > 1.0 + tol) return {false, zero2f};
Expand Down