Skip to content

Commit

Permalink
CMake|Windows: Looking for DirectX and EAX
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 22, 2015
1 parent 7f9c1de commit f307922
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 33 deletions.
51 changes: 28 additions & 23 deletions doomsday/apps/client/CMakeLists.txt
Expand Up @@ -15,6 +15,9 @@ find_package (Amethyst QUIET)
find_package (SDL2)
find_package (LZSS)
include (OpenGL)
if (WIN32)
find_package (DirectX)
endif ()

include_directories (include ${DENG_API_DIR})

Expand All @@ -30,6 +33,8 @@ if (APPLE)
list (APPEND SOURCES src/macx/MusicPlayer.mm)
elseif (WIN32)
include_directories (include/windows)
else ()
include_directories (include/unix)
endif ()

if (AMETHYST_FOUND)
Expand All @@ -44,20 +49,16 @@ if (AMETHYST_FOUND)
deng_add_amedoc (TXT ${readme} ${DENG_SOURCE_DIR}/doc/readme readme.ame)
list (APPEND SOURCES ${readme})
endif ()
endif ()

deng_filter_platform_sources (src ${SOURCES} ${HEADERS} ${API_HEADERS})

if (UNIX)
include_directories (include/unix)

if (AMETHYST_FOUND)
# Manual page.
if (UNIX)
set (MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/doomsday.6)
deng_add_amedoc (MAN ${MAN_PAGE} ${DENG_SOURCE_DIR}/doc/readme readme.ame)
list (APPEND src ${MAN_PAGE})
endif ()
endif ()

deng_filter_platform_sources (src ${SOURCES} ${HEADERS} ${API_HEADERS})

deng_add_package (net.dengine.client)

# OS X: Packages and other resources to bundle with the application.
Expand All @@ -72,14 +73,6 @@ deng_add_application (client ${src} EXTRA_RESOURCES ${MACX_RESOURCES})
# There's some old code here so relax the warnings a bit.
relaxed_warnings (client)

if (WIN32 OR APPLE)
set_property (TARGET client PROPERTY OUTPUT_NAME "Doomsday")
set (MACOSX_BUNDLE_BUNDLE_EXECUTABLE "Doomsday")
set (MACOSX_BUNDLE_ICON_FILE "deng.icns")
else ()
set_property (TARGET client PROPERTY OUTPUT_NAME "doomsday")
endif ()

# Libraries.
target_link_libraries (client PUBLIC Deng::libappfw Deng::libdoomsday lzss opengl)
if (APPLE)
Expand All @@ -92,16 +85,28 @@ endif ()
if (TARGET SDL2_mixer)
target_link_libraries (client PUBLIC SDL2_mixer)
endif ()
if (TARGET DirectX)
target_link_libraries (client PUBLIC DirectX)
endif ()

deng_install_bundle_deps (client
Deng::libcore Deng::libshell
Deng::libgui Deng::libappfw
Deng::liblegacy Deng::libdoomsday
SDL2 SDL2_mixer
)
# Deployment -----------------------------------------------------------------

if (WIN32 OR APPLE)
set_property (TARGET client PROPERTY OUTPUT_NAME "Doomsday")
set (MACOSX_BUNDLE_BUNDLE_EXECUTABLE "Doomsday")
set (MACOSX_BUNDLE_ICON_FILE "deng.icns")
else ()
set_property (TARGET client PROPERTY OUTPUT_NAME "doomsday")
endif ()

# Bundle deployment.
if (APPLE)
deng_install_bundle_deps (client
Deng::libcore Deng::libshell
Deng::libgui Deng::libappfw
Deng::liblegacy Deng::libdoomsday
SDL2 SDL2_mixer
)

set_target_properties (client PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks"
)
Expand Down
2 changes: 2 additions & 0 deletions doomsday/apps/client/include/de_platform.h
Expand Up @@ -39,6 +39,8 @@
# include <QIODevice>
# include <QFile>
# include <QTemporaryFile>
# include <QSaveFile>
# include <QProcess>
# ifndef DENG2_QT_5_0_OR_NEWER
# include <QAbstractFileEngine>
# endif
Expand Down
11 changes: 8 additions & 3 deletions doomsday/apps/plugins/directsound/CMakeLists.txt
Expand Up @@ -2,8 +2,13 @@ cmake_minimum_required (VERSION 3.0)
project (DENG_DIRECTSOUND)
include (../PluginConfig.cmake)

include_directories (include)
file (GLOB SOURCES src/*.cpp include/*.h)
find_package (DirectX)
find_package (EAX)

deng_add_plugin (audio_directsound ${SOURCES} api/dsdirectsound.def)
if (TARGET EAX2)
include_directories (include)
file (GLOB SOURCES src/*.cpp include/*.h)

deng_add_plugin (audio_directsound ${SOURCES} api/dsdirectsound.def)
target_link_libraries (audio_directsound PRIVATE DirectX EAX2)
endif ()
9 changes: 5 additions & 4 deletions doomsday/apps/server/CMakeLists.txt
Expand Up @@ -16,10 +16,6 @@ find_package (Amethyst QUIET)

include_directories (include ../client/include ${DENG_API_DIR})

if (WIN32)
include_directories (../client/include/windows)
endif ()

add_definitions (-D__DOOMSDAY__ -D__SERVER__)

file (GLOB API_HEADERS ../api/*.h)
Expand Down Expand Up @@ -246,6 +242,11 @@ set (SHARED_WITH_CLIENT
${src}/src/world/worldsystem.cpp
)

if (WIN32)
include_directories (../client/include/windows)
list (APPEND SHARED_WITH_CLIENT ${src}/src/windows/dd_winit.cpp)
endif ()

if (UNIX)
include_directories (../client/include/unix)
list (APPEND SHARED_WITH_CLIENT ${src}/src/unix/dd_uinit.cpp)
Expand Down
1 change: 1 addition & 0 deletions doomsday/cmake/FindAssimp.cmake
Expand Up @@ -59,6 +59,7 @@ if (NOT TARGET assimp)
find_file (LIBASSIMP_DLL assimp.dll HINTS ${_assimpBase}/..
PATH_SUFFIXES bin ../bin/Release ../bin/Debug
)
mark_as_advanced (LIBASSIMP_DLL)
get_filename_component (LIBASSIMP_DLL ${LIBASSIMP_DLL} REALPATH)
deng_install_library (${LIBASSIMP_DLL})
endif ()
Expand Down
23 changes: 23 additions & 0 deletions doomsday/cmake/FindDirectX.cmake
@@ -0,0 +1,23 @@
if (WIN32 AND NOT TARGET DirectX)
find_library (DIRECTX_GUID_LIBRARY dxguid
HINTS
${DIRECTX_DIR}
# TODO: look in the registry?
PATH_SUFFIXES Lib/x86 x86
)
mark_as_advanced (DIRECTX_GUID_LIBRARY)
if (NOT DIRECTX_GUID_LIBRARY)
message (FATAL_ERROR "DirectX SDK not found. Set the DIRECTX_DIR variable.")
endif ()

get_filename_component (_libDir ${DIRECTX_GUID_LIBRARY} DIRECTORY)
get_filename_component (_incDir ${_libDir}/../../include REALPATH)

add_library (DirectX INTERFACE)
target_include_directories (DirectX INTERFACE ${_incDir})
target_link_libraries (DirectX INTERFACE
${_libDir}/dinput8.lib
${_libDir}/dsound.lib
${DIRECTX_GUID_LIBRARY}
)
endif ()
21 changes: 21 additions & 0 deletions doomsday/cmake/FindEAX.cmake
@@ -0,0 +1,21 @@
if (WIN32)
set (_oldPath ${EAX2_LIBRARY})
find_library (EAX2_LIBRARY eax HINTS ${EAX2_DIR} PATH_SUFFIXES Libs "EAX 2.0 SDK/Libs")
mark_as_advanced (EAX2_LIBRARY)
if (NOT _oldPath STREQUAL EAX2_LIBRARY)
if (EAX2_LIBRARY)
message (STATUS "Looking for EAX 2 - found")
else ()
message (STATUS "Looking for EAX 2 - not found")
endif ()
endif ()

if (NOT TARGET EAX2)
add_library (EAX2 INTERFACE)
get_filename_component (_libDir ${EAX2_LIBRARY} DIRECTORY)
target_include_directories (EAX2 INTERFACE ${_libDir}/../Include)
target_link_libraries (EAX2 INTERFACE ${EAX2_LIBRARY} ${_libDir}/eaxguid.lib)
get_filename_component (_dll ${_libDir}/../dll/eax.dll REALPATH)
deng_install_library (${_dll})
endif ()
endif ()
2 changes: 2 additions & 0 deletions doomsday/cmake/FindQt.cmake
Expand Up @@ -41,7 +41,9 @@ if (NOT DEFINED QT_PREFIX_DIR OR
qmake_query (QT_BINS "QT_INSTALL_BINS")
if (APPLE)
set (MACDEPLOYQT_COMMAND "${QT_BINS}/macdeployqt" CACHE PATH "Qt's macdeployqt executable path")
mark_as_advanced (MACDEPLOYQT_COMMAND)
elseif (WIN32)
set (WINDEPLOYQT_COMMAND "${QT_BINS}/windeployqt" CACHE PATH "Qt's windeployqt executable path")
mark_as_advanced (WINDEPLOYQT_COMMAND)
endif ()
endif ()
2 changes: 2 additions & 0 deletions doomsday/cmake/FindSDL2.cmake
Expand Up @@ -7,6 +7,7 @@ elseif (WIN32)
# Try to locate SDL2 from the local system (assuming Windows).
set (_oldPath ${SDL2_LIBRARY})
find_library (SDL2_LIBRARY SDL2 HINTS ${SDL2_DIR} PATH_SUFFIXES lib/x86 lib)
mark_as_advanced (SDL2_LIBRARY)
if (NOT SDL2_LIBRARY)
message (FATAL_ERROR "SDL2 not found. Set the SDL2_DIR variable to help locate it.\n")
endif ()
Expand All @@ -31,6 +32,7 @@ elseif (WIN32)
HINTS ${SDL2_DIR} ${SDL2_MIXER_DIR}
PATH_SUFFIXES lib/x86 lib
)
mark_as_advanced (SDL2_MIXER_LIBRARY)
if (NOT _oldPath STREQUAL SDL2_MIXER_LIBRARY)
message (STATUS "Found SDL2_mixer: ${SDL2_MIXER_LIBRARY}")
endif ()
Expand Down
8 changes: 5 additions & 3 deletions doomsday/cmake/Macros.cmake
Expand Up @@ -507,8 +507,8 @@ function (deng_install_deployqt target)
endif ()
install (CODE "message (STATUS \"Running windeployqt on ${_outName}.exe...\")
execute_process (COMMAND ${WINDEPLOYQT_COMMAND} --no-translations
\"${CMAKE_INSTALL_PREFIX}/bin/${_outName}.exe\"
OUTPUT_QUIET ERROR_QUIET)")
\"${CMAKE_INSTALL_PREFIX}/bin/${_outName}.exe\" )")
# OUTPUT_QUIET ERROR_QUIET)")
endif ()
endfunction (deng_install_deployqt)

Expand Down Expand Up @@ -583,8 +583,10 @@ function (deng_add_amedoc type file ameSourceDir mainSrc)
)
if (${type} STREQUAL MAN)
install (FILES ${file} DESTINATION share/man/man6)
else ()
elseif (UNIX)
install (FILES ${file} DESTINATION ${DENG_INSTALL_DOC_DIR}/doomsday)
else ()
install (FILES ${file} DESTINATION ${DENG_INSTALL_DOC_DIR})
endif ()
endif ()
endfunction (deng_add_amedoc)
1 change: 1 addition & 0 deletions doomsday/cmake/OpenGL.cmake
Expand Up @@ -5,6 +5,7 @@ if (NOT TARGET opengl)
HINTS ${OPENGL_DIR}
PATH_SUFFIXES .. OpenGL include OpenGL/include
)
mark_as_advanced (OPENGL_GLEXT_H)
if (NOT OPENGL_GLEXT_H)
message (FATAL_ERROR "OpenGL \"GL/glext.h\" header not found.")
endif ()
Expand Down

0 comments on commit f307922

Please sign in to comment.