Skip to content

Commit

Permalink
Use CMake Visual Studio generator instead of Ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
triplef committed Aug 6, 2021
1 parent ffdb4a6 commit f0c3c65
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
# delete /c/Strawberry/c/bin/gmake built for MinGW that is found on runners, because we must use make built for MSYS
run: if GMAKE_PATH=`which gmake`; then rm -f "$GMAKE_PATH"; fi
shell: msys2 {0}
- name: Install Windows packages
run: choco install ninja
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ The MSYS2 installation is required to provide the Bash shell and Unix tools requ
- Clang (via Visual Studio or `choco install llvm`)
- CMake (via Visual Studio or `choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'`)
- Git (`choco install git`)
- Ninja (`choco install ninja`)
- MSYS2 (`choco install msys2`)

**Unix tools**
Expand Down
2 changes: 0 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ where git
if %errorlevel% neq 0 call :error_missing_command git, "'choco install git'"
where cmake
if %errorlevel% neq 0 call :error_missing_command cmake, "Visual Studio or 'choco install cmake --installargs ADD_CMAKE_TO_PATH=System'"
where ninja
if %errorlevel% neq 0 call :error_missing_command ninja, "'choco install ninja'"
where clang-cl
if %errorlevel% neq 0 call :error_missing_command clang-cl, "Visual Studio or 'choco install llvm'"
call %BASH% 'true'
Expand Down
4 changes: 2 additions & 2 deletions phases/11-libobjc2.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ cmake .. %CMAKE_OPTIONS% ^
echo.
echo ### Building
set CCC_OVERRIDE_OPTIONS=x-TC x-TP x/TC x/TP
ninja || exit /b 1
cmake %CMAKE_BUILD_OPTIONS% || exit /b 1
set CCC_OVERRIDE_OPTIONS=

echo.
echo ### Installing
ninja install || exit /b 1
cmake %CMAKE_INSTALL_OPTIONS% || exit /b 1

:: Install PDB files
xcopy /Y /F objc.pdb "%INSTALL_PREFIX%\lib\"
4 changes: 2 additions & 2 deletions phases/18-libdispatch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ cmake .. %CMAKE_OPTIONS% ^

echo.
echo ### Building
ninja || exit /b 1
cmake %CMAKE_BUILD_OPTIONS% || exit /b 1

echo.
echo ### Installing
ninja install || exit /b 1
cmake %CMAKE_INSTALL_OPTIONS% || exit /b 1

:: Install PDB file
xcopy /Y /F dispatch.pdb "%INSTALL_PREFIX%\lib\"
Expand Down
25 changes: 5 additions & 20 deletions scripts/sdkenv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,11 @@ if "%ARCH%" == "x86" (
exit /b 1
)

:: add flags for cross compilation
if not "%VSCMD_ARG_HOST_ARCH%" == "" (
if not "%VSCMD_ARG_HOST_ARCH%" == "%ARCH%" (
if "%ARCH%" == "x86" (
set FLAGS=-m32
) else if "%ARCH%" == "x64" (
set FLAGS=-m64
)
set "CFLAGS=%FLAGS% %CFLAGS%"
set "CXXFLAGS=%FLAGS% %CXXFLAGS%"
set "LDFLAGS=%FLAGS% %LDFLAGS%"
)
)

:: Common CMake options
set CMAKE_ARCH=%ARCH%
if "%ARCH%" == "x86" set CMAKE_ARCH=Win32
set CMAKE_BUILD_TYPE=%BUILD_TYPE%
if "%BUILD_TYPE%" == "Release" set CMAKE_BUILD_TYPE=RelWithDebInfo
set CMAKE_OPTIONS=^
-G Ninja ^
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
-D CMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" ^
-D CMAKE_C_COMPILER=clang-cl ^
-D CMAKE_CXX_COMPILER=clang-cl ^
set CMAKE_OPTIONS=-T ClangCL -A %CMAKE_ARCH% -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%"
set CMAKE_BUILD_OPTIONS=--build . --config %CMAKE_BUILD_TYPE% -- -m
set CMAKE_INSTALL_OPTIONS=--build . --config %CMAKE_BUILD_TYPE% --target install

0 comments on commit f0c3c65

Please sign in to comment.