1 Star 0 Fork 0

yizhigai/OpenBOR-fflns

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 5.47 KB
一键复制 编辑 原始数据 按行查看 历史
yizhigai 提交于 2024-05-08 16:01 . 添加大于4g的pak支持
cmake_minimum_required(VERSION 3.0)
#set(CMAKE_VERBOSE_MAKEFILE ON)
# delete cmake cache folder before changing this options
option(BUILD_SDL1 "Build with SDL1 support" OFF)
option(BUILD_SDL2 "Build with SDL2 support" OFF)
option(BUILD_PSP2 "Build with PSP2 support" ON)
option(BUILD_NX "Build with NX (SWITCH) support" OFF)
option(BUILD_GFX "Build with GFX support" OFF)
option(BUILD_TREMOR "Build with TREMOR support" ON)
option(BUILD_VORBIS "Build with VORBIS support" OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD_DEBUG true CACHE BOOL "Debug build")
endif ()
# setup toolchain
include(Toolchain.cmake)
project(OpenBOR-LNS)
##############
# COMMON
##############
set(BOR_INC
engine
engine/source
engine/source/adpcmlib
engine/source/gamelib
engine/source/preprocessorlib
engine/source/ramlib
engine/source/randlib
engine/source/scriptlib
engine/source/openborscript
engine/source/pnglib
)
file(GLOB BOR_SRC
engine/*.c
engine/source/*.c
engine/source/adpcmlib/*.c
engine/source/gamelib/*.c
engine/source/preprocessorlib/*.c
engine/source/ramlib/*.c
engine/source/randlib/*.c
engine/source/scriptlib/*.c
engine/source/openborscript/*.c
engine/source/pnglib/*.c
)
set(BOR_CFLAGS
-g -Wall -fsigned-char
-D_FILE_OFFSET_BITS=64
)
set(BOR_LDFLAGS
png z m
)
#####################
# OPTIONS
#####################
if (NOT BUILD_DEBUG)
list(APPEND BOR_CFLAGS
-O3 -fno-ident -freorder-blocks
)
endif ()
if (BUILD_GFX)
list(APPEND BOR_INC engine/source/gfxlib)
file(GLOB GFX_SRC engine/source/gfxlib/*.c)
list(APPEND BOR_SRC ${GFX_SRC})
endif (BUILD_GFX)
if (BUILD_VORBIS)
list(APPEND BOR_CFLAGS -DOV_EXCLUDE_STATIC_CALLBACKS)
list(APPEND BOR_LDFLAGS vorbisfile vorbis ogg)
endif (BUILD_VORBIS)
if (BUILD_TREMOR)
list(APPEND BOR_CFLAGS -DTREMOR)
list(APPEND BOR_LDFLAGS vorbisidec ogg)
endif (BUILD_TREMOR)
#####################
# PLATORM SPECIFIC
#####################
if (BUILD_PSP2)
#####################
# PSP2 PLATORM
#####################
list(REMOVE_ITEM BOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/engine/source/gamelib/filters.c)
list(APPEND BOR_INC engine/vita engine/vita/include engine/vita/include/shader engine/vita/libvita2d)
file(GLOB PSP2_SRC engine/vita/*.c)
list(APPEND BOR_SRC ${PSP2_SRC})
list(APPEND BOR_CFLAGS
-DVITA -march=armv7-a -mfpu=neon -mfloat-abi=hard -ffast-math -fcommon
)
link_directories(engine/vita/lib engine/vita/libvita2d/libvita2d)
list(APPEND BOR_LDFLAGS
vita2d vitashaders
SceDisplay_stub SceGxm_stub ScePower_stub
SceSysmodule_stub SceCtrl_stub ScePgf_stub ScePvf_stub
SceCommonDialog_stub SceAudio_stub SceAppMgr_stub
freetype jpeg m
)
elseif (BUILD_NX)
#####################
# NX PLATORM
#####################
# Ryujinx doesn't like original png decoding code.. replace that
list(REMOVE_ITEM BOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/engine/source/pnglib/pngdec.c)
list(APPEND BOR_INC engine/switch)
file(GLOB SWITCH_SRC engine/switch/*.c)
list(APPEND BOR_SRC ${SWITCH_SRC})
list(APPEND BOR_CFLAGS
-DSDL -DSDL2 -DSWITCH -D__SWITCH__
-I${DEVKITPRO}/portlibs/switch/include/SDL2
)
list(APPEND BOR_LDFLAGS
SDL2 nx m
-specs=${DEVKITPRO}/libnx/switch.specs
)
elseif (BUILD_SDL2)
#####################
# SDL2 PLATORM
#####################
elseif (BUILD_SDL1)
#####################
# SDL1 PLATORM
#####################
endif (BUILD_PSP2)
#####################
# OpenBOR executable
#####################
add_executable(${CMAKE_PROJECT_NAME}.elf ${BOR_SRC})
target_include_directories(${CMAKE_PROJECT_NAME}.elf PRIVATE ${BOR_INC})
target_compile_options(${CMAKE_PROJECT_NAME}.elf PRIVATE ${BOR_CFLAGS})
target_link_libraries(${CMAKE_PROJECT_NAME}.elf ${BOR_LDFLAGS})
#####################
# PSP2 (vita) target
#####################
if (BUILD_PSP2)
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d ATTRIBUTE2=12")
add_dependencies(${CMAKE_PROJECT_NAME}.elf libvita2d)
vita_create_self(eboot.bin ${CMAKE_PROJECT_NAME}.elf)
vita_create_vpk(${CMAKE_PROJECT_NAME}.vpk "OPENBORS1" eboot.bin
VERSION "01.30" NAME "${CMAKE_PROJECT_NAME}"
FILE ${CMAKE_SOURCE_DIR}/engine/resources/vita/sce_sys/icon0.png sce_sys/icon0.png
FILE ${CMAKE_SOURCE_DIR}/engine/resources/vita/sce_sys/pic0.png sce_sys/pic0.png
FILE ${CMAKE_SOURCE_DIR}/engine/resources/vita/sce_sys/livearea/contents/bg0.png sce_sys/livearea/contents/bg0.png
FILE ${CMAKE_SOURCE_DIR}/engine/resources/vita/sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
FILE ${CMAKE_SOURCE_DIR}/engine/resources/vita/sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
FILE ${CMAKE_SOURCE_DIR}/engine/resources/font.ttf resources/font.ttf)
add_custom_target(libvita2d
cd ${CMAKE_SOURCE_DIR}/engine/vita/libvita2d/libvita2d && make
)
endif (BUILD_PSP2)
#####################
# NX (SWITCH) target
#####################
if (BUILD_NX)
add_custom_target(${CMAKE_PROJECT_NAME}.nro
DEPENDS ${CMAKE_PROJECT_NAME}.elf
COMMAND elf2nro ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.nro)
endif (BUILD_NX)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yizhigai/openbor-fflns.git
git@gitee.com:yizhigai/openbor-fflns.git
yizhigai
openbor-fflns
OpenBOR-fflns
master

搜索帮助