initial commit

This commit is contained in:
2024-08-03 22:13:17 -07:00
commit c079037062
12 changed files with 405 additions and 0 deletions

2
Sources/CMakeLists.txt Normal file
View File

@ -0,0 +1,2 @@
add_subdirectory(SwiftFrontend)
add_subdirectory(CppBackend)

View File

@ -0,0 +1,4 @@
add_library(CppBackend STATIC backend.h backend.cpp)
set_target_properties(CppBackend PROPERTIES Swift_MODULE_NAME "CppBackend")
target_compile_options(CppBackend PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>")

View File

@ -0,0 +1,7 @@
#include "backend.h"
#include <iostream>
void backend_init() {
std::cout << "Hello World" << std::endl;
}

View File

@ -0,0 +1,3 @@
#pragma once
void backend_init();

View File

@ -0,0 +1,3 @@
module CppBackend {
header "backend.h"
}

View File

@ -0,0 +1,2 @@
add_executable(SwiftFrontend main.swift)
target_link_libraries(SwiftFrontend PRIVATE CppBackend)

View File

@ -0,0 +1,4 @@
import CppBackend
backend_init()
print("Hello World")