Skip to content

Commit

Permalink
cmake cleanup (Kenix3#510)
Browse files Browse the repository at this point in the history
* cmake cleanup

* fix exclude use

* gx2 fix

* more wii u fixes
  • Loading branch information
briaguya-ai authored Apr 24, 2024
1 parent 1cef81c commit 493639d
Show file tree
Hide file tree
Showing 19 changed files with 12,125 additions and 345 deletions.
43 changes: 43 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,36 @@ target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
set(ZAPDUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ZAPDUtils)
add_subdirectory(${ZAPDUTILS_DIR})

#=================== libgfxd ===================
# This used to be included from ZAPDTR, meaning setting GFX_DEBUG_DISASSEMBLER
# required the port include ZAPDTR. The version in extern is the version that was
# in ZAPDTR, which is
# https://github.com/glankk/libgfxd/tree/008f73dca8ebc9151b205959b17773a19c5bd0da
# with a couple small changes:
# * priv.h now has `#define CONFIG_MT` added right above the #ifdef CONFIG_MT
# * the Makefile now has `CC ?= gcc` as the first line

if (GFX_DEBUG_DISASSEMBLER)
set(LIBGFXD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libgfxd)
add_library(libgfxd STATIC)
set_property(TARGET libgfxd PROPERTY C_STANDARD 11)

target_sources(libgfxd PRIVATE
${LIBGFXD_DIR}/gbi.h
${LIBGFXD_DIR}/gfxd.h
${LIBGFXD_DIR}/priv.h
${LIBGFXD_DIR}/gfxd.c
${LIBGFXD_DIR}/uc.c
${LIBGFXD_DIR}/uc_f3d.c
${LIBGFXD_DIR}/uc_f3db.c
${LIBGFXD_DIR}/uc_f3dex.c
${LIBGFXD_DIR}/uc_f3dex2.c
${LIBGFXD_DIR}/uc_f3dexb.c
)

target_include_directories(libgfxd PUBLIC ${LIBGFXD_DIR})
endif()

#=================== nlohmann-json ===================

set(JSON_BuildTests OFF CACHE INTERNAL "")
Expand All @@ -161,3 +191,16 @@ set(THREADPOOL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thread-pool)
add_library(ThreadPool INTERFACE)

target_include_directories(ThreadPool INTERFACE ${THREADPOOL_DIR})

#=================== STB ===================

set(STB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stb)
add_library(stb STATIC)

target_sources(stb PRIVATE
${STB_DIR}/stb_image.h
${STB_DIR}/stb_image_write.h
${STB_DIR}/stb_impl.c
)

target_include_directories(stb PUBLIC ${STB_DIR})
21 changes: 21 additions & 0 deletions extern/libgfxd/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2021 glank ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions extern/libgfxd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CC ?= gcc
CFLAGS = -Wall -O2 -g
UC_OBJ = uc_f3d.o uc_f3db.o uc_f3dex.o uc_f3dexb.o uc_f3dex2.o
OBJ = gfxd.o $(UC_OBJ)
LIB = libgfxd.a

CPPFLAGS-$(MT) += -DCONFIG_MT
CPPFLAGS += $(CPPFLAGS-y)

.PHONY: all
all: $(LIB)

.PHONY: clean
clean:
rm -f $(OBJ) $(LIB)

.INTERMEDIATE: $(OBJ)

$(OBJ): gbi.h gfxd.h priv.h
$(UC_OBJ): uc.c uc_argfn.c uc_argtbl.c uc_macrofn.c uc_macrotbl.c

$(LIB): $(OBJ)
$(AR) rcs $@ $^

%.o: %.c
$(COMPILE.c) $(OUTPUT_OPTION) $<
Loading

0 comments on commit 493639d

Please sign in to comment.