Skip to content

Commit

Permalink
Getting rid of all paths for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dpar39 committed Mar 5, 2017
1 parent 400bd13 commit 4d5ab71
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ deploy:
secure: 32L8/h+aNVH4YEDheebMrHbA2PnpMaYFkJDuPf3KQF6ZwAqTEBH/Kj3poOgtjhQv0Cu3ppNp/yLGGZLrS0g9pWzMzB6GrqUGDd7lSgId3QBrcChQlE580Lpu4uMEdyTTqWRW5DrS3lchFQNSo6/H8jJbJRQumdkNlVHe76/ISeQEh1SChSi1FXeN2AU2aIUzR6xm5Boz4Mt/kcvH6+vrNatcolnt6IGt5AuzrZPT6lg2a9pNd7RwJgSJFzbP5IEA8bTASGw8EMV2yO1ZuCFfo+IZbY31tjiwCr8wt+Zl/0Np4NBrbnrGlI4uK38AHiB3FyDmDMMqYjTSXjq3diieMUAfNE6BCbICbBR6cv8eiRtr0/bh5LYpdNNwGOqBG6JjYaK9L1Edn2HMv5ranNRIXjcpEnyxFt7SzqQqXE/pPoLZXguuFcTBQPRCzvcvNgklS8XfpyoC4/FDy9FUeHVWI2x311FdkVJ4QhuTImmYAi3X/VIkLx8CH7xNkNcUZwtd8FETRBAe8Eb6s3KCVk/8IYZd0dVymKOgq3nBdWR8+9xy0X5Patbfx7o+dHCbni5YHWZRUkcb2A8Ne3WDSNZ67monBqQJcRBYZmBgccplcKwA7sGZyeyzhpcsejdVTN0v8wmaE9N3O/ZHPAOyYHr9v4vKHZZxkE3RAidgY0l4UqU=
file_glob: true
file:
- webapp/*
- webapp/addon.node
- webapp/liblibppp.so
- webapp/config.json
skip_cleanup: true
on:
repo: dpar39/ppp
Expand Down
2 changes: 1 addition & 1 deletion addon/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////
// Configuration //
/////////////////////////////////////////////////
var engineConfigFile = 'share/config.json';
var engineConfigFile = 'config.json';
var inImgName = '../research/sample_test_images/000.jpg';
var outImgName = 'output.png';

Expand Down
18 changes: 6 additions & 12 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,25 +422,25 @@ def extract_validation_data(self):
These images were requested at http://www.scface.org/ and are copyrighted,
so please do not share them without obatining written consent
"""
print 'Extracting validation data ...'
def extract(research_dir, zip_file):
"""
Extracts file
Extracts file from zip archive
"""
zip_file = os.path.join(research_dir, zip_file)
if os.path.exists(os.path.join(research_dir, 'mugshot_frontal_original_all')):
return # Nothing to do, data already been extracted
print 'Extracting validation data ...'
zip_handle = zipfile.ZipFile(zip_file)
for item in zip_handle.namelist():
zip_handle.extract(item, research_dir, pwd='mugshot_frontal_original_all.zip')
zip_handle.close()
print 'Extracting validation data completed!'

research_dir = os.path.join(self._root_dir, 'research')
extract(research_dir, 'annotated_imageset0.zip')
extract(research_dir, 'annotated_imageset1.zip')
extract(research_dir, 'annotated_imageset2.zip')
extract(research_dir, 'annotated_imageset3.zip')
print 'Extracting validation data completed!'

def build_cpp_code(self):
"""
Expand Down Expand Up @@ -491,18 +491,12 @@ def deploy_addon(self):
"""
Deploys the addon to the webapp directory as well as the shared configuration
"""
addon = os.path.join(self._install_dir, 'addon.node')
share_dir = os.path.join(self._install_dir, 'share')
webapp_dir = os.path.join(self._root_dir, 'webapp')
webapp_share = os.path.join(webapp_dir, 'share')
shutil.copy(addon, webapp_dir)
shutil.copy(os.path.join(self._install_dir, 'addon.node'), webapp_dir)
shutil.copy(os.path.join(self._install_dir, 'config.json'), webapp_dir)
if not IS_WINDOWS:
# Copy shared library to webapp directory
libppp = os.path.join(self._install_dir, 'liblibppp.so')
shutil.copy(libppp, webapp_dir)
if os.path.exists(webapp_share):
shutil.rmtree(webapp_share)
shutil.copytree(share_dir, webapp_share)
shutil.copy(os.path.join(self._install_dir, 'liblibppp.so'), webapp_dir)

def __init__(self):
# Detect OS version
Expand Down
12 changes: 1 addition & 11 deletions libppp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,17 @@ add_library(${LIB_NAME} ${LIB_MODE} ${LIB_SRC_FILES} ${LIB_INC_FILES})
link_directories(${MODULE_LIB_DIRS})
target_link_libraries(${LIB_NAME} ${MODULE_LIB_DEPS})

add_custom_command(TARGET ${LIB_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/config $<TARGET_FILE_DIR:${LIB_NAME}>)

# Install the library
install(TARGETS ${LIB_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/libppp.h DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/share DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/share/config.json DESTINATION ${CMAKE_INSTALL_PREFIX})

#-----------------------------
# Build the module tests
#-----------------------------
file(GLOB TEST_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp")
file(GLOB TEST_INC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/*.h")


set(TEST_INC_DIRS
"tests/include"
${GMOCK_ROOT}/gtest/include
Expand All @@ -79,14 +74,9 @@ set(TEST_LIB_DEPS
${MODULE_LIB_DEPS}
gmock
)
set(TEST_LIB_DIRS
${MODULE_INC_DIRS}
)

add_executable(${TEST_NAME} ${TEST_SRC_FILES} ${TEST_INC_FILES})
target_include_directories(${TEST_NAME} PUBLIC ${TEST_INC_DIRS})
link_directories(${TEST_LIB_DIRS})
target_link_libraries(${TEST_NAME} ${TEST_LIB_DEPS})

add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} --gtest_output=xml:${TEST_NAME}.xml)
#add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
8 changes: 4 additions & 4 deletions libppp/share/config.json

Large diffs are not rendered by default.

0 comments on commit 4d5ab71

Please sign in to comment.