-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These have different PIF cache locations in the build cache
- Loading branch information
1 parent
07c0b96
commit 6cf282c
Showing
8 changed files
with
168 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
set(DEPLOYMENT_TARGET 17.0) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}) | ||
set(CMAKE_SYSTEM_NAME iOS) | ||
|
||
project("CMakeDiscoveryTest" Swift) | ||
|
||
set(NAME "CMakeDiscovery") | ||
set(APP_BUNDLE_IDENTIFIER "com.veracode.${NAME}") | ||
set(EXECUTABLE_NAME ${NAME}) | ||
set(PRODUCT_NAME ${NAME}) | ||
set(CODE_SIGNING_IDENTITY "") | ||
set(EXECUTABLE_NAME ${NAME}) | ||
set(MACOSX_BUNDLE_EXECUTABLE_NAME ${NAME}) | ||
set(MACOSX_BUNDLE_INFO_STRING ${APP_BUNDLE_IDENTIFIER}) | ||
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${APP_BUNDLE_IDENTIFIER}) | ||
set(MACOSX_BUNDLE_BUNDLE_NAME ${APP_BUNDLE_IDENTIFIER}) | ||
set(MACOSX_BUNDLE_ICON_FILE "") | ||
set(MACOSX_BUNDLE_LONG_VERSION_STRING "1.0") | ||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0") | ||
set(MACOSX_BUNDLE_BUNDLE_VERSION "1.0") | ||
set(MACOSX_BUNDLE_COPYRIGHT "Copyright") | ||
set(IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}) | ||
|
||
set(SOURCE_FILES | ||
"${CMAKE_SOURCE_DIR}/Source/App.swift" | ||
) | ||
|
||
add_executable( | ||
${NAME} | ||
MACOSX_BUNDLE | ||
${SOURCE_FILES} | ||
) | ||
|
||
find_library(SWIFTUI SwiftUI) | ||
find_library(FOUNDATION Foundation) | ||
|
||
target_link_libraries(${NAME} ${SWIFT_UI}) | ||
target_link_libraries(${NAME} ${FOUNDATION}) | ||
|
||
set_target_properties(${NAME} PROPERTIES | ||
XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym" | ||
XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/Prefix.pch" | ||
RESOURCE "${RESOURCES}" | ||
XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES" | ||
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} | ||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" | ||
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "" | ||
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1" | ||
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES | ||
XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES NO | ||
XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)" | ||
XCODE_ATTRIBUTE_ENABLE_TESTABILITY YES | ||
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES | ||
XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "iphoneos iphonesimulator" | ||
XCODE_ATTRIBUTE_ARCHS "$(ARCHS_STANDARD)" | ||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" | ||
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import SwiftUI | ||
|
||
@main | ||
struct MyApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
Text("Hello, World!") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import XCTest | ||
@testable import gen_ir | ||
|
||
final class CMakeDiscoveryTests: XCTestCase { | ||
let testPath: URL = { | ||
TestContext.testAssetPath | ||
.appendingPathComponent("CMakeDiscoveryTest") | ||
.appendingPathComponent(".build") | ||
.appendingPathComponent("CMakeDiscoveryTest.xcodeproj") | ||
}() | ||
|
||
private lazy var buildPath: URL = { | ||
TestContext.testAssetPath | ||
.appendingPathComponent("CMakeDiscoveryTest") | ||
.appendingPathComponent(".build") | ||
}() | ||
|
||
let scheme = "CMakeDiscovery" | ||
|
||
private func generate() throws { | ||
if !FileManager.default.fileExists(atPath: buildPath.path) { | ||
try FileManager.default.createDirectory(at: buildPath, withIntermediateDirectories: true) | ||
} | ||
|
||
_ = try Process.runShell( | ||
"cmake", | ||
arguments: [ | ||
"-GXcode", | ||
TestContext.testAssetPath.appendingPathComponent("CMakeDiscoveryTest").path | ||
], | ||
runInDirectory: buildPath | ||
) | ||
|
||
// If this isn't set - xcodebuild will refuse to clean the project (thanks Apple!) | ||
_ = try Process.runShell( | ||
"xattr", | ||
arguments: [ | ||
"-w", | ||
"com.apple.xcode.CreatedByBuildSystem", | ||
"true", | ||
buildPath.appendingPathComponent("build").path | ||
] | ||
) | ||
} | ||
|
||
func testCMakeDiscovery() throws { | ||
try generate() | ||
let context = TestContext() | ||
try context.build(test: testPath, scheme: scheme) | ||
|
||
let cache = context.pifCache | ||
XCTAssertEqual(cache.targets.filter { $0.name == "CMakeDiscovery" }.count, 1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters