Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ else()
endif()
endif()

set(THREADS_PREFER_PTHREAD_FLAG TRUE)
set(THREADS_PREFER_PTHREAD_FLAG FALSE)
find_package(Threads REQUIRED)

find_package(SQLite3 REQUIRED)
Expand Down
6 changes: 4 additions & 2 deletions cmake/modules/Utility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endfunction()

macro(add_llbuild_library name)
cmake_parse_arguments(ARG
"SHARED" "OUTPUT_NAME" ""
"SHARED;STATIC" "OUTPUT_NAME" ""
${ARGN})
set(ALL_FILES ${ARG_UNPARSED_ARGUMENTS})

Expand Down Expand Up @@ -42,8 +42,10 @@ macro(add_llbuild_library name)
endif()
endif(MSVC_IDE OR XCODE)

if (ARG_SHARED)
if(ARG_SHARED)
add_library(${name} SHARED ${ALL_FILES})
elseif(ARG_STATIC)
add_library(${name} STATIC ${ALL_FILES})
else()
add_library(${name} ${ALL_FILES})
endif()
Expand Down
2 changes: 2 additions & 0 deletions examples/c-api/buildsystem/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ static void usage() {
exit(0);
}

#if !defined(__linux__)
static const char* basename(const char* path) {
const char* result = strrchr(path, '/');
return result ? result : path;
}
#endif

#if defined(_WIN32)
static wchar_t* convertToMultiByte(const char* s) {
Expand Down
6 changes: 1 addition & 5 deletions products/libllbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ set(SOURCES

add_llbuild_library(libllbuild
${SOURCES}
SHARED
STATIC
OUTPUT_NAME llbuild)
target_compile_definitions(libllbuild PRIVATE
_WINDLL)

set_property(TARGET libllbuild PROPERTY MACOSX_RPATH ON)

Expand All @@ -24,8 +22,6 @@ target_link_libraries(libllbuild PRIVATE
llvmSupport
SQLite::SQLite3)

set_property(GLOBAL APPEND PROPERTY LLBuild_EXPORTS libllbuild)

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
set_target_properties(libllbuild PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
endif()
Expand Down
3 changes: 1 addition & 2 deletions products/llbuildSwift/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ else()
endif()
set_target_properties(llbuildSwift PROPERTIES
Swift_MODULE_NAME llbuildSwift
INTERFACE_LINK_LIBRARIES libllbuild
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR};${PROJECT_SOURCE_DIR}/products/libllbuild/include")

install(TARGETS llbuildSwift
ARCHIVE DESTINATION lib/swift/pm/llbuild COMPONENT libllbuildSwift
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/buildsystem-capi.llbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check that the BuildSystem C API example builds and runs correctly.
#
# RUN: %clang -o %t.exe %{srcroot}/examples/c-api/buildsystem/main.c -I %{srcroot}/products/libllbuild/include -lllbuild -L %{llbuild-lib-dir} -Werror
# RUN: %clangxx -o %t.exe -x c++ %{srcroot}/examples/c-api/buildsystem/main.c -I %{srcroot}/products/libllbuild/include -lllbuild -lllbuildBuildSystem -lllbuildCore -lllbuildBasic -lllvmSupport -lLLVMDemangle -L %{llbuild-lib-dir} -Werror -Xlinker %{sqlite} %{curses} %{threads} %{dl}
# RUN: env DYLD_LIBRARY_PATH=%{llbuild-lib-dir} LD_LIBRARY_PATH=%{llbuild-lib-dir} %t.exe %s > %t.out
# RUN: %{FileCheck} %s --input-file %t.out
#
Expand Down
5 changes: 5 additions & 0 deletions tests/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ config.substitutions.append( ('%{llbuild-lib-dir}', llbuild_lib_dir) )
config.substitutions.append( ('%{llbuild-output-dir}', llbuild_output_dir) )
config.substitutions.append( ('%{llbuild-tools-dir}', llbuild_tools_dir) )
config.substitutions.append( ('%{srcroot}', llbuild_src_root) )
config.substitutions.append( ('%{sqlite}', config.sqlite_library) )
config.substitutions.append( ('%{curses}', config.curses_library) )
config.substitutions.append( ('%{threads}', config.threads_library) )
config.substitutions.append( ('%{dl}', config.dl_library) )

if config.osx_sysroot:
config.substitutions.append( ('%{swiftc-platform-flags}', "-sdk " + config.osx_sysroot) )
Expand All @@ -138,6 +142,7 @@ config.substitutions.append( ('%{build-dir}', llbuild_obj_root) )
config.substitutions.append( ('%{env}', lit.util.which('env')) )
config.substitutions.append( ('%{sort}', lit.util.which('sort')) )
config.substitutions.append( ('%{sh-invoke}', os.environ.get("PREFIX", "") + '/bin/sh') )
config.substitutions.append( ('%clangxx', inferSwiftBinary('clang++')) )
config.substitutions.append( ('%clang', inferSwiftBinary('clang')) )

###
Expand Down
12 changes: 12 additions & 0 deletions tests/lit.site.cfg.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- Python -*-

import os
import sys

## Autogenerated by llbuild configuration.
# Do not edit!
Expand All @@ -16,6 +17,17 @@ config.filecheck_path = "@FILECHECK_EXECUTABLE@"
config.swiftc_path = "@CMAKE_Swift_COMPILER@"
config.osx_sysroot = "@CMAKE_OSX_SYSROOT@"

config.sqlite_library = "@SQLite3_LIBRARY@"
if sys.platform == 'Windows':
config.curses_library = ''
else:
config.curses_library = '-lcurses'
config.threads_library = "@CMAKE_THREAD_LIBS_INIT@"
if "@CMAKE_DL_LIBS@":
config.dl_library = "-l@CMAKE_DL_LIBS@"
else:
config.dl_library = ''

# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
try:
Expand Down