Path: blob/main/CMakeLists.txt
817 views
cmake_minimum_required(VERSION 3.10)12project(RetroEngine)34set(DECOMP_VERSION 1.3.3)56set(RETRO_REVISION 3 CACHE STRING "What revision to compile for. Defaults to Origins = 3")7option(RETRO_FORCE_CASE_INSENSITIVE "Forces case insensivity." OFF)8option(RETRO_MOD_LOADER "Enables or disables the mod loader." ON)9option(RETRO_NETWORKING "Enables or disables networking features used for Sonic 2's 2P VS mode." ON)10option(RETRO_USE_HW_RENDER "Enables usage of the Hardware Render, menus are unplayable without it." ON)11option(RETRO_DISABLE_PLUS "Disables Plus. Should be set on for any public releases." OFF)12option(RETRO_ORIGINAL_CODE "Removes any change that differs from the original code, a playable game can't be built this way." OFF)1314set(RETRO_SDL_VERSION 2 CACHE STRING "Select between SDL2 and SDL1, defaults to SDL2")1516if(RETRO_ORIGINAL_CODE)17set(RETRO_MOD_LOADER OFF)18set(RETRO_NETWORKING OFF)19endif()2021set(RETRO_NAME "RSDKv4")2223set(RETRO_OUTPUT_NAME ${RETRO_NAME} CACHE STRING "The exported name of the executable.")2425set(RETRO_FILES26dependencies/all/tinyxml2/tinyxml2.cpp27RSDKv4/Animation.cpp28RSDKv4/Audio.cpp29RSDKv4/Collision.cpp30RSDKv4/Debug.cpp31RSDKv4/Drawing.cpp32RSDKv4/Ini.cpp33RSDKv4/Input.cpp34RSDKv4/fcaseopen.c35RSDKv4/main.cpp36RSDKv4/Math.cpp37RSDKv4/ModAPI.cpp38RSDKv4/Networking.cpp39RSDKv4/Object.cpp40RSDKv4/Palette.cpp41RSDKv4/Reader.cpp42RSDKv4/Renderer.cpp43RSDKv4/RetroEngine.cpp44RSDKv4/Scene.cpp45RSDKv4/Scene3D.cpp46RSDKv4/Script.cpp47RSDKv4/Sprite.cpp48RSDKv4/String.cpp49RSDKv4/Text.cpp50RSDKv4/Userdata.cpp51RSDKv4/NativeObjects/AboutScreen.cpp52RSDKv4/NativeObjects/AchievementDisplay.cpp53RSDKv4/NativeObjects/AchievementsButton.cpp54RSDKv4/NativeObjects/AchievementsMenu.cpp55RSDKv4/NativeObjects/BackButton.cpp56RSDKv4/NativeObjects/CWSplash.cpp57RSDKv4/NativeObjects/CreditText.cpp58RSDKv4/NativeObjects/DialogPanel.cpp59RSDKv4/NativeObjects/FadeScreen.cpp60RSDKv4/NativeObjects/InstructionsScreen.cpp61RSDKv4/NativeObjects/LeaderboardsButton.cpp62RSDKv4/NativeObjects/MenuBG.cpp63RSDKv4/NativeObjects/MenuControl.cpp64RSDKv4/NativeObjects/ModInfoButton.cpp65RSDKv4/NativeObjects/ModsButton.cpp66RSDKv4/NativeObjects/ModsMenu.cpp67RSDKv4/NativeObjects/MultiplayerButton.cpp68RSDKv4/NativeObjects/MultiplayerHandler.cpp69RSDKv4/NativeObjects/MultiplayerScreen.cpp70RSDKv4/NativeObjects/OptionsButton.cpp71RSDKv4/NativeObjects/OptionsMenu.cpp72RSDKv4/NativeObjects/PauseMenu.cpp73RSDKv4/NativeObjects/PlayerSelectScreen.cpp74RSDKv4/NativeObjects/PushButton.cpp75RSDKv4/NativeObjects/RecordsScreen.cpp76RSDKv4/NativeObjects/RetroGameLoop.cpp77RSDKv4/NativeObjects/SaveSelect.cpp78RSDKv4/NativeObjects/SegaIDButton.cpp79RSDKv4/NativeObjects/SegaSplash.cpp80RSDKv4/NativeObjects/SettingsScreen.cpp81RSDKv4/NativeObjects/StaffCredits.cpp82RSDKv4/NativeObjects/StartGameButton.cpp83RSDKv4/NativeObjects/SubMenuButton.cpp84RSDKv4/NativeObjects/TextLabel.cpp85RSDKv4/NativeObjects/TimeAttack.cpp86RSDKv4/NativeObjects/TimeAttackButton.cpp87RSDKv4/NativeObjects/TitleScreen.cpp88RSDKv4/NativeObjects/VirtualDPad.cpp89RSDKv4/NativeObjects/VirtualDPadM.cpp90RSDKv4/NativeObjects/ZoneButton.cpp91)9293if(NOT PLATFORM)94if(WIN32) # THIS ASSUMES VCPKG OR SOURCES !!!!!!!95set(PLATFORM "Windows" CACHE STRING "The platform to compile for.")96elseif(ANDROID)97set(PLATFORM "Android" CACHE STRING "The platform to compile for.")98else()99set(PLATFORM ${CMAKE_SYSTEM_NAME} CACHE STRING "The platform to compile for.")100endif()101endif()102103include(platforms/${PLATFORM}.cmake)104105set_target_properties(RetroEngine PROPERTIES OUTPUT_NAME ${RETRO_OUTPUT_NAME})106107if(COMPILE_OGG)108set(OGG_DIR dependencies/${DEP_PATH}/libogg)109add_library(110libogg111STATIC112${OGG_DIR}/src/bitwise.c113${OGG_DIR}/src/framing.c114)115116target_compile_options(libogg PRIVATE ${OGG_FLAGS})117118target_include_directories(libogg PRIVATE ${OGG_DIR}/include)119target_include_directories(RetroEngine PRIVATE ${OGG_DIR}/include)120target_link_libraries(RetroEngine libogg)121endif()122123if(COMPILE_VORBIS)124set(VORBIS_DIR dependencies/${DEP_PATH}/libvorbis)125set(OGG_DIR dependencies/${DEP_PATH}/libogg)126add_library(libvorbis STATIC127${VORBIS_DIR}/lib/analysis.c128${VORBIS_DIR}/lib/barkmel.c129${VORBIS_DIR}/lib/bitrate.c130${VORBIS_DIR}/lib/block.c131${VORBIS_DIR}/lib/codebook.c132${VORBIS_DIR}/lib/envelope.c133${VORBIS_DIR}/lib/floor0.c134${VORBIS_DIR}/lib/floor1.c135${VORBIS_DIR}/lib/info.c136${VORBIS_DIR}/lib/lookup.c137${VORBIS_DIR}/lib/lpc.c138${VORBIS_DIR}/lib/lsp.c139${VORBIS_DIR}/lib/mapping0.c140${VORBIS_DIR}/lib/mdct.c141${VORBIS_DIR}/lib/psy.c142${VORBIS_DIR}/lib/registry.c143${VORBIS_DIR}/lib/res0.c144${VORBIS_DIR}/lib/sharedbook.c145${VORBIS_DIR}/lib/smallft.c146${VORBIS_DIR}/lib/synthesis.c147${VORBIS_DIR}/lib/tone.c148${VORBIS_DIR}/lib/vorbisenc.c149${VORBIS_DIR}/lib/vorbisfile.c150${VORBIS_DIR}/lib/window.c151)152153target_compile_options(libvorbis PRIVATE ${VORBIS_FLAGS})154155target_include_directories(libvorbis156PRIVATE157${VORBIS_DIR}/include158${VORBIS_DIR}/lib159${OGG_DIR}/include160)161target_include_directories(RetroEngine PRIVATE ${VORBIS_DIR}/include)162target_link_libraries(RetroEngine libvorbis libogg)163endif()164165target_include_directories(RetroEngine PRIVATE166RSDKv4/167RSDKv4/NativeObjects/168dependencies/all/stb-image/169dependencies/all/tinyxml2/170)171172if(RETRO_NETWORKING)173target_include_directories(RetroEngine PRIVATE174dependencies/all/asio/asio/include/175)176endif()177178if(DEFINED DEP_PATH)179target_include_directories(RetroEngine PRIVATE180dependencies/${DEP_PATH}/181)182endif()183184185target_compile_definitions(RetroEngine PRIVATE186RSDK_REVISION=${RETRO_REVISION}187RETRO_USE_MOD_LOADER=$<BOOL:${RETRO_MOD_LOADER}>188RETRO_USE_NETWORKING=$<BOOL:${RETRO_NETWORKING}>189RETRO_USING_OPENGL=$<BOOL:${RETRO_USE_HW_RENDER}>190RETRO_USE_SDL${RETRO_SDL_VERSION}=1191FORCE_CASE_INSENSITIVE=$<BOOL:${RETRO_FORCE_CASE_INSENSITIVE}>192RETRO_USE_ORIGINAL_CODE=$<BOOL:${RETRO_ORIGINAL_CODE}>193194RSDK_AUTOBUILD=$<BOOL:${RETRO_DISABLE_PLUS}>195196RETRO_DEV_EXTRA="${PLATFORM} - ${CMAKE_CXX_COMPILER_ID}"197DECOMP_VERSION="${DECOMP_VERSION}"198)199200