Skip to content

Commit

Permalink
Update installer variables on Windows, update Qt5 path
Browse files Browse the repository at this point in the history
This should update the master branch to use "DB Browser
for SQLite" naming, and fix the problem with the
uninstaller not showing up in Add/Remove programs on
Windows (issue sqlitebrowser#742)
  • Loading branch information
justinclift committed Aug 29, 2016
1 parent e12e043 commit 8a91308
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 23 deletions.
72 changes: 49 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(sqlitebrowser)
project("DB Browser for SQLite")
cmake_minimum_required(VERSION 2.8.7)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
Expand All @@ -10,20 +10,38 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()


if(WIN32 AND MSVC)
if(CMAKE_CL_64)
set(SQLITE3_PATH "C:/dev/SQLite")
set(QT5_PATH "C:/dev/Qt/5.6/msvc2013_64")
# Paths for 64-bit windows builds
set(OPENSSL_PATH "C:/dev/OpenSSL-Win64")
set(QT5_PATH "C:/dev/Qt/5.7/msvc2013_64")
set(VSREDIST "vcredist_x64.exe")

# Choose between SQLCipher or SQLite, depending whether
# -Dsqlcipher=1 is passed on the command line
if(sqlcipher)
set(SQLITE3_PATH "C:/git_repos/sqlcipher")
else()
set(SQLITE3_PATH "C:/dev/SQLite-Win64")
endif()
else()
set(QT5_PATH "E:/Qt/Qt5.5.1/5.5/msvc2013")
set(SQLITE3_PATH "E:/libs/sqlite3")
set(OPENSSL_PATH "E:/libs/openssl-1.0.2a-i386-win32")
# Paths for 32-bit windows builds
set(OPENSSL_PATH "C:/dev/OpenSSL-Win32")
set(QT5_PATH "C:/dev/Qt/5.7/msvc2013")
set(VSREDIST "vcredist_x86.exe")

# Choose between SQLCipher or SQLite, depending whether
# -Dsqlcipher=1 is passed on the command line
if(sqlcipher)
set(SQLITE3_PATH "C:/git_repos/sqlcipher")
else()
set(SQLITE3_PATH "C:/dev/SQLite-Win32")
endif()
endif()
set(USE_QT5 TRUE)
set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}")
set(USE_QT5 TRUE)
set(VSREDIST_DIR "C:/dev/dependencies")
endif()

find_package(Antlr2)
Expand Down Expand Up @@ -229,7 +247,11 @@ endif(EXTRAPATH)

if(WIN32 AND MSVC)
find_path(SQLITE3_INCLUDE_DIR sqlite3.h)
find_file(SQLITE3_DLL sqlite3.dll)
if(sqlcipher)
find_file(SQLITE3_DLL sqlcipher.dll)
else(sqlcipher)
find_file(SQLITE3_DLL sqlite3.dll)
endif(sqlcipher)
include_directories(${SQLITE3_INCLUDE_DIR})
endif()

Expand Down Expand Up @@ -296,9 +318,11 @@ if(WIN32 AND MSVC)
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform Toolset" FORCE)
endif()

if(NOT WIN32)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)
endif()


if(ENABLE_TESTING)
Expand All @@ -317,6 +341,10 @@ if(UNIX AND NOT APPLE)
endif(UNIX AND NOT APPLE)

if(WIN32 AND MSVC)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "/"
LIBRARY DESTINATION lib)

set(QT5_BIN_PATH ${QT5_PATH}/bin)
# The Qt5 Debug configuration library files have a 'd' postfix
install(FILES
Expand All @@ -325,7 +353,7 @@ if(WIN32 AND MSVC)
${QT5_BIN_PATH}/Qt5Networkd.dll
${QT5_BIN_PATH}/Qt5PrintSupportd.dll
${QT5_BIN_PATH}/Qt5Widgetsd.dll
DESTINATION bin
DESTINATION "/"
CONFIGURATIONS Debug)
# The Qt5 Release configuration files don't have a postfix
install(FILES
Expand All @@ -334,21 +362,18 @@ if(WIN32 AND MSVC)
${QT5_BIN_PATH}/Qt5Network.dll
${QT5_BIN_PATH}/Qt5PrintSupport.dll
${QT5_BIN_PATH}/Qt5Widgets.dll
DESTINATION bin
DESTINATION "/"
CONFIGURATIONS Release)
# The files below are common to all configurations
install(FILES
${QT5_BIN_PATH}/icudt54.dll
${QT5_BIN_PATH}/icuin54.dll
${QT5_BIN_PATH}/icuuc54.dll
${SQLITE3_DLL}
${OPENSSL_PATH}/libeay32.dll
${OPENSSL_PATH}/ssleay32.dll
DESTINATION bin)
DESTINATION "/")
install(FILES
${QT5_PATH}/plugins/platforms/qwindows.dll
DESTINATION bin/platforms)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/deps/${VSREDIST} DESTINATION tmp)
DESTINATION platforms)
install(PROGRAMS "${VSREDIST_DIR}/${VSREDIST}" DESTINATION redist)
endif()

#cpack
Expand All @@ -359,30 +384,31 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "3")
set(CPACK_PACKAGE_VERSION_MINOR "9")
set(CPACK_PACKAGE_VERSION_PATCH "99")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "SqliteBrowser${CPACK_PACKAGE_VERSION_MAJOR}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "DB Browser for SQLite")
if(WIN32 AND NOT UNIX)
# There is a bug in NSIS that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\src\\\\iconwin.ico")
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\sqlitebrowser.exe")
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\src\\\\iconwin.ico")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "/")
set(CPACK_NSIS_INSTALLED_ICON_NAME "DB Browser for SQLite.exe")
set(CPACK_NSIS_DISPLAY_NAME "DB Browser for SQLite")
set(CPACK_NSIS_HELP_LINK "https:\\\\\\\\github.com\\\\sqlitebrowser\\\\sqlitebrowser")
set(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\\\\\github.com\\\\sqlitebrowser\\\\sqlitebrowser")
set(CPACK_NSIS_CONTACT "justin@postgresql.org")
set(CPACK_NSIS_MODIFY_PATH OFF)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "sqlitebrowser.exe")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "DB Browser for SQLite.exe")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")

# VS redist
list(APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
ExecWait '\\\"$INSTDIR\\\\tmp\\\\${VSREDIST}\\\" /install /passive /quiet'
Delete '\\\"$INSTDIR\\\\tmp\\\\${VSREDIST}\\\"'
ExecWait '\\\"$INSTDIR\\\\redist\\\\${VSREDIST}\\\" /install /passive /quiet'
Delete '\\\"$INSTDIR\\\\redist\\\\${VSREDIST}\\\"'
")
else(WIN32 AND NOT UNIX)
set(CPACK_STRIP_FILES "bin/sqlitebrowser")
set(CPACK_STRIP_FILES "DB Browser for SQLite")
set(CPACK_SOURCE_STRIP_FILES "")
endif(WIN32 AND NOT UNIX)
set(CPACK_PACKAGE_EXECUTABLES "sqlitebrowser" "SqliteBrowser")
set(CPACK_PACKAGE_EXECUTABLES "DB Browser for SQLite" "DB Browser for SQLite")
include(CPack)
4 changes: 4 additions & 0 deletions src/sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#ifdef ENABLE_SQLCIPHER
#define SQLITE_TEMP_STORE 2
#define SQLITE_HAS_CODEC
#ifdef Q_OS_WIN32
#include <sqlite3.h>
#else
#include <sqlcipher/sqlite3.h>
#endif
#else
#include <sqlite3.h>
#endif
Expand Down

0 comments on commit 8a91308

Please sign in to comment.