Skip to content
This repository was archived by the owner on May 7, 2020. It is now read-only.

Commit ebf5ade

Browse files
Allow ff7music and vgmstream plugins to be build
And place resulting DLLs inside the bin output directory
1 parent 4acbd25 commit ebf5ade

8 files changed

Lines changed: 81 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ if (SUPERBUILD)
2121
zlib
2222
libpng
2323
ffmpeg
24+
vgmstream
2425
)
2526
ExternalProject_Add_Step(
2627
ff7_opengl

cmake/FindVGMSTREAM.cmake

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
include(FindPackageHandleStandardArgs)
2+
3+
if (NOT VGMSTREAM_FOUND)
4+
find_package(FFMPEG REQUIRED)
5+
6+
find_library(
7+
VGMSTREAM_LIBRARY
8+
libvgmstream
9+
PATH_SUFFIXES
10+
lib
11+
)
12+
13+
find_path(
14+
VGMSTREAM_INCLUDE_DIR
15+
vgmstream.h
16+
PATH_SUFFIXES
17+
include
18+
)
19+
20+
add_library(VGMSTREAM::VGMSTREAM STATIC IMPORTED)
21+
22+
set_target_properties(
23+
VGMSTREAM::VGMSTREAM
24+
PROPERTIES
25+
IMPORTED_LOCATION
26+
"${VGMSTREAM_LIBRARY}"
27+
INTERFACE_INCLUDE_DIRECTORIES
28+
"${VGMSTREAM_INCLUDE_DIR}"
29+
INTERFACE_LINK_LIBRARIES
30+
FFMPEG::SWResample
31+
FFMPEG::AVCodec
32+
FFMPEG::AVFormat
33+
)
34+
35+
find_package_handle_standard_args(VGMSTREAM DEFAULT_MSG VGMSTREAM_LIBRARY VGMSTREAM_INCLUDE_DIR)
36+
endif()

src/CMakeLists.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ find_package(GLEW REQUIRED)
22
find_package(ZLib REQUIRED)
33
find_package(PNG REQUIRED)
44
find_package(FFMPEG REQUIRED)
5+
find_package(VGMSTREAM REQUIRED)
56

67
string(TOUPPER ${CMAKE_BUILD_TYPE} RELEASE_TYPE)
78
add_compile_definitions(${RELEASE_TYPE})
89

9-
add_library(ff7_opengl SHARED cfg.h cfg.c common.h common.c common_imports.h compile_cfg.h
10-
crashdump.c crashdump.h ctx.h ctx.c externals_102_de.h externals_102_fr.h externals_102_sp.h externals_102_us.h
11-
fake_dd.h fake_dd.c ff7.h ff7_data.h ff7_opengl.c ff8.h ff8_data.h ff8_opengl.c gl.h globals.h log.c log.h
12-
macro.h matrix.c matrix.h movies.c movies.h music.c music.h patch.c patch.h pngcustom.c pngcustom.h saveload.c saveload.h types.h
13-
)
10+
file(GLOB source_files "*.h" "*.c")
11+
add_library(ff7_opengl SHARED ${source_files})
1412
add_subdirectory(3rdparty)
1513
add_subdirectory(ff7)
1614
add_subdirectory(gl)
@@ -33,5 +31,25 @@ target_link_libraries(ffmpeg_movies
3331
)
3432
target_compile_definitions(ffmpeg_movies PRIVATE -D_CRT_SECURE_NO_WARNINGS=1)
3533

34+
add_library(vgmstream_music SHARED)
35+
target_include_directories(vgmstream_music PRIVATE "${CMAKE_BINARY_DIR}/vendor/include")
36+
add_subdirectory(vgmstream_music)
37+
target_link_libraries(vgmstream_music
38+
VGMSTREAM::VGMSTREAM
39+
FFMPEG::AVUtil
40+
FFMPEG::SWResample
41+
FFMPEG::AVCodec
42+
FFMPEG::AVFormat
43+
FFMPEG::SWScale
44+
)
45+
target_compile_definitions(vgmstream_music PRIVATE -D_CRT_SECURE_NO_WARNINGS=1)
46+
47+
add_library(ff7music SHARED)
48+
target_include_directories(ff7music PRIVATE "${CMAKE_BINARY_DIR}/vendor/include")
49+
add_subdirectory(ff7music)
50+
target_compile_definitions(ff7music PRIVATE -D_CRT_SECURE_NO_WARNINGS=1)
51+
3652
install(TARGETS ffmpeg_movies RUNTIME DESTINATION bin)
53+
install(TARGETS vgmstream_music RUNTIME DESTINATION bin)
54+
install(TARGETS ff7music RUNTIME DESTINATION bin)
3755
install(FILES "${FFMPEG_AVUTIL_DLL}" "${FFMPEG_SWRESAMPLE_DLL}" "${FFMPEG_AVCODEC_DLL}" "${FFMPEG_AVFORMAT_DLL}" "${FFMPEG_SWSCALE_DLL}" DESTINATION bin)

src/ff7music/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target_sources(ff7music
2+
PRIVATE
3+
${CMAKE_CURRENT_LIST_DIR}/music.c
4+
${CMAKE_CURRENT_LIST_DIR}/types.h
5+
)

src/vgmstream_music/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target_sources(vgmstream_music
2+
PRIVATE
3+
${CMAKE_CURRENT_LIST_DIR}/music.c
4+
${CMAKE_CURRENT_LIST_DIR}/types.h
5+
)

third_party/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ add_subdirectory(glew)
22
add_subdirectory(zlib)
33
add_subdirectory(libpng)
44
add_subdirectory(ffmpeg)
5+
add_subdirectory(vgmstream)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include(ExternalProject)
2+
3+
ExternalProject_Add(
4+
vgmstream
5+
URL "${CMAKE_SOURCE_DIR}/third_party/vgmstream/vgmstream-win32.zip"
6+
INSTALL_DIR "${CMAKE_BINARY_DIR}/vendor"
7+
CONFIGURE_COMMAND ""
8+
BUILD_COMMAND ""
9+
INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_directory "<SOURCE_DIR>" "<INSTALL_DIR>"
10+
)
13.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)