blob: a34744d3aa5ccd780bcfe65f14ab00108079965f (
plain) (
tree)
|
|
cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_SYSTEM_NAME "Generic")
set(DEVKITPRO $ENV{DEVKITPRO})
set(CMAKE_SYSTEM_PROCESSOR "armv8-a")
set(CMAKE_C_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc")
set(CMAKE_CXX_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++")
set(CMAKE_ASM_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-as")
set(CMAKE_AR "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ar" CACHE STRING "")
set(CMAKE_RANLIB "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ranlib" CACHE STRING "")
set(CMAKE_C_FLAGS "-g -march=armv8-a -mtune=cortex-a57 -mtp=soft -ftls-model=local-exec -fPIC -I${DEVKITPRO}/libnx/include -I${DEVKITPRO}/portlibs/switch/include" CACHE STRING "C flags")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "C++ flags") #-fno-rtti -fno-exceptions
set(CMAKE_FIND_ROOT_PATH ${DEVKITPRO} ${DEVKITPRO}/devkitA64 ${DEVKITPRO}/libnx ${DEVKITPRO}/portlibs/switch)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available")
project(ManaPlus)
file(GLOB SOURCES src/*.cpp)
set(SOURCES_DIRS
src/being
src/enums/being
src/fs
src/gui
src/input
src/listeners
src/net
src/particle
src/progs/manaplus
src/render
src/resources
src/sdl2gfx
src/test
src/utils
)
foreach (DIR ${SOURCES_DIRS})
file(GLOB_RECURSE FILES ${DIR}/*.cpp)
list(APPEND SOURCES ${FILES})
endforeach (DIR)
set(INCLUDES
${DEVKITPRO}/portlibs/switch/include/SDL2
${DEVKITPRO}/portlibs/switch/include/libxml2
src src/sdl2gfx
)
set(FLAGS -DPACKAGE_NAME=\"ManaPlus\" -DPACKAGE_TARNAME=\"manaplus\" -DPACKAGE_VERSION=\"1.9.3.23\"
-DPACKAGE_STRING=\"ManaPlus\ 1.9.3.23\" -DPACKAGE_BUGREPORT=\"akaras@inbox.ru\" -DPACKAGE_URL=\"\"
-DPACKAGE=\"manaplus\" -DVERSION=\"1.9.3.23\" -DTIME_WITH_SYS_TIME=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1
-DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \\*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \\*\)
-DHAVE_VPRINTF=1 -DHAVE_FORK=1 -Dvfork=fork -DHAVE_WORKING_FORK=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1
-DHAVE_SYS_PARAM_H=1 -DHAVE_ATEXIT=1 -DHAVE_FLOOR=1 -DHAVE_GETCWD=1 -DHAVE_GETHOSTBYNAME=1 -DHAVE_MEMSET=1
-DHAVE_MKDIR=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_DUP2=1 -DHAVE_GETTIMEOFDAY=1
-DHAVE_MEMCHR=1 -DHAVE_MEMMOVE=1 -DHAVE_POW=1 -DHAVE_PUTENV=1 -DHAVE_SETENV=1 -DHAVE_SETLOCALE=1
-DHAVE_SQRT=1 -DHAVE_STRCHR=1 -DHAVE_MALLOC_TRIM=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_TIME_H=1
-DHAVE_WCHAR_H=1 -DHAVE_LIBSDL2=1 -DHAVE_LIBSDL2_IMAGE=1 -DHAVE_LIBSDL2_TTF=1 -DHAVE_LIBSDL2_MIXER=1
-DHAVE_LIBSDL2_NET=1 -DUSE_INTERNALSDLGFX=1 -DHAVE_SDL_H=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBZ=1 -DHAVE_LIBCURL=1
-DHAVE_CURL_CURL_H=1 -DHAVE_LIBXML2=1 -DHAVE_LIBXML_XMLREADER_H=1 -DHAVE_LIBPNG=1 -DSTDC_HEADERS=1 -DHAVE_ARPA_INET_H=1
-DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_SYS_SOCKET_H=1 -DHAVE_UNISTD_H=1 -Wall -DENABLE_ASSERTS -DHAVE_GLEXT -DENABLE_LIBXML -DUSE_SDL2 -DTMWA_SUPPORT -DCURL_STATICLIB
-DUSE_OPENGL=1
)
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDES})
target_compile_options(${PROJECT_NAME} PRIVATE -D__SWITCH__ ${FLAGS})
target_link_libraries(${PROJECT_NAME}
png xml2 curl z pthread SDL2_net SDL2_mixer SDL2_ttf SDL2_image SDL2
SDL2_image png16 z m nx z jpeg webp
SDL2_mixer vorbisidec modplug mpg123
opusfile ogg opus
SDL2_net
SDL2_ttf freetype bz2
curl mbedtls mbedx509 mbedcrypto
GLESv2
EGL
glapi
drm_nouveau
nx
stdc++
m
)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS
"-specs=${DEVKITPRO}/libnx/switch.specs -L${DEVKITPRO}/libnx/lib -L${DEVKITPRO}/portlibs/switch/lib")
add_custom_target(${PROJECT_NAME}.nro
DEPENDS ${PROJECT_NAME}
COMMAND elf2nro ${PROJECT_NAME} ${PROJECT_NAME}.nro)
|