diff --git a/build.bat b/build.bat index 85bbfd7..0b696e4 100644 --- a/build.bat +++ b/build.bat @@ -87,8 +87,8 @@ 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'" +where clang +if %errorlevel% neq 0 call :error_missing_command clang, "Visual Studio or 'choco install llvm'" call %BASH% 'true' if %errorlevel% neq 0 call :error_missing_command MSYS2, "'choco install msys2'" call %BASH% 'which make' diff --git a/phases/11-libobjc2.bat b/phases/11-libobjc2.bat index 566663f..4b8784b 100644 --- a/phases/11-libobjc2.bat +++ b/phases/11-libobjc2.bat @@ -22,9 +22,7 @@ cmake .. %CMAKE_OPTIONS% ^ echo. echo ### Building -set CCC_OVERRIDE_OPTIONS=x-TC x-TP x/TC x/TP ninja || exit /b 1 -set CCC_OVERRIDE_OPTIONS= echo. echo ### Installing diff --git a/phases/18-libdispatch.bat b/phases/18-libdispatch.bat index 4089f8a..37f3ccf 100644 --- a/phases/18-libdispatch.bat +++ b/phases/18-libdispatch.bat @@ -23,6 +23,7 @@ echo. echo ### Running cmake :: CXX and linker flags below are to produce PDBs for release builds. :: BlocksRuntime parameters provided to use blocks runtime from libobjc2 with libdispatch-own-blocksruntime.patch. +:: libdispatch only supports building with clang-cl frontend. cmake .. %CMAKE_OPTIONS% ^ -D BUILD_SHARED_LIBS=YES ^ -D INSTALL_PRIVATE_HEADERS=YES ^ @@ -30,6 +31,8 @@ cmake .. %CMAKE_OPTIONS% ^ -D CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO="/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF" ^ -D BlocksRuntime_INCLUDE_DIR=%INSTALL_PREFIX%\include ^ -D BlocksRuntime_LIBRARIES=%INSTALL_PREFIX%\lib\objc.lib ^ + -D CMAKE_C_COMPILER=clang-cl ^ + -D CMAKE_CXX_COMPILER=clang-cl ^ || exit /b 1 echo. diff --git a/scripts/sdkenv.bat b/scripts/sdkenv.bat index ea097aa..bb496b3 100644 --- a/scripts/sdkenv.bat +++ b/scripts/sdkenv.bat @@ -36,26 +36,26 @@ if "%ARCH%" == "x86" ( exit /b 1 ) -:: compiler/linker flags -:: - -m32/64 flags are required to ensure the right architecture is built and linked, -:: and setting these via CFLAGS doesn't work because GNUstep Make ignores those, -:: so we set them as part of the compiler instead -:: - LLD linker is required for linking Objective C -if not defined CC set CC=clang %MFLAG% -if not defined CXX set CXX=clang++ %MFLAG% -if not defined OBJCC set OBJCC=clang %MFLAG% -if not defined OBJCXX set OBJCXX=clang++ %MFLAG% +:: compiler flags: -m32/64 is required to ensure the right architecture is +:: built and linked. Unfortunately GNUstep Make ignores those, so we also set +:: them as part of the compiler. +if not defined CFLAGS set CFLAGS=%MFLAG% +if not defined CXXFLAGS set CXXFLAGS=%MFLAG% +if not defined OBJCFLAGS set OBJCFLAGS=%MFLAG% +if not defined OBJCXXFLAGS set OBJCXXFLAGS=%MFLAG% +if not defined ASMFLAGS set ASMFLAGS=%MFLAG% +if not defined CC set "CC=clang %MFLAG%" +if not defined CXX set "CXX=clang++ %MFLAG%" +if not defined OBJCC set "OBJCC=clang %MFLAG%" +if not defined OBJCXX set "OBJCXX=clang++ %MFLAG%" + +:: LLD linker is required for linking Objective C set LDFLAGS=-fuse-ld=lld :: common CMake options -:: - CMAKE_C(XX)_COMPILER_TARGET are required to ensure the right architecture is built and linked 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 ^ - -D CMAKE_C_COMPILER_TARGET=%TARGET% ^ - -D CMAKE_CXX_COMPILER_TARGET=%TARGET% ^