Skip to content

Commit 86f4464

Browse files
Revert "Support native Apple ARM64" (#467)
I discovered some issues that I need to investigate. I think it would be better to revert until they are investigated. Signed-off-by: Cédrik Fuoco <[email protected]>
1 parent e78d986 commit 86f4464

28 files changed

+378
-184
lines changed

cmake/defaults/cxx_clang_defaults.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@ ELSE()
1313
)
1414
ENDIF()
1515

16-
IF(NOT RV_TARGET_APPLE_ARM64)
17-
SET(__compiler_options_x86_64 -msse -msse2 -msse3 -mmmx)
18-
ENDIF()
19-
20-
SET(__compiler_options__
21-
-Wall ${__compiler_options_x86_64}
22-
)
23-
2416
# Common options
2517
ADD_COMPILE_OPTIONS(
2618
${_verbose_invocation}
27-
${_compiler_options__}
19+
-Wall
2820
-Wnonportable-include-path
21+
-msse
22+
-msse2
23+
-msse3
24+
-mmmx
2925
)
3026

3127
IF(${CMAKE_BUILD_TYPE} STREQUAL "Release")

cmake/defaults/rv_targets.cmake

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,6 @@ SET(CMAKE_SKIP_RPATH
99
)
1010

1111
IF(APPLE)
12-
# Only native builds are supported (x86_64 on Intel MacOS and ARM64 on Apple chipset).
13-
# Rosetta can be used to build x86_64 on Apple chipset.
14-
IF("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
15-
SET(RV_TARGET_APPLE_X86_64
16-
ON
17-
CACHE INTERNAL "Compile for x86_64 on Apple MacOS" FORCE
18-
)
19-
SET(__target_arch__ -DRV_ARCH_X86_64)
20-
ELSEIF("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
21-
SET(RV_TARGET_APPLE_ARM64
22-
ON
23-
CACHE INTERNAL "Compile for arm64 on Apple MacOS" FORCE
24-
)
25-
SET(__target_arch__ -DRV_ARCH_ARM64)
26-
ENDIF()
27-
28-
MESSAGE(STATUS "Building for ${CMAKE_HOST_SYSTEM_PROCESSOR}")
29-
ADD_COMPILE_OPTIONS(${__target_arch__})
30-
3112
# Darwin is the name of the mach BSD-base kernel :-)
3213
SET(RV_TARGET_DARWIN
3314
BOOL TRUE "Detected target is Apple's macOS"
@@ -37,6 +18,18 @@ IF(APPLE)
3718
"Darwin"
3819
CACHE INTERNAL ""
3920
)
21+
SET(CMAKE_OSX_ARCHITECTURES
22+
"x86_64"
23+
CACHE STRING "Force compilation for Intel processors." FORCE
24+
)
25+
26+
SET(RV_OSX_EMULATION
27+
ON
28+
)
29+
SET(RV_OSX_EMULATION_ARCH
30+
"-x86_64"
31+
CACHE STRING "Architecture to use while building the dependencies" FORCE
32+
) # Set to empty string for native
4033

4134
# The code makes extensive use of the 'PLATFORM_DARWIN' definition
4235
SET(PLATFORM
@@ -152,4 +145,4 @@ ELSEIF(WIN32)
152145
ELSE()
153146
MESSAGE(FATAL_ERROR "Unsupported platform")
154147

155-
ENDIF()
148+
ENDIF()

cmake/dependencies/atomic_ops.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ SET(_autogen_command
5656
sh ./autogen.sh
5757
)
5858

59+
IF(${RV_OSX_EMULATION})
60+
SET(_darwin_x86_64
61+
"arch" "${RV_OSX_EMULATION_ARCH}"
62+
)
63+
64+
SET(_make_command
65+
${_darwin_x86_64} ${_make_command}
66+
)
67+
SET(_configure_command
68+
${_darwin_x86_64} ${_configure_command}
69+
)
70+
SET(_autogen_command
71+
${_darwin_x86_64} ${_autogen_command}
72+
)
73+
ENDIF()
74+
5975
# Make sure NOT to enable GPL
6076
SET(_configure_args
6177
"--disable-gpl"

cmake/dependencies/boost.cmake

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ ELSE()
159159
)
160160
ENDIF()
161161

162+
IF(${RV_OSX_EMULATION})
163+
SET(_darwin_x86_64
164+
"arch" "${RV_OSX_EMULATION_ARCH}"
165+
)
166+
167+
SET(_b2_command
168+
${_darwin_x86_64} ${_b2_command}
169+
)
170+
SET(_bootstrap_command
171+
${_darwin_x86_64} ${_bootstrap_command}
172+
)
173+
ENDIF()
174+
162175
IF(RV_TARGET_WINDOWS)
163176
SET(_boost_python_bin
164177
${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/python.exe
@@ -177,13 +190,6 @@ LIST(
177190
OUTPUT_VARIABLE _boost_with_list
178191
)
179192

180-
SET(__boost_arch__ x86)
181-
IF(APPLE)
182-
IF(RV_TARGET_APPLE_ARM64)
183-
SET(__boost_arch__ arm)
184-
ENDIF()
185-
ENDIF()
186-
187193
EXTERNALPROJECT_ADD(
188194
${_target}
189195
DEPENDS Python::Python
@@ -198,7 +204,7 @@ EXTERNALPROJECT_ADD(
198204
BUILD_COMMAND
199205
# Ref.: https://www.boost.org/doc/libs/1_70_0/tools/build/doc/html/index.html#bbv2.builtin.features.cflags Ref.:
200206
# https://www.boost.org/doc/libs/1_76_0/tools/build/doc/html/index.html#bbv2.builtin.features.cflags
201-
./b2 -a -q toolset=${_toolset} cxxstd=${RV_CPP_STANDARD} variant=${_boost_variant} link=shared threading=multi architecture=${__boost_arch__} address-model=64
207+
./b2 -a -q toolset=${_toolset} cxxstd=${RV_CPP_STANDARD} variant=${_boost_variant} link=shared threading=multi architecture=x86 address-model=64
202208
${_boost_with_list} ${_boost_b2_options} -j${_cpu_count} install --prefix=${_install_dir}
203209
INSTALL_COMMAND echo "Boost was both built and installed in the build stage"
204210
BUILD_IN_SOURCE TRUE

cmake/dependencies/dav1d.cmake

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,12 @@ SET(_make_command
5353
ninja
5454
)
5555

56-
IF(APPLE)
57-
# Cross-file must be specified because if Rosetta is used to compile for x86_64 from ARM64,
58-
# Meson still detects ARM64 as the default architecture.
59-
60-
IF(RV_TARGET_APPLE_X86_64)
61-
SET(_meson_cross_file
62-
"${PROJECT_SOURCE_DIR}/src/build/meson_arch_x86_64.txt"
63-
)
64-
ELSEIF(RV_TARGET_APPLE_ARM64)
65-
SET(_meson_cross_file
66-
"${PROJECT_SOURCE_DIR}/src/build/meson_arch_arm64.txt"
67-
)
68-
ENDIF()
69-
56+
IF(${RV_OSX_EMULATION})
57+
SET(_meson_cross_file
58+
"${PROJECT_SOURCE_DIR}/src/build/meson_arch_x86_64.txt"
59+
)
7060
SET(_configure_command
71-
${_configure_command} "--cross-file" ${_meson_cross_file}
61+
${_configure_command} "--cross-file" ${_meson_cross_file}
7262
)
7363
ENDIF()
7464

cmake/dependencies/ffmpeg.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ SET(_configure_command
5252
sh ./configure
5353
)
5454

55+
IF(${RV_OSX_EMULATION})
56+
SET(_darwin_x86_64
57+
"arch" "${RV_OSX_EMULATION_ARCH}"
58+
)
59+
60+
SET(_make_command
61+
${_darwin_x86_64} ${_make_command}
62+
)
63+
SET(_configure_command
64+
${_darwin_x86_64} ${_configure_command}
65+
)
66+
ENDIF()
67+
5568
SET(_include_dir
5669
${_install_dir}/include
5770
)

cmake/dependencies/gc.cmake

Lines changed: 93 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
INCLUDE(ProcessorCount) # require CMake 3.15+
88
PROCESSORCOUNT(_cpu_count)
99

10-
RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_GC" "8.2.2" "" "")
10+
SET(_target
11+
"RV_DEPS_GC"
12+
)
13+
14+
SET(_version
15+
"8.2.2"
16+
)
1117

1218
SET(_download_url
1319
"https://github.com/ivmai/bdwgc/archive/refs/tags/v${_version}.zip"
@@ -20,16 +26,42 @@ SET(_install_dir
2026
${RV_DEPS_BASE_DIR}/${_target}/install
2127
)
2228

23-
IF(RV_TARGET_LINUX)
24-
SET(_lib_dir
25-
${_install_dir}/lib64
29+
SET(_make_command
30+
make
31+
)
32+
SET(_autogen_command
33+
sh ./autogen.sh
34+
)
35+
SET(_configure_command
36+
sh ./configure
37+
)
38+
39+
IF(${RV_OSX_EMULATION})
40+
SET(_darwin_x86_64
41+
"arch" "${RV_OSX_EMULATION_ARCH}"
2642
)
27-
ELSE()
28-
SET(_lib_dir
29-
${_install_dir}/lib
43+
44+
SET(_make_command
45+
${_darwin_x86_64} ${_make_command}
46+
)
47+
SET(_autogen_command
48+
${_darwin_x86_64} ${_autogen_command}
49+
)
50+
SET(_configure_command
51+
${_darwin_x86_64} ${_configure_command}
52+
)
53+
ENDIF()
54+
IF(RV_TARGET_WINDOWS)
55+
# MSYS2/CMake defaults to Ninja
56+
SET(_make_command
57+
ninja
3058
)
3159
ENDIF()
3260

61+
SET(_lib_dir
62+
${_install_dir}/lib
63+
)
64+
3365
SET(_gc_lib_name
3466
${CMAKE_SHARED_LIBRARY_PREFIX}gc.1${CMAKE_SHARED_LIBRARY_SUFFIX}
3567
)
@@ -83,33 +115,64 @@ SET(_include_dir
83115
)
84116
FILE(MAKE_DIRECTORY ${_include_dir})
85117

86-
LIST(APPEND _configure_options "-Denable_parallel_mark=ON")
87-
LIST(APPEND _configure_options "-Denable_cplusplus=ON")
88118
IF(RV_TARGET_WINDOWS)
89-
LIST(APPEND _configure_options "-DCMAKE_USE_WIN32_THREADS_INIT=1")
119+
SET(_cmake_configure_command
120+
${CMAKE_COMMAND}
121+
)
122+
LIST(APPEND _cmake_configure_command "-DCMAKE_INSTALL_PREFIX=${_install_dir}")
123+
LIST(APPEND _cmake_configure_command "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
124+
LIST(APPEND _cmake_configure_command "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
125+
LIST(APPEND _cmake_configure_command "-Denable_parallel_mark=ON")
126+
LIST(APPEND _cmake_configure_command "-Denable_cplusplus=ON")
127+
LIST(APPEND _cmake_configure_command "-DCMAKE_USE_WIN32_THREADS_INIT=1")
128+
LIST(APPEND _cmake_configure_command "${RV_DEPS_BASE_DIR}/${_target}/src")
129+
EXTERNALPROJECT_ADD(
130+
${_target}
131+
DOWNLOAD_NAME ${_target}_${_version}.zip
132+
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
133+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
134+
SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src
135+
INSTALL_DIR ${_install_dir}
136+
URL ${_download_url}
137+
URL_MD5 ${_download_hash}
138+
CONFIGURE_COMMAND ${_cmake_configure_command}
139+
BUILD_COMMAND ${_make_command} -j${_cpu_count}
140+
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${RV_DEPS_BASE_DIR}/${_target}/src/include ${_include_dir}/gc
141+
COMMAND ${CMAKE_COMMAND} -E copy ${RV_DEPS_BASE_DIR}/${_target}/src/${_gc_lib_name} ${_gc_lib}
142+
BUILD_IN_SOURCE TRUE
143+
BUILD_ALWAYS FALSE
144+
BUILD_BYPRODUCTS ${_gc_byproducts}
145+
USES_TERMINAL_BUILD TRUE
146+
)
147+
ADD_LIBRARY(BDWGC::Gc STATIC IMPORTED GLOBAL)
90148
ELSE()
91-
LIST(APPEND _configure_options "-DCMAKE_USE_PTHREADS_INIT=1")
149+
SET(_configure_args
150+
"--enable-cplusplus"
151+
)
152+
LIST(APPEND _configure_args "--prefix=${_install_dir}")
153+
154+
EXTERNALPROJECT_ADD(
155+
${_target}
156+
DOWNLOAD_NAME ${_target}_${_version}.zip
157+
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
158+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
159+
SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src
160+
INSTALL_DIR ${_install_dir}
161+
URL ${_download_url}
162+
URL_MD5 ${_download_hash}
163+
CONFIGURE_COMMAND ${_autogen_command} && ${_configure_command} ${_configure_args}
164+
BUILD_COMMAND ${_make_command} -j${_cpu_count}
165+
INSTALL_COMMAND ${_make_command} install
166+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir} ${CMAKE_BINARY_DIR}
167+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/lib ${RV_STAGE_LIB_DIR}
168+
BUILD_IN_SOURCE TRUE
169+
BUILD_ALWAYS FALSE
170+
BUILD_BYPRODUCTS ${_gc_byproducts}
171+
USES_TERMINAL_BUILD TRUE
172+
)
173+
ADD_LIBRARY(BDWGC::Gc SHARED IMPORTED GLOBAL)
92174
ENDIF()
93175

94-
EXTERNALPROJECT_ADD(
95-
${_target}
96-
DOWNLOAD_NAME ${_target}_${_version}.zip
97-
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
98-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
99-
SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src
100-
INSTALL_DIR ${_install_dir}
101-
URL ${_download_url}
102-
URL_MD5 ${_download_hash}
103-
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_configure_options}
104-
BUILD_COMMAND ${_cmake_build_command}
105-
INSTALL_COMMAND ${_cmake_install_command}
106-
BUILD_IN_SOURCE TRUE
107-
BUILD_ALWAYS FALSE
108-
BUILD_BYPRODUCTS ${_gc_byproducts}
109-
USES_TERMINAL_BUILD TRUE
110-
)
111-
ADD_LIBRARY(BDWGC::Gc STATIC IMPORTED GLOBAL)
112-
113176
ADD_DEPENDENCIES(BDWGC::Gc ${_target})
114177
SET_PROPERTY(
115178
TARGET BDWGC::Gc

cmake/dependencies/glew.cmake

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
INCLUDE(ProcessorCount) # require CMake 3.15+
88
PROCESSORCOUNT(_cpu_count)
99

10-
RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_GLEW" "e1a80a9f12d7def202d394f46e44cfced1104bfb" "make" "")
10+
SET(_target
11+
"RV_DEPS_GLEW"
12+
)
13+
14+
SET(_version
15+
"e1a80a9f12d7def202d394f46e44cfced1104bfb"
16+
)
1117

1218
SET(_download_url
1319
"https://github.com/nigels-com/glew/archive/${_version}.zip"
@@ -44,6 +50,20 @@ SET(_glew_lib
4450
${_lib_dir}/${_glew_lib_name}
4551
)
4652

53+
SET(_make_command
54+
make
55+
)
56+
57+
IF(${RV_OSX_EMULATION})
58+
SET(_darwin_x86_64
59+
"arch" "${RV_OSX_EMULATION_ARCH}"
60+
)
61+
62+
SET(_make_command
63+
${_darwin_x86_64} ${_make_command}
64+
)
65+
ENDIF()
66+
4767
EXTERNALPROJECT_ADD(
4868
${_target}
4969
SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src
@@ -52,7 +72,7 @@ EXTERNALPROJECT_ADD(
5272
URL_MD5 ${_download_hash}
5373
DOWNLOAD_NAME ${_target}_${_version}.zip
5474
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
55-
CONFIGURE_COMMAND cd auto && ${_make_command} && cd .. && ${_make_command}
75+
CONFIGURE_COMMAND cd auto && ${_make_command}
5676
BUILD_COMMAND ${_make_command} -j${_cpu_count} GLEW_DEST=${_install_dir}
5777
INSTALL_COMMAND ${_make_command} install GLEW_DEST=${_install_dir}
5878
BUILD_IN_SOURCE TRUE

0 commit comments

Comments
 (0)