|
| 1 | +cmake_minimum_required(VERSION 3.5.1) |
| 2 | + |
| 3 | +# Set all of our output directories. |
| 4 | +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/") |
| 5 | +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/") |
| 6 | + |
| 7 | +set(CMAKE_CXX_STANDARD 11) |
| 8 | +set(CMAKE_C_STANDARD 11) |
| 9 | + |
| 10 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") |
| 11 | +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") |
| 12 | +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") #GCC |
| 13 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-compare -Wno-unused-function -Wno-unused-variable -Wno-format-truncation -Wold-style-declaration") |
| 14 | +endif() |
| 15 | + |
| 16 | +# Get the current working branch |
| 17 | +execute_process( |
| 18 | + COMMAND git rev-parse --abbrev-ref HEAD |
| 19 | + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| 20 | + OUTPUT_VARIABLE GIT_BRANCH |
| 21 | + OUTPUT_STRIP_TRAILING_WHITESPACE |
| 22 | +) |
| 23 | + |
| 24 | +# Get the latest abbreviated commit hash of the working branch |
| 25 | +execute_process( |
| 26 | + COMMAND git log -1 --format=%h |
| 27 | + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| 28 | + OUTPUT_VARIABLE GIT_COMMIT_HASH |
| 29 | + OUTPUT_STRIP_TRAILING_WHITESPACE |
| 30 | +) |
| 31 | + |
| 32 | +# Get the number of commits on the working branch |
| 33 | +execute_process( |
| 34 | + COMMAND git rev-list HEAD --count |
| 35 | + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| 36 | + OUTPUT_VARIABLE GIT_COMMIT_COUNT |
| 37 | + OUTPUT_STRIP_TRAILING_WHITESPACE |
| 38 | +) |
| 39 | + |
| 40 | +add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}") |
| 41 | +add_definitions(-DGIT_COMMIT_COUNT="${GIT_COMMIT_COUNT}") |
| 42 | +add_definitions(-DGIT_BRANCH="${GIT_BRANCH}") |
| 43 | + |
| 44 | +add_subdirectory(rott/audiolib) |
| 45 | + |
| 46 | +project(hrotte) |
| 47 | + |
| 48 | +add_executable(hrotte |
| 49 | + rott/byteordr.c |
| 50 | + rott/cin_actr.c |
| 51 | + rott/cin_efct.c |
| 52 | + rott/cin_evnt.c |
| 53 | + rott/cin_glob.c |
| 54 | + rott/cin_main.c |
| 55 | + rott/cin_util.c |
| 56 | + rott/dosutil.c |
| 57 | + rott/dukemusc.c |
| 58 | + rott/engine.c |
| 59 | + rott/isr.c |
| 60 | + rott/modexlib.c |
| 61 | + rott/rt_actor.c |
| 62 | + rott/rt_battl.c |
| 63 | + rott/rt_cfg.c |
| 64 | + rott/rt_com.c |
| 65 | + rott/rt_crc.c |
| 66 | + rott/rt_debug.c |
| 67 | + rott/rt_dmand.c |
| 68 | + rott/rt_door.c |
| 69 | + rott/rt_draw.c |
| 70 | + rott/rt_err.c |
| 71 | + rott/rt_floor.c |
| 72 | + rott/rt_game.c |
| 73 | + rott/rt_in.c |
| 74 | + rott/rt_main.c |
| 75 | + rott/rt_map.c |
| 76 | + rott/rt_menu.c |
| 77 | + rott/rt_msg.c |
| 78 | + rott/rt_net.c |
| 79 | + rott/rt_playr.c |
| 80 | + rott/rt_rand.c |
| 81 | + rott/rt_scale.c |
| 82 | + rott/rt_sound.c |
| 83 | + rott/rt_spbal.c |
| 84 | + rott/rt_sqrt.c |
| 85 | + rott/rt_stat.c |
| 86 | + rott/rt_state.c |
| 87 | + rott/rt_str.c |
| 88 | + rott/rt_swift.c |
| 89 | + rott/rt_ted.c |
| 90 | + rott/rt_util.c |
| 91 | + rott/rt_vid.c |
| 92 | + rott/rt_view.c |
| 93 | + rott/scriplib.c |
| 94 | + rott/watcom.c |
| 95 | + rott/winrott.c |
| 96 | + rott/w_wad.c |
| 97 | + rott/z_zone.c |
| 98 | + ) |
| 99 | + |
| 100 | +target_link_libraries(hrotte audiolib SDL2) |
0 commit comments