mirror of
https://github.com/GayPizzaSpecifications/cxx-swift-interop.git
synced 2025-08-03 21:21:32 +00:00
refactor swift shim
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
/.vscode
|
/.vscode
|
||||||
/.idea
|
/.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/build/
|
||||||
|
/cmake-build-*/
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
add_subdirectory(SwiftFrontend)
|
add_subdirectory(SwiftFrontend)
|
||||||
add_subdirectory(SDL3)
|
add_subdirectory(SDLSwift)
|
||||||
add_subdirectory(CppBackend)
|
add_subdirectory(CppBackend)
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
add_library(SDL3 STATIC SDL3.h SDL3.cpp)
|
|
||||||
set_property(TARGET SDL3 PROPERTY Swift_MODULE_NAME "SDL3")
|
|
||||||
set_property(TARGET SDL3 PROPERTY CXX_STANDARD 20)
|
|
||||||
|
|
||||||
target_compile_options(SDL3 PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>")
|
|
||||||
target_include_directories(SDL3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
|
|
||||||
find_library(SDL3_LIB SDL3 REQUIRED)
|
|
||||||
target_link_libraries(SDL3 PUBLIC ${SDL3_LIB})
|
|
@ -1 +0,0 @@
|
|||||||
#include "SDL3.h"
|
|
@ -1,3 +0,0 @@
|
|||||||
module SDL3 {
|
|
||||||
header "SDL3.h"
|
|
||||||
}
|
|
9
Sources/SDLSwift/CMakeLists.txt
Normal file
9
Sources/SDLSwift/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
find_library(SDL3 SDL3 REQUIRED)
|
||||||
|
|
||||||
|
add_library(SDLSwift INTERFACE)
|
||||||
|
set_property(TARGET SDLSwift PROPERTY Swift_MODULE_NAME "SDL3")
|
||||||
|
|
||||||
|
target_compile_options(SDLSwift INTERFACE "$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>")
|
||||||
|
target_include_directories(SDLSwift INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
target_link_libraries(SDLSwift INTERFACE ${SDL3})
|
3
Sources/SDLSwift/module.modulemap
Normal file
3
Sources/SDLSwift/module.modulemap
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module SDL3 {
|
||||||
|
header "shim.h"
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
add_executable(SwiftFrontend MACOSX_BUNDLE main.swift Application.swift)
|
add_executable(SwiftFrontend MACOSX_BUNDLE main.swift Application.swift)
|
||||||
target_link_libraries(SwiftFrontend PRIVATE CppBackend SDL3)
|
target_link_libraries(SwiftFrontend PRIVATE CppBackend SDLSwift)
|
||||||
set_target_properties(SwiftFrontend PROPERTIES
|
set_target_properties(SwiftFrontend PROPERTIES
|
||||||
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME NO
|
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME NO
|
||||||
MACOSX_BUNDLE_BUNDLE_NAME "cxxswift"
|
MACOSX_BUNDLE_BUNDLE_NAME "cxxswift"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import SDL3
|
|
||||||
|
|
||||||
exit(Application().run())
|
exit(Application().run())
|
||||||
|
Reference in New Issue
Block a user