Skip to content

Commit

Permalink
Added heaps lib (#732)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuxiao Mao <yuxiao.mao@outlook.com>
  • Loading branch information
TothBenoit and yuxiaomao authored Dec 13, 2024
1 parent 80a10d2 commit 2091e1c
Show file tree
Hide file tree
Showing 12 changed files with 8,922 additions and 80 deletions.
33 changes: 31 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ INSTALL_BIN_DIR ?= $(PREFIX)/bin
INSTALL_LIB_DIR ?= $(PREFIX)/lib
INSTALL_INCLUDE_DIR ?= $(PREFIX)/include

LIBS=fmt sdl ssl openal ui uv mysql sqlite
LIBS=fmt sdl ssl openal ui uv mysql sqlite heaps
ARCH ?= $(shell uname -m)

CFLAGS = -Wall -O3 -I src -std=c11 -D LIBHL_EXPORTS
Expand Down Expand Up @@ -105,6 +105,18 @@ MYSQL = libs/mysql/socket.o libs/mysql/sha1.o libs/mysql/my_proto.o libs/mysql/m

SQLITE = libs/sqlite/sqlite.o

HEAPS = libs/heaps/mikkt.o libs/heaps/meshoptimizer.o libs/heaps/vhacd.o
HEAPS += include/mikktspace/mikktspace.o
HEAPS += include/meshoptimizer/allocator.o include/meshoptimizer/overdrawoptimizer.o \
include/meshoptimizer/vcacheoptimizer.o include/meshoptimizer/clusterizer.o \
include/meshoptimizer/quantization.o include/meshoptimizer/vertexcodec.o \
include/meshoptimizer/indexcodec.o include/meshoptimizer/simplifier.o \
include/meshoptimizer/vertexfilter.o include/meshoptimizer/indexgenerator.o \
include/meshoptimizer/spatialorder.o include/meshoptimizer/vfetchanalyzer.o \
include/meshoptimizer/stripifier.o include/meshoptimizer/vfetchoptimizer.o \
include/meshoptimizer/overdrawanalyzer.o include/meshoptimizer/vcacheanalyzer.o
HEAPS_CFLAGS = -fvisibility=hidden -I include/mikktspace -I include/meshoptimizer -I include/vhacd

LIB = ${PCRE} ${RUNTIME} ${STD}

BOOT = src/_main.o
Expand Down Expand Up @@ -290,6 +302,23 @@ mysql: ${MYSQL} libhl
sqlite: ${SQLITE} libhl
${CC} ${CFLAGS} -shared -o sqlite.hdll ${SQLITE} ${LIBFLAGS} -L. -lhl -lsqlite3

CXXFLAGS:=$(filter-out -std=c11,$(CFLAGS)) -std=c++11

./include/mikktspace/%.o: ./include/mikktspace/%.c
${CC} ${CFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}

./include/meshoptimizer/%.o: ./include/meshoptimizer/%.cpp
${CC} ${CXXFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}

./libs/heaps/%.o: ./libs/heaps/%.c
${CC} ${CFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}

./libs/heaps/%.o: ./libs/heaps/%.cpp
${CC} ${CXXFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}

heaps: ${HEAPS} libhl
${CXX} ${CFLAGS} ${HEAPS_CFLAGS} -shared -o heaps.hdll ${HEAPS} ${LIBFLAGS} -L. -lhl

mesa:
(cd libs/mesa && ${MAKE})

Expand Down Expand Up @@ -363,7 +392,7 @@ codesign_osx:
${CC} ${CFLAGS} -o $@ -c $<

clean_o:
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HL_DEBUG}
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HEAPS} ${HL_DEBUG}

clean: clean_o
rm -f hl hl.exe libhl.$(LIBEXT) *.hdll
Expand Down
15 changes: 15 additions & 0 deletions hl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dx12", "libs\directx\dx12.v
{C6213FBF-BC2B-4235-A827-84A60E848C52} = {C6213FBF-BC2B-4235-A827-84A60E848C52}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "heaps", "libs\heaps\heaps.vcxproj", "{E3F735ED-9701-46BE-A86C-C61D3CE0D525}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -226,6 +228,18 @@ Global
{F9A2435E-D545-43EB-B471-A4497D96A71B}.ReleaseVS2013|Win32.Build.0 = Release|Win32
{F9A2435E-D545-43EB-B471-A4497D96A71B}.ReleaseVS2013|x64.ActiveCfg = Release|x64
{F9A2435E-D545-43EB-B471-A4497D96A71B}.ReleaseVS2013|x64.Build.0 = Release|x64
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Debug|Win32.ActiveCfg = Debug|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Debug|Win32.Build.0 = Debug|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Debug|x64.ActiveCfg = Debug|x64
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Debug|x64.Build.0 = Debug|x64
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Release|Win32.ActiveCfg = Release|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Release|Win32.Build.0 = Release|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Release|x64.ActiveCfg = Release|x64
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.Release|x64.Build.0 = Release|x64
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.ReleaseVS2013|Win32.ActiveCfg = ReleaseVS2013|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.ReleaseVS2013|Win32.Build.0 = ReleaseVS2013|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.ReleaseVS2013|x64.ActiveCfg = ReleaseVS2013|Win32
{E3F735ED-9701-46BE-A86C-C61D3CE0D525}.ReleaseVS2013|x64.Build.0 = ReleaseVS2013|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -241,6 +255,7 @@ Global
{EC2DCE5C-267A-4050-8DDE-5BF58FF08E31} = {0EC4330B-6B61-45F8-B297-CA7097AFFD98}
{540E0E11-B7B1-43F8-B107-0867B2D97F74} = {0EC4330B-6B61-45F8-B297-CA7097AFFD98}
{F9A2435E-D545-43EB-B471-A4497D96A71B} = {0EC4330B-6B61-45F8-B297-CA7097AFFD98}
{E3F735ED-9701-46BE-A86C-C61D3CE0D525} = {0EC4330B-6B61-45F8-B297-CA7097AFFD98}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {52150AEE-F84D-4481-89B7-00D273AE84AF}
Expand Down
Loading

0 comments on commit 2091e1c

Please sign in to comment.