Skip to content

Commit f0017d7

Browse files
authored
Fix build on Windows (#98)
* Fix build on Windows: put `dirent` under os check * Fix build on Windows: link SQLite3 * Fix installation on Windows: add missing `TSCUtility.dll`
1 parent 266a491 commit f0017d7

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ option(BUILD_SHARED_LIBS "Build shared libraryes by default" YES)
2525

2626
find_package(dispatch QUIET)
2727
find_package(Foundation QUIET)
28+
find_package(SQLite3 REQUIRED)
2829

2930
add_subdirectory(Sources)
3031
add_subdirectory(cmake/modules)

Sources/TSCBasic/FileSystem.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ extension FileSystem {
900900
}
901901
}
902902

903+
#if !os(Windows)
903904
extension dirent {
904905
/// Get the directory name.
905906
///
@@ -911,4 +912,4 @@ extension dirent {
911912
}
912913
}
913914
}
914-
915+
#endif

Sources/TSCUtility/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,11 @@ endif()
4747
set_target_properties(TSCUtility PROPERTIES
4848
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
4949

50+
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
51+
install(TARGETS TSCUtility
52+
ARCHIVE DESTINATION lib
53+
LIBRARY DESTINATION lib
54+
RUNTIME DESTINATION bin)
55+
endif()
56+
5057
set_property(GLOBAL APPEND PROPERTY TSC_EXPORTS TSCUtility)

Sources/TSCclibc/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ add_library(TSCclibc STATIC
1111
target_include_directories(TSCclibc PUBLIC
1212
include)
1313

14+
target_link_libraries(TSCclibc PUBLIC
15+
SQLite::SQLite3)
16+
1417
if(NOT BUILD_SHARED_LIBS)
1518
install(TARGETS TSCclibc
1619
ARCHIVE DESTINATION lib)

0 commit comments

Comments
 (0)