|
| 1 | +cmake_minimum_required(VERSION 3.22) |
| 2 | +project(tetris42 VERSION 1.0.0) |
| 3 | + |
| 4 | +LIST(APPEND SRC tetris42.c) |
| 5 | +IF(WIN32) |
| 6 | + LIST(APPEND SRC tetris42.rc) |
| 7 | +ENDIF() |
| 8 | + |
| 9 | +# Player count names are define via agruments |
| 10 | +add_executable(tetris42 ${SRC}) |
| 11 | +# Players use generic names PLAYERn and below are seperate |
| 12 | +# clickable executables for different number of players |
| 13 | +add_executable(tetris4-1 ${SRC}) |
| 14 | +add_executable(tetris4-2 ${SRC}) |
| 15 | +add_executable(tetris4-3 ${SRC}) |
| 16 | +add_executable(tetris4-4 ${SRC}) |
| 17 | + |
| 18 | +target_compile_definitions(tetris4-1 PUBLIC PLAYERS=1) |
| 19 | +target_compile_definitions(tetris4-2 PUBLIC PLAYERS=2) |
| 20 | +target_compile_definitions(tetris4-3 PUBLIC PLAYERS=3) |
| 21 | +target_compile_definitions(tetris4-4 PUBLIC PLAYERS=4) |
| 22 | + |
| 23 | +set (CMAKE_BUILD_TYPE "Release") |
| 24 | +add_subdirectory(raylib) |
| 25 | + |
| 26 | +find_path(RAYLIB_DIR "raylib.h" HINTS raylib/src) |
| 27 | +include_directories(${RAYLIB_DIR}) |
| 28 | +LIST(APPEND LIBS raylib) |
| 29 | +target_link_libraries(tetris42 ${LIBS}) |
| 30 | +target_link_libraries(tetris4-1 ${LIBS}) |
| 31 | +target_link_libraries(tetris4-2 ${LIBS}) |
| 32 | +target_link_libraries(tetris4-3 ${LIBS}) |
| 33 | +target_link_libraries(tetris4-4 ${LIBS}) |
| 34 | + |
| 35 | +INSTALL(TARGETS tetris42 tetris4-1 tetris4-2 tetris4-3 tetris4-4 |
| 36 | +DESTINATION bin) |
| 37 | + |
| 38 | +# CPack support - |
| 39 | +set(CPACK_GENERATOR "ZIP;TGZ") |
| 40 | +include (CPack) |
0 commit comments