Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
94f438f
WIP: Transcoder build/install test.
tomfinegan Feb 17, 2022
1c6bc2b
Add missing include to sources list to ensure it is installed.
tomfinegan Feb 25, 2022
619c552
Update the install check program to use sources that require transcod…
tomfinegan Feb 25, 2022
ebc70d2
Add install testing for transcoder enabled builds.
tomfinegan Feb 25, 2022
07c5a1d
Add transcoder enabled tests to ci.yml.
tomfinegan Feb 25, 2022
610dd88
Add version check before blind usage of dirs_exist_ok with shutil.cop…
tomfinegan Feb 25, 2022
a774e80
Fix compile for light.cc on Windows.
tomfinegan Feb 25, 2022
e790292
Move _USE_MATH_DEFINES to light.h: vector_d.h includes it as well, so…
tomfinegan Feb 25, 2022
59d3879
cmath -> math.h, and _USE_MATH_DEFINES back to light.cc because MSVC …
tomfinegan Feb 25, 2022
730e7f6
Add _USE_MATH_DEFINES to gltf_decoder_test and light_test.
tomfinegan Feb 25, 2022
cb1ca9e
Drop /Ox from the MSVC build.
tomfinegan Feb 25, 2022
84164c2
Revert change to opt level.
tomfinegan Feb 25, 2022
44b3961
Disable the transcoder-enabled tests for Windows.
tomfinegan Feb 25, 2022
f04eecc
Avoid comparing bool using the < and > operator (#817)
bjornblissing Feb 26, 2022
bc4177b
Bump nokogiri from 1.13.1 to 1.13.3 in /docs (#822)
dependabot[bot] Feb 28, 2022
5c98634
Sync internal fixes for transcoder CI coverage blockers.
tomfinegan Mar 2, 2022
e94a774
Style tidying.
tomfinegan Mar 2, 2022
f06922c
Add core/constants.h
tomfinegan Mar 2, 2022
f051da2
Turn on all the CI builds again (hope springs eternal).
tomfinegan Mar 2, 2022
f3899b7
Disable msvc-release-static-with-transcoder again
tomfinegan Mar 2, 2022
816fae2
Skip GltfDecoderTest.ThreeMeshesOneNoMaterialMesh for Windows MSVC CI…
tomfinegan Mar 2, 2022
48dcead
Merge branch 'master' into ci_transcoder
tomfinegan Mar 2, 2022
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
131 changes: 131 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: macos-make-release-shared-with-transcoder
os: macos-latest
cmake_configure_command: |-
cmake .. -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

- test_name: macos-make-release-static
os: macos-latest
Expand All @@ -38,6 +48,16 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: macos-make-release-static-with-transcoder
os: macos-latest
cmake_configure_command: |-
cmake .. -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

- test_name: macos-xcode-release-shared
os: macos-latest
Expand All @@ -48,6 +68,16 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . --config Release
draco_test_command: Release/draco_tests
- test_name: macos-xcode-release-shared-with-transcoder
os: macos-latest
cmake_configure_command: |-
cmake .. -G Xcode \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CONFIGURATION_TYPES=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . --config Release
draco_test_command: Release/draco_tests

- test_name: macos-xcode-release-static
os: macos-latest
Expand All @@ -58,6 +88,16 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . --config Release
draco_test_command: Release/draco_tests
- test_name: macos-xcode-release-static-with-transcoder
os: macos-latest
cmake_configure_command: |-
cmake .. -G Xcode \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CONFIGURATION_TYPES=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . --config Release
draco_test_command: Release/draco_tests

- test_name: ubuntu-make-release-shared
os: ubuntu-latest
Expand All @@ -70,6 +110,18 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: ubuntu-make-release-shared-with-transcoder
os: ubuntu-latest
cmake_configure_command: |-
cmake .. -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

- test_name: ubuntu-make-release-static
os: ubuntu-latest
Expand All @@ -82,6 +134,18 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: ubuntu-make-release-static-with-transcoder
os: ubuntu-latest
cmake_configure_command: |-
cmake .. -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

- test_name: windows-msvc-release-shared
os: windows-2019
Expand All @@ -92,6 +156,20 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . --config Release -- -m:2
draco_test_command: Release/draco_tests
- test_name: windows-msvc-release-shared-with-transcoder
os: windows-2019
cmake_configure_command: |-
cmake .. -G "Visual Studio 16 2019" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CONFIGURATION_TYPES=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . --config Release -- -m:2
# TODO(https://github.com/google/draco/issues/826)
draco_test_command: |-
Release/draco_tests \
--gtest_filter=-GltfDecoderTest.ThreeMeshesOneNoMaterialMesh


- test_name: windows-msvc-release-static
os: windows-2019
Expand All @@ -102,6 +180,20 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . --config Release -- -m:2
draco_test_command: Release/draco_tests
- test_name: windows-msvc-release-static-with-transcoder
os: windows-2019
cmake_configure_command: |-
cmake .. -G "Visual Studio 16 2019" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CONFIGURATION_TYPES=Release \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . --config Release -- -m:2
# TODO(https://github.com/google/draco/issues/826)
draco_test_command: |-
Release/draco_tests \
--gtest_filter=-GltfDecoderTest.ThreeMeshesOneNoMaterialMesh


- test_name: windows-make-release-shared
os: windows-2019
Expand All @@ -114,6 +206,18 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: windows-make-release-shared-with-transcoder
os: windows-2019
cmake_configure_command: |-
cmake .. -G "MinGW Makefiles" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

- test_name: windows-make-release-static
os: windows-2019
Expand All @@ -126,6 +230,18 @@ jobs:
-DDRACO_TESTS=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests
- test_name: windows-make-release-static-with-transcoder
os: windows-2019
cmake_configure_command: |-
cmake .. -G "MinGW Makefiles" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
-DDRACO_TESTS=ON \
-DDRACO_TRANSCODER_SUPPORTED=ON
cmake_build_command: cmake --build . -- -j2
draco_test_command: ./draco_tests

name: test-${{ matrix.test_name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -163,22 +279,37 @@ jobs:
- test_name: ubuntu-make
os: ubuntu-latest
test_command: python3 test.py -v -G "Unix Makefiles"
- test_name: ubuntu-make-with-transcoder
os: ubuntu-latest
test_command: python3 test.py -v -t -G "Unix Makefiles"

- test_name: macos-make
os: macos-latest
test_command: python3 test.py -v -G "Unix Makefiles"
- test_name: macos-make-with-transcoder
os: macos-latest
test_command: python3 test.py -v -t -G "Unix Makefiles"

- test_name: macos-xcode
os: macos-latest
test_command: python3 test.py -v -G Xcode
- test_name: macos-xcode-with-transcoder
os: macos-latest
test_command: python3 test.py -v -t -G Xcode

- test_name: windows-make
os: windows-2019
test_command: python3 test.py -v -G "MinGW Makefiles"
- test_name: windows-make-with-transcoder
os: windows-2019
test_command: python3 test.py -v -t -G "MinGW Makefiles"

- test_name: windows-msvc
os: windows-2019
test_command: python3 test.py -v -G "Visual Studio 16 2019"
- test_name: windows-msvc-with-transcoder
os: windows-2019
test_command: python3 test.py -v -t -G "Visual Studio 16 2019"

name: install-test-${{ matrix.test_name }}
runs-on: ${{ matrix.os }}
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@ list(APPEND draco_dec_config_sources

list(APPEND draco_compression_decode_sources
"${draco_src_root}/compression/decode.cc"
"${draco_src_root}/compression/decode.h")
"${draco_src_root}/compression/decode.h"
"${draco_src_root}/compression/draco_compression_options.h")

list(APPEND draco_compression_encode_sources
"${draco_src_root}/compression/draco_compression_options.h"
"${draco_src_root}/compression/encode.cc"
"${draco_src_root}/compression/encode.h"
"${draco_src_root}/compression/encode_base.h"
Expand Down Expand Up @@ -337,6 +339,7 @@ list(APPEND draco_core_sources
"${draco_src_root}/core/bit_utils.h"
"${draco_src_root}/core/bounding_box.cc"
"${draco_src_root}/core/bounding_box.h"
"${draco_src_root}/core/constants.h"
"${draco_src_root}/core/cycle_timer.cc"
"${draco_src_root}/core/cycle_timer.h"
"${draco_src_root}/core/data_buffer.cc"
Expand Down
6 changes: 6 additions & 0 deletions src/draco/core/constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef DRACO_CORE_CONSTANTS_H_
#define DRACO_CORE_CONSTANTS_H_

#define DRACO_PI 3.14159265358979323846

#endif // DRACO_CORE_CONSTANTS_H_
5 changes: 3 additions & 2 deletions src/draco/io/gltf_decoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <vector>

#ifdef DRACO_TRANSCODER_SUPPORTED
#include "draco/core/constants.h"
#include "draco/core/draco_test_base.h"
#include "draco/core/draco_test_utils.h"
#include "draco/core/draco_types.h"
Expand Down Expand Up @@ -1156,7 +1157,7 @@ TEST(GltfDecoderTest, DecodeLightsIntoScene) {
ASSERT_EQ(light.GetType(), draco::Light::POINT);
ASSERT_EQ(light.GetRange(), 1000);
ASSERT_EQ(light.GetInnerConeAngle(), 0.0);
ASSERT_NEAR(light.GetOuterConeAngle(), M_PI / 4.0f, 1e-8);
ASSERT_NEAR(light.GetOuterConeAngle(), DRACO_PI / 4.0f, 1e-8);

// Check directional light with some properties specified.
light = *scene->GetLight(LightIndex(2));
Expand All @@ -1174,7 +1175,7 @@ TEST(GltfDecoderTest, DecodeLightsIntoScene) {
ASSERT_EQ(light.GetType(), draco::Light::SPOT);
ASSERT_EQ(light.GetRange(), std::numeric_limits<float>::max());
ASSERT_EQ(light.GetInnerConeAngle(), 0.0);
ASSERT_NEAR(light.GetOuterConeAngle(), M_PI / 4.0f, 1e-8);
ASSERT_NEAR(light.GetOuterConeAngle(), DRACO_PI / 4.0f, 1e-8);

// Check that lights are referenced by the scene nodes.
ASSERT_EQ(scene->GetNode(SceneNodeIndex(0))->GetLightIndex(),
Expand Down
7 changes: 5 additions & 2 deletions src/draco/io/gltf_encoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

#ifdef DRACO_TRANSCODER_SUPPORTED
#include <sstream>
#include <string>
#include <unordered_set>
#include <utility>

#include "draco/core/draco_test_base.h"
#include "draco/core/draco_test_utils.h"
Expand Down Expand Up @@ -411,8 +413,9 @@ TEST_F(GltfEncoderTest, EncodeNamedGenericAttribute) {
// Set metadata for first attribute so it gets written out by glTF encoder.
std::unique_ptr<draco::AttributeMetadata> am(new draco::AttributeMetadata());
constexpr char kAttributeName[] = "MyAttributeName";
am->AddEntryString(GltfEncoder::kDracoMetadataGltfAttributeName,
kAttributeName);
constexpr char kDracoMetadataGltfAttributeName[] =
"//GLTF/ApplicationSpecificAttributeName";
am->AddEntryString(kDracoMetadataGltfAttributeName, kAttributeName);
mesh->AddAttributeMetadata(new_att_id_0, std::move(am));

// Make sure the GLTF contains a reference to the named attribute.
Expand Down
5 changes: 3 additions & 2 deletions src/draco/scene/light.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

#ifdef DRACO_TRANSCODER_SUPPORTED

#include <cmath>
#include <limits>

#include "draco/core/constants.h"

namespace draco {

Light::Light()
Expand All @@ -27,7 +28,7 @@ Light::Light()
type_(POINT),
range_(std::numeric_limits<float>::max()), // Infinity.
inner_cone_angle_(0.0),
outer_cone_angle_(M_PI / 4.0) {}
outer_cone_angle_(DRACO_PI / 4.0) {}

void Light::Copy(const Light &light) {
name_ = light.name_;
Expand Down
12 changes: 6 additions & 6 deletions src/draco/scene/light_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
//
#include "draco/scene/light.h"

#include <cmath>
#include <limits>

#include "draco/core/constants.h"
#include "draco/core/draco_test_base.h"
#include "draco/core/draco_test_utils.h"

Expand All @@ -33,7 +33,7 @@ TEST(LightTest, TestDefaults) {
ASSERT_EQ(light.GetType(), draco::Light::POINT);
ASSERT_EQ(light.GetRange(), std::numeric_limits<float>::max());
ASSERT_EQ(light.GetInnerConeAngle(), 0.0);
ASSERT_EQ(light.GetOuterConeAngle(), M_PI / 4.0);
ASSERT_EQ(light.GetOuterConeAngle(), DRACO_PI / 4.0);
}

TEST(LightTest, TestCopy) {
Expand All @@ -44,8 +44,8 @@ TEST(LightTest, TestCopy) {
light.SetIntensity(5.0);
light.SetType(draco::Light::SPOT);
light.SetRange(1000.0);
light.SetInnerConeAngle(M_PI / 8.0);
light.SetOuterConeAngle(M_PI / 2.0);
light.SetInnerConeAngle(DRACO_PI / 8.0);
light.SetOuterConeAngle(DRACO_PI / 2.0);

// Create a copy of the initialized light and check all properties.
draco::Light copy;
Expand All @@ -55,8 +55,8 @@ TEST(LightTest, TestCopy) {
ASSERT_EQ(copy.GetIntensity(), 5.0);
ASSERT_EQ(copy.GetType(), draco::Light::SPOT);
ASSERT_EQ(copy.GetRange(), 1000.0);
ASSERT_EQ(copy.GetInnerConeAngle(), M_PI / 8.0);
ASSERT_EQ(copy.GetOuterConeAngle(), M_PI / 2.0);
ASSERT_EQ(copy.GetInnerConeAngle(), DRACO_PI / 8.0);
ASSERT_EQ(copy.GetOuterConeAngle(), DRACO_PI / 2.0);
}

#endif // DRACO_TRANSCODER_SUPPORTED
Expand Down
14 changes: 14 additions & 0 deletions src/draco/tools/install_test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@
// against an installed version of Draco without errors. It does not perform
// any sort of library tests.

#include <cstdio>
#include <vector>

#include "draco/core/decoder_buffer.h"

#if defined DRACO_TRANSCODER_SUPPORTED
#include "draco/scene/scene.h"
#include "draco/scene/scene_utils.h"
#endif

int main(int /*argc*/, char** /*argv*/) {
std::vector<char> empty_buffer;
draco::DecoderBuffer buffer;
buffer.Init(empty_buffer.data(), empty_buffer.size());

#if defined DRACO_TRANSCODER_SUPPORTED
draco::Scene empty_scene;
const int num_meshes = empty_scene.NumMeshes();
(void)num_meshes;
#endif

printf("Partial sanity test passed.\n");
return 0;
}
Loading