From 48e78763df579ccfcc0aed6b6f738550fdb55bc5 Mon Sep 17 00:00:00 2001 From: Manu Date: Fri, 4 Nov 2016 13:59:32 -0700 Subject: [PATCH 1/4] Remove compilation of Store/Phone targets --- buildWindows.bat | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/buildWindows.bat b/buildWindows.bat index e114aca..37ebad0 100644 --- a/buildWindows.bat +++ b/buildWindows.bat @@ -19,43 +19,6 @@ msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd -REM Windows Store -if not exist build\WindowsStore\x86 mkdir build\WindowsStore\x86 -pushd build\WindowsStore\x86 -cmake ..\..\..\ -G "Visual Studio 14" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 -msbuild libNativePath.sln /p:Configuration=Release -if %ERRORLEVEL% neq 0 GOTO :error_popd -popd - -if not exist build\WindowsStore\x64 mkdir build\WindowsStore\x64 -pushd build\WindowsStore\x64 -cmake ..\..\..\ -G "Visual Studio 14 Win64" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 -msbuild libNativePath.sln /p:Configuration=Release -if %ERRORLEVEL% neq 0 GOTO :error_popd -popd - -if not exist build\WindowsStore\ARM mkdir build\WindowsStore\ARM -pushd build\WindowsStore\ARM -cmake ..\..\..\ -G "Visual Studio 14 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 -msbuild libNativePath.sln /p:Configuration=Release -if %ERRORLEVEL% neq 0 GOTO :error_popd -popd - -REM Windows Phone -if not exist build\WindowsPhone\x86 mkdir build\WindowsPhone\x86 -pushd build\WindowsPhone\x86 -cmake ..\..\..\ -G "Visual Studio 14" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 -msbuild libNativePath.sln /p:Configuration=Release -if %ERRORLEVEL% neq 0 GOTO :error_popd -popd - -if not exist build\WindowsPhone\ARM mkdir build\WindowsPhone\ARM -pushd build\WindowsPhone\ARM -cmake ..\..\..\ -G "Visual Studio 14 ARM" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 -msbuild libNativePath.sln /p:Configuration=Release -if %ERRORLEVEL% neq 0 GOTO :error_popd -popd - REM Windows Universal if not exist build\WindowsUniversal\x86 mkdir build\WindowsUniversal\x86 pushd build\WindowsUniversal\x86 @@ -78,7 +41,10 @@ msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd +goto :exit + :error_popd popd +:exit @echo on From 22fc1769921c19d38e2a642195248b3b25cf7cca Mon Sep 17 00:00:00 2001 From: Manu Date: Fri, 4 Nov 2016 14:00:21 -0700 Subject: [PATCH 2/4] Rename WindowsUniversal into UWP --- buildWindows.bat | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/buildWindows.bat b/buildWindows.bat index 37ebad0..b7e0924 100644 --- a/buildWindows.bat +++ b/buildWindows.bat @@ -19,23 +19,23 @@ msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd -REM Windows Universal -if not exist build\WindowsUniversal\x86 mkdir build\WindowsUniversal\x86 -pushd build\WindowsUniversal\x86 +REM Windows UWP +if not exist build\UWP\x86 mkdir build\UWP\x86 +pushd build\UWP\x86 cmake ..\..\..\ -G "Visual Studio 14" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd -if not exist build\WindowsUniversal\x64 mkdir build\WindowsUniversal\x64 -pushd build\WindowsUniversal\x64 +if not exist build\UWP\x64 mkdir build\UWP\x64 +pushd build\UWP\x64 cmake ..\..\..\ -G "Visual Studio 14 Win64" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd -if not exist build\WindowsUniversal\ARM mkdir build\WindowsUniversal\ARM -pushd build\WindowsUniversal\ARM +if not exist build\UWP\ARM mkdir build\UWP\ARM +pushd build\UWP\ARM cmake ..\..\..\ -G "Visual Studio 14 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 msbuild libNativePath.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd From 1457bdda88bb37d87b89f485ea5b6e7ca99a3249 Mon Sep 17 00:00:00 2001 From: Manu Date: Fri, 4 Nov 2016 14:02:55 -0700 Subject: [PATCH 3/4] Add -GS- option to clang-cl command line to avoid unresolved reference to __stack_chk_guard when linking --- tools/np-build.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/np-build.lua b/tools/np-build.lua index 8605745..7b059e3 100644 --- a/tools/np-build.lua +++ b/tools/np-build.lua @@ -86,7 +86,7 @@ end function BuildWindowsUWP32(cfile) local flags = "" if debug then flags = debug_ms_flags else flags = release_ms_flags end - local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -MD -DWIN_EXPORT -m32 "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m32 "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -108,7 +108,7 @@ end function BuildWindowsUWP64(cfile) local flags = "" if debug then flags = debug_ms_flags else flags = release_ms_flags end - local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -MD -DWIN_EXPORT -m64 "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m64 "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -130,7 +130,7 @@ end function BuildWindowsUWPARM(cfile) local flags = "" if debug then flags = debug_ms_flags else flags = release_ms_flags end - local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -MD -DWIN_EXPORT -m32 --target=thumbv7-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m32 --target=thumbv7-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end From 2a5c7f5554cb59627304c60d4b69036e9ed91428 Mon Sep 17 00:00:00 2001 From: Manu Date: Fri, 4 Nov 2016 14:31:32 -0700 Subject: [PATCH 4/4] Add -nostdlibinc to clang to avoid getting Windows headers Add -GS- option to clang-cl to avoid unresolved externals on __stack_chk_guard --- tools/np-build.lua | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/np-build.lua b/tools/np-build.lua index 7b059e3..be5091b 100644 --- a/tools/np-build.lua +++ b/tools/np-build.lua @@ -16,7 +16,7 @@ local release_ms_flags = "-O2" function BuildWindows32DLL(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -m32 -DNP_WIN32 -Wall -fno-ms-extensions -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -m32 -DNP_WIN32 -Wall -fno-ms-extensions -nostdlibinc -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -40,7 +40,7 @@ end function BuildWindows32(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -m32 -DNP_WIN32 -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -m32 -DNP_WIN32 -nostdlibinc -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -62,7 +62,7 @@ end function BuildWindows64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -m64 -DNP_WIN32 -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -m64 -DNP_WIN32 -nostdlibinc -nobuiltininc -nostdinc++ -target i686-pc-windows-msvc "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -98,7 +98,7 @@ function LinkWindowsUWP32() for i, o in ipairs(objs) do objs_str = objs_str..o.." " end - local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x86 store && lib /NOLOGO /OUT:WindowsUWP\\x86\\"..outputName..".lib "..objs_str + local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x86 store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP\\x86\\"..outputName..".lib "..objs_str if is_verbose == true then print(cmd) end @@ -120,7 +120,7 @@ function LinkWindowsUWP64() for i, o in ipairs(objs) do objs_str = objs_str..o.." " end - local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x64 store && lib /NOLOGO /OUT:WindowsUWP\\x64\\"..outputName..".lib "..objs_str + local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x64 store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP\\x64\\"..outputName..".lib "..objs_str if is_verbose == true then print(cmd) end @@ -142,7 +142,7 @@ function LinkWindowsUWPARM() for i, o in ipairs(objs) do objs_str = objs_str..o.." " end - local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x86_arm store && lib /NOLOGO /OUT:WindowsUWP\\ARM\\"..outputName..".lib "..objs_str + local cmd = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall\" x86_arm store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP\\ARM\\"..outputName..".lib "..objs_str if is_verbose == true then print(cmd) end @@ -218,7 +218,7 @@ end function BuildIOSArm7(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_IOS -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target armv7-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_IOS -nostdlibinc -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target armv7-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -243,7 +243,7 @@ end function BuildIOSArm7s(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_IOS -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target armv7s-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_IOS -nostdlibinc -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target armv7s-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -265,7 +265,7 @@ end function BuildIOSArm64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_IOS -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target arm64-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_IOS -nostdlibinc -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target arm64-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -287,7 +287,7 @@ end function BuildIOSx86(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_IOS -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target i386-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_IOS -nostdlibinc -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target i386-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -309,7 +309,7 @@ end function BuildIOSx64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_IOS -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target x86_64-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_IOS -nostdlibinc -nobuiltininc -nostdinc++ -mios-version-min=6.0 -target x86_64-apple-ios "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -333,7 +333,7 @@ end function BuildMacOSx86(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_MACOS -nobuiltininc -nostdinc++ -mmacosx-version-min=10.5 -target i386-apple-macosx "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_MACOS -nostdlibinc -nobuiltininc -nostdinc++ -mmacosx-version-min=10.5 -target i386-apple-macosx "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -355,7 +355,7 @@ end function BuildMacOSx64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_MACOS -nobuiltininc -nostdinc++ -mmacosx-version-min=10.5 -target x86_64-apple-macosx "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_MACOS -nostdlibinc -nobuiltininc -nostdinc++ -mmacosx-version-min=10.5 -target x86_64-apple-macosx "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -379,7 +379,7 @@ end function BuildAndroidArm(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_ANDROID -nobuiltininc -nostdinc++ -target arm-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_ANDROID -nostdlibinc -nobuiltininc -nostdinc++ -target arm-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -401,7 +401,7 @@ end function BuildAndroidArm7(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_ANDROID -nobuiltininc -nostdinc++ -target armv7-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_ANDROID -nostdlibinc -nobuiltininc -nostdinc++ -target armv7-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -423,7 +423,7 @@ end function BuildAndroidArm64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_ANDROID -nobuiltininc -nostdinc++ -target aarch64-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_ANDROID -nostdlibinc -nobuiltininc -nostdinc++ -target aarch64-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -445,7 +445,7 @@ end function BuildAndroidx86(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_ANDROID -nobuiltininc -nostdinc++ -target i386-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_ANDROID -nostdlibinc -nobuiltininc -nostdinc++ -target i386-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -470,7 +470,7 @@ end function BuildAndroidx64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_ANDROID -nobuiltininc -nostdinc++ -target x86_64-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_ANDROID -nostdlibinc -nobuiltininc -nostdinc++ -target x86_64-none-android "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -494,7 +494,7 @@ end function BuildLinuxX64(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_LINUX -nobuiltininc -nostdinc++ -fPIC -target x86_64-linux-gnu "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_LINUX -nostdlibinc -nobuiltininc -nostdinc++ -fPIC -target x86_64-linux-gnu "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end @@ -516,7 +516,7 @@ end function BuildLinuxX86(cfile) local flags = "" if debug then flags = debug_flags else flags = release_flags end - local cmd = "clang -DNP_LINUX -nobuiltininc -nostdinc++ -fPIC -target i386-linux-gnu "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; + local cmd = "clang -DNP_LINUX -nostdlibinc -nobuiltininc -nostdinc++ -fPIC -target i386-linux-gnu "..common_flags.." "..flags.." -o "..cfile..".o ".." -c "..cfile; if is_verbose == true then print(cmd) end