Skip to content

Commit

Permalink
UTF-8 Support (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
kfprimm authored Nov 26, 2023
1 parent 773b5b0 commit d3d3af9
Show file tree
Hide file tree
Showing 44 changed files with 408 additions and 250 deletions.
28 changes: 17 additions & 11 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[submodule "freetype2"]
path = deps/freetype2/tree
url = https://gitlab.freedesktop.org/freetype/freetype.git
[submodule "freeimage"]
path = deps/freeimage/src
url = https://github.com/blitz3d-ng/freeimage
[submodule "assimp"]
path = deps/assimp/tree
url = https://github.com/assimp/assimp.git
[submodule "enet"]
path = deps/enet/src
path = deps/enet/tree
url = https://github.com/lsalzman/enet.git
[submodule "ode"]
path = deps/ode/tree
url = https://bitbucket.org/odedevs/ode.git
[submodule "freetype2"]
path = deps/freetype2/tree
url = https://github.com/blitz3d-ng/freetype2.git
[submodule "vorbis"]
path = deps/vorbis/tree
url = https://github.com/xiph/vorbis.git
Expand All @@ -22,24 +22,30 @@
[submodule "crossguid"]
path = deps/crossguid/src
url = https://github.com/graeme-hill/crossguid.git
[submodule "src/deps/zlib/src"]
[submodule "zlib"]
path = deps/zlib/tree
url = https://github.com/madler/zlib.git
[submodule "src/deps/json-hpp/src"]
[submodule "json-hpp"]
path = deps/json-hpp/tree
url = https://github.com/nlohmann/json.git
[submodule "deps/wxwidgets/tree"]
[submodule "wxwidgets"]
path = deps/wxwidgets/tree
url = https://github.com/wxWidgets/wxWidgets
[submodule "deps/sdl/tree"]
[submodule "sdl"]
path = deps/sdl/tree
url = https://github.com/libsdl-org/SDL.git
[submodule "deps/toml11/tree"]
[submodule "toml11"]
path = deps/toml11/tree
url = https://github.com/ToruNiina/toml11.git
[submodule "deps/env"]
[submodule "env"]
path = deps/env
url = https://github.com/blitz3d-ng/env
[submodule "deps/stackwalker/tree"]
[submodule "stackwalker"]
path = deps/stackwalker/tree
url = https://github.com/JochenKalmbach/StackWalker
[submodule "utf8.h"]
path = deps/utf8.h/tree
url = https://github.com/sheredom/utf8.h
[submodule "libpng"]
path = deps/libpng/tree
url = https://github.com/glennrp/libpng
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,13 @@ endfunction()
if(APPLE)
enable_language(OBJC) # TODO: needed after adding SDL...seems like a deep root cmake bug
endif()
add_subdirectory(deps)
add_subdirectory(deps EXCLUDE_FROM_ALL)

#if(NOT MSVC)
# add_compile_options(-Wall -Werror
# -Wno-error=deprecated-declarations
# )
#endif()

add_definitions(-DBB_PLATFORM="${BB_PLATFORM}")
add_definitions(-DBB_ENV="${BB_ENV}")
Expand Down
21 changes: 19 additions & 2 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
set(BUILD_SHARED_LIBS OFF CACHE STRING "" FORCE)
set(SKIP_INSTALL_ALL ON CACHE STRING "" FORCE)

# force local zlib
set(ZLIB_FOUND 1 CACHE STRING "" FORCE)

# suppress warnings
if(BB_MSVC)
add_compile_options(/w)
elseif(BB_CLANG)
add_compile_options(-Wno-everything)
elseif(BB_GNU)
add_compile_options(-w)
endif()

# core
add_subdirectory(zlib)
add_subdirectory(stackwalker)
add_subdirectory(utf8.h)

# ide
add_subdirectory(wxwidgets)
Expand All @@ -17,6 +33,7 @@ add_subdirectory(vrapi)
add_subdirectory(freetype2)
add_subdirectory(glew)
add_subdirectory(sdl)
add_subdirectory(libpng)
add_subdirectory(freeimage)
add_subdirectory(dxsdk)
add_subdirectory(assimp)
Expand All @@ -26,7 +43,7 @@ add_subdirectory(fmod)
add_subdirectory(ogg)
add_subdirectory(vorbis)

# misc
# misc
add_subdirectory(enet)
add_subdirectory(uuid)
add_subdirectory(crossguid)
Expand All @@ -35,4 +52,4 @@ add_subdirectory(crossguid)
add_subdirectory(ode)
add_subdirectory(steamworks)
add_subdirectory(tiltfive)
#add_subdirectory(luajit)
#add_subdirectory(luajit)
2 changes: 1 addition & 1 deletion deps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This directory contains code & submodules of third party libraries which are used by either the tooling or runtime.

Each directory contains a CMakeLists.txt file which configures a library for its use case.
Each directory contains a CMakeLists.txt file which configures a library for its use case in this project.
4 changes: 2 additions & 2 deletions deps/enet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ if (BB_EMSCRIPTEN OR BB_NX)
return()
endif()

add_subdirectory(src)
add_subdirectory(tree)
target_output_to_toolchain(enet)
target_include_directories (enet INTERFACE src/include)
target_include_directories (enet INTERFACE tree/include)
14 changes: 3 additions & 11 deletions deps/freeimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ endif()

set(CMAKE_CXX_STANDARD 14)

add_compile_options(-w) # suppress warnings

# JPEG
add_library(jpeg OBJECT src/Source/LibJPEG/jaricom.c src/Source/LibJPEG/jcapimin.c src/Source/LibJPEG/jcapistd.c src/Source/LibJPEG/jcarith.c src/Source/LibJPEG/jccoefct.c src/Source/LibJPEG/jccolor.c src/Source/LibJPEG/jcdctmgr.c src/Source/LibJPEG/jchuff.c src/Source/LibJPEG/jcinit.c src/Source/LibJPEG/jcmainct.c src/Source/LibJPEG/jcmarker.c src/Source/LibJPEG/jcmaster.c src/Source/LibJPEG/jcomapi.c src/Source/LibJPEG/jcparam.c src/Source/LibJPEG/jcprepct.c src/Source/LibJPEG/jcsample.c src/Source/LibJPEG/jctrans.c src/Source/LibJPEG/jdapimin.c src/Source/LibJPEG/jdapistd.c src/Source/LibJPEG/jdarith.c src/Source/LibJPEG/jdatadst.c src/Source/LibJPEG/jdatasrc.c src/Source/LibJPEG/jdcoefct.c src/Source/LibJPEG/jdcolor.c src/Source/LibJPEG/jddctmgr.c src/Source/LibJPEG/jdhuff.c src/Source/LibJPEG/jdinput.c src/Source/LibJPEG/jdmainct.c src/Source/LibJPEG/jdmarker.c src/Source/LibJPEG/jdmaster.c src/Source/LibJPEG/jdmerge.c src/Source/LibJPEG/jdpostct.c src/Source/LibJPEG/jdsample.c src/Source/LibJPEG/jdtrans.c src/Source/LibJPEG/jerror.c src/Source/LibJPEG/jfdctflt.c src/Source/LibJPEG/jfdctfst.c src/Source/LibJPEG/jfdctint.c src/Source/LibJPEG/jidctflt.c src/Source/LibJPEG/jidctfst.c src/Source/LibJPEG/jidctint.c src/Source/LibJPEG/jmemmgr.c src/Source/LibJPEG/jmemnobs.c src/Source/LibJPEG/jquant1.c src/Source/LibJPEG/jquant2.c src/Source/LibJPEG/jutils.c src/Source/LibJPEG/transupp.c)
target_include_directories(jpeg PUBLIC src/Source/LibJPEG)
Expand Down Expand Up @@ -49,11 +47,6 @@ set_target_properties(jpeg PROPERTIES UNITY_BUILD false)
# target_compile_definitions(openjpeg PUBLIC -DOPJ_STATIC)
# set_target_properties(openjpeg PROPERTIES UNITY_BUILD false)

# png
add_library(png OBJECT src/Source/LibPNG/png.c src/Source/LibPNG/pngerror.c src/Source/LibPNG/pngget.c src/Source/LibPNG/pngmem.c src/Source/LibPNG/pngpread.c src/Source/LibPNG/pngread.c src/Source/LibPNG/pngrio.c src/Source/LibPNG/pngrtran.c src/Source/LibPNG/pngrutil.c src/Source/LibPNG/pngset.c src/Source/LibPNG/pngtrans.c src/Source/LibPNG/pngwio.c src/Source/LibPNG/pngwrite.c src/Source/LibPNG/pngwtran.c src/Source/LibPNG/pngwutil.c )
target_link_libraries(png ${ZLIB})
target_compile_definitions(png PRIVATE PNG_ARM_NEON_OPT=0)

# raw
# add_library(raw_ OBJECT src/Source/LibRawLite/internal/dcraw_common.cpp src/Source/LibRawLite/internal/dcraw_fileio.cpp src/Source/LibRawLite/internal/demosaic_packs.cpp src/Source/LibRawLite/src/libraw_c_api.cpp src/Source/LibRawLite/src/libraw_cxx.cpp src/Source/LibRawLite/src/libraw_datastream.cpp src/Source/LibRawLite/internal/defines.h src/Source/LibRawLite/internal/libraw_internal_funcs.h src/Source/LibRawLite/internal/var_defines.h src/Source/LibRawLite/libraw/libraw.h src/Source/LibRawLite/libraw/libraw_alloc.h src/Source/LibRawLite/libraw/libraw_const.h src/Source/LibRawLite/libraw/libraw_datastream.h src/Source/LibRawLite/libraw/libraw_internal.h src/Source/LibRawLite/libraw/libraw_types.h src/Source/LibRawLite/libraw/libraw_version.h)
#
Expand Down Expand Up @@ -172,14 +165,13 @@ set(SOURCES
# src/Source/OpenEXR/Half/half.cpp
)

set(DEPS jpeg png ${ZLIB})
set(DEPS jpeg png_static)

add_library(freeimage STATIC ${SOURCES})
target_output_to_toolchain(freeimage)
target_compile_definitions(freeimage PRIVATE -DLIBRAW_NODLL)
target_compile_definitions(freeimage PUBLIC -DFREEIMAGE_LIB)
target_include_directories(freeimage SYSTEM PUBLIC src/Source)
# target_include_directories(freeimage PRIVATE src/Source/LibJXR/jxrgluelib src/Source/LibJXR/image/sys src/Source/OpenEXR/Half src/Source/OpenEXR/Iex src/Source/OpenEXR/lexMath src/Source/OpenEXR/IlmImf src/Source/OpenEXR/IlmThread src/Source/OpenEXR/Imath src/Source/OpenEXR)
target_include_directories(freeimage PUBLIC src/Source)

target_link_libraries(freeimage ${DEPS})
target_link_libraries(freeimage ${DEPS} png_static)
set_target_properties(freeimage PROPERTIES UNITY_BUILD false)
67 changes: 17 additions & 50 deletions deps/freetype2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,20 @@
set(CMAKE_UNITY_BUILD false)
add_compile_options(-w) # suppress warnings

add_library(freetype2 STATIC
tree/src/base/ftbase.c
tree/src/base/ftbbox.c
tree/src/base/ftbdf.c
tree/src/base/ftbitmap.c
tree/src/base/ftcid.c
tree/src/base/ftdebug.c
tree/src/base/ftfntfmt.c
tree/src/base/ftfstype.c
tree/src/base/ftgasp.c
tree/src/base/ftglyph.c
tree/src/base/ftgxval.c
tree/src/base/ftinit.c
tree/src/base/ftlcdfil.c
tree/src/base/ftmm.c
tree/src/base/ftotval.c
tree/src/base/ftpatent.c
tree/src/base/ftpfr.c
tree/src/base/ftstroke.c
tree/src/base/ftsynth.c
tree/src/base/ftsystem.c
tree/src/base/fttype1.c
tree/src/base/ftwinfnt.c
tree/src/autofit/autofit.c
tree/src/bdf/bdf.c
tree/src/bzip2/ftbzip2.c
tree/src/cache/ftcache.c
tree/src/cff/cff.c
tree/src/cid/type1cid.c
tree/src/gxvalid/gxvalid.c
tree/src/gzip/ftgzip.c
tree/src/lzw/ftlzw.c
tree/src/otvalid/otvalid.c
tree/src/pcf/pcf.c
tree/src/pfr/pfr.c
tree/src/psaux/psaux.c
tree/src/pshinter/pshinter.c
tree/src/psnames/psnames.c
tree/src/raster/raster.c
tree/src/sfnt/sfnt.c
tree/src/smooth/smooth.c
tree/src/truetype/truetype.c
tree/src/type1/type1.c
tree/src/type42/type42.c
tree/src/winfonts/winfnt.c)
set(BUILD_SHARED_LIBS OFF CACHE STRING "" FORCE)

target_output_to_toolchain(freetype2)
target_include_directories(freetype2 SYSTEM PUBLIC tree/include)
target_compile_definitions(freetype2 PRIVATE -DFT2_BUILD_LIBRARY)
target_link_libraries(freetype2 ${ZLIB})
set(DISABLE_FORCE_DEBUG_POSTFIX ON CACHE STRING "" FORCE)

set(FT_DISABLE_ZLIB TRUE CACHE STRING "" FORCE)
set(ZLIB_FOUND 1 CACHE STRING "" FORCE)

set(PNG_FOUND 1 CACHE STRING "" FORCE)

# TODO: probably should look into getting these enabled
set(FT_DISABLE_HARFBUZZ TRUE CACHE STRING "" FORCE)
set(FT_DISABLE_BZIP2 TRUE CACHE STRING "" FORCE)
set(FT_DISABLE_BROTLI TRUE CACHE STRING "" FORCE)

add_subdirectory(tree)

target_link_libraries(freetype PUBLIC png_static ${ZLIB})
target_output_to_toolchain(freetype)
2 changes: 1 addition & 1 deletion deps/freetype2/tree
Submodule tree updated from a19af2 to 920c55
15 changes: 15 additions & 0 deletions deps/libpng/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(PNG_SHARED OFF CACHE STRING "" FORCE)
set(PNG_BUILD_ZLIB ON CACHE STRING "" FORCE)
set(PNG_DEBUG_POSTFIX "" CACHE STRING "" FORCE)

# TODO: remove this hack
set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/../zlib/tree;${CMAKE_CURRENT_SOURCE_DIR}/../zlib/tree" CACHE STRING "" FORCE)

add_subdirectory(tree)

target_link_libraries(png_static ${ZLIB})
target_include_directories(png_static PUBLIC tree ${CMAKE_CURRENT_BINARY_DIR}/tree)
set_target_properties(png_static PROPERTIES OUTPUT_NAME png)
target_output_to_toolchain(png_static)

add_library(png ALIAS png_static)
1 change: 1 addition & 0 deletions deps/libpng/tree
Submodule tree added at f13577
2 changes: 1 addition & 1 deletion deps/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(SDL_FORCE_STATIC_VCRT ON CACHE STRING "" FORCE)
set(SDL_LIBC ON CACHE STRING "" FORCE)
set(SDL_CMAKE_DEBUG_POSTFIX "" CACHE STRING "" FORCE)
if(BB_LINUX)
set(SDL_OPENGLES OFF CACHE BOOLEAN "" FORCE)
set(SDL_OPENGLES OFF CACHE STRING "" FORCE)
endif()

add_subdirectory(tree)
Expand Down
2 changes: 2 additions & 0 deletions deps/utf8.h/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_library(utf8.h INTERFACE)
target_include_directories(utf8.h INTERFACE tree)
1 change: 1 addition & 0 deletions deps/utf8.h/tree
Submodule tree added at 0f66f4
1 change: 0 additions & 1 deletion deps/zlib/.gitignore

This file was deleted.

21 changes: 1 addition & 20 deletions deps/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,13 @@ if (BB_MINGW)
set(MINGW true)
endif()

set(BUILD_SHARED_LIBS off)

add_subdirectory(tree)

target_include_directories(zlibstatic PUBLIC tree ${CMAKE_BINARY_DIR}/deps/zlib/tree)

# silence zlib warnings for the time being
if(NOT BB_MSVC)
target_compile_options(zlibstatic PRIVATE -Wno-deprecated-non-prototype)
endif()

target_include_directories(zlibstatic PUBLIC tree ${CMAKE_CURRENT_BINARY_DIR}/tree)
target_output_to_toolchain(zlibstatic)
set_target_properties(zlibstatic PROPERTIES
OUTPUT_NAME zlibstatic
UNITY_BUILD false
)

# disable these since the CMakeLists.txt does not offer a flag.
set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
set_target_properties(example PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
set_target_properties(minigzip PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
IF(TARGET example64)
set_target_properties(example64 PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
ENDIF()
IF(TARGET minigzip64)
set_target_properties(minigzip64 PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
ENDIF()

add_library(ZLIB::ZLIB ALIAS zlibstatic)
3 changes: 2 additions & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# if no params, export needed variables for the compiler.
if [ "$1" = "" ]
then
export blitzpath=$(dirname $0)/_release
dir=$(cd "$(dirname "$0")"; pwd -P)
export blitzpath=$dir/_release
export PATH=$blitzpath/bin:$PATH
return 0
fi
Expand Down
3 changes: 1 addition & 2 deletions src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ macro(bb_start_module name)
set(SOURCES )
set(LIBS )
set(SYSTEM_LIBS )
set(INTERFACE_LIBS )
set(EXTRA_FILES )
set(FUNCTIONS )
endmacro()

macro(bb_end_module)
add_library (bb.${MODULE_ID} STATIC ${SOURCES})
target_link_libraries (bb.${MODULE_ID} ${DEPENDS_ON} ${LIBS} ${SYSTEM_LIBS} ${INTERFACE_LIBS})
target_link_libraries (bb.${MODULE_ID} ${DEPENDS_ON} ${LIBS} ${SYSTEM_LIBS})
target_output_to_toolchain(bb.${MODULE_ID})

if(BB_COVERAGE)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/bb/blitz3d/q3bsprep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct q3_brushside{
struct q3_direntry{
union{
int offset;
void *lump;
char *lump;
};
int length;
};
Expand Down
Loading

0 comments on commit d3d3af9

Please sign in to comment.