game/mario/CMakeLists.txt

109 lines
2.7 KiB
CMake
Raw Normal View History

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)
if(APPLE)
2022-08-22 20:38:45 +00:00
include_directories(/opt/homebrew/include)
link_directories(/opt/homebrew/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 17:16:12 +00:00
list(APPEND SDLLibs
sdlpp)
if(WIN32)
2022-06-21 12:52:36 +00:00
list(APPEND CommonFiles
filesystem/windows/filesystem.cpp)
2021-08-05 17:16:12 +00:00
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()
2022-06-21 12:52:36 +00:00
list(APPEND CommonFiles
filesystem/unix/filesystem.cpp)
2021-08-05 17:16:12 +00:00
add_executable(mario)
add_executable(editor)
list(APPEND SDLLibs
SDL2
SDL2_image
SDL2_ttf
SDL2_gfx
)
endif()
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
2021-08-07 19:41:15 +00:00
PRIVATE visitors/mushroom_visitor.cpp
2021-08-08 19:45:05 +00:00
PRIVATE visitors/goomba_visitor.cpp
2021-08-05 17:16:12 +00:00
PRIVATE visitors/bounce_visitor.cpp
PRIVATE visitors/visitor_generator.cpp
PRIVATE blocks/coinblock.cpp
2021-08-07 19:41:15 +00:00
PRIVATE blocks/mushroomblock.cpp
2021-08-08 19:45:05 +00:00
PRIVATE blocks/goombablock.cpp
2022-09-19 20:56:50 +00:00
PRIVATE scenes/load_scene.cpp
PRIVATE scenes/game_main_menu.cpp
PRIVATE editor_visitor.cpp # TODO
PRIVATE edit_box.cpp # TODO
PRIVATE tool_box.cpp # TODO
2021-08-05 17:16:12 +00:00
)
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
2021-08-08 19:45:05 +00:00
PRIVATE blocks/goombablock.cpp
2021-08-05 17:16:12 +00:00
PRIVATE editor.cpp
PRIVATE edit_box.cpp
PRIVATE tool_box.cpp
PRIVATE editor_visitor.cpp
PRIVATE scenes/editor_main.cpp
PRIVATE scenes/editor_main_menu.cpp
2022-07-22 10:23:16 +00:00
PRIVATE scenes/yes_no_scene.cpp
2022-07-22 10:55:09 +00:00
PRIVATE scenes/ok_scene.cpp
PRIVATE scenes/load_scene.cpp
2021-08-05 17:16:12 +00:00
)
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})