isle-portable/3rdparty/d3drm/CMakeLists.txt
Anonymous Maarten 659a54b221
Some checks are pending
Build / Current ${{ matrix.toolchain.name }} (map[clang-tidy:true d3drm-from-wine:true dx5-libs:false msys-env:mingw-w64-i686 msystem:mingw32 name:msys2 mingw32 shell:msys2 {0} werror:true]) (push) Waiting to run
Build / Current ${{ matrix.toolchain.name }} (map[clang-tidy:true d3drm-from-wine:true dx5-libs:false msys-env:mingw-w64-x86_64 msystem:mingw64 name:msys2 mingw64 shell:msys2 {0} werror:true]) (push) Waiting to run
Build / Current ${{ matrix.toolchain.name }} (map[d3drm-from-wine:false dx5-libs:true name:MSVC (32-bit) setup-cmake:true setup-msvc:true setup-ninja:true shell:sh vc-arch:amd64_x86]) (push) Waiting to run
Build / Current ${{ matrix.toolchain.name }} (map[d3drm-from-wine:true dx5-libs:false name:MSVC (64-bit) setup-cmake:true setup-msvc:true setup-ninja:true shell:sh vc-arch:amd64]) (push) Waiting to run
Format / C++ (push) Waiting to run
Naming / C++ (push) Waiting to run
Add support for building x64 executables (#29)
* d3drm: store LPVOID data instead of DWORD

* m_extraCharacterId is an integer, not a pointer

* cmake: look for iniparser using config file first, then try our custom module file

Our custom module file is still useful.
My linux distro does not package the cmake files.

* x86's stdcall becomes MS's x64 calling canvention

* Fix 64-bit mxdsbuffer pointer arithmetic

* Casting from void* to a smaller-sized integer needs an intermediate equally-sized integer

* Don't cast address to scalar (this is fishy)

* Add mingw64 build to the ci matrix

* Ignore -Wdiscarded-qualifiers warning with const vtables

* Ignore different 'const' qualifiers with MSVC

* Create d3dxof import library for MSVC

* DESCRIPTION in .def file(s) is deprecated

* Assume mmx is supported on x64, require a test for x86 and disabled on other archs

* 32- and 64-bit LEGO1.dll export different symbol names

* Introduce d3drm_guid containing the guids of d3drm

* Disable __wine_dbg_cdecl

* Include d3drm directory with EXCLUDE_FROM_ALL

* lego1 leaks d3drm headers

* Add dxfile.h

* Add 64-bit MSVC to the build matrix

* cmake: using ISLE_USE_DX5 means going all-in

* Load d3dxof.dll dynamically

* cmake: don't emit a warning about bitness anymore
2024-06-25 18:47:43 -07:00

69 lines
2.2 KiB
CMake

project(wine_d3drm LANGUAGES C)
set(CMAKE_C_CLANG_TIDY)
if(MSVC)
# FIXME: this is wrong.
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(def "${CMAKE_CURRENT_SOURCE_DIR}/d3dxof32.def")
else()
set(def "${CMAKE_CURRENT_SOURCE_DIR}/d3dxof64.def")
endif()
set(imp "${CMAKE_CURRENT_BINARY_DIR}/d3dxof.lib")
set(exp "${CMAKE_CURRENT_BINARY_DIR}/d3dxof.exp")
add_custom_command(OUTPUT "${imp}" "${exp}"
COMMAND "${CMAKE_AR}" "${CMAKE_STATIC_LINKER_FLAGS}" "/NOLOGO" "/DEF:${def}" "/OUT:${imp}"
DEPENDS "${def}"
)
add_custom_target(d3dxof-implib DEPENDS "${imp}")
target_sources(d3dxof-implib PRIVATE "${def}")
add_library(d3dxof INTERFACE)
target_link_libraries(d3dxof INTERFACE "${imp}")
add_dependencies(d3dxof "d3dxof-implib")
add_library(d3drm_guid STATIC d3drm_guid.c)
target_include_directories(d3drm_guid PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include")
else()
set(d3drm_guid)
add_library(d3drm_guid INTERFACE)
endif()
option(WINE_D3DRM_DYNAMIC_D3DXOF "Dynamic d3dxof" ON)
add_library(d3drm-wine SHARED
d3drm.c
d3drm_main.c
d3drm_private.h
d3drm.spec
device.c
face.c
frame.c
light.c
material.c
math.c
meshbuilder.c
texture.c
version.rc
viewport.c
)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_sources(d3drm-wine PRIVATE d3drm32.def)
else()
target_sources(d3drm-wine PRIVATE d3drm64.def)
endif()
if(WINE_D3DRM_DYNAMIC_D3DXOF)
target_sources(d3drm-wine PRIVATE dyn_d3dxof.c dyn_d3dxof.h)
target_compile_definitions(d3drm-wine PRIVATE DYNAMIC_D3DXOF)
endif()
target_include_directories(d3drm-wine SYSTEM PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include")
if(NOT WINE_D3DRM_DYNAMIC_D3DXOF)
target_link_libraries(d3drm-wine PRIVATE d3dxof)
endif()
target_link_libraries(d3drm-wine PRIVATE ddraw)
set_property(TARGET d3drm-wine PROPERTY PREFIX "")
set_property(TARGET d3drm-wine PROPERTY OUTPUT_NAME "d3drm")
target_compile_definitions(d3drm-wine PRIVATE "__WINESRC__")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_TRACE_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_DEBUG_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "DECLSPEC_EXPORT=")