sptest_env = env.Clone()
src_dir = sptest_env.get('SRC_DIR')
+target_os = env.get('TARGET_OS')
######################################################################
# Build flags
'gtest_main'])
if env.get('SECURED') == '1':
+ sptest_env.AppendUnique(LIBS = ['timer'])
sptest_env.AppendUnique(LIBS = ['tinydtls'])
if env.get('DTLS_WITH_X509') == '1':
sptest_env.AppendUnique(LIBS = ['CKManager'])
if not env.get('RELEASE'):
sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+if target_os in ['msys_nt', 'windows']:
+ sptest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
+ sptest_env.AppendUnique(LIBS = ['ws2_32',
+ 'advapi32',
+ 'iphlpapi'])
+
######################################################################
# Source files and Targets
######################################################################
-unittest = sptest_env.Program('unittest', ['pmutilitytest.cpp',
- 'secureresourceprovider.cpp',
- 'provisioningdatabasemanager.cpp',
- 'ocprovisioningmanager.cpp', 'otmunittest.cpp',
- 'credentialgeneratortest.cpp' ])
+unittest_src = ['pmutilitytest.cpp',
+ 'secureresourceprovider.cpp',
+ 'provisioningdatabasemanager.cpp',
+ 'ocprovisioningmanager.cpp',
+ 'credentialgeneratortest.cpp',
+ ]
+
+if target_os not in ['windows']:
+ unittest_src += [ 'otmunittest.cpp' ]
-sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
-sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
+unittest = sptest_env.Program('unittest', unittest_src)
-provisioning_unittest_src_dir = src_dir + '/resource/csdk/security/provisioning/unittest/'
-provisioning_unittest_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/unittest/'
+if target_os not in ['windows']:
+ sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
+ sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
+ Alias("test", [sample_server1, sample_server2])
-Alias("test", [unittest, sample_server1, sample_server2])
+Alias("test", [unittest])
env.AppendTarget('test')
if env.get('TEST') == '1':
- target_os = env.get('TARGET_OS')
- if target_os == 'linux':
+ if target_os in ['linux', 'windows']:
out_dir = env.get('BUILD_DIR')
result_dir = env.get('BUILD_DIR') + '/test_out/'
if not os.path.isdir(result_dir):
os.makedirs(result_dir)
sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
+ sptest_env.AppendENVPath('PATH', env.get('BUILD_DIR'))
sptest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')
AlwaysBuild ('ut')