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

Add cmake files #16

Open
wants to merge 14 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
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project(GURUX.DLMS.cpp)

cmake_minimum_required(VERSION 3.9)

find_package (Threads REQUIRED)

option(BUILD_EXAMPLE "Build Examples" OFF)
option(BUILD_SHARED_LIBS "Build Shared Libs" OFF)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)

add_subdirectory(development)

if(BUILD_EXAMPLE)
add_subdirectory(GuruxDLMSClientExample)
add_subdirectory(GuruxDLMSPushExample)
add_subdirectory(GuruxDLMSServerExample)
endif()
23 changes: 23 additions & 0 deletions GuruxDLMSClientExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
project(gurux_dlms_cpp_client_example)

cmake_minimum_required(VERSION 3.9)

file(GLOB sources src/*.cpp)

add_executable(gurux.dlms.client.bin
${sources}
)

target_include_directories(gurux.dlms.client.bin
PUBLIC
include
)

target_compile_options(gurux.dlms.client.bin
PUBLIC
-Wall -fPIC
)

target_link_libraries(gurux.dlms.client.bin
gurux_dlms_cpp
)
24 changes: 24 additions & 0 deletions GuruxDLMSPushExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project(gurux_dlms_cpp_push_example)

cmake_minimum_required(VERSION 3.9)

file(GLOB sources src/*.cpp)

add_executable(gurux.dlms.push.bin
${sources}
)

target_include_directories(gurux.dlms.push.bin
PUBLIC
include
)

target_compile_options(gurux.dlms.push.bin
PUBLIC
-Wall -fPIC
)

target_link_libraries(gurux.dlms.push.bin
gurux_dlms_cpp
Threads::Threads
)
24 changes: 24 additions & 0 deletions GuruxDLMSServerExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project(gurux_dlms_cpp_server_example)

cmake_minimum_required(VERSION 3.9)

file(GLOB sources src/*.cpp)

add_executable(gurux.dlms.server.bin
${sources}
)

target_include_directories(gurux.dlms.server.bin
PUBLIC
include
)

target_compile_options(gurux.dlms.server.bin
PUBLIC
-Wall -fPIC
)

target_link_libraries(gurux.dlms.server.bin
gurux_dlms_cpp
Threads::Threads
)
28 changes: 28 additions & 0 deletions development/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project(gurux_dlms_cpp)

cmake_minimum_required(VERSION 3.9)

file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cpp)

add_library(gurux_dlms_cpp
${sources}
)

target_include_directories(gurux_dlms_cpp
PUBLIC
${PROJECT_SOURCE_DIR}/include/
)

target_compile_options(gurux_dlms_cpp
PUBLIC
-Wall -fPIC
)

install(TARGETS gurux_dlms_cpp
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)

install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
FILES_MATCHING PATTERN "*.*h"
)
4 changes: 2 additions & 2 deletions development/src/GXDLMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ int CGXDLMS::GetData(CGXDLMSSettings& settings,
{
return ret;
}
if (ret == DLMS_ERROR_CODE_FALSE)
if (notify != NULL && ret == DLMS_ERROR_CODE_FALSE)
{
target = notify;
isNotify = true;
Expand Down Expand Up @@ -3797,4 +3797,4 @@ int CGXDLMS::HandleConfirmedServiceError(CGXReplyData& data)
return service << 16 | type << 8 | ch;
}
return 0;
}
}