diff --git a/makefile b/makefile index 662828b8..628d9ddb 100644 --- a/makefile +++ b/makefile @@ -48,14 +48,20 @@ ON_GNU_COMMON_FLAGS = $(ON_GNU_OPTIMIZER_FLAGS) $(ON_GNU_WARNING_FLAGS) -D_GNU_S # C compiler and flags CC = gcc +# clang c +#CC = clang CFLAGS = $(ON_GNU_COMMON_FLAGS) # C++ compiler and flags CCC = g++ +# clang++ +#CCC = c++ CCFLAGS = $(ON_GNU_COMMON_FLAGS) -std=c++14 LINK = $(CCC) -LINKFLAGS = +LINKFLAGS = +# Linux link flag needed for libuuid +#LINKFLAGS = -luuid ############################################################### @@ -377,6 +383,7 @@ ON_SRC = opennurbs_3dm_attributes.cpp \ opennurbs_topology.cpp \ opennurbs_torus.cpp \ opennurbs_unicode.cpp \ + opennurbs_unicode_cpsb.cpp \ opennurbs_units.cpp \ opennurbs_userdata.cpp \ opennurbs_userdata_obsolete.cpp \ @@ -443,6 +450,7 @@ ON_OBJ = opennurbs_3dm_attributes.o \ opennurbs_fsp.o \ opennurbs_function_list.o \ opennurbs_geometry.o \ + opennurbs_glyph_outline.o \ opennurbs_group.o \ opennurbs_hash_table.o \ opennurbs_hatch.o \ @@ -549,6 +557,7 @@ ON_OBJ = opennurbs_3dm_attributes.o \ opennurbs_topology.o \ opennurbs_torus.o \ opennurbs_unicode.o \ + opennurbs_unicode_cpsb.o \ opennurbs_units.o \ opennurbs_userdata.o \ opennurbs_userdata_obsolete.o \ diff --git a/opennurbs_3dm_settings.cpp b/opennurbs_3dm_settings.cpp index 2f12bc19..1230435d 100644 --- a/opennurbs_3dm_settings.cpp +++ b/opennurbs_3dm_settings.cpp @@ -5370,7 +5370,7 @@ void ON_3dmSettings::Dump( ON_TextLog& dump ) const // ON_3dmAnimationProperties // -const ON_3dmAnimationProperties ON_3dmAnimationProperties::Default; +const ON_3dmAnimationProperties ON_3dmAnimationProperties::Default ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_3dmAnimationProperties); bool ON_3dmAnimationProperties::Read(ON_BinaryArchive& archive) { diff --git a/opennurbs_font.cpp b/opennurbs_font.cpp index 1ea2fa21..bb951236 100644 --- a/opennurbs_font.cpp +++ b/opennurbs_font.cpp @@ -6592,7 +6592,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName( const wchar_t* prev_clean_family_name = nullptr; for (size_t i = 0; i < installed_count; i++) { -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) const ON_Font* font = installed_fonts[(int)i]; #else const ON_Font* font = installed_fonts[i]; @@ -6655,7 +6655,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName( InternalHashToName candidate; for (size_t i = 0; i < count0; i++) { -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) InternalHashToName e = a[(int)i]; #else InternalHashToName e = a[i]; diff --git a/opennurbs_locale.cpp b/opennurbs_locale.cpp index f148935d..1f1a516b 100644 --- a/opennurbs_locale.cpp +++ b/opennurbs_locale.cpp @@ -35,7 +35,7 @@ static ON_CRT_locale_t ON_CRT_C_locale() ON_C_locale = _create_locale(LC_ALL, "C"); #elif defined(ON_RUNTIME_APPLE) ON_C_locale = _c_locale; -#elif defined(ON_RUNTIME_ANDROID) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) ON_C_locale = 0; #else ON_C_locale = _create_locale(category, locale); @@ -104,7 +104,7 @@ static ON_CRT_locale_t ON_CRT_create_locale_ALL( const char * locale ) } } return newlocale(LC_ALL_MASK, apple_name, ON_CRT_C_locale() ); -#elif defined(ON_RUNTIME_ANDROID) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) return 0; #else return _create_locale(category, locale); @@ -1344,7 +1344,7 @@ public: static bool Validate_sprintf_l() { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) // Test formatted printing char buffer[64] = { 0 }; // Testing C-runtime - do not using ON_String::FormatIntoBuffer @@ -1369,7 +1369,7 @@ public: static bool Validate_sprintf_s_l() { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) // Test formatted printing char buffer[64] = { 0 }; size_t buffer_capacity = (sizeof(buffer) / sizeof(buffer[0])) - 1; @@ -1423,7 +1423,7 @@ public: static bool Validate_sscanf_l() { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan @@ -1448,7 +1448,7 @@ public: static bool Validate_sscanf_s_l() { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan diff --git a/opennurbs_mesh_ngon.cpp b/opennurbs_mesh_ngon.cpp index afc8185e..1139acaf 100644 --- a/opennurbs_mesh_ngon.cpp +++ b/opennurbs_mesh_ngon.cpp @@ -4774,7 +4774,7 @@ ON_Plane ON_Plane::FromPointList( -const ON_MeshNgonIterator ON_MeshNgonIterator::EmptyMeshNgonIterator; +const ON_MeshNgonIterator ON_MeshNgonIterator::EmptyMeshNgonIterator ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_MeshNgonIterator); ON_MeshNgonIterator::ON_MeshNgonIterator( const class ON_Mesh* mesh diff --git a/opennurbs_sort.cpp b/opennurbs_sort.cpp index 5ab0fe95..e96431f8 100644 --- a/opennurbs_sort.cpp +++ b/opennurbs_sort.cpp @@ -63,7 +63,7 @@ ON_qsort( void *base, size_t nel, size_t width, int (*compar)(void*,const void * // find pivots, that calculation must be thread safe. #if defined(ON_COMPILER_MSC) qsort_s(base,nel,width,compar,context); -#elif defined(ON_RUNTIME_ANDROID) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) ON_hsort(base, nel, width, compar, context); #elif defined(ON_COMPILER_CLANG) qsort_r(base,nel,width,context,compar); diff --git a/opennurbs_string_format.cpp b/opennurbs_string_format.cpp index 1ed91a05..272ae593 100644 --- a/opennurbs_string_format.cpp +++ b/opennurbs_string_format.cpp @@ -693,7 +693,7 @@ int ON_String::FormatVargsIntoBuffer( // CLang modifies args so a copy is required va_list args_copy; va_copy (args_copy, args); -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) int len = vsnprintf(buffer, buffer_capacity, format, args_copy); #else int len = vsnprintf_l(buffer, buffer_capacity, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy); @@ -745,7 +745,7 @@ int ON_String::FormatVargsOutputCount( va_list args_copy; va_copy (args_copy, args); -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) int len = vsnprintf(nullptr, 0, format, args_copy); #else int len = vsnprintf_l(nullptr, 0, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy); diff --git a/opennurbs_string_scan.cpp b/opennurbs_string_scan.cpp index 2c37d6b1..c2b84946 100644 --- a/opennurbs_string_scan.cpp +++ b/opennurbs_string_scan.cpp @@ -86,7 +86,7 @@ int ON_String::ScanBufferVargs( ) { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) if (nullptr == buffer || nullptr == format) return -1; return vsscanf(buffer, format, args); @@ -149,7 +149,7 @@ int ON_wString::ScanBufferVargs( ) { #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) if (nullptr == buffer || nullptr == format) return -1; return swscanf(buffer, format, args); @@ -398,7 +398,7 @@ const char* ON_String::ToNumber( double x = value_on_failure; #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; @@ -640,7 +640,7 @@ const wchar_t* ON_wString::ToNumber( double x = value_on_failure; #if defined(ON_COMPILER_CLANG) -#if defined(ON_RUNTIME_ANDROID) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; diff --git a/opennurbs_system_compiler.h b/opennurbs_system_compiler.h index 794d1d42..4c1d40ad 100644 --- a/opennurbs_system_compiler.h +++ b/opennurbs_system_compiler.h @@ -247,7 +247,7 @@ #define ON_SIZEOF_WCHAR_T 2 -#elif defined(__clang__) | defined(ON_COMPILER_CLANG) +#elif defined(__clang__) | defined(__clang) | defined(ON_COMPILER_CLANG) /* //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// diff --git a/opennurbs_system_runtime.h b/opennurbs_system_runtime.h index d41ba995..ca4bfce0 100644 --- a/opennurbs_system_runtime.h +++ b/opennurbs_system_runtime.h @@ -55,6 +55,11 @@ #define ON_RUNTIME_ANDROID #endif +#elif defined(__linux__) +#if !defined(ON_RUNTIME_LINUX) +#define ON_RUNTIME_LINUX +#endif + #endif /* // @@ -150,6 +155,25 @@ #define ON_SIZEOF_WCHAR_T 4 #endif +#elif defined(ON_RUNTIME_LINUX) + +#if defined(__x86_64__) +#define ON_64BIT_RUNTIME +#else +#define ON_32BIT_RUNTIME +#endif + + +#if !defined(ON_SIZEOF_WCHAR_T) +#define ON_SIZEOF_WCHAR_T 4 +#endif + +#if !defined(ON_LITTLE_ENDIAN) +#if defined( __x86_64__ ) +#define ON_LITTLE_ENDIAN +#endif +#endif + #endif #if !defined(ON_64BIT_RUNTIME) && !defined(ON_32BIT_RUNTIME)