Commit 55ff9a5d532d6dd04170cc9dabf076a1374d2d9a

Authored by Scott Klum
1 parent 44f45db8

Working structure in place

3rdparty/stasm4.0.0/CMakeLists.txt
@@ -29,6 +29,7 @@ if(MSVC) @@ -29,6 +29,7 @@ if(MSVC)
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /wd4267 /wd4307 /wd4308 /nologo") 29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /wd4267 /wd4307 /wd4308 /nologo")
30 endif() 30 endif()
31 31
  32 +message("********* ${PROJECT_SOURCE_DIR} ************")
32 add_subdirectory(${PROJECT_SOURCE_DIR}/stasm) 33 add_subdirectory(${PROJECT_SOURCE_DIR}/stasm)
33 34
34 # Package 35 # Package
3rdparty/stasm4.0.0/stasm/CMakeLists.txt
@@ -15,6 +15,5 @@ set_target_properties(stasm PROPERTIES @@ -15,6 +15,5 @@ set_target_properties(stasm PROPERTIES
15 15
16 target_link_libraries(stasm ${OpenCV_LIBS} ${Qt5Core_QTMAIN_LIBRARIES}) 16 target_link_libraries(stasm ${OpenCV_LIBS} ${Qt5Core_QTMAIN_LIBRARIES})
17 17
18 -file(GLOB HEADERS "include/*.h")  
19 -install(FILES ${HEADERS} DESTINATION include/stasm) 18 +install(DIRECTORY include DESTINATION include/stasm)
20 install(TARGETS stasm RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) 19 install(TARGETS stasm RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
openbr/plugins/stasm4.cmake
@@ -3,14 +3,16 @@ set(BR_WITH_STASM4 ON CACHE BOOL "Build with Stasm") @@ -3,14 +3,16 @@ set(BR_WITH_STASM4 ON CACHE BOOL "Build with Stasm")
3 if(${BR_WITH_STASM4}) 3 if(${BR_WITH_STASM4})
4 find_package(Stasm4 REQUIRED) 4 find_package(Stasm4 REQUIRED)
5 5
  6 + include_directories(${STASM4_INCLUDE_DIR})
  7 +
6 set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} plugins/stasm4.cpp) 8 set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} plugins/stasm4.cpp)
7 - set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Stasm4_LIBS}) 9 + set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${STASM4_LIBS})
8 10
9 if(WIN32) 11 if(WIN32)
10 - install(FILES ${Stasm4_LIBS} DESTINATION bin) 12 + install(FILES ${STASM4_LIBS} DESTINATION bin)
11 else() 13 else()
12 - install(FILES ${Stasm4_LIBS} DESTINATION lib) 14 + install(FILES ${STASM4_LIBS} DESTINATION lib)
13 endif() 15 endif()
14 16
15 - install(DIRECTORY ${Stasm4_DIR}/data/ DESTINATION share/openbr/models/stasm) 17 + install(DIRECTORY ${STASM4_DATA_DIR} DESTINATION share/openbr/models/stasm)
16 endif() 18 endif()
share/openbr/cmake/FindStasm4.cmake
1 # ================================================================ 1 # ================================================================
2 # The Stasm CMake configuration file 2 # The Stasm CMake configuration file
3 # 3 #
  4 +# Formatting from: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
  5 +#
4 # Usage from an external project: 6 # Usage from an external project:
5 # In your CMakeLists.txt, add these lines: 7 # In your CMakeLists.txt, add these lines:
6 # 8 #
7 -# find_package(Stasm4 REQUIRED)  
8 -# target_link_libraries(MY_TARGET ${Stasm4_LIBS}) 9 +# find_package(STASM4 REQUIRED)
  10 +# include_directories(STASM4_INCLUDE_DIR)
  11 +# target_link_libraries(MY_TARGET ${STASM4_LIBS})
9 # ================================================================ 12 # ================================================================
10 include(ExternalProject) 13 include(ExternalProject)
11 14
@@ -23,40 +26,28 @@ foreach(CACHE_VAR ${CACHE_VARS}) @@ -23,40 +26,28 @@ foreach(CACHE_VAR ${CACHE_VARS})
23 endif() 26 endif()
24 endforeach() 27 endforeach()
25 28
26 -find_path(Stasm4_SOURCE_DIR stasm/include/stasm_lib.h ${CMAKE_SOURCE_DIR}/3rdparty/*) 29 +find_path(STASM4_SOURCE_DIR stasm/include/stasm_lib.h ${CMAKE_SOURCE_DIR}/3rdparty/*)
27 30
28 -set(stasm_prefix ${CMAKE_BINARY_DIR}/stasm) 31 +set(STASM4_PREFIX "${CMAKE_BINARY_DIR}/stasm")
  32 +set(STASM4_INSTALL_DIR "${CMAKE_BINARY_DIR}/stasm")
29 33
30 # Have to use a name other than stasm so it doesn't conflict with the project itself 34 # Have to use a name other than stasm so it doesn't conflict with the project itself
31 ExternalProject_Add(external_stasm 35 ExternalProject_Add(external_stasm
32 - URL ${Stasm4_SOURCE_DIR}  
33 - PREFIX ${stasm_prefix}  
34 - CMAKE_ARGS "-DCMAKE_PREFIX_PATH=~/Qt/5.3/clang_64/"  
35 - INSTALL_COMMAND ""  
36 - BINARY_DIR "${stasm_prefix}/lib" 36 + URL ${STASM4_SOURCE_DIR}
  37 + PREFIX ${STASM4_PREFIX}
  38 + CMAKE_ARGS \"${CMAKE_ARGS}\";
  39 + INSTALL_DIR ${STASM4_INSTALL_DIR}
  40 + BINARY_DIR "${STASM4_PREFIX}/lib"
37 ) 41 )
38 42
39 -ExternalProject_Add_Step(  
40 - external_stasm  
41 - copy_stasm_headers  
42 - COMMAND ${CMAKE_COMMAND} -E copy_directory "${Stasm4_SOURCE_DIR}/stasm/include" ${stasm_prefix}/include/stasm  
43 - COMMENT "Copying stasm headers..."  
44 - DEPENDERS configure  
45 - )  
46 -  
47 -ExternalProject_Add_Step(  
48 - external_stasm  
49 - copy_stasm_data  
50 - COMMAND ${CMAKE_COMMAND} -E copy_directory "${Stasm4_SOURCE_DIR}/data" ${stasm_prefix}/data  
51 - COMMENT "Copying stasm headers..."  
52 - DEPENDERS configure  
53 - )  
54 -  
55 # We have to fake a library being created to force external_stasm to be built 43 # We have to fake a library being created to force external_stasm to be built
56 add_library(fake_stasm UNKNOWN IMPORTED) 44 add_library(fake_stasm UNKNOWN IMPORTED)
57 add_dependencies(fake_stasm external_stasm) 45 add_dependencies(fake_stasm external_stasm)
58 ExternalProject_Get_Property(external_stasm install_dir) 46 ExternalProject_Get_Property(external_stasm install_dir)
59 47
60 -set(Stasm4_DIR ${install_dir})  
61 -include_directories(${install_dir}/include/stasm)  
62 -file(GLOB Stasm4_LIBS ${install_dir}/lib/stasm/*.dylib) 48 +set(STASM4_FOUND TRUE)
  49 +set(STASM4_INCLUDE_DIR ${install_dir}/include)
  50 +set(STASM4_DATA_DIR ${install_dir}/src/external_stasm/data)
  51 +
  52 +# We have to explicitly set these, because they aren't created by the time the calling project gets to this point
  53 +set(STASM4_LIBS ${install_dir}/lib/stasm/libstasm.dylib ${install_dir}/lib/stasm/libstasm.dylib)