game/mario/CMakeLists.txt

102 lines
2.5 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)
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
2022-06-21 12:52:36 +00:00
gui/gui.cpp
2021-08-04 22:33:55 +00:00
)
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
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
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})