Check-in [165f5d2471]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add build support for macosx to snap7
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 165f5d247136e742bb8d672c7f3821e2af4abc05
User & Date: chw 2019-07-13 13:15:23.275
Context
2019-07-13
13:56
add snap7 and libmodbus to macosx build scripts check-in: 01b76f6c19 user: chw tags: trunk
13:15
add build support for macosx to snap7 check-in: 165f5d2471 user: chw tags: trunk
06:12
fix formatting in TSB's readme check-in: dcfb8c8dac user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added undroid/snap7/build/osx/common.mk.
























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Common for every unix flavour (any changes will be reflected on all platforms)
#
IntermediateDirectory  := ../temp
OutDir                 := $(IntermediateDirectory)
LinkerName             := $(CXX)
SharedObjectLinkerName := $(CC) -shared -fPIC -Wno-inline-new-delete
DebugSwitch            := -g
IncludeSwitch          := -I
LibrarySwitch          := -l
OutputSwitch           := -o 
LibraryPathSwitch      := -L
PreprocessorSwitch     := -D
SourceSwitch           := -c 
OutputFile             := ../bin/libsnap7.dylib
PreprocessOnlySwitch   := -E 
MakeDirCommand         := mkdir -p
LinkOptions            := -O3
IncludePath            := $(IncludeSwitch). $(IncludeSwitch)../../src/sys $(IncludeSwitch)../../src/core $(IncludeSwitch)../../src/lib 
Libs                   := $(LibrarySwitch)pthread
LibPath                := $(LibraryPathSwitch). 

##
## Common variables (CXXFLAGS varies across platforms)
##

##
## User defined environment variables
##
Objects= \
	  $(IntermediateDirectory)/sys_snap_msgsock.o \
	  $(IntermediateDirectory)/sys_snap_sysutils.o \
	  $(IntermediateDirectory)/sys_snap_tcpsrvr.o \
	  $(IntermediateDirectory)/sys_snap_threads.o \
	  $(IntermediateDirectory)/core_s7_client.o \
	  $(IntermediateDirectory)/core_s7_isotcp.o \
	  $(IntermediateDirectory)/core_s7_partner.o \
	  $(IntermediateDirectory)/core_s7_peer.o \
	  $(IntermediateDirectory)/core_s7_server.o \
	  $(IntermediateDirectory)/core_s7_text.o \
	  $(IntermediateDirectory)/core_s7_micro_client.o \
	  $(IntermediateDirectory)/lib_snap7_libmain.o 

##
## Main Build Targets 
##
.PHONY: all clean install PreBuild PostBuild
all: $(OutputFile)

$(OutputFile): $(IntermediateDirectory)/.d $(Objects) 
	@$(MakeDirCommand) $(@D)
	@$(MakeDirCommand) $(IntermediateDirectory)
	$(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) $(Objects) $(LibPath) $(Libs) $(LinkOptions)
	$(RM) $(ObjectsFileList)

$(IntermediateDirectory)/.d:
	@$(MakeDirCommand) $(IntermediateDirectory)

PreBuild:

PostBuild:

##
## Objects
##
$(IntermediateDirectory)/sys_snap_msgsock.o: 
	$(CXX) $(SourceSwitch) "../../src/sys/snap_msgsock.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_msgsock.o $(IncludePath)

$(IntermediateDirectory)/sys_snap_sysutils.o:
	$(CXX) $(SourceSwitch) "../../src/sys/snap_sysutils.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_sysutils.o $(IncludePath)

$(IntermediateDirectory)/sys_snap_tcpsrvr.o:
	$(CXX) $(SourceSwitch) "../../src/sys/snap_tcpsrvr.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_tcpsrvr.o $(IncludePath)

$(IntermediateDirectory)/sys_snap_threads.o:
	$(CXX) $(SourceSwitch) "../../src/sys/snap_threads.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_threads.o $(IncludePath)

$(IntermediateDirectory)/core_s7_client.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_client.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_client.o $(IncludePath)

$(IntermediateDirectory)/core_s7_isotcp.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_isotcp.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_isotcp.o $(IncludePath)

$(IntermediateDirectory)/core_s7_partner.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_partner.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_partner.o $(IncludePath)

$(IntermediateDirectory)/core_s7_peer.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_peer.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_peer.o $(IncludePath)

$(IntermediateDirectory)/core_s7_server.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_server.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_server.o $(IncludePath)

$(IntermediateDirectory)/core_s7_text.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_text.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_text.o $(IncludePath)

$(IntermediateDirectory)/core_s7_micro_client.o:
	$(CXX) $(SourceSwitch) "../../src/core/s7_micro_client.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_micro_client.o $(IncludePath)

$(IntermediateDirectory)/lib_snap7_libmain.o:
	$(CXX) $(SourceSwitch) "../../src/lib/snap7_libmain.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/lib_snap7_libmain.o $(IncludePath)

##
## Clean / Install
##
clean:
	$(RM) $(IntermediateDirectory)/*.o
	$(RM) $(OutputFile)

Added undroid/snap7/build/osx/osx.mk.
















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
##
## generic makefile
##
CXXFLAGS   := -O3 -fPIC -pedantic -fno-rtti -fno-exceptions -fno-stack-protector

# Standard part

include common.mk
Changes to undroid/snap7/examples/cpp/snap7.h.
51
52
53
54
55
56
57



58
59
60
61
62
63
64

#if BSD>=0
# define OS_BSD
#endif

#if defined(__APPLE__)
# define OS_OSX



#endif

#if defined(__HAIKU__)
# define OS_HAIKU
# if !defined(PLATFORM_UNIX)
#   define PLATFORM_UNIX
# endif







>
>
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

#if BSD>=0
# define OS_BSD
#endif

#if defined(__APPLE__)
# define OS_OSX
# ifndef PLATFORM_UNIX
#  define PLATFORM_UNIX
# endif
#endif

#if defined(__HAIKU__)
# define OS_HAIKU
# if !defined(PLATFORM_UNIX)
#   define PLATFORM_UNIX
# endif
Changes to undroid/snap7/src/sys/snap_platform.h.
42
43
44
45
46
47
48



49
50
51
52
53
54
55

#if BSD>=0
# define OS_BSD
#endif

#if __APPLE__
# define OS_OSX



#endif

#if defined(__SVR4) || defined(__svr4__)
# define OS_SOLARIS
// Thanks to Rolf Stalder now it's possible to use pthreads also for Solaris
// In any case the Solaris native threads model is still present and can be
// used uncommenting the #define line below.







>
>
>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

#if BSD>=0
# define OS_BSD
#endif

#if __APPLE__
# define OS_OSX
# ifndef PLATFORM_UNIX
#  define PLATFORM_UNIX
# endif
#endif

#if defined(__SVR4) || defined(__svr4__)
# define OS_SOLARIS
// Thanks to Rolf Stalder now it's possible to use pthreads also for Solaris
// In any case the Solaris native threads model is still present and can be
// used uncommenting the #define line below.
Changes to undroid/snap7/src/sys/snap_sysutils.h.
25
26
27
28
29
30
31

32

33
34
35
36
37
38
39
|=============================================================================*/
#ifndef snap_sysutils_h
#define snap_sysutils_h
//---------------------------------------------------------------------------
#include "snap_platform.h"
//---------------------------------------------------------------------------
#ifdef OS_OSX

# define CLOCK_MONOTONIC 0

#endif

longword SysGetTick();
void SysSleep(longword Delay_ms);
longword DeltaTime(longword &Elapsed);

#endif // snap_sysutils_h







>
|
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|=============================================================================*/
#ifndef snap_sysutils_h
#define snap_sysutils_h
//---------------------------------------------------------------------------
#include "snap_platform.h"
//---------------------------------------------------------------------------
#ifdef OS_OSX
# ifndef CLOCK_MONOTONIC
#  define CLOCK_MONOTONIC 0
# endif
#endif

longword SysGetTick();
void SysSleep(longword Delay_ms);
longword DeltaTime(longword &Elapsed);

#endif // snap_sysutils_h