-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
97 lines (80 loc) · 2.88 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#### in_vgm (libvgm-based) ####
cmake_minimum_required(VERSION 3.1)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
project(in_vgm VERSION 0.5 LANGUAGES C CXX)
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
find_package(Iconv QUIET)
find_package(libvgm REQUIRED)
if(MSVC)
if(NOT MSVC_VERSION LESS 1400)
add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
# silence typical sound core warnings
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unknown-pragmas")
# additional warnings from http://blog.httrack.com/blog/2014/03/09/what-are-your-gcc-flags/
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Winit-self -Wstrict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security -Wformat-nonliteral")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif(CMAKE_COMPILER_IS_GNUCC)
set(WINAMP_PLUGIN_PATH "" CACHE PATH "(optional) Winamp/Plugins directory for copying the plugin to after build")
set(HEADERS
FileInfoStorage.hpp
in_vgm.h
ini_func.h
playcfg.hpp
resource.h
TagFormatter.hpp
utils.hpp
)
set(SOURCES
dlg_cfg.cpp
dlg_fileinfo.cpp
extFileInfo.cpp
FileInfoStorage.cpp
in_vgm.cpp
ini_func.c
playcfg.cpp
TagFormatter.cpp
utils.cpp
)
set(RESORUCES
in_vgm.rc
icon.ico
images/logo.bmp
images/tabicons.bmp
)
# ANSI version (in_vgm.dll)
add_library(${PROJECT_NAME} SHARED ${HEADERS} ${SOURCES} ${RESORUCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE libvgm::vgm-utils libvgm::vgm-emu libvgm::vgm-player comctl32)
# Unicode version (in_vgmW.dll)
add_library(${PROJECT_NAME}W SHARED ${HEADERS} ${SOURCES} ${RESORUCES})
target_include_directories(${PROJECT_NAME}W PRIVATE ${PROJECT_SOURCE_DIR})
target_compile_definitions(${PROJECT_NAME}W PRIVATE UNICODE_INPUT_PLUGIN)
target_link_libraries(${PROJECT_NAME}W PRIVATE libvgm::vgm-utils libvgm::vgm-emu libvgm::vgm-player comctl32)
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}W RUNTIME DESTINATION "bin")
if (WINAMP_PLUGIN_PATH)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${PROJECT_NAME}>" "${WINAMP_PLUGIN_PATH}/"
COMMENT "copy to Winamp Plugin dir for testing"
)
add_custom_command(TARGET ${PROJECT_NAME}W POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${PROJECT_NAME}W>" "${WINAMP_PLUGIN_PATH}/"
COMMENT "copy to Winamp Plugin dir for testing"
)
endif()