isle/cmake/dx5sdk.cmake
modeco80 2dc554e83b *: Add CMake build system
I haven't yet:
- Ensured CMake is generating the same cl flags as Developer Studio (ditto..)

The old IDE makefiles are left in attic/ if anyone wants to try matching flags

Source structure has been slightly modified:

Uppercase directories moved to lowercase

isle/res -> isle/src/res (I'm a bit dubious of this myself but eh)
isle/*.{cpp, h} -> isle/src

lego1/*.h -> lego1/include
lego1/*.cpp -> lego1/src

All mixed/upper includes have additionally been changed to lowercase,
for compatibility with building on both Windows and Linux.
2023-06-13 18:20:00 -04:00

37 lines
1.2 KiB
CMake

# Make sure the user provided a valid kit root.
if("$ENV{ISLE_KIT_ROOT}" STREQUAL "")
message(FATAL_ERROR "ISLE_KIT_ROOT needs to be set to build")
endif()
set(__DX5_SDK_PATH "$ENV{ISLE_KIT_ROOT}/dx5sdk/sdk")
# There are no seperated includes, so for nicity just define a common interface target
# that nets us includes, that all DX5 targets include from.
# This techinically means a project can do a no-no and use, say D3D apis w/o linking D3D,
# but that's a footgun that requires knowledge of this so I'm not particulary.. worried about it?
add_library(__DX5_Inc INTERFACE)
target_include_directories(__DX5_Inc INTERFACE ${__DX5_SDK_PATH}/inc)
# Bootstrapping problems are fun.
add_library(DX5::Guid STATIC IMPORTED)
set_property(TARGET DX5::Guid PROPERTY
IMPORTED_LOCATION $ENV{ISLE_KIT_ROOT}/dx5sdk/sdk/lib/dxguid.lib
)
macro(__add_dx5_lib name libname)
add_library(DX5::${name} SHARED IMPORTED)
target_link_libraries(DX5::${name} INTERFACE __DX5_Inc DX5::Guid)
set_property(TARGET DX5::${name} PROPERTY
IMPORTED_IMPLIB ${__DX5_SDK_PATH}/lib/${libname}
)
endmacro()
__add_dx5_lib(D3DRM d3drm.lib)
__add_dx5_lib(DDraw ddraw.lib)
__add_dx5_lib(DInput dinput.lib)
__add_dx5_lib(DSound dsound.lib)