2010-06-22 13:30:36 +00:00
|
|
|
# Check that people use the good file
|
|
|
|
if(NOT TOP_CMAKE_WAS_SOURCED)
|
|
|
|
message(FATAL_ERROR "
|
|
|
|
You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir.
|
|
|
|
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
|
2014-12-14 13:00:20 +00:00
|
|
|
endif()
|
2010-06-22 13:30:36 +00:00
|
|
|
|
2015-10-17 16:57:28 +00:00
|
|
|
set(compiled_images "${CMAKE_BINARY_DIR}/plugins/onepad/ImgHeader")
|
|
|
|
set(image_sources "${CMAKE_SOURCE_DIR}/plugins/onepad/Img")
|
|
|
|
set(linux_sources "Linux")
|
|
|
|
set(linux_headers "Linux")
|
|
|
|
|
|
|
|
|
|
|
|
set(onepadGuiResources
|
|
|
|
${compiled_images}/analog.h
|
|
|
|
${compiled_images}/circle.h
|
|
|
|
${compiled_images}/cross.h
|
|
|
|
${compiled_images}/dp_bottom.h
|
|
|
|
${compiled_images}/dp_left.h
|
|
|
|
${compiled_images}/dp_right.h
|
|
|
|
${compiled_images}/dp_up.h
|
|
|
|
${compiled_images}/dualshock2.h
|
|
|
|
${compiled_images}/joystick_cursor.h
|
|
|
|
${compiled_images}/l1.h
|
|
|
|
${compiled_images}/r1.h
|
|
|
|
${compiled_images}/l2.h
|
|
|
|
${compiled_images}/r2.h
|
|
|
|
${compiled_images}/l3.h
|
|
|
|
${compiled_images}/r3.h
|
|
|
|
${compiled_images}/select.h
|
|
|
|
${compiled_images}/square.h
|
|
|
|
${compiled_images}/start.h
|
|
|
|
${compiled_images}/triangle.h
|
2015-10-27 19:07:41 +00:00
|
|
|
${compiled_images}/arrow_up.h
|
|
|
|
${compiled_images}/arrow_bottom.h
|
|
|
|
${compiled_images}/arrow_left.h
|
|
|
|
${compiled_images}/arrow_right.h
|
2015-10-17 16:57:28 +00:00
|
|
|
)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# plugin name
|
2015-10-17 16:57:28 +00:00
|
|
|
set(Output onepad-1.2.0)
|
2015-08-08 13:25:17 +00:00
|
|
|
set(onepadFinalFlags "")
|
2010-01-22 04:36:49 +00:00
|
|
|
|
2010-01-21 15:12:50 +00:00
|
|
|
# onepad sources
|
|
|
|
set(onepadSources
|
|
|
|
controller.cpp
|
2015-10-14 13:05:02 +00:00
|
|
|
GamePad.cpp
|
|
|
|
SDL/joystick.cpp
|
2010-01-21 15:12:50 +00:00
|
|
|
keyboard.cpp
|
2015-10-14 13:05:02 +00:00
|
|
|
KeyStatus.cpp
|
2010-01-21 15:12:50 +00:00
|
|
|
onepad.cpp)
|
2010-06-03 15:12:29 +00:00
|
|
|
|
2010-01-21 15:12:50 +00:00
|
|
|
# onepad headers
|
|
|
|
set(onepadHeaders
|
|
|
|
bitwise.h
|
|
|
|
controller.h
|
2015-10-14 13:05:02 +00:00
|
|
|
GamePad.h
|
|
|
|
SDL/joystick.h
|
2010-01-21 15:12:50 +00:00
|
|
|
keyboard.h
|
2015-10-14 13:05:02 +00:00
|
|
|
KeyStatus.h
|
2010-01-21 15:12:50 +00:00
|
|
|
onepad.h)
|
|
|
|
|
|
|
|
# onepad Linux sources
|
|
|
|
set(onepadLinuxSources
|
2015-10-17 16:57:28 +00:00
|
|
|
${linux_sources}/ini.cpp
|
|
|
|
${linux_sources}/dialog.cpp
|
|
|
|
${linux_sources}/linux.cpp
|
2015-11-29 14:42:42 +00:00
|
|
|
${linux_sources}/opPanel.cpp
|
|
|
|
${linux_sources}/GamepadConfiguration.cpp
|
|
|
|
${linux_headers}/JoystickConfiguration.cpp)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# onepad Linux headers
|
|
|
|
set(onepadLinuxHeaders
|
2015-10-17 16:57:28 +00:00
|
|
|
${linux_headers}/linux.h
|
2015-11-29 14:42:42 +00:00
|
|
|
${linux_headers}/opPanel.h
|
|
|
|
${linux_headers}/GamepadConfiguration.h
|
|
|
|
${linux_headers}/JoystickConfiguration.h)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# onepad Windows sources
|
|
|
|
set(onepadWindowsSources
|
|
|
|
)
|
|
|
|
|
|
|
|
# onepad Windows headers
|
|
|
|
set(onepadWindowsHeaders
|
|
|
|
)
|
|
|
|
|
2013-11-01 21:05:59 +00:00
|
|
|
if (SDL2_API)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalLibs
|
2014-12-07 11:19:14 +00:00
|
|
|
${SDL2_LIBRARIES}
|
2014-08-04 16:42:40 +00:00
|
|
|
)
|
2015-10-14 13:05:02 +00:00
|
|
|
add_definitions(-DSDL_BUILD)
|
2013-11-01 21:05:59 +00:00
|
|
|
else()
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalLibs
|
|
|
|
${SDL_LIBRARY}
|
|
|
|
)
|
2015-10-14 13:05:02 +00:00
|
|
|
add_definitions(-DSDL_BUILD)
|
2013-11-01 21:05:59 +00:00
|
|
|
endif()
|
2010-07-25 14:20:03 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalLibs
|
|
|
|
${onepadFinalLibs}
|
|
|
|
${GTK2_LIBRARIES}
|
|
|
|
${X11_LIBRARIES}
|
|
|
|
)
|
2012-04-16 15:36:16 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalSources
|
|
|
|
${onepadSources}
|
|
|
|
${onepadHeaders}
|
|
|
|
${onepadLinuxSources}
|
|
|
|
${onepadLinuxHeaders}
|
2015-11-29 14:42:42 +00:00
|
|
|
${onepadGuiResources}
|
2015-10-17 16:57:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${CMAKE_BINARY_DIR}/plugins/onepad/
|
2014-08-04 16:42:40 +00:00
|
|
|
)
|
2011-07-14 09:02:37 +00:00
|
|
|
|
2015-10-17 16:57:28 +00:00
|
|
|
### Generate the resources files
|
|
|
|
file(MAKE_DIRECTORY ${compiled_images})
|
|
|
|
|
|
|
|
foreach(result_file IN ITEMS
|
|
|
|
analog circle cross dp_bottom dp_left dp_right dp_up dualshock2
|
2015-10-27 19:07:41 +00:00
|
|
|
joystick_cursor l1 r1 l2 r2 l3 r3 select square start triangle arrow_up
|
|
|
|
arrow_bottom arrow_left arrow_right)
|
2015-10-17 16:57:28 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${compiled_images}/${result_file}.h"
|
|
|
|
COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${image_sources}/${result_file}.png" "${compiled_images}/${result_file}" )
|
|
|
|
endforeach()
|
|
|
|
|
2016-03-30 08:19:54 +00:00
|
|
|
if(BUILTIN_PAD)
|
|
|
|
add_pcsx2_lib(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
|
|
|
|
else()
|
|
|
|
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
|
|
|
|
endif()
|