|
| 1 | +cmake_minimum_required(VERSION 3.7) |
| 2 | + |
| 3 | +project(RetroEngine) |
| 4 | + |
| 5 | +option(FORCE_CASE_INSENSITIVE "Forces case insensivity." OFF) |
| 6 | +option(RETRO_MOD_LOADER "Enables or disables the mod loader." ON) |
| 7 | +option(RETRO_USE_ORIGINAL_CODE "Removes any change that differs from the original code, a playable game can't be built this way." OFF) |
| 8 | + |
| 9 | +set(RETRO_SDL_VERSION 2 CACHE STRING "Select between SDL2 and SDL1, defaults to SDL2") |
| 10 | + |
| 11 | +if(RETRO_ORIGINAL_CODE) |
| 12 | + set(RETRO_MOD_LOADER OFF) |
| 13 | +endif() |
| 14 | + |
| 15 | +set(RETRO_NAME "Nexus") |
| 16 | + |
| 17 | +set(RETRO_OUTPUT_NAME ${RETRO_NAME} CACHE STRING "The exported name of the executable.") |
| 18 | + |
| 19 | +set(RETRO_FILES |
| 20 | + Nexus/Animation.cpp |
| 21 | + Nexus/Audio.cpp |
| 22 | + Nexus/Collision.cpp |
| 23 | + Nexus/Debug.cpp |
| 24 | + Nexus/Drawing.cpp |
| 25 | + Nexus/Ini.cpp |
| 26 | + Nexus/Input.cpp |
| 27 | + Nexus/fcaseopen.c |
| 28 | + Nexus/main.cpp |
| 29 | + Nexus/Math.cpp |
| 30 | + Nexus/Object.cpp |
| 31 | + Nexus/Palette.cpp |
| 32 | + Nexus/Player.cpp |
| 33 | + Nexus/Reader.cpp |
| 34 | + Nexus/RetroEngine.cpp |
| 35 | + Nexus/Scene.cpp |
| 36 | + Nexus/Script.cpp |
| 37 | + Nexus/Sprite.cpp |
| 38 | + Nexus/String.cpp |
| 39 | + Nexus/Text.cpp |
| 40 | + Nexus/Userdata.cpp |
| 41 | + Nexus/Video.cpp |
| 42 | +) |
| 43 | + |
| 44 | +if(NOT PLATFORM) |
| 45 | + if(WIN32) # THIS ASSUMES VCPKG OR SOURCES !!!!!!! |
| 46 | + set(PLATFORM "Windows" CACHE STRING "The platform to compile for.") |
| 47 | + elseif(ANDROID) |
| 48 | + set(PLATFORM "Android" CACHE STRING "The platform to compile for.") |
| 49 | + else() |
| 50 | + set(PLATFORM ${CMAKE_SYSTEM_NAME} CACHE STRING "The platform to compile for.") |
| 51 | + endif() |
| 52 | +endif() |
| 53 | + |
| 54 | +include(platforms/${PLATFORM}.cmake) |
| 55 | + |
| 56 | +set_target_properties(RetroEngine PROPERTIES OUTPUT_NAME ${RETRO_OUTPUT_NAME}) |
| 57 | + |
| 58 | +if(COMPILE_OGG) |
| 59 | + set(OGG_DIR dependencies/${DEP_PATH}/libogg) |
| 60 | + add_library( |
| 61 | + libogg |
| 62 | + STATIC |
| 63 | + ${OGG_DIR}/src/bitwise.c |
| 64 | + ${OGG_DIR}/src/framing.c |
| 65 | + ) |
| 66 | + |
| 67 | + target_compile_options(libogg PRIVATE ${OGG_FLAGS}) |
| 68 | + |
| 69 | + target_include_directories(libogg PRIVATE ${OGG_DIR}/include) |
| 70 | + target_include_directories(RetroEngine PRIVATE ${OGG_DIR}/include) |
| 71 | + target_link_libraries(RetroEngine libogg) |
| 72 | +endif() |
| 73 | + |
| 74 | +if(COMPILE_VORBIS) |
| 75 | + set(VORBIS_DIR dependencies/${DEP_PATH}/libvorbis) |
| 76 | + set(OGG_DIR dependencies/${DEP_PATH}/libogg) |
| 77 | + add_library(libvorbis STATIC |
| 78 | + ${VORBIS_DIR}/lib/analysis.c |
| 79 | + ${VORBIS_DIR}/lib/barkmel.c |
| 80 | + ${VORBIS_DIR}/lib/bitrate.c |
| 81 | + ${VORBIS_DIR}/lib/block.c |
| 82 | + ${VORBIS_DIR}/lib/codebook.c |
| 83 | + ${VORBIS_DIR}/lib/envelope.c |
| 84 | + ${VORBIS_DIR}/lib/floor0.c |
| 85 | + ${VORBIS_DIR}/lib/floor1.c |
| 86 | + ${VORBIS_DIR}/lib/info.c |
| 87 | + ${VORBIS_DIR}/lib/lookup.c |
| 88 | + ${VORBIS_DIR}/lib/lpc.c |
| 89 | + ${VORBIS_DIR}/lib/lsp.c |
| 90 | + ${VORBIS_DIR}/lib/mapping0.c |
| 91 | + ${VORBIS_DIR}/lib/mdct.c |
| 92 | + ${VORBIS_DIR}/lib/psy.c |
| 93 | + ${VORBIS_DIR}/lib/registry.c |
| 94 | + ${VORBIS_DIR}/lib/res0.c |
| 95 | + ${VORBIS_DIR}/lib/sharedbook.c |
| 96 | + ${VORBIS_DIR}/lib/smallft.c |
| 97 | + ${VORBIS_DIR}/lib/synthesis.c |
| 98 | + ${VORBIS_DIR}/lib/tone.c |
| 99 | + ${VORBIS_DIR}/lib/vorbisenc.c |
| 100 | + ${VORBIS_DIR}/lib/vorbisfile.c |
| 101 | + ${VORBIS_DIR}/lib/window.c |
| 102 | + ) |
| 103 | + |
| 104 | + target_compile_options(libvorbis PRIVATE ${VORBIS_FLAGS}) |
| 105 | + |
| 106 | + target_include_directories(libvorbis |
| 107 | + PRIVATE |
| 108 | + ${VORBIS_DIR}/include |
| 109 | + ${VORBIS_DIR}/lib |
| 110 | + ${OGG_DIR}/include |
| 111 | + ) |
| 112 | + target_include_directories(RetroEngine PRIVATE ${VORBIS_DIR}/include) |
| 113 | + target_link_libraries(RetroEngine libvorbis libogg) |
| 114 | +endif() |
| 115 | + |
| 116 | +if(COMPILE_THEORA) |
| 117 | + set(THEORA_DIR dependencies/${DEP_PATH}/libtheora) |
| 118 | + |
| 119 | + add_library(libtheora STATIC |
| 120 | + ${THEORA_DIR}/lib/analyze.c |
| 121 | + ${THEORA_DIR}/lib/apiwrapper.c |
| 122 | + ${THEORA_DIR}/lib/bitpack.c |
| 123 | + ${THEORA_DIR}/lib/cpu.c |
| 124 | + ${THEORA_DIR}/lib/decapiwrapper.c |
| 125 | + ${THEORA_DIR}/lib/decinfo.c |
| 126 | + ${THEORA_DIR}/lib/decode.c |
| 127 | + ${THEORA_DIR}/lib/dequant.c |
| 128 | + ${THEORA_DIR}/lib/encapiwrapper.c |
| 129 | + ${THEORA_DIR}/lib/encfrag.c |
| 130 | + ${THEORA_DIR}/lib/encinfo.c |
| 131 | + ${THEORA_DIR}/lib/encode.c |
| 132 | + ${THEORA_DIR}/lib/encoder_disabled.c |
| 133 | + ${THEORA_DIR}/lib/enquant.c |
| 134 | + ${THEORA_DIR}/lib/fdct.c |
| 135 | + ${THEORA_DIR}/lib/fragment.c |
| 136 | + ${THEORA_DIR}/lib/huffdec.c |
| 137 | + ${THEORA_DIR}/lib/huffenc.c |
| 138 | + ${THEORA_DIR}/lib/idct.c |
| 139 | + ${THEORA_DIR}/lib/info.c |
| 140 | + ${THEORA_DIR}/lib/internal.c |
| 141 | + ${THEORA_DIR}/lib/mathops.c |
| 142 | + ${THEORA_DIR}/lib/mcenc.c |
| 143 | + ${THEORA_DIR}/lib/quant.c |
| 144 | + ${THEORA_DIR}/lib/rate.c |
| 145 | + ${THEORA_DIR}/lib/state.c |
| 146 | + ${THEORA_DIR}/lib/tokenize.c |
| 147 | + ) |
| 148 | + |
| 149 | + target_compile_options(libtheora PRIVATE ${THEORA_FLAGS}) |
| 150 | + |
| 151 | + target_include_directories(libtheora PRIVATE ${THEORA_DIR}/include ${OGG_DIR}/include) |
| 152 | + target_include_directories(RetroEngine PRIVATE ${THEORA_DIR}/include) |
| 153 | + target_link_libraries(RetroEngine libtheora) |
| 154 | +endif() |
| 155 | + |
| 156 | +target_include_directories(RetroEngine PRIVATE |
| 157 | + Nexus/ |
| 158 | +) |
| 159 | + |
| 160 | +if(DEFINED DEP_PATH) |
| 161 | + target_include_directories(RetroEngine PRIVATE |
| 162 | + dependencies/${DEP_PATH}/ |
| 163 | + ) |
| 164 | +endif() |
| 165 | + |
| 166 | + |
| 167 | +target_compile_definitions(RetroEngine PRIVATE |
| 168 | + RETRO_USE_MOD_LOADER=$<BOOL:${RETRO_USE_MOD_LOADER}> |
| 169 | + FORCE_CASE_INSENSITIVE=$<BOOL:${FORCE_CASE_INSENSITIVE}> |
| 170 | + RETRO_USE_ORIGINAL_CODE=$<BOOL:${RETRO_USE_ORIGINAL_CODE}> |
| 171 | +) |
0 commit comments