Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2600868
Attempt to build `as.exe` on Windows
grendello Feb 23, 2024
75697d1
Build `gas` first, for quicker testing
grendello Feb 23, 2024
b32911b
Syntax, fool
grendello Feb 23, 2024
4fbea9e
Copy pasta, yum
grendello Feb 23, 2024
3bb1fe9
Make cmake happy
grendello Feb 23, 2024
7400489
Msbuild needs a project... lesseeee
grendello Feb 23, 2024
a3dd2c7
Solution?
grendello Feb 23, 2024
1b264ca
Merge branch 'main' into dev/grendel/as-on-windows
grendello Feb 27, 2024
eb7d9bd
Added the cxxopts submodule
grendello Feb 27, 2024
5f5d871
Don't use tip of master
grendello Feb 27, 2024
deda657
Let's see if it builds on CI
grendello Feb 27, 2024
4d5be55
Fix CI Linux build
grendello Feb 27, 2024
587074d
Merge branch 'main' into dev/grendel/as-on-windows
grendello Feb 28, 2024
4c7ee4f
Get some CI environment info
grendello Feb 28, 2024
88b0f28
Let's see if this fixes the build
grendello Feb 28, 2024
dabb05f
Merge branch 'main' into dev/grendel/as-on-windows
grendello Feb 29, 2024
de2dc8d
Actually build as, doh
grendello Feb 29, 2024
6cfea8d
Merge branch 'main' into dev/grendel/as-on-windows
grendello Mar 1, 2024
ed2e3ea
Return on errors in Windows build scripts
grendello Mar 1, 2024
269de5b
Windows endlines
grendello Mar 1, 2024
7c4f24c
Build utilities first, to save on testing time
grendello Mar 1, 2024
cd38954
Merge branch 'main' into dev/grendel/as-on-windows
grendello Mar 1, 2024
323a3b1
Make sure shell scripts quit on error
grendello Mar 1, 2024
8bfd09d
Make sure the correct macOS version is used
grendello Mar 1, 2024
988a2e7
Update gdnsuppress
pjcollins Mar 1, 2024
4aab854
Enable warnings at level 3
grendello Mar 1, 2024
1fdab6f
Revert "Update gdnsuppress"
grendello Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
url = https://github.com/llvm/llvm-project.git
shallow = true
branch = release/13.x
[submodule "cxxopts"]
path = external/cxxopts
url = https://github.com/jarro2783/cxxopts.git
branch = master
10 changes: 10 additions & 0 deletions build-common.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set MY_DIR=%~dp0
set HOST=windows
set BUILD_DIR=%MY_DIR%\xa-build
set ARTIFACTS_DIR=%MY_DIR%\artifacts
set HOST_ARTIFACTS_DIR=%ARTIFACTS_DIR%\%HOST%
set HOST_ARTIFACTS_BIN_DIR=%HOST_ARTIFACTS_DIR%\bin
set CMAKE_VS_GENERATOR=Visual Studio 17 2022
set MSVC_RUNTIME_LIBRARY="MultiThreaded"

mkdir %HOST_ARTIFACTS_BIN_DIR%
31 changes: 16 additions & 15 deletions build-llvm-azure.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FOR /F "tokens=1 delims=" %%F IN ('.\scripts\vswhere.cmd') DO SET result=%%F
CALL "%result%\Common7\Tools\VsDevCmd.bat"
IF ERRORLEVEL 1 CALL:FAILED_CASE

echo "VS path: %result%"

CALL ".\build-llvm.cmd"
IF ERRORLEVEL 1 CALL:FAILED_CASE
GOTO END_CASE

:FAILED_CASE
echo "Failed to find an instance of Visual Studio. Please check it is correctly installed."
GOTO END_CASE
:END_CASE
GOTO :EOF
FOR /F "tokens=1 delims=" %%F IN ('.\scripts\vswhere.cmd') DO SET result=%%F
CALL "%result%\Common7\Tools\VsDevCmd.bat"
IF %ERRORLEVEL% GEQ 1 CALL:FAILED_CASE

echo "VS path: %result%"

CALL ".\build-llvm.cmd"
IF %ERRORLEVEL% GEQ 1 CALL:FAILED_CASE
GOTO END_CASE

:FAILED_CASE
echo "Failed to find an instance of Visual Studio. Please check it is correctly installed."
exit /B %errorlevel%
GOTO END_CASE
:END_CASE
GOTO :EOF
35 changes: 22 additions & 13 deletions build-llvm.cmd
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
set MY_DIR=%~dp0
set HOST=windows
set BUILD_DIR=%MY_DIR%\xa-build
set ARTIFACTS_DIR=%MY_DIR%\artifacts
call build-common.cmd

set SOURCE_DIR=%MY_DIR%external\llvm\llvm

set PROJECTS=lld
set TARGETS=X86;ARM;AArch64
set BINARIES=llvm-mc.exe llvm-strip.exe lld.exe llc.exe
set PDBS=llvm-mc.pdb llvm-strip.pdb lld.pdb llc.pdb

set HOST_BUILD_DIR=%BUILD_DIR%\%HOST%
set HOST_BUILD_DIR=%BUILD_DIR%\%HOST%\llvm
set HOST_BIN_DIR=%HOST_BUILD_DIR%\Release\bin
set HOST_ARTIFACTS_DIR=%ARTIFACTS_DIR%\%HOST%

set LLVM_VERSION_FILE=%HOST_ARTIFACTS_DIR%\llvm-version.txt
set CXXFLAGS="/Qspectre /sdl /guard:cf"

if exist %HOST_BUILD_DIR% (rmdir /S /Q %HOST_BUILD_DIR%)
mkdir %HOST_BUILD_DIR%

if exist %HOST_ARTIFACTS_DIR% (rmdir /S /Q %HOST_ARTIFACTS_DIR%)
mkdir %HOST_ARTIFACTS_DIR%\bin

cd %HOST_BUILD_DIR%

cmake --version
cmake --help

cmake -G "Visual Studio 17 2022" -A x64 ^
cmake -G "%CMAKE_VS_GENERATOR%" -A x64 ^
-DCMAKE_EXE_LINKER_FLAGS_INIT="/PROFILE /DYNAMICBASE /CETCOMPAT /guard:cf" ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ^
-DCMAKE_MSVC_RUNTIME_LIBRARY="%MSVC_RUNTIME_LIBRARY%" ^
-DLLVM_BUILD_BENCHMARKS=OFF ^
-DLLVM_BUILD_DOCS=OFF ^
-DLLVM_BUILD_EXAMPLES=OFF ^
Expand Down Expand Up @@ -59,19 +54,33 @@ cmake -G "Visual Studio 17 2022" -A x64 ^
-DLLVM_USE_CRT_MINSIZEREL=MT ^
-DLLVM_USE_CRT_RELEASE=MT ^
%SOURCE_DIR%
IF %ERRORLEVEL% GEQ 1 EXIT /B 1

msbuild /p:Configuration=Release /m tools\llvm-mc\llvm-mc.vcxproj
IF %ERRORLEVEL% GEQ 1 EXIT /B 2

msbuild /p:Configuration=Release /m tools\llvm-objcopy\llvm-objcopy.vcxproj
IF %ERRORLEVEL% GEQ 1 EXIT /B 3

msbuild /p:Configuration=Release /m tools\lld\tools\lld\lld.vcxproj
IF %ERRORLEVEL% GEQ 1 EXIT /B 4

msbuild /p:Configuration=Release /m tools\llc\llc.vcxproj
IF %ERRORLEVEL% GEQ 1 EXIT /B 5

move %HOST_BIN_DIR%\llvm-objcopy.exe %HOST_BIN_DIR%\llvm-strip.exe
IF %ERRORLEVEL% GEQ 1 EXIT /B 6

move %HOST_BIN_DIR%\llvm-objcopy.pdb %HOST_BIN_DIR%\llvm-strip.pdb
IF %ERRORLEVEL% GEQ 1 EXIT /B 7

for %%b in (%BINARIES%) DO (
copy %HOST_BIN_DIR%\%%b %HOST_ARTIFACTS_DIR%\bin\%%b
copy %HOST_BIN_DIR%\%%b %HOST_ARTIFACTS_BIN_DIR%\%%b
IF %ERRORLEVEL% GEQ 1 EXIT /B 8
)
for %%p in (%PDBS%) DO (
copy %HOST_BIN_DIR%\%%p %HOST_ARTIFACTS_DIR%\bin\%%p
copy %HOST_BIN_DIR%\%%p %HOST_ARTIFACTS_BIN_DIR%\%%p
IF %ERRORLEVEL% GEQ 1 EXIT /B 9
)

cd %MY_DIR%
30 changes: 29 additions & 1 deletion build-llvm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/bin/bash

set -e

MY_NAME="$(basename $0)"
MY_DIR="$(cd $(dirname $0);pwd)"
Expand Down Expand Up @@ -109,6 +111,32 @@ function build()
fi
}

function print_compiler_info()
{
local path="$(which ${1})"

if [ -z "${path}" ]; then
echo "Compiler ${1} not found"
return
fi

echo "Compiler ${1} found:"
"${path}" --version
echo
}

if [ "${HOST}" == "linux" ]; then
echo "Compilers found:"

print_compiler_info gcc
print_compiler_info g++

for v in 10 11 12 13 14; do
print_compiler_info gcc-${v}
print_compiler_info g++-${v}
done
fi

create_empty_dir "${MY_BUILD_DIR}"
create_dir "${HOST_ARTIFACTS_BIN_DIR}"
create_dir "${HOST_ARTIFACTS_LIB_DIR}"
Expand Down
13 changes: 8 additions & 5 deletions build-tools/automation/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ extends:

- script: ./build-llvm.sh
env:
CC: gcc-10
CXX: g++-10
CC: gcc-13
CXX: g++-13
displayName: Build LLVM

- script: ./build-xa-utils.sh
env:
CC: gcc-10
CXX: g++-10
CC: gcc-13
CXX: g++-13
displayName: Build utilities

- script: |
Expand All @@ -140,6 +140,7 @@ extends:
vmImage: macOS-latest
${{ else }}:
name: VSEng-Xamarin-RedmondMac-Android-Untrusted
demands: macOS.Name -equals Monterey
os: macOS
templateContext:
outputs:
Expand Down Expand Up @@ -197,10 +198,12 @@ extends:
- checkout: self
submodules: recursive

- script: ./build-xa-utils-azure.cmd
displayName: Build utilities

- script: ./build-llvm-azure.cmd
displayName: Build Windows LLVM


- stage: package
displayName: Package Stage
dependsOn: build
Expand Down
16 changes: 16 additions & 0 deletions build-xa-utils-azure.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FOR /F "tokens=1 delims=" %%F IN ('.\scripts\vswhere.cmd') DO SET result=%%F
CALL "%result%\Common7\Tools\VsDevCmd.bat"
IF %ERRORLEVEL% GEQ 1 CALL:FAILED_CASE

echo "VS path: %result%"

CALL ".\build-xa-utils.cmd"
IF %ERRORLEVEL% GEQ 1 CALL:FAILED_CASE
GOTO END_CASE

:FAILED_CASE
echo "Failed to find an instance of Visual Studio. Please check it is correctly installed."
exit /B %errorlevel%
GOTO END_CASE
:END_CASE
GOTO :EOF
30 changes: 30 additions & 0 deletions build-xa-utils.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
call build-common.cmd

set SOURCE_DIR=%MY_DIR%src
set HOST_BUILD_DIR=%BUILD_DIR%\%HOST%\xa-utils
set HOST_BIN_DIR=%HOST_BUILD_DIR%\bin\Release

if exist %HOST_BUILD_DIR% (rmdir /S /Q %HOST_BUILD_DIR%)
mkdir %HOST_BUILD_DIR%

cd %HOST_BUILD_DIR%

cmake --version

cmake -G "%CMAKE_VS_GENERATOR%" -A x64 ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_MSVC_RUNTIME_LIBRARY="%MSVC_RUNTIME_LIBRARY%" ^
-DBINUTILS_VERSION="2.38" ^
%SOURCE_DIR%
IF %ERRORLEVEL% GEQ 1 EXIT /B 1

msbuild /p:Configuration=Release /m xa-utilities.sln
IF %ERRORLEVEL% GEQ 1 EXIT /B 2

copy %HOST_BIN_DIR%\as.exe %HOST_ARTIFACTS_BIN_DIR%\as.exe
IF %ERRORLEVEL% GEQ 1 EXIT /B 3

copy %HOST_BIN_DIR%\as.pdb %HOST_ARTIFACTS_BIN_DIR%\as.pdb
IF %ERRORLEVEL% GEQ 1 EXIT /B 4

cd %MY_DIR%
19 changes: 3 additions & 16 deletions build-xa-utils.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/bin/bash

set -e

MY_NAME="$(basename $0)"
MY_DIR="$(cd $(dirname $0);pwd)"
Expand Down Expand Up @@ -86,18 +88,3 @@ esac

(cd "${MY_BUILD_DIR}"; configure_${HOST})
(cd "${MY_BUILD_DIR}"; build "${HOST}")

if [ "${HOST}" != "linux" ]; then
exit 0
fi

MY_BUILD_DIR="${MY_BUILD_DIR}-windows"
HOST_ARTIFACTS_DIR="${ARTIFACTS_DIR}/windows"
HOST_ARTIFACTS_BIN_DIR="${HOST_ARTIFACTS_DIR}/bin"
HOST_BIN_DIR="${MY_BUILD_DIR}/bin"

create_empty_dir "${MY_BUILD_DIR}"
create_dir "${HOST_ARTIFACTS_BIN_DIR}"

(cd "${MY_BUILD_DIR}"; configure_windows)
(cd "${MY_BUILD_DIR}"; build windows)
1 change: 1 addition & 0 deletions external/cxxopts
Submodule cxxopts added at 3bf268
Loading