Add libopenmpt to cmake

This commit is contained in:
mazmazz 2019-01-02 03:27:24 -05:00
parent 08812b1501
commit a851c5d7da
2 changed files with 29 additions and 1 deletions

View File

@ -218,6 +218,8 @@ set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
"Enable zlib support.")
set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
"Enable GME support.")
set(SRB2_CONFIG_HAVE_OPENMPT OFF CACHE BOOL
"Enable OpenMPT support.")
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
"Enable hardware rendering through OpenGL.")
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
@ -230,7 +232,7 @@ set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
### use internal libraries?
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME).")
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif()
if(${SRB2_CONFIG_HAVE_BLUA})
@ -340,6 +342,26 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
endif()
if(${SRB2_CONFIG_HAVE_OPENMPT})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(OPENMPT_FOUND ON)
set(OPENMPT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/inc/libopenmpt)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86 -llibopenmpt")
else() # 32-bit
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86_64 -llibopenmpt")
endif()
else()
find_package(OPENMPT)
endif()
if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT)
else()
message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif()
endif()
if(${SRB2_CONFIG_HAVE_ZLIB})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(ZLIB_FOUND ON)

View File

@ -146,6 +146,7 @@ if(${SDL2_FOUND})
SDL2
SDL2_mixer
${GME_LIBRARIES}
${OPENMPT_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
@ -156,6 +157,7 @@ if(${SDL2_FOUND})
${SDL2_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
${GME_LIBRARIES}
${OPENMPT_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
@ -235,6 +237,7 @@ if(${SDL2_FOUND})
${SDL2_INCLUDE_DIRS}
${SDL2_MIXER_INCLUDE_DIRS}
${GME_INCLUDE_DIRS}
${OPENMPT_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIRS}
@ -321,6 +324,9 @@ if(${SDL2_FOUND})
if(${SRB2_CONFIG_HAVE_GME})
getwinlib(libgme "libgme.dll")
endif()
if(${SRB2_CONFIG_HAVE_OPENMPT})
getwinlib(libopenmpt "libopenmpt.dll")
endif()
install(PROGRAMS
${win_extra_dll_list}