Skip to content

Commit

Permalink
Improvements for windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavidberger committed Oct 13, 2020
1 parent e5683f2 commit 50f6255
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,30 @@ endif()

find_program(DOTNET dotnet)
if(DOTNET)
SET(DOTNET_RUNTIME_FLAGS "")
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(DOTNET_RUNTIME_FLAGS "--runtime;win-x64")

elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(DOTNET_RUNTIME_FLAGS "--runtime;win-x86")
endif()
endif()

message("${DOTNET} build -c Release ${DOTNET_RUNTIME_FLAGS}")
execute_process(
COMMAND ${DOTNET} build -c Release
COMMAND ${DOTNET} build -c Release ${DOTNET_RUNTIME_FLAGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/)

file(GLOB_RECURSE CS_BINDINGS
"${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/libsurvive.net/bin/Release/*.dll")

install(FILES ${CS_BINDINGS} DESTINATION "lib")
install(FILES ${CS_BINDINGS} DESTINATION "bin")

file(GLOB_RECURSE CS_DEMO
"${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/Demo/bin/Release/Demo.*")

install(FILES ${CS_DEMO} DESTINATION "bin")
endif()

if(EXISTS /etc/bash_completion.d)
Expand Down
5 changes: 5 additions & 0 deletions redist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ elseif(WIN32)
endif()
message("Nuget is found at ${NUGET}")
add_custom_command(TARGET minimal_opencv PRE_BUILD COMMAND ${NUGET} restore ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.sln)

file(GLOB_RECURSE OPENBLAS_DLLS
"${CMAKE_BINARY_DIR}/packages/*.dll")

install(FILES ${OPENBLAS_DLLS} DESTINATION "bin")

ENDIF()

Expand Down
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ set_target_properties(survive PROPERTIES
FOLDER "libraries"
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})
if(WIN32)
set_target_properties(survive PROPERTIES PREFIX "lib")
endif()

target_link_libraries(survive minimal_opencv ${ADDITIONAL_LIBRARIES} mpfit)
IF(HAVE_ZLIB_H)
Expand Down Expand Up @@ -147,7 +150,12 @@ function(SURVIVE_REGISTER_PLUGIN PLUGIN)
#set_target_properties(${PLUGIN} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}Release/plugins")
#set_target_properties(${PLUGIN} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${OUTPUT_DIR}RelWithDebInfo/plugins")

if(NOT WIN32)
install(TARGETS ${PLUGIN} DESTINATION lib/libsurvive/plugins)
else()
install(TARGETS ${PLUGIN} DESTINATION bin/plugins)
endif()

endfunction()

foreach(PLUGIN ${PLUGINS})
Expand All @@ -168,6 +176,11 @@ ENDIF()

set(SURVIVE_BUILT_PLUGINS "${SURVIVE_BUILT_PLUGINS}" PARENT_SCOPE)

if(NOT WIN32)
install(TARGETS ${SURVIVE_BUILT_PLUGINS} DESTINATION lib/libsurvive/plugins)
install(TARGETS survive DESTINATION lib/libsurvive)
install(TARGETS survive DESTINATION lib)
else()
install(TARGETS ${SURVIVE_BUILT_PLUGINS} DESTINATION bin/plugins)
install(TARGETS survive DESTINATION bin)
endif()

0 comments on commit 50f6255

Please sign in to comment.