Skip to content

Commit

Permalink
Fix mac compilation by replacing c11 to c++11 in flags, add cmake file
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Dec 13, 2024
1 parent cf3010f commit e90452a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,19 @@ 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} ${CFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}
${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} ${CFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}
${CC} ${CXXFLAGS} -o $@ -c $< ${HEAPS_CFLAGS}

heaps: ${HEAPS} libhl
${CC} ${CFLAGS} ${HEAPS_CFLAGS} -shared -o heaps.hdll ${HEAPS} ${LIBFLAGS} -L. -lhl
Expand Down
46 changes: 46 additions & 0 deletions libs/heaps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
set(HEAPS_INCLUDE_DIRS
${INCLUDES_BASE_DIR}/mikktspace
${INCLUDES_BASE_DIR}/meshoptimizer
${INCLUDES_BASE_DIR}/vhacd
.
)

add_library(heaps.hdll SHARED
${INCLUDES_BASE_DIR}/mikktspace/mikktspace.c
${INCLUDES_BASE_DIR}/meshoptimizer/allocator.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/overdrawoptimizer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vcacheoptimizer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/clusterizer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/quantization.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vertexcodec.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/indexcodec.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/simplifier.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vertexfilter.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/indexgenerator.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/spatialorder.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vfetchanalyzer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/stripifier.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vfetchoptimizer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/overdrawanalyzer.cpp
${INCLUDES_BASE_DIR}/meshoptimizer/vcacheanalyzer.cpp
mikkt.c
meshoptimizer.cpp
vhacd.cpp
)

set_as_hdll(heaps)

target_include_directories(heaps.hdll
PRIVATE
${HEAPS_INCLUDE_DIRS}
)

target_link_libraries(heaps.hdll
libhl
)

install(
TARGETS
heaps.hdll
DESTINATION ${HDLL_DESTINATION}
)

0 comments on commit e90452a

Please sign in to comment.