Skip to content

Commit

Permalink
Proper cmake patching
Browse files Browse the repository at this point in the history
  • Loading branch information
FriwiDev committed Nov 23, 2021
1 parent 16d14bf commit 0e8dc56
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 328 deletions.
322 changes: 0 additions & 322 deletions CMakeLists.txt

This file was deleted.

4 changes: 4 additions & 0 deletions DockerfileLinux
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ COPY out/linux* /prebuild
#Copy additional natives
COPY natives /natives

#Copy cmake patching script
COPY scripts/patch_cmake.py .
COPY patch/CMakeLists.txt.patch .

#Copy and launch run script
COPY scripts/run_linux.sh .
RUN chmod +x run_linux.sh
Expand Down
4 changes: 4 additions & 0 deletions DockerfileWindows
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ FROM friwidev/jcefdocker:windows-latest

WORKDIR C:/

#Copy cmake patching script
COPY scripts/patch_cmake.py .
COPY patch/CMakeLists.txt.patch .

#Copy and launch run script
COPY scripts/run_windows.bat .
ENTRYPOINT ["run_windows.bat"]
44 changes: 44 additions & 0 deletions patch/CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Determine the platform.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
if("${PROJECT_ARCH}" STREQUAL "arm64")
set(CEF_PLATFORM "macosarm64")
else()
set(CEF_PLATFORM "macosx64")
endif()
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
if("${PROJECT_ARCH}" STREQUAL "amd64")
set(CEF_PLATFORM "linux64")
elseif("${PROJECT_ARCH}" STREQUAL "arm64")
set(CEF_PLATFORM "linuxarm64")
elseif("${PROJECT_ARCH}" STREQUAL "arm/v6")
set(CEF_PLATFORM "linuxarm")
else()
set(CEF_PLATFORM "linux32")
endif()
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
#Stolen from Jetbrains jcef repository for the arm64 windows build

This comment has been minimized.

Copy link
@VladRassokhin

VladRassokhin Apr 6, 2022

A moment when you stole it back to JetBrains for the lines about Linux and arm64 🤣

if(MSVC)
include(CheckSymbolExists)

# MSVC predefines _M_ARM64 for compilations that target ARM64
# and _M_AMD64 for compilations that target x86_64.
check_symbol_exists("_M_ARM64" "" CEF_PLATFORM_WINARM64)
check_symbol_exists("_M_AMD64" "" CEF_PLATFORM_WIN64)

# We also should set PROJECT_ARCH explicitly because FindCEF.cmake deduces it incorrectly for
# cross-compilation cases.
if(CEF_PLATFORM_WINARM64)
set(CEF_PLATFORM "windowsarm64")
set(PROJECT_ARCH "arm64")
elseif(CEF_PLATFORM_WIN64)
set(CEF_PLATFORM "windows64")
set(PROJECT_ARCH "x86_64")
else()
set(CEF_PLATFORM "windows32")
set(PROJECT_ARCH "x86")
endif()
else()
message(FATAL_ERROR "Building JCEF for Windows using non-MSVC compiler is not supported.")
endif()
endif()

Loading

0 comments on commit 0e8dc56

Please sign in to comment.