From d45689a2c163306cc7f86fee99ece9ed2eac51d3 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Wed, 18 Sep 2013 13:52:49 +0200 Subject: [PATCH 1/3] CMake for assimp_view: copy dlls from assimp build over to output folder. --- tools/assimp_view/CMakeLists.txt | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index e3f15e9d8..dc7ae543a 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -1,18 +1,16 @@ FIND_PACKAGE(DirectX REQUIRED) -# Make sure the compiler can find include files from our Hello library. -include_directories ( + +INCLUDE_DIRECTORIES ( ${Assimp_SOURCE_DIR}/include ${Assimp_SOURCE_DIR}/code ${DirectX_INCLUDE_DIR} ) -# Make sure the linker can find the Hello library once it is built. -link_directories (${Assimp_BINARY_DIR} ${AssetImporter_BINARY_DIR}/lib) +# Make sure the linker can find the Assimp library once it is built. +LINK_DIRECTORIES (${Assimp_BINARY_DIR} ${AssetImporter_BINARY_DIR}/lib) -# Add executable called "helloDemo" that is built from the source files -# "demo.cxx" and "demo_b.cxx". The extensions are automatically found. -add_executable( assimp_viewer WIN32 +ADD_EXECUTABLE( assimp_viewer WIN32 AnimEvaluator.cpp Background.cpp Display.cpp @@ -46,12 +44,17 @@ add_executable( assimp_viewer WIN32 SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) IF( WIN32 ) - ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) + ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) ENDIF( WIN32 ) -# Link the executable to the Hello library. -target_link_libraries ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib ) +# +ADD_CUSTOM_COMMAND(TARGET assimp_viewer + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) + +# Link the executable to the assimp + dx libs. +TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib ) INSTALL( TARGETS assimp_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev From 995978b16338e83a86441bf892324e9c38af22b7 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Wed, 18 Sep 2013 13:55:02 +0200 Subject: [PATCH 2/3] CMake for assimp_cmd: also copy over assimp output binary as PRE_BUILD event. --- tools/assimp_cmd/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index 9d1a291d2..ec31e76b0 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -19,6 +19,11 @@ ADD_EXECUTABLE( assimp_cmd SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) +# +ADD_CUSTOM_COMMAND(TARGET assimp_cmd + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) + TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES OUTPUT_NAME assimp From f8f7e2468c6544b244b54c5c3255525d17f24821 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Wed, 18 Sep 2013 14:10:26 +0200 Subject: [PATCH 3/3] CMake: use copy_if_different instead of copy and only run PRE_BUILD on Windows as it is not required on *nix anyway. --- tools/assimp_cmd/CMakeLists.txt | 9 +++++---- tools/assimp_view/CMakeLists.txt | 9 ++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index ec31e76b0..8581eba09 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -19,10 +19,11 @@ ADD_EXECUTABLE( assimp_cmd SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) -# -ADD_CUSTOM_COMMAND(TARGET assimp_cmd - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) +IF( WIN32 ) + ADD_CUSTOM_COMMAND(TARGET assimp_cmd + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) +ENDIF( WIN32 ) TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index dc7ae543a..4673cfeb4 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -43,15 +43,14 @@ ADD_EXECUTABLE( assimp_viewer WIN32 SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) -IF( WIN32 ) - ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) - ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) -ENDIF( WIN32 ) +ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) +ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) + # ADD_CUSTOM_COMMAND(TARGET assimp_viewer PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) # Link the executable to the assimp + dx libs. TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib )