Skip to content

Commit 5fa4d5c

Browse files
authored
[v1.0.3] CMake tweaks and compiler warning fixes (#2)
* Update OpenAL CMake min version * CI: use default GCC and Clang * Fix warnings
1 parent 822c289 commit 5fa4d5c

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ jobs:
66
steps:
77
- uses: actions/checkout@v2
88
- name: init
9-
run: sudo apt update -yqq && sudo apt install -yqq ninja-build g++-11 clang-15
9+
run: sudo apt update -yqq && sudo apt install -yqq ninja-build
1010
- name: configure gcc
11-
run: cmake -S . --preset=default -B build -DCAPO_USE_OPENAL=OFF -DCAPO_BUILD_EXAMPLES=OFF -DCMAKE_CXX_COMPILER=g++-11
11+
run: cmake -S . --preset=default -B build -DCAPO_USE_OPENAL=OFF -DCAPO_BUILD_EXAMPLES=OFF
1212
- name: configure clang
13-
run: cmake -S . --preset=ninja-clang -B clang -DCAPO_USE_OPENAL=OFF -DCAPO_BUILD_EXAMPLES=OFF -DCMAKE_CXX_COMPILER=clang++-15
13+
run: cmake -S . --preset=ninja-clang -B clang -DCAPO_USE_OPENAL=OFF -DCAPO_BUILD_EXAMPLES=OFF
1414
- name: build gcc
1515
run: cmake --build build --config=Release
1616
- name: build clang

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
55
set(CMAKE_CXX_EXTENSIONS OFF)
66
set(CMAKE_DEBUG_POSTFIX "-d")
77

8-
project(capo-lite VERSION "1.0.2")
8+
project(capo-lite VERSION "1.0.3")
99

1010
set(is_root_project OFF)
1111

capo/src/detail/unique.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
#include <concepts>
33
#include <utility>
44

5+
#if defined(_MSC_VER)
6+
#define CAPO_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
7+
#else
8+
#define CAPO_NO_UNIQUE_ADDRESS [[no_unique_address]]
9+
#endif
10+
511
namespace capo {
612
///
713
/// \brief Default deleter for a Unique<Type>.
@@ -72,6 +78,6 @@ class Unique {
7278

7379
private:
7480
Type m_t{};
75-
[[no_unique_address]] Deleter m_deleter{};
81+
CAPO_NO_UNIQUE_ADDRESS Deleter m_deleter{};
7682
};
7783
} // namespace capo

ext/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ find_package(Threads)
44

55
file(ARCHIVE_EXTRACT INPUT "${CMAKE_CURRENT_SOURCE_DIR}/src.zip" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
66

7+
message(STATUS "[dr-libs]")
78
add_subdirectory(src/dr-libs)
89

910
if(CAPO_USE_OPENAL)
@@ -21,8 +22,15 @@ if(CAPO_USE_OPENAL)
2122
set(ALSOFT_INSTALL_UTILS OFF)
2223
set(ALSOFT_UPDATE_BUILD_VERSION OFF)
2324
set(LIBTYPE STATIC)
25+
message(STATUS "[openal-soft]")
2426
add_subdirectory(src/openal-soft)
2527
add_library(${PROJECT_NAME}::OpenAL ALIAS OpenAL)
28+
29+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
30+
target_compile_options(OpenAL PRIVATE -w)
31+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
32+
target_compile_options(OpenAL PRIVATE /wd4244 /wd4267)
33+
endif()
2634
endif()
2735

2836
add_library(${PROJECT_NAME} INTERFACE)

ext/src.zip

8.34 KB
Binary file not shown.

0 commit comments

Comments
 (0)