Skip to content

Commit

Permalink
Added windows install
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Oct 21, 2021
1 parent ded4d3d commit 6911a2e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 289 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,7 @@
],
"C_Cpp.intelliSenseEngineFallback": "Enabled",
"C_Cpp.default.cppStandard": "c++11",
"cmake.configureSettings": {
"CMAKE_BUILD_TYPE": "${buildType}"
}
}
17 changes: 14 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,20 @@
"problemMatcher": "$gcc"
},
{
"taskName": "Windows: Clean & build vscp-helper-lib",
"taskName": "Windows: Clean & build vscp-helper-lib debug",
"type": "shell",
"command": "cd build; cmake .. -G 'Visual Studio 16 2019' -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=C:\\Users\\Administrator\\Desktop\\Development\\vcpkg\\scripts\buildsystems\\vcpkg.cmake; msbuild libvscphelper.sln /p:Configuration=Debug",
"command": "cd build; cmake .. -G 'Visual Studio 16 2019' -DCMAKE_BUILD_TYPE=debug -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=C:\\Users\\Administrator\\Desktop\\Development\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake; msbuild libvscphelper.sln /p:Configuration=Debug",
"args": [],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": "$gcc"
},
{
"taskName": "Windows: Clean & build vscp-helper-lib release",
"type": "shell",
"command": "cd build; cmake .. -G 'Visual Studio 16 2019' -DCMAKE_BUILD_TYPE=release -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=C:\\Users\\Administrator\\Desktop\\Development\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake; msbuild libvscphelper.sln /p:Configuration=Debug",
"args": [],
"group": {
"kind": "build",
Expand All @@ -59,7 +70,7 @@
{
"taskName": "Linux: clean & build alltest",
"type": "shell",
"command": "cd tests/alltest; mkdir build; cd build; rm CMakeCache.txt; cmake --clean-first .. -DCMAKE_BUILD_TYPE=Debug; make clean; make",
"command": "cd tests/alltest; mkdir build; cd build; rm CMakeCache.txt; cmake .. -DCMAKE_BUILD_TYPE=Debug; make --clean-first",
"args": [],
"group": {
"kind": "build",
Expand Down
91 changes: 58 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ if(NOT DEFINED PATCH_VERSION)
SET(PATCH_VERSION "2")
endif()


SET(CPACK_PACKAGE_DESCRIPTION "VSCP Helper library")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Helper functionality for VSCP applications")
SET(CPACK_PACKAGE_VENDOR "the VSCP Project")
SET(CPACK_PACKAGE_CONTACT "[email protected]")

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/resources/nsis ${CMAKE_MODULE_PATH})
#${CMAKE_BINARY_DIR}_CPack_Packages${CPACK_TOPLEVEL_TAG}${CPACK_GENERATOR}

if(NOT DEFINED APP_LOW_NAME)
set(APP_LOW_NAME "libvscphelper")
endif()
Expand Down Expand Up @@ -86,7 +88,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

# Default location for VSCP level II drivers
#set(VSCP_LEVEL2_DRV_DIR /var/lib/vscp/drivers/level2/)
set(VSCP_LEVEL2_DRV_DIR /var/lib/vscp/drivers/level2/)

# Generate position-independent code (-fPIC on UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -96,7 +98,7 @@ message(STATUS "CMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}")

# --- Path to vscp ---
if (NOT DEFINED VSCP_PATH)
set (VSCP_PATH "${PROJECT_SOURCE_DIR}/../vscp")
set (VSCP_PATH "${PROJECT_SOURCE_DIR}/../vscp")
endif()

if(WIN32)
Expand All @@ -114,12 +116,12 @@ if(UNIX)
set(LIBS_SYSTEM c stdc++)
endif(UNIX)

set(CMAKE_INSTALL_PREFIX "/")
set(CMAKE_INSTALL_PREFIX "/")

# =========================== cpack ===========================
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

INCLUDE(InstallRequiredSystemLibraries)
include(InstallRequiredSystemLibraries)

set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/resources/debpkg/shlibs;"
Expand All @@ -133,8 +135,10 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_GENERATOR "DEB" "RPM" "TGZ" "ZIP")
ENDIF(WIN32)

SET(CPACK_PACKAGE_NAME ${APP_LOW_NAME})
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${APP_NAME})
SET(CPACK_PACKAGE_NAME "libvscphelper")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "libvscphelper")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VENDOR "The VSCP Project")

SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
Expand All @@ -144,39 +148,42 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# SET(CPACK_IGNORE_FILES "\\.psd$;/CVS/;/\\.svn/;/\\.git/;\\.swp$;/CMakeLists.txt.user;\\.#;/#;\\.tar.gz$;/CMakeFiles/;CMakeCache.txt;\\.qm$;/build/;\\.diff$;.DS_Store'")
# SET(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})

SET(CPACK_NSIS_INSTALLED_ICON_NAME "${APP_LOW_NAME}.ico")
SET(CPACK_NSIS_HELP_LINK ${APP_URL})
SET(CPACK_NSIS_URL_INFO_ABOUT ${APP_URL})
SET(CPACK_NSIS_INSTALLED_ICON_NAME "libvscphelper.ico")
SET(CPACK_NSIS_HELP_LINK "https://www.vscp.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "https://www.vscp.org")
set(CPACK_NSIS_CONTACT "[email protected]")

IF(NOT DEFINED WIN32)
if(NOT DEFINED WIN32)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS " libexpat-dev, libssl-dev ")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "network")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
ENDIF()
endif()

SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)
# For component selection during install - If used
# need to specify components in the install part to
#SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)

# Configure file with custom definitions for NSIS.
IF(WIN32)
configure_file(
${PROJECT_SOURCE_DIR}/resources/nsis/NSIS.definitions.nsh.in
${CMAKE_CURRENT_BINARY_DIR}/resources/nsis/NSIS.definitions.nsh
)
ELSE(WIN32)
if(WIN32)
# Configure file with custom definitions for NSIS.
# configure_file(
# ${PROJECT_SOURCE_DIR}/resources/nsis/NSIS.definitions.nsh.in
# ${CMAKE_CURRENT_BINARY_DIR}/resources/nsis/NSIS.definitions.nsh)
else()
SET(CPACK_DEBIAN_PACKAGE_DEPENDS
"libuuid1, lsb-base (>=4.1+Debian3), libc6-dev (>= 2.14), libstdc++6 (>= 5.2), libgcc1 (>= 1:3.0), libssl-dev (>=1.0.0), libmosquitto-dev (>=1.4.10), libexpat1-dev (>=2.0), libz-dev")
"lsb-base (>=4.1+Debian3), libc6-dev (>= 2.14), libstdc++6 (>= 5.2), libgcc1 (>= 1:3.0), libssl-dev (>=1.0.0), libexpat1-dev (>=2.0), libz-dev")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "network")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_STRIP_FILES "bin/vscpd")
set(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32)
endif()

# Load packaging facilities.
INCLUDE(CPack)
include(CPack)

ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
endif()


set(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand Down Expand Up @@ -354,38 +361,54 @@ else()
)
endif()

if(NOT WIN32)
configure_file("${PROJECT_SOURCE_DIR}/resources/linux/libvscphelper.pc.in"
libvscphelper.pc @ONLY)
endif()

# Install
if(WIN32)

# Runtime files
install(TARGETS libvscphelper
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Dependencies
file(GLOB deps_files "${CMAKE_BINARY_DIR}/Release/*")
install(FILES ${deps_files} DESTINATION ${CMAKE_INSTALL_BINDIR})

# Install the dependencies dll's
file(GLOB deps_files "${CMAKE_BINARY_DIR}/CMAKE_BUILD_TYPE/*.dll")

# Dependency files
install(FILES ${deps_files}
DESTINATION ${CMAKE_INSTALL_BINDIR}../deps)

# LICENSE
install(FILES "${CMAKE_BINARY_DIR}/../LICENSE" DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
DESTINATION ${CMAKE_INSTALL_BINDIR}/..)

# README
install(FILES "${CMAKE_BINARY_DIR}/../README.md" DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES ${CMAKE_SOURCE_DIR}/README.md
DESTINATION ${CMAKE_INSTALL_BINDIR}/..)

# Headers
INSTALL(FILES "${VSCP_PATH}/src/vscp/common/vscp.h"
"${PROJECT_SOURCE_DIR}/src/vscphelperlib.h"
INSTALL( FILES "${VSCP_PATH}/src/vscp/common/vscp.h"
"${CMAKE_SOURCE_DIR}/src/vscphelperlib.h"
"${VSCP_PATH}/src/vscp/common/canal.h"
"${VSCP_PATH}/src/vscp/common/vscp_class.h"
"${VSCP_PATH}/src/vscp/common/vscp_type.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

else()

INSTALL(TARGETS libvscphelper
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}/"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_MANDIR}"
RESOURCE DESTINATION "${CMAKE_INSTALL_FULL_}/var/lib/vscp/")

install(FILES ${CMAKE_BINARY_DIR}/libvscphelper.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)

# Headers
INSTALL(FILES "${VSCP_PATH}/src/vscp/common/vscp.h"
"${PROJECT_SOURCE_DIR}/src/vscphelperlib.h"
Expand All @@ -394,3 +417,5 @@ else()
"${VSCP_PATH}/src/vscp/common/vscp_type.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()


Binary file added resources/icons/logo.ico
Binary file not shown.
Binary file added resources/images/vscp_logo.bmp
Binary file not shown.
11 changes: 0 additions & 11 deletions resources/nsis/NSIS.definitions.nsh

This file was deleted.

11 changes: 0 additions & 11 deletions resources/nsis/NSIS.definitions.nsh.in

This file was deleted.

Loading

0 comments on commit 6911a2e

Please sign in to comment.