diff --git a/.gitignore b/.gitignore index 2702bfa..b8900a8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /.vscode /.idea .DS_Store +/build/ +/cmake-build-*/ diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index e8a2145..3ab91ce 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(SwiftFrontend) -add_subdirectory(SDL3) +add_subdirectory(SDLSwift) add_subdirectory(CppBackend) diff --git a/Sources/SDL3/CMakeLists.txt b/Sources/SDL3/CMakeLists.txt deleted file mode 100644 index c7e0c21..0000000 --- a/Sources/SDL3/CMakeLists.txt +++ /dev/null @@ -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 "$<$:-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}) diff --git a/Sources/SDL3/SDL3.cpp b/Sources/SDL3/SDL3.cpp deleted file mode 100644 index cf04475..0000000 --- a/Sources/SDL3/SDL3.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "SDL3.h" diff --git a/Sources/SDL3/module.modulemap b/Sources/SDL3/module.modulemap deleted file mode 100644 index 1091db3..0000000 --- a/Sources/SDL3/module.modulemap +++ /dev/null @@ -1,3 +0,0 @@ -module SDL3 { - header "SDL3.h" -} diff --git a/Sources/SDLSwift/CMakeLists.txt b/Sources/SDLSwift/CMakeLists.txt new file mode 100644 index 0000000..940a66f --- /dev/null +++ b/Sources/SDLSwift/CMakeLists.txt @@ -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 "$<$:-cxx-interoperability-mode=default>") +target_include_directories(SDLSwift INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(SDLSwift INTERFACE ${SDL3}) diff --git a/Sources/SDLSwift/module.modulemap b/Sources/SDLSwift/module.modulemap new file mode 100644 index 0000000..77aad28 --- /dev/null +++ b/Sources/SDLSwift/module.modulemap @@ -0,0 +1,3 @@ +module SDL3 { + header "shim.h" +} diff --git a/Sources/SDL3/SDL3.h b/Sources/SDLSwift/shim.h similarity index 100% rename from Sources/SDL3/SDL3.h rename to Sources/SDLSwift/shim.h diff --git a/Sources/SwiftFrontend/CMakeLists.txt b/Sources/SwiftFrontend/CMakeLists.txt index 993b168..669263e 100644 --- a/Sources/SwiftFrontend/CMakeLists.txt +++ b/Sources/SwiftFrontend/CMakeLists.txt @@ -1,5 +1,5 @@ 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 XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME NO MACOSX_BUNDLE_BUNDLE_NAME "cxxswift" diff --git a/Sources/SwiftFrontend/main.swift b/Sources/SwiftFrontend/main.swift index 8abc5c1..3b1fcc3 100644 --- a/Sources/SwiftFrontend/main.swift +++ b/Sources/SwiftFrontend/main.swift @@ -1,4 +1,3 @@ import Foundation -import SDL3 exit(Application().run())