Made changes to write compiled binaries to a common directory.

The following changes were tested with the following projects:

- assimp DLL
- unit tests
- tools/assimp_cmd
- tools/assimp viewer
- samples/SimpleOpenGL
- samples/SimpleTexturedDirectx11
- samples/SimpleTexturedOpenGL

For each program listed above, the results were tested when (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) is true and false.

Also, the "lib" in SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib") was changed to "bin" to allow DLLs to be written to executables/launchables programs directory.
pull/3013/head
Marc-Antoine Lortie 2020-02-15 13:10:11 -05:00
parent a0000e5be4
commit be4fe131d5
4 changed files with 5 additions and 22 deletions

View File

@ -342,9 +342,13 @@ INCLUDE (PrecompiledHeader)
# source tree. During an out-of-source build, however, do not litter this # source tree. During an out-of-source build, however, do not litter this
# directory, since that is probably what the user wanted to avoid. # directory, since that is probably what the user wanted to avoid.
IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib" ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib" ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib" )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" )
ELSE()
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
# Cache these to allow the user to override them manually. # Cache these to allow the user to override them manually.

View File

@ -205,13 +205,6 @@ ELSE( WIN32 )
SET( platform_libs pthread ) SET( platform_libs pthread )
ENDIF( WIN32 ) ENDIF( WIN32 )
IF( WIN32 )
ADD_CUSTOM_COMMAND(TARGET unit
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:assimp> $<TARGET_FILE_DIR:unit>
MAIN_DEPENDENCY assimp)
ENDIF( WIN32 )
IF(MSVC) IF(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -61,13 +61,6 @@ ADD_EXECUTABLE( assimp_cmd
SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
IF( WIN32 )
ADD_CUSTOM_COMMAND(TARGET assimp_cmd
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:assimp> $<TARGET_FILE_DIR:assimp_cmd>
MAIN_DEPENDENCY assimp)
ENDIF( WIN32 )
TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES} ) TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES} )
SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES
OUTPUT_NAME assimp OUTPUT_NAME assimp

View File

@ -92,13 +92,6 @@ IF ( MSVC )
REMOVE_DEFINITIONS( -DUNICODE -D_UNICODE ) REMOVE_DEFINITIONS( -DUNICODE -D_UNICODE )
ENDIF ( MSVC ) ENDIF ( MSVC )
#
ADD_CUSTOM_COMMAND(TARGET assimp_viewer
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:assimp> $<TARGET_FILE_DIR:assimp_viewer>
MAIN_DEPENDENCY assimp)
# Link the executable to the assimp + dx libs. # Link the executable to the assimp + dx libs.
TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib winmm.lib ) TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib winmm.lib )