Merge pull request #56 from hughbe/curses-lib
Don't attempt to link curses.lib on Windows
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e8f5a7..89fbc9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,6 +119,14 @@
link_directories("/usr/local/lib")
endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+if(NOT ${LLBUILD_PATH_TO_SQLITE_SOURCE} STREQUAL "")
+ include_directories("${LLBUILD_PATH_TO_SQLITE_SOURCE}")
+endif()
+
+if(NOT "${LLBUILD_PATH_TO_SQLITE_BUILD}" STREQUAL "")
+ link_directories("${LLBUILD_PATH_TO_SQLITE_BUILD}")
+endif()
+
# Xcode: Use libc++ and c++14 using proper build settings.
if (XCODE)
# Force usage of Clang.
@@ -158,6 +166,20 @@
# Disable headermaps.
set(CMAKE_XCODE_ATTRIBUTE_USE_HEADERMAP "NO")
+elseif(MSVC)
+ # Disable unknown pragma warnings (e.g. for #pragma mark).
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4068")
+
+ # TODO: these warnings come from llvmSupport. Since we don't want to diverge from llvmSupport by
+ # addressing these warnings , disable these for now to clean the build log.
+ # If/when we move to use LLVM's own llvmSupport, we should reenable these warnings.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4996") # POSIX name for this item is deprecated.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4244") # Signed conversion.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4267") # Possible loss of data conversions.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4291") # Operator new with no matching delete found.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4800") # Forcing value to bool 'true' or 'false'.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4146") # Unary minus applied to unsigned type.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4141") # 'inline' used more than once.
else ()
# Compile with C++14, without RTTI or exceptions.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fno-rtti -fno-exceptions")
diff --git a/docs/development.rst b/docs/development.rst
index 3e1ea82..526e6a3 100644
--- a/docs/development.rst
+++ b/docs/development.rst
@@ -54,6 +54,41 @@
$ cmake -G Ninja -DCMAKE_BUILD_TYPE:=Debug -DCMAKE_C_COMPILER:=clang -DCMAKE_CXX_COMPILER:=clang++ ..
$ ninja
+**Building from source on Windows**
+
+* Install the latest Visual Studio with Visual C++.
+
+* Install the latest version of `CMake <https://cmake.org/>`_ and add `cmake.exe` to the system's PATH
+ environment variable.
+
+* Install the latest version of `Ninja <https://ninja-build.org/>`_ and add `ninja.exe` to the system's
+ PATH environment variable.
+
+* Configure a developer command prompt, using `amd64` for 64 bit processors and 'x86' for 32 bit processors.
+ All the followingcommands should be executed from a developer command prompt.
+
+ $ "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" amd64
+
+* Download the latest `sqlite amalgamation source code <https://sqlite.org/download.html>`_ and extract the source code.
+
+* Build sqlite3, using `/MDd` for a Debug build, and `/MD` for a Release build::
+
+ $ cl shell.c sqlite3.c /MDd -Fe:sqlite3.exe
+ $ lib shell.obj sqlite3.obj /out:sqlite3.lib
+
+* Build LLVM, in order to use `FileCheck` and `llvm-lit`.
+
+* Build::
+
+ $ mkdir build && cd build
+ $ cmake -G "Ninja"^
+ -DCMAKE_BUILD_TYPE=Debug^
+ -DLIT_EXECUTABLE="<llvm-bin-directory>/llvm-lit.py"^
+ -DFILECHECK_EXECUTABLE="<llvm-bin-directory>/FileCheck.exe"^
+ -DLLBUILD_PATH_TO_SQLITE_SOURCE="<directory-containing-sqlite3.h>"^
+ -DLLBUILD_PATH_TO_SQLITE_BUILD="<directory-containing-sqlite3.lib>"^
+ "C:/Users/hbellamy/Documents/GitHub/my-swift/llbuild"
+ $ ninja
Notes
-----
diff --git a/lib/Core/SQLiteBuildDB.cpp b/lib/Core/SQLiteBuildDB.cpp
index 0deff31..a741d5e 100644
--- a/lib/Core/SQLiteBuildDB.cpp
+++ b/lib/Core/SQLiteBuildDB.cpp
@@ -155,7 +155,7 @@
"rule_id INTEGER, "
"key_id INTEGER, "
"PRIMARY KEY (rule_id, key_id) "
- "FOREIGN KEY(rule_id) REFERENCES rule_info(id) "
+ "FOREIGN KEY(rule_id) REFERENCES rule_results(id) "
"FOREIGN KEY(key_id) REFERENCES key_names(id)) "
#if SQLITE_VERSION_NUMBER >= 3008002
"WITHOUT ROWID"