Skip to content

Commit

Permalink
Use swl-variant to improve compile times.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Aug 12, 2024
1 parent e819812 commit d90ebbe
Show file tree
Hide file tree
Showing 9 changed files with 656 additions and 767 deletions.
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
url = https://github.com/htacg/tidy-html5.git
[submodule "native~/extern/enum-flags"]
path = native~/extern/enum-flags
url = https://github.com/grisumbras/enum-flags.git
url = https://github.com/kring/enum-flags.git
[submodule "native~/extern/swl-variant"]
path = native~/extern/swl-variant
url = https://github.com/kring/swl-variant.git
branch = exception-public-inheritance
64 changes: 1 addition & 63 deletions native~/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ if (NOT IOS)
set(CESIUM_INSTALL_STATIC_LIBS OFF)
endif()

add_subdirectory(extern/swl-variant)
add_subdirectory(extern/cesium-native)

# Don't build the cesium-native tests by default.
Expand All @@ -106,69 +107,6 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})

# Specify all targets that need to compile bitcode
if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
# set (ALL_TARGETS
# CesiumForUnityNative-Runtime
# Async++
# Cesium3DTilesContent
# Cesium3DTilesReader
# Cesium3DTilesSelection
# CesiumAsync
# CesiumGeometry
# CesiumGeospatial
# CesiumGltf
# CesiumGltfContent
# CesiumGltfReader
# CesiumJsonReader
# CesiumRasterOverlays
# CesiumQuantizedMeshTerrain
# CesiumUtility
# draco_attributes
# draco_compression_attributes_dec
# draco_compression_bit_coders
# draco_compression_entropy
# draco_compression_decode
# draco_compression_mesh_dec
# draco_compression_point_cloud_dec
# draco_core
# draco_mesh
# draco_metadata
# draco_metadata_dec
# draco_point_cloud
# draco_points_dec
# draco_static
# expected-lite
# GSL
# httplib
# ktx
# meshoptimizer
# modp_b64
# spdlog
# sqlite3
# s2geometry
# tinyxml2
# tidy-static
# uriparser
# webpdecode
# webpdecoder
# webpdspdecode
# webputils
# webputilsdecode
# zlibstatic
# )
#set(MESHOPT_BUILD_SHARED_LIBS OFF BOOL FORCE)
install(TARGETS tidy-static)
# install(
# TARGETS ${ALL_TARGETS}
# PUBLIC_HEADER
# EXCLUDE_FROM_ALL
# FRAMEWORK
# DESTINATION ${CMAKE_INSTALL_LIBDIR}
# )
set_target_properties(tidy-static PROPERTIES EXCLUDE_FROM_ALL 0 EXCLUDE_FROM_DEFAULT_BUILD 0)
#set_target_properties(${ALL_TARGETS} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")

# ktx tags itself as a FRAMEWORK on iOS, which causes linker errors. Undo that.
#set_target_properties(ktx PROPERTIES FRAMEWORK FALSE)
endif()


2 changes: 1 addition & 1 deletion native~/Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ target_link_libraries(
set_target_properties(
CesiumForUnityNative-Editor
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
Expand Down
4 changes: 3 additions & 1 deletion native~/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ target_link_libraries(
PRIVATE
tidy-static
enum-flags
swl-variant
)

set_target_properties(
CesiumForUnityNative-Runtime
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
Expand All @@ -66,6 +67,7 @@ target_compile_definitions(
CesiumForUnityNative-Runtime
PUBLIC
TIDY_STATIC
SWL_VARIANT_NO_CONSTEXPR_EMPLACE
)

# If we're building for the Unity Editor, set a #define accordingly.
Expand Down
4 changes: 2 additions & 2 deletions native~/Runtime/src/CesiumFeatureImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include <DotNet/CesiumForUnity/CesiumMetadataValue.h>
#include <DotNet/CesiumForUnity/MetadataType.h>
#include <swl/variant.hpp>

#include <unordered_map>
#include <variant>

namespace DotNet::CesiumForUnity {
class CesiumFeature;
Expand All @@ -18,7 +18,7 @@ class String;

namespace CesiumForUnityNative {

using ValueType = std::variant<
using ValueType = swl::variant<
int8_t,
uint8_t,
int16_t,
Expand Down
Loading

0 comments on commit d90ebbe

Please sign in to comment.