Fix segfault on linux (use SDL2_ttf)
Loading font caused a segmentation fault beceause of using SDL_ttf with SDL2 on linux (not compatible) Note: This section might have helped too but was not necessary at the end: --- Locate SDL2_ttf --- find_package(SDL2_ttf REQUIRED) if(SDL2_ttf_FOUND) add_definitions(-DUSE_SDL2_TTF) set(nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf) #message(STATUS "DEBUG: ttf-library found!") endif()
This commit is contained in:
parent
c94f205e47
commit
5c72303409
@ -32,11 +32,7 @@ endif()
|
|||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
|
|
||||||
# --- Locate SDL2_ttf ---
|
# --- Locate SDL2_ttf ---
|
||||||
if(WIN32)
|
|
||||||
find_package(SDL2_ttf REQUIRED)
|
find_package(SDL2_ttf REQUIRED)
|
||||||
else()
|
|
||||||
find_package(SDL_ttf REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#--- Include directories ---
|
#--- Include directories ---
|
||||||
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS} ./include ./src)
|
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS} ./include ./src)
|
||||||
@ -61,7 +57,14 @@ set(SOURCES
|
|||||||
|
|
||||||
|
|
||||||
add_executable(Snake ${SOURCES})
|
add_executable(Snake ${SOURCES})
|
||||||
target_link_libraries(Snake ${SDL2_LIBRARIES} ${SDL_TTF_LIBRARIES})
|
|
||||||
|
|
||||||
|
#--- link libraries ---
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(Snake ${SDL2_LIBRARIES} ${SDL_TTF_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(Snake SDL2::SDL2 SDL2_ttf::SDL2_ttf)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# --- Copy SDL2 DLLs to the output folder on Windows ---
|
# --- Copy SDL2 DLLs to the output folder on Windows ---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user