Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
05d367ee
Commit
05d367ee
authored
Apr 06, 2025
by
Keith
Committed by
David Reid
May 08, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: remove macro and fix warnings
parent
97493bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
38 deletions
+45
-38
CMakeLists.txt
CMakeLists.txt
+45
-38
No files found.
CMakeLists.txt
View file @
05d367ee
...
...
@@ -62,35 +62,16 @@ option(MINIAUDIO_USE_STDINT "Use <stdint.h> for sized types"
option
(
MINIAUDIO_DEBUG_OUTPUT
"Enable stdout debug output"
OFF
)
set
(
LIBS_TO_INSTALL
)
# This assumes that our static library has exactly one .c file and 1 .h file, both named ${prefix.c} and ${prefix.h} respectively
# prefix is optional and defaults to name
macro
(
add_miniaudio_library name relpath
)
set
(
prefix
${
name
}
)
set
(
extra_args
${
ARGN
}
)
list
(
LENGTH extra_args extra_count
)
if
(
${
extra_count
}
GREATER 0
)
list
(
GET extra_args 0 prefix
)
endif
()
add_library
(
${
name
}
STATIC
${
relpath
}
/
${
prefix
}
.c
${
relpath
}
/
${
prefix
}
.h
)
# Without this, changes made to LIBS_TO_INSTALL disappear when we return
list
(
APPEND LIBS_TO_INSTALL
${
name
}
)
set
(
LIBS_TO_INSTALL
${
LIBS_TO_INSTALL
}
PARENT_SCOPE
)
install
(
FILES
${
relpath
}
/
${
prefix
}
.h
DESTINATION include/miniaudio/
${
relpath
}
)
target_include_directories
(
${
name
}
PUBLIC
${
dir
}
)
endmacro
()
# Construct compiler options.
set
(
COMPILE_OPTIONS
)
# Store libraries to install
# When installing any header that imports miniaudio.h from a relative path, we
# need to maintain its place in the directory tree so it can find Miniaudio
set
(
LIBS_TO_INSTALL
)
if
(
MINIAUDIO_FORCE_CXX AND MINIAUDIO_FORCE_C89
)
message
(
FATAL_ERROR
"MINIAUDIO_FORCE_CXX and MINIAUDIO_FORCE_C89 cannot be enabled at the same time."
)
endif
()
...
...
@@ -478,8 +459,15 @@ endif()
# Static Libraries
add_miniaudio_library
(
miniaudio
"."
)
add_library
(
miniaudio STATIC
miniaudio.c
miniaudio.h
)
list
(
APPEND LIBS_TO_INSTALL miniaudio
)
install
(
FILES miniaudio.h DESTINATION include/miniaudio
)
target_include_directories
(
miniaudio PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
)
target_compile_options
(
miniaudio PRIVATE
${
COMPILE_OPTIONS
}
)
target_compile_definitions
(
miniaudio PRIVATE
${
COMPILE_DEFINES
}
)
...
...
@@ -494,7 +482,13 @@ if(HAS_LIBVORBIS)
endif
()
if
(
HAS_LIBVORBIS
)
add_miniaudio_library
(
miniaudio_libvorbis extras/decoders/libvorbis
)
add_library
(
miniaudio_libvorbis STATIC
extras/decoders/libvorbis/miniaudio_libvorbis.c
extras/decoders/libvorbis/miniaudio_libvorbis.h
)
list
(
APPEND LIBS_TO_INSTALL miniaudio_libvorbis
)
install
(
FILES extras/decoders/libvorbis/miniaudio_libvorbis.h DESTINATION include/miniaudio/extras/decoders/libvorbis
)
target_compile_options
(
miniaudio_libvorbis PRIVATE
${
COMPILE_OPTIONS
}
)
target_compile_definitions
(
miniaudio_libvorbis PRIVATE
${
COMPILE_DEFINES
}
)
...
...
@@ -513,7 +507,14 @@ if(HAS_LIBOPUS)
endif
()
if
(
HAS_LIBOPUS
)
add_miniaudio_library
(
miniaudio_libopus extras/decoders/libopus
)
add_library
(
miniaudio_libopus STATIC
extras/decoders/libopus/miniaudio_libopus.c
extras/decoders/libopus/miniaudio_libopus.h
)
list
(
APPEND LIBS_TO_INSTALL miniaudio_libopus
)
install
(
FILES extras/decoders/libopus/miniaudio_libopus.h DESTINATION include/miniaudio/extras/decoders/libopus
)
target_compile_options
(
miniaudio_libopus PRIVATE
${
COMPILE_OPTIONS
}
)
target_compile_definitions
(
miniaudio_libopus PRIVATE
${
COMPILE_DEFINES
}
)
...
...
@@ -523,8 +524,17 @@ endif()
if
(
NOT MINIAUDIO_NO_EXTRA_NODES
)
function
(
add_extra_node name
)
add_miniaudio_library
(
miniaudio_
${
name
}
_node extras/nodes/ma_
${
name
}
_node ma_
${
name
}
_node
)
add_library
(
miniaudio_
${
name
}
_node STATIC
extras/nodes/ma_
${
name
}
_node/ma_
${
name
}
_node.c
extras/nodes/ma_
${
name
}
_node/ma_
${
name
}
_node.h
)
set
(
libs
"
${
LIBS_TO_INSTALL
}
"
)
list
(
APPEND libs miniaudio_
${
name
}
_node
)
set
(
LIBS_TO_INSTALL
"
${
libs
}
"
PARENT_SCOPE
)
# without PARENT_SCOPE, any changes are lost
install
(
FILES extras/nodes/ma_
${
name
}
_node/ma_
${
name
}
_node.h DESTINATION include/miniaudio/extras/nodes/ma_
${
name
}
_node
)
target_include_directories
(
miniaudio_
${
name
}
_node PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/extras/nodes/ma_
${
name
}
_node
)
target_compile_options
(
miniaudio_
${
name
}
_node PRIVATE
${
COMPILE_OPTIONS
}
)
target_compile_definitions
(
miniaudio_
${
name
}
_node PRIVATE
${
COMPILE_DEFINES
}
)
...
...
@@ -660,12 +670,9 @@ endif()
include
(
GNUInstallDirs
)
install
(
TARGETS
${
LIBS_TO_INSTALL
}
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
ARCHIVE DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
RUNTIME DESTINATION
"
${
CMAKE_INSTALL_BINDIR
}
"
INCLUDES DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
\ No newline at end of file
message
(
STATUS
"Library list:
${
LIBS_TO_INSTALL
}
"
)
install
(
TARGETS
${
LIBS_TO_INSTALL
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment