2021-08-04 22:33:55 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
enable_language(CXX)
|
|
|
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
project(Mario)
|
|
|
|
|
2021-08-05 19:21:25 +00:00
|
|
|
if(APPLE)
|
|
|
|
include_directories(/usr/local/include)
|
|
|
|
link_directories(/usr/local/lib)
|
|
|
|
endif()
|
|
|
|
|
2021-08-04 22:33:55 +00:00
|
|
|
list(APPEND CommonFiles
|
|
|
|
global_vars.cpp
|
|
|
|
sprites.cpp
|
|
|
|
maploader.cpp
|
|
|
|
mapobject.cpp
|
|
|
|
blocks/simpleblocks.cpp
|
|
|
|
mario.cpp
|
|
|
|
blocks.cpp
|
|
|
|
)
|
2021-08-05 16:00:47 +00:00
|
|
|
|
2021-08-05 17:16:12 +00:00
|
|
|
list(APPEND SDLLibs
|
|
|
|
sdlpp)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
list(APPEND CommonFiles
|
|
|
|
../sdlpp/SDL2/SDL2_framerate.c
|
|
|
|
../sdlpp/SDL2/SDL2_gfxPrimitives.c
|
|
|
|
../sdlpp/SDL2/SDL2_imageFilter.c
|
|
|
|
../sdlpp/SDL2/SDL2_rotozoom.c
|
|
|
|
)
|
|
|
|
add_library(SDL2_m STATIC IMPORTED)
|
|
|
|
set_target_properties(SDL2_m PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../sdlpp/SDL2.lib)
|
|
|
|
add_library(SDL2_ttf_m STATIC IMPORTED)
|
|
|
|
set_target_properties(SDL2_ttf_m PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../sdlpp/SDL2_ttf.lib)
|
|
|
|
add_library(SDL2_image_m STATIC IMPORTED)
|
|
|
|
set_target_properties(SDL2_image_m PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../sdlpp/SDL2_image.lib)
|
|
|
|
add_executable(mario WIN32)
|
|
|
|
add_executable(editor WIN32)
|
|
|
|
list(APPEND SDLLibs
|
|
|
|
SDL2_m
|
|
|
|
SDL2_image_m
|
|
|
|
SDL2_ttf_m
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_executable(mario)
|
|
|
|
add_executable(editor)
|
|
|
|
list(APPEND SDLLibs
|
|
|
|
SDL2
|
|
|
|
SDL2_image
|
|
|
|
SDL2_ttf
|
|
|
|
SDL2_gfx
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-08-05 16:00:47 +00:00
|
|
|
add_subdirectory(../sdlpp sdlpp)
|
2021-08-04 22:33:55 +00:00
|
|
|
|
2021-08-05 17:16:12 +00:00
|
|
|
target_sources(mario
|
|
|
|
PRIVATE ${CommonFiles}
|
|
|
|
PRIVATE main.cpp
|
|
|
|
PRIVATE visitors/mario_visitor.cpp
|
|
|
|
PRIVATE visitors/bounce_visitor.cpp
|
|
|
|
PRIVATE visitors/visitor_generator.cpp
|
|
|
|
PRIVATE blocks/coinblock.cpp
|
|
|
|
)
|
2021-08-04 22:33:55 +00:00
|
|
|
|
2021-08-05 17:16:12 +00:00
|
|
|
target_sources(editor
|
|
|
|
PRIVATE ${CommonFiles}
|
|
|
|
PRIVATE blocks/coineditorblock.cpp
|
|
|
|
PRIVATE editor.cpp
|
|
|
|
PRIVATE edit_box.cpp
|
|
|
|
PRIVATE tool_box.cpp
|
|
|
|
PRIVATE editor_visitor.cpp
|
|
|
|
)
|
2021-08-04 22:33:55 +00:00
|
|
|
|
|
|
|
target_compile_definitions(editor PUBLIC EDITOR)
|
|
|
|
|
2021-08-05 17:16:12 +00:00
|
|
|
target_link_libraries(mario PRIVATE ${SDLLibs} Threads::Threads)
|
|
|
|
target_link_libraries(editor PRIVATE ${SDLLibs} Threads::Threads)
|
2021-08-04 22:33:55 +00:00
|
|
|
|
|
|
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/testfont.ttf ${CMAKE_CURRENT_SOURCE_DIR}/sprites DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|