More bullet + windows + cmake fun.

This commit is contained in:
jaynus 2015-05-12 11:26:07 -07:00
parent 1423b91871
commit ae0849764e
5 changed files with 30 additions and 28 deletions

View File

@ -4,7 +4,7 @@ project (ACE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(WIN32) if(WIN32)
add_definitions(/DWINVER=0x0600) add_definitions(/DWINVER=0x0600 /D_WIN32_WINNT=0x0600)
endif() endif()
if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX) if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX)
@ -34,7 +34,23 @@ include_directories("common")
if(USE_BULLET) if(USE_BULLET)
# Dependencies # Dependencies
add_subdirectory(lib/bullet3) #
add_definitions(-DUSE_DIRECTX)
add_definitions(-DBUILD_BULLET2_DEMOS=false -DBUILD_UNIT_TESTS=false -DBUILD_BULLET3_DEMOS=false -DBUILD_CPU_DEMOS=false -DBUILD_EXTRAS=false)
add_subdirectory(lib/bullet3 EXCLUDE_FROM_ALL)
#set(depname bullet3)
#set(${depname}_PREFIX "lib/${depname}")
#set(${depname}_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/binaries/${CMAKE_SYSTEM_NAME}${CMAKE_CXX_COMPILER_ID}${KINEVOX_ARCHITECTURE}/usr/local/")
#set(${depname}_CMAKE_ARGS -DBUILD_SHARED_LIBS=true -DCMAKE_INSTALL_PREFIX=${${depname}_INSTALL_DIR} -DBUILD_BULLET2_DEMOS=false -DBUILD_UNIT_TESTS=false -DBUILD_BULLET3_DEMOS=false -DBUILD_CPU_DEMOS=false -DBUILD_EXTRAS=false -DINSTALL_LIBS=true ${EXTRA_ARGS})
#ExternalProject_Add(
# ${depname}
# PREFIX ${${depname}_PREFIX}
# GIT_REPOSITORY https://github.com/bulletphysics/bullet3.git lib/${depname}
# SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${depname}
# INSTALL_DIR ${${depname}_INSTALL_DIR}
# CMAKE_ARGS ${${depname}_CMAKE_ARGS}
#)
set_target_properties(App_BasicExample PROPERTIES FOLDER Bullet3) set_target_properties(App_BasicExample PROPERTIES FOLDER Bullet3)
set_target_properties(App_HelloWorld PROPERTIES FOLDER Bullet3) set_target_properties(App_HelloWorld PROPERTIES FOLDER Bullet3)
set_target_properties(App_ExampleBrowser PROPERTIES FOLDER Bullet3) set_target_properties(App_ExampleBrowser PROPERTIES FOLDER Bullet3)
@ -67,6 +83,7 @@ else()
set(BULLET_LIBS "") set(BULLET_LIBS "")
endif() endif()
if(USE_DIRECTX) if(USE_DIRECTX)
add_definitions(-DUSE_DIRECTX)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package (DirectX) find_package (DirectX)
link_directories (BEFORE ${DirectX_D3DX11_LIBRARY}) link_directories (BEFORE ${DirectX_D3DX11_LIBRARY})

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#else #else

View File

@ -15,15 +15,10 @@ if(USE_DIRECTX)
add_dependencies(ace_vd_ext_test ace_common ace_vd_static) add_dependencies(ace_vd_ext_test ace_common ace_vd_static)
target_link_libraries(ace_vd_ext_test ace_common directxtk target_link_libraries(ace_vd_ext_test ace_common directxtk
ace_vd_static ace_vd_static
${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} BulletDynamics BulletCollision LinaerMath)
${BULLET_LIBS_DEBUG}
)
else() else()
add_dependencies(ace_vd_ext_test ace_common ace_vd_static) add_dependencies(ace_vd_ext_test ace_common ace_vd_static)
target_link_libraries(ace_vd_ext_test ace_common target_link_libraries(ace_vd_ext_test ace_common BulletDynamics BulletCollision LinaerMath ace_vd_static)
${BULLET_LIBS_DEBUG}
ace_vd_static
)
endif() endif()
set_target_properties(ace_vd_ext_test PROPERTIES PREFIX "") set_target_properties(ace_vd_ext_test PROPERTIES PREFIX "")
set_target_properties(ace_vd_ext_test PROPERTIES FOLDER Tests) set_target_properties(ace_vd_ext_test PROPERTIES FOLDER Tests)
@ -38,14 +33,10 @@ if(USE_DIRECTX)
add_dependencies(ace_longrod_dxtk_test ace_common ace_vd_static) add_dependencies(ace_longrod_dxtk_test ace_common ace_vd_static)
target_link_libraries(ace_longrod_dxtk_test ace_common directxtk target_link_libraries(ace_longrod_dxtk_test ace_common directxtk
ace_vd_static ace_vd_static
${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} BulletDynamics BulletCollision LinaerMath)
${BULLET_LIBS_DEBUG}
)
else() else()
add_dependencies(ace_longrod_dxtk_test ace_common ace_vd_static) add_dependencies(ace_longrod_dxtk_test ace_common ace_vd_static)
target_link_libraries(ace_longrod_dxtk_test ace_common target_link_libraries(ace_longrod_dxtk_test ace_common BulletDynamics BulletCollision LinaerMath ace_vd_static
${BULLET_LIBS_DEBUG}
ace_vd_static
) )
endif() endif()
set_target_properties(ace_longrod_dxtk_test PROPERTIES PREFIX "") set_target_properties(ace_longrod_dxtk_test PROPERTIES PREFIX "")
@ -58,18 +49,14 @@ set_target_properties(ace_longrod_dxtk_test PROPERTIES FOLDER Tests)
if(USE_DIRECTX) if(USE_DIRECTX)
add_executable( ace_test_render test_render.cpp test_render.hpp) add_executable( ace_test_render test_render.cpp test_render.hpp)
target_link_libraries(ace_test_render ace_common target_link_libraries(ace_test_render ace_common
${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} BulletDynamics BulletCollision LinaerMath )
${BULLET_LIBS_DEBUG}
)
add_dependencies(ace_test_render ace_common) add_dependencies(ace_test_render ace_common)
SET_TARGET_PROPERTIES(ace_test_render PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(ace_test_render PROPERTIES PREFIX "")
set_target_properties(ace_test_render PROPERTIES FOLDER Tests) set_target_properties(ace_test_render PROPERTIES FOLDER Tests)
add_executable( ace_dxtk_test dxtk_test.cpp) add_executable( ace_dxtk_test dxtk_test.cpp)
target_link_libraries(ace_dxtk_test ace_common directxtk target_link_libraries(ace_dxtk_test ace_common directxtk
${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY} BulletDynamics BulletCollision LinaerMath)
${BULLET_LIBS_DEBUG}
)
add_dependencies(ace_dxtk_test ace_common directxtk) add_dependencies(ace_dxtk_test ace_common directxtk)
SET_TARGET_PROPERTIES(ace_dxtk_test PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(ace_dxtk_test PROPERTIES PREFIX "")

View File

@ -17,16 +17,14 @@ add_library( ${ACE_EXTENSION_NAME} SHARED ${DEBUG_SOURCES} ${SOURCES} ${DAMAGE_S
add_library( ${ACE_EXTENSION_NAME}_static STATIC ${DEBUG_SOURCES} ${SOURCES} ${DAMAGE_SOURCES} ${PENETRATION_SOURCES} ${GLOBAL_SOURCES}) add_library( ${ACE_EXTENSION_NAME}_static STATIC ${DEBUG_SOURCES} ${SOURCES} ${DAMAGE_SOURCES} ${PENETRATION_SOURCES} ${GLOBAL_SOURCES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(USE_BULLET) if(NOT USE_BULLET)
set(BULLET_LIBS ${BULLET_LIBS_DEBUG})
else()
message(FATAL_ERROR "Bullet is required for vehicle damage!\nYou need to build out the bullet3 folder and define -DUSE_BULLET=On") message(FATAL_ERROR "Bullet is required for vehicle damage!\nYou need to build out the bullet3 folder and define -DUSE_BULLET=On")
endif() endif()
if(DEVEL AND USE_DIRECTX) if(DEVEL AND USE_DIRECTX)
set(LINK_LIBS directxtk ${BULLET_LIBS_DEBUG} ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY}) set(LINK_LIBS directxtk BulletDynamics BulletCollision LinaerMath ${DirectX_D3DX11_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DirectX_D3D11_1_LIBRARY} ${DirectX_D3D11_2_LIBRARY})
else() else()
set(LINK_LIBS ${BULLET_LIBS_DEBUG}) set(LINK_LIBS BulletDynamics BulletCollision LinaerMath)
endif() endif()
target_link_libraries(${ACE_EXTENSION_NAME} ace_common ${LINK_LIBS}) target_link_libraries(${ACE_EXTENSION_NAME} ace_common ${LINK_LIBS})

View File

@ -21,7 +21,7 @@ namespace ace {
} }
if (fire_lod == -1) // @TODO: fallback on geo LOD if (fire_lod == -1) // @TODO: fallback on geo LOD
fire_lod = 0; fire_lod = 0;
//fire_lod = 0; fire_lod = 0;
assert(fire_lod != -1); assert(fire_lod != -1);
// Build the mesh from object faces // Build the mesh from object faces