Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fixes. and Build script changes #46

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 12 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/.idea/
/.gradle/
/build/
/native_libs/
/gradle.properties
/OZW_Log.txt
/zwscene.xml
/zwcfg_*.xml
*.iml
*.ipr
*.iws
/.idea/
/.gradle/
/build/
/native_libs/
/gradle.properties
/OZW_Log.txt
/zwscene.xml
/zwcfg_*.xml
*.iml
*.ipr
*.iws
/.nb-gradle/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a new line at the end of file

60 changes: 48 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ task generateOzwVersion(type: Exec) {

workingDir openZWaveDir
commandLine "make"
args "cpp/src/vers.cpp"
args "cpp/build/windows/winversion.cpp"
}

model {
Expand Down Expand Up @@ -133,6 +133,14 @@ model {
}
}
clang(Clang) {
}

visualCpp(VisualCpp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 spaced should be used instead of tabs here and in other places

{
// Specify the installDir if Visual Studio cannot be located
//installDir "C:/Apps/Microsoft Visual Studio 10.0"
installDir "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
//installDir "C:/Program Files (x86)/Microsoft Visual Studio 12.0"
}
}

Expand Down Expand Up @@ -200,9 +208,11 @@ model {
}
cpp(CppSourceSet) {
lib library: "hidApi", linkage: "api"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant whitespaces

source {
if (targetPlatform.operatingSystem.windows) {
if (targetPlatform.operatingSystem.windows)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly brace should be on the same line as if

cppCompiler.args "/D_USRDLL", "/DHIDAPI_EXPORTS", "/D_WINDLL"
srcDir "$openZWaveDir/cpp/hidapi/windows"
}
include "*.cpp"
Expand Down Expand Up @@ -253,7 +263,7 @@ model {
srcDir "$openZWaveDir/cpp/src"
srcDir "$openZWaveDir/cpp/src/command_classes"
srcDir "$openZWaveDir/cpp/src/value_classes"
srcDir "$openZWaveDir/cpp/src/platform"
srcDir "$openZWaveDir/cpp/src/platform/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think that trailing slash is necessary

include "*.cpp"
}

Expand All @@ -271,21 +281,24 @@ model {
sources {
cpp(CppSourceSet) {
lib library: "openZWave", linkage: "api"

source {
source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant whitespace at the end of line

if (targetPlatform.operatingSystem.windows) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it just a code move? don't think it is necessary

srcDir "$openZWaveDir/cpp/src/platform/windows"
}
else
if (targetPlatform.operatingSystem.linux || targetPlatform.operatingSystem.macOsX) {
srcDir "$openZWaveDir/cpp/src/platform/unix"
} else if (targetPlatform.operatingSystem.windows) {
srcDir "$openZWaveDir/cpp/src/platform/windows"
}
include "*.cpp"
}

exportedHeaders {
if (targetPlatform.operatingSystem.windows) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, looks like an unnecessary code move

srcDir "$openZWaveDir/cpp/src/platform/windows"
}
else
if (targetPlatform.operatingSystem.linux || targetPlatform.operatingSystem.macOsX) {
srcDir "$openZWaveDir/cpp/src/platform/unix"
} else if (targetPlatform.operatingSystem.windows) {
srcDir "$openZWaveDir/cpp/src/platform/windows"
}
include "*.h"
}
Expand Down Expand Up @@ -317,7 +330,7 @@ model {
lib library: "aes", linkage: "static"

exportedHeaders {
srcDir generatedNativeHeadersDir
srcDirs generatedNativeHeadersDir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary? srcDir is a valid method according to docs

}
}
}
Expand All @@ -338,6 +351,13 @@ model {
if (toolChain in Gcc) {
linker.args "-static", "-lsetupapi"
}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, format code like

if () {
} else if () {
} else {
}

if (toolChain in VisualCpp)
{
//cppCompiler.args "/DWIN32", "/Zi", "/FS", "/EHsc", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/INCLUDE", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/ucrt", "/IC:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/include/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/shared", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/winrt"
//linker.args "/DEBUG", "/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/LIB/amd64","/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/LIB/amd64","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/ucrt/x64","/LIBPATH:C:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/lib/um/x64","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/um/x64"
}

} else if (targetPlatform.operatingSystem.macOsX) {
if (toolChain in Gcc || toolChain in Clang) {
linker.args "-framework", "IOKit", "-framework", "CoreFoundation"
Expand All @@ -364,6 +384,22 @@ model {
linker.args "-Wl,--kill-at"
}
}
else
if (toolChain in VisualCpp)
{
if (targetPlatform.architecture.name == "x86")
{
cCompiler.args "/DWIN32", "/D_WINDOWS", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/INCLUDE", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/ucrt", "/IC:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/include/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/shared", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/winrt"
cppCompiler.args "/GS", "/GL", "/Zi", "/O2", "/Zc:inline", "/fp:precise", "/Zc:wchar_t", "/MD", "/DUNICODE", "/Gd", "/DWIN32", "/D_WINDOWS", "/Zi", "/FS", "/EHsc", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/INCLUDE", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/ucrt", "/IC:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/include/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/shared", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/winrt"
linker.args "/DEBUG", "/DYNAMICBASE", "setupapi.lib", "kernel32.lib", "user32.lib", "gdi32.lib", "winspool.lib", "comdlg32.lib", "advapi32.lib", "shell32.lib", "ole32.lib", "oleaut32.lib", "uuid.lib", "odbc32.lib", "odbccp32.lib", "/SUBSYSTEM:WINDOWS", "/MANIFEST", "/LTCG:incremental", "/NXCOMPAT", "/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/LIB","/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/LIB","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/ucrt/x86","/LIBPATH:C:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/lib/um/x86","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/um/x86"
}
else
{
cCompiler.args "/DWIN32", "/D_WINDOWS", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/INCLUDE", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/ucrt", "/IC:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/include/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/shared", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/winrt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are many common parts of paths here, it would be nice if it can be moved to reused variables/properties

cppCompiler.args "/GS", "/GL", "/Zi", "/O2", "/Zc:inline", "/fp:precise", "/Zc:wchar_t", "/MD", "/DUNICODE", "/DWIN32", "/D_WINDOWS", "/Zi", "/FS", "/EHsc", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE", "/IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/INCLUDE", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/ucrt", "/IC:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/include/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/shared", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/um", "/IC:/Program Files (x86)/Windows Kits/10/include/10.0.10586.0/winrt"
linker.args "/DEBUG", "/DYNAMICBASE", "setupapi.lib", "kernel32.lib", "user32.lib", "gdi32.lib", "winspool.lib", "comdlg32.lib", "advapi32.lib", "shell32.lib", "ole32.lib", "oleaut32.lib", "uuid.lib", "odbc32.lib", "odbccp32.lib", "/SUBSYSTEM:WINDOWS", "/MANIFEST", "/LTCG:incremental", "/NXCOMPAT", "/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/LIB/amd64","/LIBPATH:C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/ATLMFC/LIB/amd64","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/ucrt/x64","/LIBPATH:C:/Program Files (x86)/Windows Kits/NETFXSDK/4.6.1/lib/um/x64","/LIBPATH:C:/Program Files (x86)/Windows Kits/10/lib/10.0.10586.0/um/x64"
}
}
} else if (targetPlatform.operatingSystem.macOsX) {
if (toolChain in Gcc || toolChain in Clang) {
cppCompiler.define "DARWIN"
Expand Down Expand Up @@ -475,7 +511,7 @@ uploadArchives {
}

task wrapper(type: Wrapper) {
gradleVersion = "2.13"
gradleVersion = "3.1"
}

idea {
Expand Down
17 changes: 0 additions & 17 deletions example.gradle.properties

This file was deleted.

12 changes: 6 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun May 01 21:33:12 SAMT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
#Sun Sep 25 16:18:33 PDT 2016
distributionBase=GRADLE_USER_HOME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
Loading