@@ -27,16 +27,25 @@ option(USE_LIBCXX "Link WickedEngine to llvm libc++ library - only available wit
2727option (WICKED_EDITOR "Build WickedEngine editor" ON )
2828option (WICKED_TESTS "Build WickedEngine tests" ON )
2929option (WICKED_IMGUI_EXAMPLE "Build WickedEngine imgui example" ON )
30- option (WICKED_ENABLE_IPO "Enable IPO/LTO in non-debug builds" NO )
31- option (WICKED_EMBED_SHADERS "Embed shaders into the library" NO )
30+ option (WICKED_ENABLE_IPO "Enable IPO/LTO in non-debug builds" OFF )
31+ option (WICKED_EMBED_SHADERS "Embed shaders into the library" OFF )
3232option (WICKED_ENABLE_RTTI "Enable RTTI" NO )
33- if (UNIX )
33+ if (APPLE )
34+ set (WICKED_TESTS OFF ) # no main for macos
35+ set (WICKED_IMGUI_EXAMPLE OFF ) # no main for macos
36+ set (WICKED_ENABLE_IPO OFF )
37+ endif ()
38+
39+ if (UNIX AND NOT APPLE )
3440 option (WICKED_ENABLE_ASAN "Enable AddressSanitizer in debug builds" OFF )
3541 option (WICKED_ENABLE_UBSAN "Enable UndefinedBehaviourSanitizer in debug builds" OFF )
3642 option (WICKED_ENABLE_TSAN "Enable ThreadSanitizer in debug builds" OFF )
3743 option (WICKED_ENABLE_SAN_ALWAYS "Enable the selected sanitizers in all builds, not just debug" OFF )
3844endif ()
39- if (UNIX )
45+
46+ if (APPLE )
47+ option (WICKED_MACOS_TEMPLATE "Build WickedEngine MacOS template" ON )
48+ elseif (UNIX )
4049 option (WICKED_LINUX_TEMPLATE "Build WickedEngine Linux template" ON )
4150elseif (WIN32 )
4251 option (WICKED_WINDOWS_TEMPLATE "Build WickedEngine Windows template" ON )
@@ -113,6 +122,15 @@ if (WIN32)
113122 set (PLATFORM "Windows" )
114123 add_compile_definitions (WIN32 =1 )
115124 add_compile_definitions (_HAS_EXCEPTIONS=0 )
125+ elseif (APPLE )
126+ # set(CMAKE_C_COMPILER /opt/homebrew/opt/llvm/bin/clang)
127+ # set(CMAKE_CXX_COMPILER /opt/homebrew/opt/llvm/bin/clang++)
128+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS } -fuse-ld=lld" )
129+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS } -fuse-ld=lld" )
130+ set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld" )
131+ set (CMAKE_LINKER ld64.lld)
132+ set (PLATFORM "MacOS" )
133+ add_compile_definitions (MACOS=1 )
116134elseif (UNIX )
117135 set (PLATFORM "SDL2" )
118136 add_compile_definitions (SDL2=1 )
@@ -147,7 +165,7 @@ else()
147165 # security checks disabled in Release:
148166 $<$<CONFIG :Release >:-fno -stack -protector >
149167 $<$<CONFIG :Release >:-fcf -protection =none >
150- $<$<AND :$<CONFIG :Release >,$<NOT :$<PLATFORM_ID :Windows >>> :-fno -stack -clash -protection > # not supported on Windows
168+ $<$<AND :$<CONFIG :Release >,$<NOT :$<OR :$< PLATFORM_ID :Windows >,$< PLATFORM_ID : Darwin >>>> :-fno -stack -clash -protection > # not supported on Windows or macOS
151169 $<$<CONFIG :Release >:-fno -stack -check >
152170 $<$<AND :$<CONFIG :Release >,$<NOT :$<PLATFORM_ID :Windows >>>:-fno -asynchronous -unwind -tables > # seems to crash LUA evaluation on Windows
153171 )
@@ -206,6 +224,10 @@ if (WICKED_LINUX_TEMPLATE)
206224 add_subdirectory (Samples/Template_Linux )
207225endif ()
208226
227+ if (WICKED_MACOS_TEMPLATE)
228+ add_subdirectory (Samples/Template_MacOS )
229+ endif ()
230+
209231if (WICKED_WINDOWS_TEMPLATE)
210232 add_subdirectory (Samples/Template_Windows )
211233endif ()
0 commit comments