-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
125 lines (103 loc) · 3.2 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required (VERSION 3.5.0)
project(OGGExtractor)
cmake_policy(SET CMP0053 NEW)
cmake_policy(SET CMP0071 OLD)
# Version Number
set (OGG_EXTRACTOR_VERSION_MAJOR 1)
set (OGG_EXTRACTOR_VERSION_MINOR 9)
set (OGG_EXTRACTOR_VERSION_PATCH 0)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the QtWidgets library
find_package(Qt5 COMPONENTS Widgets Multimedia)
if(WIN32)
find_package(Qt5 COMPONENTS WinExtras)
endif()
#libvorbis
if(WIN32)
set(LIBVORBIS_INCLUDE_DIR "D:/Desarrollo/Bibliotecas/libvorbis-1.3.7/include")
set(LIBVORBIS_LIBRARY_DIR "D:/Desarrollo/Bibliotecas/libvorbis-1.3.7/build/lib/")
set(LIBVORBIS_LIBRARIES ${LIBVORBIS_LIBRARY_DIR}/libvorbisfile.a
${LIBVORBIS_LIBRARY_DIR}/libvorbis.a)
else()
find_library(LIBVORBISFILE_LIBRARY vorbisfile libvorbisfile libvorbisfile-3 )
find_library(LIBVORBIS_LIBRARIES libvorbis )
endif()
#libogg
if(WIN32)
set(LIBOGG_INCLUDE_DIRS "D:/Desarrollo/Bibliotecas/libogg-1.3.5/include" "D:/Desarrollo/Bibliotecas/libogg-1.3.5/build/include")
set(LIBOGG_LIBRARY "D:/Desarrollo/Bibliotecas/libogg-1.3.5/build/libogg.a")
else()
find_library(LIBOGG_LIBRARY libogg)
endif()
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${QT_QTTEST_LIBRARY})
endif (CMAKE_BUILD_TYPE MATCHES Debug)
if(DEFINED MINGW)
configure_file("${PROJECT_SOURCE_DIR}/resources.rc.in" "${PROJECT_BINARY_DIR}/resources.rc")
configure_file("${PROJECT_SOURCE_DIR}/installer/script.iss.in" "${PROJECT_BINARY_DIR}/script.iss")
set(WINAPP_SOURCES ${WINAPP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/resources.rc)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> -i <SOURCE>")
enable_language(RC)
endif(DEFINED MINGW)
include_directories(
${CMAKE_SOURCE_DIR}
${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR} # Generated .h files
${CMAKE_CURRENT_BINARY_DIR} # For wrap/ui files
${LIBVORBIS_INCLUDE_DIR}
${LIBOGG_INCLUDE_DIRS}
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
# Add Qt Resource files
qt5_add_resources(RESOURCES
rsc/resources.qrc
)
qt5_wrap_ui(CORE_UI
# .ui for Qt
AboutDialog.ui
OGGExtractor.ui
)
set (WINAPP_SOURCES
# project files
${WINAPP_SOURCES}
${RESOURCES}
${CORE_MOC}
${CORE_UI}
main.cpp
TableModel.cpp
OGGExtractor.cpp
AboutDialog.cpp
OGGContainerWrapper.cpp
ScanThread.cpp
)
set (CLI_SOURCES
main-cli.cpp
OGGContainerWrapper.cpp
)
set(OGG_LIBS
${LIBVORBIS_LIBRARIES}
${LIBOGG_LIBRARY}
)
set(EXTERNAL_LIBS
Qt5::Widgets
Qt5::Multimedia
${OGG_LIBS}
)
if(WIN32)
set(EXTERNAL_LIBS ${EXTERNAL_LIBS} Qt5::WinExtras)
endif()
add_executable(OGGExtractor ${WINAPP_SOURCES})
target_link_libraries (OGGExtractor ${EXTERNAL_LIBS})
if(WIN32)
set_target_properties(OGGExtractor PROPERTIES COMPILE_FLAGS "-mwindows ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${Qt5Multimedia_EXECUTABLE_COMPILE_FLAGS}" )
target_link_options(OGGExtractor PUBLIC "-mwindows")
endif()
qt5_use_modules(OGGExtractor Widgets Multimedia)
add_executable(OGGExtractor-cli ${CLI_SOURCES})
target_link_libraries (OGGExtractor-cli ${OGG_LIBS})