Skip to content

Commit 46a6efd

Browse files
committed
DiscordCoreAPI Release v2.0.6
* Updated the song platforms to support requesting playlists. * Added a DCA_INLINE macro. * Modified the usage of certain Jsonifier classes to hold up to the updates.
1 parent 81197ab commit 46a6efd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1647
-1709
lines changed

.github/workflows/CLANG_18-Ubuntu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
Build:
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-latest
1212

1313
strategy:
1414
fail-fast: false

.github/workflows/GCC_13-MacOS.yml

+31-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,43 @@ jobs:
2424
run: |
2525
brew install gcc
2626
27+
- name: Update Vcpkg and install other dependencies.
28+
run: |
29+
brew update
30+
brew upgrade
31+
brew install nasm
32+
brew install nano
33+
brew install autoconf
34+
brew install automake
35+
brew install glibtoolize
36+
which autoconf
37+
export PATH="/opt/homebrew/bin/autoconf:$PATH"
38+
git clone https://github.com/Microsoft/Vcpkg ./vcpkg2
39+
cd ./vcpkg2
40+
./bootstrap-vcpkg.sh
41+
git stash
42+
git pull
43+
./vcpkg update
44+
45+
- name: Set TERM environment variable
46+
run: echo "export TERM=xterm" >> $GITHUB_ENV
47+
2748
- name: Install the dependencies.
49+
working-directory: /Users/runner/work/DiscordCoreAPI/DiscordCoreAPI/vcpkg2/
2850
run: |
29-
vcpkg install opus:x64-osx
30-
vcpkg install libsodium:x64-osx
31-
vcpkg install openssl:x64-osx
51+
/Users/runner/work/DiscordCoreAPI/DiscordCoreAPI/vcpkg2/vcpkg install opus:x64-osx
52+
/Users/runner/work/DiscordCoreAPI/DiscordCoreAPI/vcpkg2/vcpkg install libsodium:x64-osx
53+
/Users/runner/work/DiscordCoreAPI/DiscordCoreAPI/vcpkg2/vcpkg install openssl:x64-osx
54+
55+
- name: Print failure log on failure
56+
if: ${{ failure() }}
57+
run: cat /Users/runner/work/DiscordCoreAPI/DiscordCoreAPI/vcpkg2/buildtrees/libsodium/autoconf-x64-osx-err.log
58+
3259

3360
- name: Configure CMake
3461
working-directory: ./
3562
run: |
36-
cmake -S . -B ./Build -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc@13/bin/g++-13 -DDEV=true -DDISCORDCOREAPI_TEST=true -DVCPKG_ROOT_DIR=/usr/local/share/vcpkg
63+
cmake -S . -B ./Build -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc@13/bin/g++-13 -DDEV=true -DDISCORDCOREAPI_TEST=true -DVCPKG_ROOT_DIR=./vcpkg2
3764
3865
- name: Build the Test
3966
working-directory: ./Build

.github/workflows/MSVC_2022-Windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
Build:
11-
runs-on: windows-2022
11+
runs-on: windows-latest
1212

1313
strategy:
1414
fail-fast: false

CMake/DCADetectArchitecture.cmake

+27-22
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1818
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1919
# DEALINGS IN THE SOFTWARE.
20-
# JsonifierDetectArchitecture.cmake - Script for detecting the CPU architecture.
20+
# DCADetectArchitecture.cmake - Script for detecting the CPU architecture.
2121
# Sept 18, 2023
2222
# https://discordcoreapi.com
2323
include(CheckCXXSourceRuns)
@@ -47,29 +47,30 @@ function(jsonifier_check_instruction_set INSTRUCTION_SET_NAME INSTRUCTION_SET_IN
4747
endif()
4848
endfunction()
4949

50-
set(INSTRUCTION_SET_NAMES "POPCNT" "LZCNT" "BMI" "AVX" "AVX2" "AVX512")
51-
set (INSTRUCTION_SET_CODE
50+
set(INSTRUCTION_SET_NAMES "POPCNT" "LZCNT" "BMI" "BMI2" "AVX" "AVX2" "AVX512")
51+
set(INSTRUCTION_SET_CODE
5252
"auto result = _mm_popcnt_u64(uint64_t{})"
5353
"auto result = _lzcnt_u64(int64_t{})"
54-
"auto result = _blsr_u64(uint64_t{})"
55-
"auto result = _mm_castsi128_pd(__m128i{}).auto result02 = _mm_setzero_si128()"
54+
"auto result = _blsr_u64(uint64_t{}).result = _tzcnt_u32(uint16_t{})"
55+
"auto result = _pdep_u64(uint64_t{}, uint64_t{})"
56+
"auto result = _mm_castsi128_pd(__m128i{}).auto result01 = _mm_setzero_si128()"
5657
"auto result = _mm256_add_epi32(__m256i{}, __m256i{})"
57-
"auto result = _mm512_add_ps(__m512i{}, __m512i{}).auto result2 = _mm512_cmplt_epu8_mask(__m512i{}, __m512i{}).auto result03 = _mm_abs_epi64 (__m128i{})"
58+
"auto result = _mm_abs_epi64 (__m128i{}).auto result01 = _mm512_abs_epi16(__m512i{})"
5859
)
5960

60-
set(INDEX_SET "0" "1" "2" "3" "4" "5")
61+
set(INDEX_SET "0" "1" "2" "3" "4" "5" "6")
6162

62-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
63-
set(INSTRUCTION_SET_IN_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
64-
set(INSTRUCTION_SET_OUT_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
63+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
64+
set(INSTRUCTION_SET_IN_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
65+
set(INSTRUCTION_SET_OUT_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
6566
else()
66-
set(INSTRUCTION_SET_IN_FLAGS "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native")
67-
set(INSTRUCTION_SET_OUT_FLAGS "-mpopcnt" "-mlzcnt" "-mbmi" "-mavx.-mpclmul" "-mavx2.-mpclmul" "-mavx512f.-mavx512bw.-mavx512vl.-mpclmul")
67+
set(INSTRUCTION_SET_IN_FLAGS "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native")
68+
set(INSTRUCTION_SET_OUT_FLAGS "-mpopcnt" "-mlzcnt" "-mbmi" "-mbmi2" "-mavx.-mpclmul" "-mavx2.-mpclmul" "-mavx512f.-mavx512bw.-mavx512vl.-mpclmul")
6869
endif()
6970

7071
set(CMAKE_REQUIRED_FLAGS_SAVE "${CMAKE_REQUIRED_FLAGS}")
7172

72-
if ((${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") OR (${CMAKE_SYSTEM_PROCESSOR} MATCHES "i386") OR (${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64"))
73+
if(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") OR ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386") OR ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64"))
7374

7475
foreach(CURRENT_INDEX IN LISTS INDEX_SET)
7576
list(GET INSTRUCTION_SET_NAMES "${CURRENT_INDEX}" INSTRUCTION_SET_NAME)
@@ -89,27 +90,31 @@ endif()
8990
set(AVX_FLAG)
9091
set(JSONIFIER_CPU_INSTRUCTIONS 0)
9192

92-
if (NOT "${POPCNT}" STREQUAL "")
93+
if(NOT "${POPCNT}" STREQUAL "")
9394
list(APPEND AVX_FLAG "${POPCNT}")
9495
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 0" OUTPUT_FORMAT DECIMAL)
9596
endif()
96-
if (NOT "${LZCNT}" STREQUAL "")
97+
if(NOT "${LZCNT}" STREQUAL "")
9798
list(APPEND AVX_FLAG "${LZCNT}")
9899
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 1" OUTPUT_FORMAT DECIMAL)
99100
endif()
100-
if (NOT "${BMI}" STREQUAL "")
101+
if(NOT "${BMI}" STREQUAL "")
101102
list(APPEND AVX_FLAG "${BMI}")
102103
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 2" OUTPUT_FORMAT DECIMAL)
103104
endif()
104-
if (NOT "${AVX512}" STREQUAL "")
105+
if(NOT "${BMI2}" STREQUAL "")
106+
list(APPEND AVX_FLAG "${BMI2}")
107+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 3" OUTPUT_FORMAT DECIMAL)
108+
endif()
109+
if(NOT "${AVX512}" STREQUAL "")
105110
list(APPEND AVX_FLAG "${AVX512}")
106-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 5" OUTPUT_FORMAT DECIMAL)
107-
elseif (NOT "${AVX2}" STREQUAL "")
111+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 6" OUTPUT_FORMAT DECIMAL)
112+
elseif(NOT "${AVX2}" STREQUAL "")
108113
list(APPEND AVX_FLAG "${AVX2}")
109-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 4" OUTPUT_FORMAT DECIMAL)
110-
elseif (NOT "${AVX}" STREQUAL "")
114+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 5" OUTPUT_FORMAT DECIMAL)
115+
elseif(NOT "${AVX}" STREQUAL "")
111116
list(APPEND AVX_FLAG "${AVX}")
112-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 3" OUTPUT_FORMAT DECIMAL)
117+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 4" OUTPUT_FORMAT DECIMAL)
113118
endif()
114119

115120
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE}")

CMakeLists.txt

+24-8
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,38 @@
2121
# CMakeLists.txt - The CMake script for building this library.
2222
# May 13, 2021
2323
# https://discordcoreapi.com
24-
set(Opus_DIR "C:/Vcpkg/installed/x64-windows/share/opus") # Set this one to the folder location of the file "OpusConfig.cmake".
25-
set(unofficial-sodium_DIR "C:/Vcpkg/installed/x64-windows/share/unofficial-sodium") # Set this one to the folder location of the file "unofficial-sodiumConfig.cmake".
26-
set(Jsonifier_DIR "C:/vcpkg2/Users/Chris/source/repos/Jsonifier/Install/Windows-Release/share/jsonifier") # Set this one to the folder location of the file "JsonifierConfig.cmake".
27-
set(OPENSSL_ROOT_DIR "C:/Vcpkg/installed/x64-windows/") # Set this one to the folder location of the include folder and library folders of OpenSSL.
24+
set(Opus_DIR "C:/Vcpkg/installed/x64-windows-static/share/opus") # Set this one to the folder location of the file "OpusConfig.cmake".
25+
set(unofficial-sodium_DIR "C:/Vcpkg/installed/x64-windows-static/share/unofficial-sodium") # Set this one to the folder location of the file "unofficial-sodiumConfig.cmake".
26+
set(Jsonifier_DIR "") # Set this one to the folder location of the file "JsonifierConfig.cmake".
27+
set(OPENSSL_ROOT_DIR "C:/Vcpkg/installed/x64-windows-static/") # Set this one to the folder location of the include folder and library folders of OpenSSL.
28+
set(VCPKG_ROOT_DIR "C:/Vcpkg")
29+
set(CMAKE_BUILD_TYPES "Release;Debug")
30+
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
31+
set(DEV TRUE)
2832

2933
if (EXISTS "${VCPKG_ROOT_DIR}")
3034
set(ENV{VCPKG_INSTALLATION_ROOT} "${VCPKG_ROOT_DIR}")
31-
endif()
35+
endif()
3236

3337
cmake_minimum_required(VERSION 3.20)
3438
if (WIN32)
35-
set(OS "windows")
39+
if (NOT BUILD_SHARED_LIBS)
40+
set(OS "windows-static")
41+
else()
42+
set(OS "windows")
43+
endif()
3644
elseif(APPLE)
37-
set(OS "osx")
45+
if (NOT BUILD_SHARED_LIBS)
46+
set(OS "osx-static")
47+
else()
48+
set(OS "osx")
49+
endif()
3850
elseif(UNIX)
39-
set(OS "linux")
51+
if (NOT BUILD_SHARED_LIBS)
52+
set(OS "linux-static")
53+
else()
54+
set(OS "linux")
55+
endif()
4056
endif()
4157
if (EXISTS "$ENV{VCPKG_INSTALLATION_ROOT}")
4258
set(VCPKG_INSTALLATION_ROOT_NEW "$ENV{VCPKG_INSTALLATION_ROOT}")

0 commit comments

Comments
 (0)