|
14 | 14 |
|
15 | 15 | cmake_minimum_required(VERSION 3.12 FATAL_ERROR) |
16 | 16 |
|
17 | | -# Draco requires C++11. |
| 17 | +# Draco requires modern compiler support. |
| 18 | +set(CMAKE_C_STANDARD 99) |
18 | 19 | set(CMAKE_CXX_STANDARD 11) |
19 | 20 | project(draco C CXX) |
20 | 21 |
|
@@ -81,6 +82,7 @@ draco_reset_target_lists() |
81 | 82 | draco_setup_options() |
82 | 83 | draco_set_build_definitions() |
83 | 84 | draco_set_cxx_flags() |
| 85 | +draco_set_exe_linker_flags() |
84 | 86 | draco_generate_features_h() |
85 | 87 |
|
86 | 88 | # Draco source file listing variables. |
@@ -508,12 +510,77 @@ list(APPEND draco_maya_plug_sources |
508 | 510 | "${draco_src_root}/maya/draco_maya_plugin.cc" |
509 | 511 | "${draco_src_root}/maya/draco_maya_plugin.h") |
510 | 512 |
|
| 513 | +if(DRACO_TRANSCODER_SUPPORTED) |
| 514 | + list(APPEND draco_animation_sources |
| 515 | + "${draco_src_root}/animation/animation.cc" |
| 516 | + "${draco_src_root}/animation/animation.h" |
| 517 | + "${draco_src_root}/animation/node_animation_data.h" |
| 518 | + "${draco_src_root}/animation/skin.cc" |
| 519 | + "${draco_src_root}/animation/skin.h") |
| 520 | + |
| 521 | + list(APPEND draco_io_sources |
| 522 | + "${draco_src_root}/io/gltf_decoder.cc" |
| 523 | + "${draco_src_root}/io/gltf_decoder.h" |
| 524 | + "${draco_src_root}/io/gltf_encoder.cc" |
| 525 | + "${draco_src_root}/io/gltf_encoder.h" |
| 526 | + "${draco_src_root}/io/gltf_utils.cc" |
| 527 | + "${draco_src_root}/io/gltf_utils.h" |
| 528 | + "${draco_src_root}/io/image_compression_options.h" |
| 529 | + "${draco_src_root}/io/scene_io.cc" |
| 530 | + "${draco_src_root}/io/scene_io.h" |
| 531 | + "${draco_src_root}/io/texture_io.cc" |
| 532 | + "${draco_src_root}/io/texture_io.h" |
| 533 | + "${draco_src_root}/io/tiny_gltf_utils.cc" |
| 534 | + "${draco_src_root}/io/tiny_gltf_utils.h") |
| 535 | + |
| 536 | + list(APPEND draco_material_sources |
| 537 | + "${draco_src_root}/material/material.cc" |
| 538 | + "${draco_src_root}/material/material.h" |
| 539 | + "${draco_src_root}/material/material_library.cc" |
| 540 | + "${draco_src_root}/material/material_library.h") |
| 541 | + |
| 542 | + list(APPEND draco_mesh_sources |
| 543 | + "${draco_src_root}/mesh/mesh_splitter.cc" |
| 544 | + "${draco_src_root}/mesh/mesh_splitter.h" |
| 545 | + "${draco_src_root}/mesh/mesh_utils.cc" |
| 546 | + "${draco_src_root}/mesh/mesh_utils.h") |
| 547 | + |
| 548 | + list(APPEND draco_scene_sources |
| 549 | + "${draco_src_root}/scene/mesh_group.h" |
| 550 | + "${draco_src_root}/scene/scene.cc" |
| 551 | + "${draco_src_root}/scene/scene.h" |
| 552 | + "${draco_src_root}/scene/scene_indices.h" |
| 553 | + "${draco_src_root}/scene/scene_node.h" |
| 554 | + "${draco_src_root}/scene/scene_utils.cc" |
| 555 | + "${draco_src_root}/scene/scene_utils.h" |
| 556 | + "${draco_src_root}/scene/trs_matrix.cc" |
| 557 | + "${draco_src_root}/scene/trs_matrix.h") |
| 558 | + |
| 559 | + list(APPEND draco_texture_sources |
| 560 | + "${draco_src_root}/texture/source_image.cc" |
| 561 | + "${draco_src_root}/texture/source_image.h" |
| 562 | + "${draco_src_root}/texture/texture.h" |
| 563 | + "${draco_src_root}/texture/texture_library.cc" |
| 564 | + "${draco_src_root}/texture/texture_library.h" |
| 565 | + "${draco_src_root}/texture/texture_map.cc" |
| 566 | + "${draco_src_root}/texture/texture_map.h" |
| 567 | + "${draco_src_root}/texture/texture_transform.cc" |
| 568 | + "${draco_src_root}/texture/texture_transform.h" |
| 569 | + "${draco_src_root}/texture/texture_utils.cc" |
| 570 | + "${draco_src_root}/texture/texture_utils.h") |
| 571 | +endif() |
| 572 | + |
511 | 573 | # |
512 | 574 | # Draco targets. |
513 | 575 | # |
514 | 576 | if(EMSCRIPTEN AND DRACO_JS_GLUE) |
515 | 577 | # Draco decoder and encoder "executable" targets in various flavors for |
516 | | - # Emsscripten. |
| 578 | + # Emscripten. |
| 579 | + |
| 580 | + if(DRACO_TRANSCODER_SUPPORTED) |
| 581 | + message(FATAL_ERROR "The transcoder is not supported in Emscripten.") |
| 582 | + endif() |
| 583 | + |
517 | 584 | list(APPEND draco_decoder_src |
518 | 585 | ${draco_attributes_sources} |
519 | 586 | ${draco_compression_attributes_dec_sources} |
@@ -788,7 +855,45 @@ else() |
788 | 855 | INCLUDES |
789 | 856 | ${draco_include_paths}) |
790 | 857 |
|
791 | | - set(draco_object_library_deps |
| 858 | + if(DRACO_TRANSCODER_SUPPORTED) |
| 859 | + draco_add_library( |
| 860 | + NAME |
| 861 | + draco_material |
| 862 | + TYPE |
| 863 | + OBJECT |
| 864 | + SOURCES |
| 865 | + ${draco_material_sources} |
| 866 | + DEFINES |
| 867 | + ${draco_defines} |
| 868 | + INCLUDES |
| 869 | + ${draco_include_paths}) |
| 870 | + |
| 871 | + draco_add_library( |
| 872 | + NAME |
| 873 | + draco_scene |
| 874 | + TYPE |
| 875 | + OBJECT |
| 876 | + SOURCES |
| 877 | + ${draco_scene_sources} |
| 878 | + DEFINES |
| 879 | + ${draco_defines} |
| 880 | + INCLUDES |
| 881 | + ${draco_include_paths}) |
| 882 | + |
| 883 | + draco_add_library( |
| 884 | + NAME |
| 885 | + draco_texture |
| 886 | + TYPE |
| 887 | + OBJECT |
| 888 | + SOURCES |
| 889 | + ${draco_texture_sources} |
| 890 | + DEFINES |
| 891 | + ${draco_defines} |
| 892 | + INCLUDES |
| 893 | + ${draco_include_paths}) |
| 894 | + endif() |
| 895 | + |
| 896 | + list(APPEND draco_object_library_deps |
792 | 897 | draco_attributes |
793 | 898 | draco_compression_attributes_dec |
794 | 899 | draco_compression_attributes_enc |
@@ -817,14 +922,19 @@ else() |
817 | 922 | draco_points_dec |
818 | 923 | draco_points_enc) |
819 | 924 |
|
| 925 | + if(DRACO_TRANSCODER_SUPPORTED) |
| 926 | + list(APPEND draco_object_library_deps |
| 927 | + draco_material draco_scene draco_texture) |
| 928 | + endif() |
| 929 | + |
820 | 930 | # Library targets that consume the object collections. |
821 | 931 | if(MSVC) |
822 | 932 | # In order to produce a DLL and import library the Windows tools require |
823 | 933 | # that the exported symbols are part of the DLL target. The unfortunate side |
824 | 934 | # effect of this is that a single configuration cannot output both the |
825 | 935 | # static library and the DLL: This results in an either/or situation. |
826 | | - # Windows users of the draco build can have a DLL and an import library, |
827 | | - # or they can have a static library; they cannot have both from a single |
| 936 | + # Windows users of the draco build can have a DLL and an import library, or |
| 937 | + # they can have a static library; they cannot have both from a single |
828 | 938 | # configuration of the build. |
829 | 939 | if(BUILD_SHARED_LIBS) |
830 | 940 | set(draco_lib_type SHARED) |
@@ -955,6 +1065,22 @@ else() |
955 | 1065 | LIB_DEPS |
956 | 1066 | ${draco_dependency}) |
957 | 1067 |
|
| 1068 | + if(DRACO_TRANSCODER_SUPPORTED) |
| 1069 | + draco_add_executable(NAME |
| 1070 | + draco_transcoder |
| 1071 | + SOURCES |
| 1072 | + "${draco_src_root}/tools/draco_transcoder.cc" |
| 1073 | + "${draco_src_root}/tools/draco_transcoder_lib.cc" |
| 1074 | + "${draco_src_root}/tools/draco_transcoder_lib.h" |
| 1075 | + ${draco_io_sources} |
| 1076 | + DEFINES |
| 1077 | + ${draco_defines} |
| 1078 | + INCLUDES |
| 1079 | + ${draco_include_paths} |
| 1080 | + LIB_DEPS |
| 1081 | + ${draco_dependency}) |
| 1082 | + endif() |
| 1083 | + |
958 | 1084 | draco_setup_install_target() |
959 | 1085 | draco_setup_test_targets() |
960 | 1086 | endif() |
|
0 commit comments