Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Commit 6d8a2e6

Browse files
committed
Add windows ARM64 builds support
1 parent 64a3dcf commit 6d8a2e6

5 files changed

Lines changed: 90 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ jobs:
2020
with:
2121
path: ./build/src/Release/axslcc.exe
2222
name: axslcc-win-x64
23+
win-arm64:
24+
runs-on: windows-11-arm
25+
steps:
26+
- uses: actions/checkout@v6
27+
- name: build
28+
shell: pwsh
29+
run: |
30+
cmake -B build -A arm64
31+
cmake --build build --config Release --target axslcc
32+
- name: Upload
33+
uses: actions/upload-artifact@v6
34+
with:
35+
path: ./build/src/Release/axslcc.exe
36+
name: axslcc-win-arm64
2337
linux-x64:
2438
runs-on: ubuntu-22.04
2539
steps:

.github/workflows/dist.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ jobs:
5757
- name: Create packages
5858
if: ${{ steps.check_ver.outputs.release_ver != '' }}
5959
run: |
60-
curl -L https://github.com/simdsoft/1kiss/releases/download/devtools/d3dcompiler_47.dll -o ./axslcc-win-x64/d3dcompiler_47.dll
60+
curl -L https://github.com/simdsoft/1kiss/releases/download/devtools/d3dcompiler_47-x64.dll -o ./axslcc-win-x64/d3dcompiler_47.dll
61+
curl -L https://github.com/simdsoft/1kiss/releases/download/devtools/d3dcompiler_47-arm64.dll -o ./axslcc-win-arm64/d3dcompiler_47.dll
6162
ls -l ./axslcc-win-x64
63+
ls -l ./axslcc-win-arm64
6264
mkdir -p pkg_dir
6365
prefix=axslcc-${{ steps.check_ver.outputs.release_ver }}
6466
ls -l axslcc-linux-x64
@@ -78,6 +80,7 @@ jobs:
7880
tar -czvf ./pkg_dir/$prefix-osx-x64.tar.gz -C ./axslcc-osx-x64 axslcc
7981
tar -czvf ./pkg_dir/$prefix-osx-arm64.tar.gz -C ./axslcc-osx-arm64 axslcc
8082
sh -c "cd ./axslcc-win-x64; zip ../pkg_dir/$prefix-win-x64.zip axslcc.exe d3dcompiler_47.dll"
83+
sh -c "cd ./axslcc-win-arm64; zip ../pkg_dir/$prefix-win-arm64.zip axslcc.exe d3dcompiler_47.dll"
8184
- name: Publish to github release page
8285
if: ${{ steps.check_ver.outputs.release_ver != '' }}
8386
uses: softprops/action-gh-release@v2

3rdparty/sx/include/sx/atomic.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@
4242
// Every source must include <windows.h> before including atomic.h
4343
# include <intrin.h>
4444
# if SX_COMPILER_MSVC
45+
#if !defined(_M_ARM) && !defined(_M_ARM64)
4546
# pragma intrinsic(_mm_pause)
4647
# pragma intrinsic(_mm_mfence)
4748
# pragma intrinsic(_mm_lfence)
4849
# pragma intrinsic(_mm_sfence)
50+
#else
51+
#define _mm_pause(...)
52+
#define _mm_mfence(...)
53+
#define _mm_lfence(...)
54+
#define _mm_sfence(...)
55+
#endif
4956
# pragma intrinsic(_ReadWriteBarrier)
5057
# pragma intrinsic(_ReadBarrier)
5158
# pragma intrinsic(_WriteBarrier)

3rdparty/sx/include/sx/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
# define SX_CACHE_LINE_SIZE 64
120120
#endif //
121121

122-
#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(__64BIT__) || \
122+
#if defined(__x86_64__) || defined(_M_X64) || defined(_M_ARM64) || defined(__arm64__) || defined(__aarch64__) || defined(__64BIT__) || \
123123
defined(__mips64) || defined(__powerpc64__) || defined(__ppc64__) || defined(__LP64__)
124124
# undef SX_ARCH_64BIT
125125
# define SX_ARCH_64BIT 64

CMakeLists.txt

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.23..4.1)
1+
cmake_minimum_required(VERSION 3.23..4.3)
22
project(axslcc)
33

44
if (WIN32)
@@ -88,6 +88,69 @@ add_subdirectory(3rdparty/spirv-cross)
8888
add_subdirectory(3rdparty/sx)
8989
add_subdirectory(src)
9090

91+
92+
# ------------------------------------------------------------------------------
93+
# Helper Function: get_all_targets
94+
# Description:
95+
# A helper function to collect all targets (including those in subdirectories)
96+
# into a list variable. This solves the limitation of CMake's native target listing.
97+
# Parameters:
98+
# result - Output variable name to store the list of all targets
99+
# ------------------------------------------------------------------------------
100+
function(get_all_targets result)
101+
# Initialize an empty list to store targets
102+
set(targets "")
103+
104+
# Define a recursive function to collect targets from all directories
105+
function(_get_all_targets_recursive dir)
106+
# Get targets in the current directory
107+
get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
108+
109+
# Add current directory's targets to the global list
110+
list(APPEND targets ${current_targets})
111+
112+
# Get subdirectories of the current directory
113+
get_property(subdirs DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
114+
115+
# Recursively process all subdirectories
116+
foreach(subdir IN LISTS subdirs)
117+
_get_all_targets_recursive(${subdir})
118+
endforeach()
119+
120+
# Update the global targets list (PARENT_SCOPE to pass up)
121+
set(targets ${targets} PARENT_SCOPE)
122+
endfunction()
123+
124+
# Start recursive collection from the top-level source directory
125+
_get_all_targets_recursive(${CMAKE_SOURCE_DIR})
126+
127+
# Pass the collected targets to the output variable
128+
set(${result} ${targets} PARENT_SCOPE)
129+
endfunction()
130+
131+
# Get the list of all targets defined in the current CMake context
132+
get_all_targets(all_targets)
133+
134+
# Iterate through each target in the collected list
135+
foreach(target IN LISTS all_targets)
136+
# Check if the target is an IMPORTED target (external dependency)
137+
get_target_property(is_imported ${target} IMPORTED)
138+
139+
# Skip imported targets to prevent modifying external libraries
140+
if(NOT is_imported)
141+
# Set C++ standard to 20 for the target (C++20)
142+
set_target_properties(${target} PROPERTIES
143+
C_STANDARD ${CMAKE_C_STANDARD}
144+
CXX_STANDARD ${CMAKE_CXX_STANDARD}
145+
# Enforce the standard (disable compiler-specific extensions)
146+
CXX_STANDARD_REQUIRED ON
147+
)
148+
149+
# Optional: Print log to confirm the setting (comment out if not needed)
150+
message(STATUS "Set C++${CMAKE_CXX_STANDARD} standard for target: ${target}")
151+
endif()
152+
endforeach()
153+
91154
if(MSVC_IDE)
92155
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT axslcc)
93156
endif()

0 commit comments

Comments
 (0)