diff --git a/BUILDING-cmake.md b/BUILDING-cmake.md new file mode 100644 index 000000000..fb541acd2 --- /dev/null +++ b/BUILDING-cmake.md @@ -0,0 +1,69 @@ +libpng and zlib will be used from VCPKG. +My vcpkg is located at d:/VCPKG +I also created a new triplet to be used. + +~~~ +x64-windows-v142: +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_PLATFORM_TOOLSET v142) +~~~ + +prepare libpng: +~~~ +D:\vcpkg\vcpkg.exe install libpng --triple=x86-windows-v142 +~~~ + +~~~ +git clone https://github.com/th-2021/Shipwright-cmake.git +# +# build SoH +# +cd shipwright-cmake +cd OTRExporter +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 "-DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows-v142" +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --config Release +# copy ROM for asset extraction +#.\extract_assets.py +cd ../soh +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/Win32" -G "Visual Studio 17 2022" -T v142 -A Win32 "-DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=x86-windows-v142" +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\Win32 --config Release +~~~ + +Linux (Ubuntu 22.04): + +using native build (not docker) + +As long as Linux is not merged, you need to apply the changes to Random's repo as follows: +~~~ +git clone -b linux https://github.com/Random06457/ShipWright.git Shipwright-random +wget https://github.com/HarbourMasters/Shipwright/pull/260.patch +cd Shipwright-random +patch -p1 < ../260.patch +~~~ + +~~~ +cd ShipWright +git clone https://github.com/ladislav-zezula/StormLib external/StormLib +git clone https://github.com/Perlmint/glew-cmake.git external/glew +~~~ + +(will be built with below cmake commands) - no extra build needed + +~~~ +cd OTRExporter + +# change the path to ZAPD in extract_assets.py +sed "s%../ZAPDTR/ZAPD.out%build-cmake/ZAPD/ZAPD%" < extract_assets.py > extract_assets_cmake.py +chmod +x extract_assets_cmake.py + +cmake -S . -B build-cmake +cmake --build build-cmake + +./extract_assets_cmake.py + +cd ../soh +cmake -S . -B build-cmake -DCMAKE_TOOLCHAIN_FILE=CMake/Linux32bit-toolchain.cmake +cmake --build build-cmake +~~~ diff --git a/ZAPDTR/ZAPD/CMakeLists.txt b/ZAPDTR/ZAPD/CMakeLists.txt new file mode 100644 index 000000000..b2a433139 --- /dev/null +++ b/ZAPDTR/ZAPD/CMakeLists.txt @@ -0,0 +1,442 @@ +set(PROJECT_NAME ZAPD) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files + "../lib/tinyxml2/tinyxml2.h" + "CRC32.h" + "Declaration.h" + "FileWorker.h" + "GameConfig.h" + "Globals.h" + "ImageBackend.h" + "OutputFormatter.h" + "WarningHandler.h" +) +source_group("Header Files" FILES ${Header_Files}) + +set(Header_Files__Libraries + "../../libultraship/libultraship/Lib/stb/stb_image.h" + "../../libultraship/libultraship/Lib/stb/stb_image_write.h" + "ctpl_stl.h" +) +source_group("Header Files\\Libraries" FILES ${Header_Files__Libraries}) + +set(Header_Files__Libraries__elfio + "../lib/elfio/elfio/elf_types.hpp" + "../lib/elfio/elfio/elfio.hpp" + "../lib/elfio/elfio/elfio_dump.hpp" + "../lib/elfio/elfio/elfio_dynamic.hpp" + "../lib/elfio/elfio/elfio_header.hpp" + "../lib/elfio/elfio/elfio_note.hpp" + "../lib/elfio/elfio/elfio_relocation.hpp" + "../lib/elfio/elfio/elfio_section.hpp" + "../lib/elfio/elfio/elfio_segment.hpp" + "../lib/elfio/elfio/elfio_strings.hpp" + "../lib/elfio/elfio/elfio_symbols.hpp" + "../lib/elfio/elfio/elfio_utils.hpp" +) +source_group("Header Files\\Libraries\\elfio" FILES ${Header_Files__Libraries__elfio}) + +set(Header_Files__Libraries__libgfxd + "../lib/libgfxd/gbi.h" + "../lib/libgfxd/gfxd.h" + "../lib/libgfxd/priv.h" +) +source_group("Header Files\\Libraries\\libgfxd" FILES ${Header_Files__Libraries__libgfxd}) + +set(Header_Files__Yaz0 + "yaz0/readwrite.h" + "yaz0/yaz0.h" +) +source_group("Header Files\\Yaz0" FILES ${Header_Files__Yaz0}) + +set(Header_Files__Z64 + "OtherStructs/SkinLimbStructs.h" + "Overlays/ZOverlay.h" + "ZAnimation.h" + "ZArray.h" + "ZBackground.h" + "ZBlob.h" + "ZCollision.h" + "ZCutscene.h" + "ZCutsceneMM.h" + "ZDisplayList.h" + "ZFile.h" + "ZLimb.h" + "ZMtx.h" + "ZPath.h" + "ZPlayerAnimationData.h" + "ZResource.h" + "ZRom.h" + "ZScalar.h" + "ZSkeleton.h" + "ZString.h" + "ZSymbol.h" + "ZText.h" + "ZTexture.h" + "ZTextureAnimation.h" + "ZVector.h" + "ZVtx.h" +) +source_group("Header Files\\Z64" FILES ${Header_Files__Z64}) + +set(Header_Files__Z64__ZRoom + "ZRoom/ZRoom.h" + "ZRoom/ZRoomCommand.h" +) +source_group("Header Files\\Z64\\ZRoom" FILES ${Header_Files__Z64__ZRoom}) + +set(Header_Files__Z64__ZRoom__Commands + "ZRoom/Commands/EndMarker.h" + "ZRoom/Commands/SetActorCutsceneList.h" + "ZRoom/Commands/SetActorList.h" + "ZRoom/Commands/SetAlternateHeaders.h" + "ZRoom/Commands/SetAnimatedMaterialList.h" + "ZRoom/Commands/SetCameraSettings.h" + "ZRoom/Commands/SetCollisionHeader.h" + "ZRoom/Commands/SetCsCamera.h" + "ZRoom/Commands/SetCutscenes.h" + "ZRoom/Commands/SetEchoSettings.h" + "ZRoom/Commands/SetEntranceList.h" + "ZRoom/Commands/SetExitList.h" + "ZRoom/Commands/SetLightingSettings.h" + "ZRoom/Commands/SetLightList.h" + "ZRoom/Commands/SetMesh.h" + "ZRoom/Commands/SetMinimapChests.h" + "ZRoom/Commands/SetMinimapList.h" + "ZRoom/Commands/SetObjectList.h" + "ZRoom/Commands/SetPathways.h" + "ZRoom/Commands/SetRoomBehavior.h" + "ZRoom/Commands/SetRoomList.h" + "ZRoom/Commands/SetSkyboxModifier.h" + "ZRoom/Commands/SetSkyboxSettings.h" + "ZRoom/Commands/SetSoundSettings.h" + "ZRoom/Commands/SetSpecialObjects.h" + "ZRoom/Commands/SetStartPositionList.h" + "ZRoom/Commands/SetTimeSettings.h" + "ZRoom/Commands/SetTransitionActorList.h" + "ZRoom/Commands/SetWind.h" + "ZRoom/Commands/SetWorldMapVisited.h" + "ZRoom/Commands/Unused09.h" + "ZRoom/Commands/Unused1D.h" + "ZRoom/Commands/ZRoomCommandUnk.h" +) +source_group("Header Files\\Z64\\ZRoom\\Commands" FILES ${Header_Files__Z64__ZRoom__Commands}) + +set(Resource_Files + "../../OTRExporter/CFG/SymbolMap_OoTMqDbg.txt" +) +source_group("Resource Files" FILES ${Resource_Files}) + +set(Source_Files + "Declaration.cpp" + "FileWorker.cpp" + "GameConfig.cpp" + "Globals.cpp" + "ImageBackend.cpp" + "Main.cpp" + "OutputFormatter.cpp" + "WarningHandler.cpp" +) +source_group("Source Files" FILES ${Source_Files}) + +set(Source_Files__Libraries__libgfxd + "../lib/libgfxd/gfxd.c" + "../lib/libgfxd/uc.c" + "../lib/libgfxd/uc_f3d.c" + "../lib/libgfxd/uc_f3db.c" + "../lib/libgfxd/uc_f3dex.c" + "../lib/libgfxd/uc_f3dex2.c" + "../lib/libgfxd/uc_f3dexb.c" +) +source_group("Source Files\\Libraries\\libgfxd" FILES ${Source_Files__Libraries__libgfxd}) + +set(Source_Files__Yaz0 + "yaz0/yaz0.cpp" +) +source_group("Source Files\\Yaz0" FILES ${Source_Files__Yaz0}) + +set(Source_Files__Z64 + "OtherStructs/SkinLimbStructs.cpp" + "Overlays/ZOverlay.cpp" + "ZAnimation.cpp" + "ZArray.cpp" + "ZBackground.cpp" + "ZBlob.cpp" + "ZCollision.cpp" + "ZCutscene.cpp" + "ZCutsceneMM.cpp" + "ZDisplayList.cpp" + "ZFile.cpp" + "ZLimb.cpp" + "ZMtx.cpp" + "ZPath.cpp" + "ZPlayerAnimationData.cpp" + "ZResource.cpp" + "ZRom.cpp" + "ZScalar.cpp" + "ZSkeleton.cpp" + "ZString.cpp" + "ZSymbol.cpp" + "ZText.cpp" + "ZTexture.cpp" + "ZTextureAnimation.cpp" + "ZVector.cpp" + "ZVtx.cpp" +) +source_group("Source Files\\Z64" FILES ${Source_Files__Z64}) + +set(Source_Files__Z64__ZRoom + "ZRoom/ZRoom.cpp" + "ZRoom/ZRoomCommand.cpp" +) +source_group("Source Files\\Z64\\ZRoom" FILES ${Source_Files__Z64__ZRoom}) + +set(Source_Files__Z64__ZRoom__Commands + "ZRoom/Commands/EndMarker.cpp" + "ZRoom/Commands/SetActorCutsceneList.cpp" + "ZRoom/Commands/SetActorList.cpp" + "ZRoom/Commands/SetAlternateHeaders.cpp" + "ZRoom/Commands/SetAnimatedMaterialList.cpp" + "ZRoom/Commands/SetCameraSettings.cpp" + "ZRoom/Commands/SetCollisionHeader.cpp" + "ZRoom/Commands/SetCsCamera.cpp" + "ZRoom/Commands/SetCutscenes.cpp" + "ZRoom/Commands/SetEchoSettings.cpp" + "ZRoom/Commands/SetEntranceList.cpp" + "ZRoom/Commands/SetExitList.cpp" + "ZRoom/Commands/SetLightingSettings.cpp" + "ZRoom/Commands/SetLightList.cpp" + "ZRoom/Commands/SetMesh.cpp" + "ZRoom/Commands/SetMinimapChests.cpp" + "ZRoom/Commands/SetMinimapList.cpp" + "ZRoom/Commands/SetObjectList.cpp" + "ZRoom/Commands/SetPathways.cpp" + "ZRoom/Commands/SetRoomBehavior.cpp" + "ZRoom/Commands/SetRoomList.cpp" + "ZRoom/Commands/SetSkyboxModifier.cpp" + "ZRoom/Commands/SetSkyboxSettings.cpp" + "ZRoom/Commands/SetSoundSettings.cpp" + "ZRoom/Commands/SetSpecialObjects.cpp" + "ZRoom/Commands/SetStartPositionList.cpp" + "ZRoom/Commands/SetTimeSettings.cpp" + "ZRoom/Commands/SetTransitionActorList.cpp" + "ZRoom/Commands/SetWind.cpp" + "ZRoom/Commands/SetWorldMapVisited.cpp" + "ZRoom/Commands/Unused09.cpp" + "ZRoom/Commands/Unused1D.cpp" + "ZRoom/Commands/ZRoomCommandUnk.cpp" +) +source_group("Source Files\\Z64\\ZRoom\\Commands" FILES ${Source_Files__Z64__ZRoom__Commands}) + +set(ALL_FILES + ${Header_Files} + ${Header_Files__Libraries} + ${Header_Files__Libraries__elfio} + ${Header_Files__Libraries__libgfxd} + ${Header_Files__Yaz0} + ${Header_Files__Z64} + ${Header_Files__Z64__ZRoom} + ${Header_Files__Z64__ZRoom__Commands} + ${Resource_Files} + ${Source_Files} + ${Source_Files__Libraries__libgfxd} + ${Source_Files__Yaz0} + ${Source_Files__Z64} + ${Source_Files__Z64__ZRoom} + ${Source_Files__Z64__ZRoom__Commands} + ${any__any} +) + +################################################################################ +# Target +################################################################################ +add_executable(${PROJECT_NAME} ${ALL_FILES}) + +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +################################################################################ +# Includes for CMake from *.props +################################################################################ +#use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "../../OTRExporter/packages/YY.NuGet.Import.Helper.1.0.0.4/build/native/YY.NuGet.Import.Helper.cmake") + +set(ROOT_NAMESPACE ZAPD) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "_CRT_SECURE_NO_WARNINGS;" + "_MBCS" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_CRT_SECURE_NO_WARNINGS" + ">" + "_MBCS" + ) + endif() +endif() + +################################################################################ +# Compile and link options +################################################################################ + +find_package(PNG REQUIRED) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${PROJECT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils + ${PROJECT_SOURCE_DIR}/../ZAPDTR/lib/tinyxml2 + ${PROJECT_SOURCE_DIR}/../ZAPDTR/lib/libgfxd + ${PNG_PNG_INCLUDE_DIR}/ + . + $(IncludePath) + ) + +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od; + /RTC1 + > + $<$: + /Oi; + /Gy + > + /permissive-; + /std:c++17; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /std:c++17; + /Od + > + $<$: + /O2; + /Oi; + /Gy + > + /permissive-; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /PROFILE + > + $<$: + /OPT:REF; + /OPT:ICF + > + /DEBUG:FULL + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /PROFILE + > + $<$: + /OPT:REF; + /OPT:ICF + > + /DEBUG:FULL + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + $<$:-Wno-deprecated-enum-enum-conversion> + ) + + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + -Wl,-export-dynamic + ) + +endif() + +################################################################################ +# Dependencies +################################################################################ +add_dependencies(${PROJECT_NAME} + OTRExporter + ZAPDUtils + libultraship +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + #set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:${PROJECT_SOURCE_DIR}/x64/Release/OTRExporter.lib") + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + "-WHOLEARCHIVE:${PROJECT_SOURCE_DIR}/x64/Release/OTRExporter.lib" + "libultraship;" + PNG::PNG + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/StormLibRUS64.lib + ) + endif() +else() + find_package(BZip2 REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + -Wl,--whole-archive ${PROJECT_BINARY_DIR}/OTRExporter/libOTRExporter.a -Wl,--no-whole-archive + "libultraship;" + storm + PNG::PNG + BZip2::BZip2 + ) +endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}") diff --git a/libultraship/libultraship/CMakeLists.txt b/libultraship/libultraship/CMakeLists.txt new file mode 100644 index 000000000..8dbcaccee --- /dev/null +++ b/libultraship/libultraship/CMakeLists.txt @@ -0,0 +1,504 @@ +set(PROJECT_NAME libultraship) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files__Resources__Factories + "Factories/AnimationFactory.h" + "Factories/ArrayFactory.h" + "Factories/BlobFactory.h" + "Factories/CollisionHeaderFactory.h" + "Factories/CutsceneFactory.h" + "Factories/DisplayListFactory.h" + "Factories/MaterialFactory.h" + "Factories/MtxFactory.h" + "Factories/PathFactory.h" + "Factories/PlayerAnimationFactory.h" + "Factories/SceneFactory.h" + "Factories/SkeletonFactory.h" + "Factories/SkeletonLimbFactory.h" + "Factories/TextFactory.h" + "Factories/TextureFactory.h" + "Factories/VtxFactory.h" +) +source_group("Header Files\\Resources\\Factories" FILES ${Header_Files__Resources__Factories}) + +set(Header_Files__Resources__Files + "Animation.h" + "Array.h" + "Blob.h" + "CollisionHeader.h" + "Cutscene.h" + "DisplayList.h" + "Factories/ResourceLoader.h" + "Material.h" + "Matrix.h" + "Model.h" + "Path.h" + "PlayerAnimation.h" + "Scene.h" + "Skeleton.h" + "SkeletonLimb.h" + "Text.h" + "Texture.h" + "Vertex.h" +) +source_group("Header Files\\Resources\\Files" FILES ${Header_Files__Resources__Files}) + +set(Source_Files__Audio + "abi.h" + "AudioPlayer.h" + "mixer.c" + "mixer.h" + "SDLAudioPlayer.cpp" + "SDLAudioPlayer.h" +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Audio__Windows + "WasapiAudioPlayer.cpp" + "WasapiAudioPlayer.h" +) +endif () + +source_group("Source Files\\Audio" FILES ${Source_Files__Audio} ${Source_Files__Audio__Windows}) + +set(Source_Files__Config + "ConfigFile.cpp" + "ConfigFile.h" +) +source_group("Source Files\\Config" FILES ${Source_Files__Config}) + +set(Source_Files__Controller + "Controller.cpp" + "Controller.h" + "KeyboardController.cpp" + "KeyboardController.h" + "SDLController.cpp" + "SDLController.h" + "UltraController.h" +) +source_group("Source Files\\Controller" FILES ${Source_Files__Controller}) + +set(Source_Files__Controller__Attachment + "ControllerAttachment.cpp" + "ControllerAttachment.h" + "MemoryPack.cpp" + "MemoryPack.h" + "RumblePack.cpp" + "RumblePack.h" +) +source_group("Source Files\\Controller\\Attachment" FILES ${Source_Files__Controller__Attachment}) + +set(Source_Files__CustomImpl + "GameOverlay.cpp" + "GameOverlay.h" + "GameSettings.cpp" + "GameSettings.h" + "SohConsole.cpp" + "SohConsole.h" + "SohImGuiImpl.cpp" + "SohImGuiImpl.h" +) +source_group("Source Files\\CustomImpl" FILES ${Source_Files__CustomImpl}) + +set(Source_Files__CustomImpl__Environment + "Environment.cpp" + "Environment.h" +) +source_group("Source Files\\CustomImpl\\Environment" FILES ${Source_Files__CustomImpl__Environment}) + +set(Source_Files__CustomImpl__Hooks + "SohHooks.cpp" + "SohHooks.h" +) +source_group("Source Files\\CustomImpl\\Hooks" FILES ${Source_Files__CustomImpl__Hooks}) + +set(Source_Files__CustomImpl__Utils + "Utils.cpp" + "Utils.h" +) +source_group("Source Files\\CustomImpl\\Utils" FILES ${Source_Files__CustomImpl__Utils}) + +set(Source_Files__Globals + "Cvar.cpp" + "Cvar.h" + "GlobalCtx2.cpp" + "GlobalCtx2.h" + "LUSMacros.h" + "Window.cpp" + "Window.h" + "WindowShim.cpp" + "WindowShim.h" +) +source_group("Source Files\\Globals" FILES ${Source_Files__Globals}) + +set(Source_Files__Lib + "Lib/mINI/src/mini/ini.h" + "Lib/StrHash64.cpp" + "Lib/StrHash64.h" + "Lib/tinyxml2/tinyxml2.cpp" + "stox.cpp" + "stox.h" +) +source_group("Source Files\\Lib" FILES ${Source_Files__Lib}) + +set(Source_Files__Lib__Fast3D + "Lib/Fast3D/gfx_cc.cpp" + "Lib/Fast3D/gfx_cc.h" + "Lib/Fast3D/gfx_direct3d11.cpp" + "Lib/Fast3D/gfx_direct3d11.h" + "Lib/Fast3D/gfx_direct3d12.cpp" + "Lib/Fast3D/gfx_direct3d12.h" + "Lib/Fast3D/gfx_direct3d12_guids.h" + "Lib/Fast3D/gfx_direct3d_common.cpp" + "Lib/Fast3D/gfx_direct3d_common.h" + "Lib/Fast3D/gfx_dxgi.cpp" + "Lib/Fast3D/gfx_dxgi.h" + "Lib/Fast3D/gfx_glx.cpp" + "Lib/Fast3D/gfx_glx.h" + "Lib/Fast3D/gfx_opengl.cpp" + "Lib/Fast3D/gfx_opengl.h" + "Lib/Fast3D/gfx_pc.cpp" + "Lib/Fast3D/gfx_pc.h" + "Lib/Fast3D/gfx_rendering_api.h" + "Lib/Fast3D/gfx_screen_config.h" + "Lib/Fast3D/gfx_sdl.h" + "Lib/Fast3D/gfx_sdl2.cpp" + "Lib/Fast3D/gfx_window_manager_api.h" +) +source_group("Source Files\\Lib\\Fast3D" FILES ${Source_Files__Lib__Fast3D}) + +set(Source_Files__Lib__ImGui + "Lib/ImGui/backends/imgui_impl_opengl3.cpp" + "Lib/ImGui/backends/imgui_impl_opengl3.h" + "Lib/ImGui/backends/imgui_impl_sdl.cpp" + "Lib/ImGui/backends/imgui_impl_sdl.h" + "Lib/ImGui/imconfig.h" + "Lib/ImGui/imgui.cpp" + "Lib/ImGui/imgui.h" + "Lib/ImGui/imgui_demo.cpp" + "Lib/ImGui/imgui_draw.cpp" + "Lib/ImGui/imgui_internal.h" + "Lib/ImGui/imgui_tables.cpp" + "Lib/ImGui/imgui_widgets.cpp" + "Lib/ImGui/imstb_rectpack.h" + "Lib/ImGui/imstb_textedit.h" + "Lib/ImGui/imstb_truetype.h" +) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Lib__ImGui__Windows + "Lib/ImGui/backends/imgui_impl_dx11.cpp" + "Lib/ImGui/backends/imgui_impl_dx11.h" + "Lib/ImGui/backends/imgui_impl_win32.cpp" + "Lib/ImGui/backends/imgui_impl_win32.h" +) +endif () +source_group("Source Files\\Lib\\ImGui" FILES ${Source_Files__Lib__ImGui} ${Source_Files__Lib__ImGui__Windows}) + +set(Source_Files__Lib__stb + "Lib/stb/stb_image.h" + "Lib/stb/stb_image_write.h" + "Lib/stb/stb_impl.c" +) +source_group("Source Files\\Lib\\stb" FILES ${Source_Files__Lib__stb}) + +set(Source_Files__Lib__tinyxml2 + "Lib/tinyxml2/tinyxml2.h" +) +source_group("Source Files\\Lib\\tinyxml2" FILES ${Source_Files__Lib__tinyxml2}) + +set(Source_Files__Logging + "luslog.cpp" + "luslog.h" +) +source_group("Source Files\\Logging" FILES ${Source_Files__Logging}) + +set(Source_Files__ModManager + "ModManager.cpp" + "ModManager.h" +) +source_group("Source Files\\ModManager" FILES ${Source_Files__ModManager}) + +set(Source_Files__ModManager__ModModule + "ModModule.h" + "TextureMod.cpp" + "TextureMod.h" +) +source_group("Source Files\\ModManager\\ModModule" FILES ${Source_Files__ModManager__ModModule}) + +set(Source_Files__Resources + "GameVersions.h" + "Resource.cpp" + "Resource.h" + "ResourceMgr.cpp" + "ResourceMgr.h" +) +source_group("Source Files\\Resources" FILES ${Source_Files__Resources}) + +set(Source_Files__Resources__Factories + "Factories/AnimationFactory.cpp" + "Factories/ArrayFactory.cpp" + "Factories/BlobFactory.cpp" + "Factories/CollisionHeaderFactory.cpp" + "Factories/CutsceneFactory.cpp" + "Factories/DisplayListFactory.cpp" + "Factories/MaterialFactory.cpp" + "Factories/MtxFactory.cpp" + "Factories/PathFactory.cpp" + "Factories/PlayerAnimationFactory.cpp" + "Factories/ResourceLoader.cpp" + "Factories/SceneFactory.cpp" + "Factories/SkeletonFactory.cpp" + "Factories/SkeletonLimbFactory.cpp" + "Factories/TextFactory.cpp" + "Factories/TextureFactory.cpp" + "Factories/VtxFactory.cpp" +) +source_group("Source Files\\Resources\\Factories" FILES ${Source_Files__Resources__Factories}) + +set(Source_Files__Resources__Files + "Animation.cpp" + "Array.cpp" + "Blob.cpp" + "CollisionHeader.cpp" + "Cutscene.cpp" + "DisplayList.cpp" + "Material.cpp" + "Matrix.cpp" + "Model.cpp" + "Path.cpp" + "PlayerAnimation.cpp" + "Scene.cpp" + "Skeleton.cpp" + "SkeletonLimb.cpp" + "Text.cpp" + "Texture.cpp" + "Vertex.cpp" +) +source_group("Source Files\\Resources\\Files" FILES ${Source_Files__Resources__Files}) + +set(Source_Files__Resources__mpq + "Archive.cpp" + "Archive.h" + "File.cpp" + "File.h" +) +source_group("Source Files\\Resources\\mpq" FILES ${Source_Files__Resources__mpq}) + +set(ALL_FILES + ${Header_Files__Resources__Factories} + ${Header_Files__Resources__Files} + ${Source_Files__Audio} + ${Source_Files__Audio__Windows} + ${Source_Files__Config} + ${Source_Files__Controller} + ${Source_Files__Controller__Attachment} + ${Source_Files__CustomImpl} + ${Source_Files__CustomImpl__Environment} + ${Source_Files__CustomImpl__Hooks} + ${Source_Files__CustomImpl__Utils} + ${Source_Files__Globals} + ${Source_Files__Lib} + ${Source_Files__Lib__Fast3D} + ${Source_Files__Lib__ImGui} + ${Source_Files__Lib__ImGui__Windows} + ${Source_Files__Lib__stb} + ${Source_Files__Lib__tinyxml2} + ${Source_Files__Logging} + ${Source_Files__ModManager} + ${Source_Files__ModManager__ModModule} + ${Source_Files__Resources} + ${Source_Files__Resources__Factories} + ${Source_Files__Resources__Files} + ${Source_Files__Resources__mpq} +) + +################################################################################ +# Target +################################################################################ +add_library(${PROJECT_NAME} STATIC ${ALL_FILES}) + +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +set(ROOT_NAMESPACE libultraship) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "SPDLOG_ACTIVE_LEVEL=0;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_DX11;" + "ENABLE_OPENGL;" + "UNICODE;" + "_UNICODE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "SPDLOG_ACTIVE_LEVEL=0;" + "WIN32;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_OPENGL;" + "ENABLE_DX11;" + "%(PreprocessorDefinitions)GLEW_STATIC;" + "UNICODE;" + "_UNICODE" + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "ENABLE_OPENGL;" + ) +endif() +################################################################################ +# Compile and link options +################################################################################ + +target_include_directories(${PROJECT_NAME} PRIVATE + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/spdlog/include/ + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/ + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/PR + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL + ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/GLEW/ + ${PROJECT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils + . + $(IncludePath) + ) + +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /std:c++latest; + /Oi; + /Gy + > + /permissive-; + /MP; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od; + /Oi-; + /W2 + > + $<$: + /Oi; + /Gy; + /W3 + > + /permissive-; + /MP; + /sdl; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall + -Wextra + -Wno-error + -Wno-unused-variable + -Wno-unused-parameter + -Wno-unused-function + -Wno-parentheses + -Wno-narrowing + -Wno-missing-field-initializers + ) +endif() +################################################################################ +# Dependencies +################################################################################ +# Link with other targets. +