1) Moved header and source file into the same folder for VS.
2) Fixed using/building WIIUSE on VS when created from cmake. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13417 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a3bfed004e
commit
72a2b69695
@ -14,6 +14,15 @@ endif()
|
||||
option(USE_WIIUSE "Support for wiimote input devices" OFF)
|
||||
option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
|
||||
if(MSVC)
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
# on the installation of the Windows DDK (Driver Developer Kit),
|
||||
# which also needs an absolute path :(
|
||||
option(WIIUSE_BUILD "Build wiiuse lib (only for developers)" OFF)
|
||||
mark_as_advanced(WIIUSE_BUILD)
|
||||
else()
|
||||
set(WIIUSE_BUILD ON)
|
||||
endif()
|
||||
|
||||
set(STK_SOURCE_DIR "src")
|
||||
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
|
||||
@ -33,16 +42,21 @@ include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
|
||||
|
||||
# Build the Wiiuse library
|
||||
if(USE_WIIUSE)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
|
||||
# Build the irrlicht library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
|
||||
|
||||
# Build the Wiiuse library
|
||||
# Note: wiiuse MUST be declared after irrlicht, since otherwise
|
||||
# (at least on VS) irrlicht will find wiiuse io.h file because
|
||||
# of the added include directory.
|
||||
if(USE_WIIUSE)
|
||||
if(WIIUSE_BUILD)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
|
||||
|
||||
# Set include paths
|
||||
include_directories(${STK_SOURCE_DIR})
|
||||
@ -227,14 +241,24 @@ if(USE_FRIBIDI)
|
||||
add_definitions(-DENABLE_BIDI)
|
||||
endif()
|
||||
|
||||
# Wiiuse
|
||||
# ------
|
||||
if(USE_WIIUSE)
|
||||
if(APPLE)
|
||||
find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
|
||||
target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
|
||||
elseif(MSVC)
|
||||
add_definitions("/DWIIUSE_STATIC")
|
||||
if(WIIUSE_BUILD)
|
||||
target_link_libraries(supertuxkart wiiuse)
|
||||
else()
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(supertuxkart wiiuse bluetooth)
|
||||
endif()
|
||||
add_definitions(-DENABLE_WIIUSE)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
@ -267,4 +291,4 @@ install(FILES data/supertuxkart_32.xpm data/supertuxkart_64.xpm DESTINATION shar
|
||||
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
configure_file(data/supertuxkart_desktop.template supertuxkart.desktop)
|
||||
add_dependencies(supertuxkart supertuxkart.desktop)
|
||||
add_dependencies(supertuxkart supertuxkart.desktop)
|
||||
|
@ -16,7 +16,6 @@ set(WIIUSE_SOURCES
|
||||
wiiuse.c
|
||||
)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
|
||||
@ -27,4 +26,49 @@ if(APPLE)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(wiiuse ${WIIUSE_SOURCES})
|
||||
if(MSVC)
|
||||
add_definitions("/DWIIUSE_STATIC")
|
||||
add_library(wiiuse STATIC ${WIIUSE_SOURCES})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" /MTd)
|
||||
else()
|
||||
add_library(wiiuse ${WIIUSE_SOURCES})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(MSVC90)
|
||||
set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 9.0\\VC\\include"
|
||||
CACHE STRING "VS 9.0 include directory, see lib/wiiuse/README for details")
|
||||
elseif(MSVC10)
|
||||
set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 10.0\\VC\\include"
|
||||
CACHE STRING "VS 10.0 include directory, see lib/wiiuse/README for details")
|
||||
endif()
|
||||
mark_as_advanced(WIIUSE_VS_INCLUDE_DIR)
|
||||
|
||||
if(MSVC90 OR MSVC10)
|
||||
# VS 9 does not have the windows device driver kit
|
||||
# So the driver must be installed additionally. Also,
|
||||
# in order to avoid a compilation error, you have to
|
||||
# specify the visual studio include path FIRST (google
|
||||
# it, known issue). So in this case add appropriate
|
||||
# variables that can be set.
|
||||
set(WIIUSE_WINDDK_ROOT "C:/WinDDK" CACHE
|
||||
STRING "Install directory of Windows Driver Kits")
|
||||
mark_as_advanced(WIIUSE_WINDDK_ROOT)
|
||||
include_directories(${WIIUSE_VS_INCLUDE_DIR} ${WIIUSE_WINDDK_ROOT}/inc/api)
|
||||
endif()
|
||||
add_library(setupapi.lib STATIC IMPORTED)
|
||||
add_library(hid.lib STATIC IMPORTED)
|
||||
set_target_properties(setupapi.lib PROPERTIES
|
||||
IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib)
|
||||
set_target_properties(hid.lib PROPERTIES
|
||||
IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib)
|
||||
# This doesn't work for me with VS 11, which apparently finds its own
|
||||
# copy of the libs
|
||||
if(MSVC90 OR MSVC10)
|
||||
set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS
|
||||
"${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib")
|
||||
else()
|
||||
set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS "setupapi.lib hid.lib")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user