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")
|
2018-10-13 05:29:38 +00:00
|
|
|
set(wx_sources "wx_dialog")
|
|
|
|
set(wx_headers "wx_dialog")
|
2015-10-17 16:57:28 +00:00
|
|
|
|
|
|
|
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
|
2017-04-15 12:57:00 +00:00
|
|
|
set(Output onepad)
|
2010-01-22 04:36:49 +00:00
|
|
|
|
2018-10-13 18:05:27 +00:00
|
|
|
set(onepadFinalFlags
|
|
|
|
-fvisibility=hidden
|
|
|
|
-Wall
|
|
|
|
-Wno-parentheses
|
|
|
|
)
|
|
|
|
|
2010-01-21 15:12:50 +00:00
|
|
|
# onepad sources
|
|
|
|
set(onepadSources
|
2017-04-16 11:39:53 +00:00
|
|
|
controller.cpp
|
|
|
|
GamePad.cpp
|
|
|
|
SDL/joystick.cpp
|
|
|
|
keyboard.cpp
|
|
|
|
KeyStatus.cpp
|
|
|
|
onepad.cpp
|
2017-04-16 11:41:16 +00:00
|
|
|
resources.cpp
|
2017-04-16 11:39:53 +00:00
|
|
|
state_management.cpp)
|
2010-06-03 15:12:29 +00:00
|
|
|
|
2010-01-21 15:12:50 +00:00
|
|
|
# onepad headers
|
|
|
|
set(onepadHeaders
|
2017-04-16 11:39:53 +00:00
|
|
|
bitwise.h
|
|
|
|
controller.h
|
|
|
|
GamePad.h
|
|
|
|
SDL/joystick.h
|
|
|
|
keyboard.h
|
|
|
|
KeyStatus.h
|
|
|
|
onepad.h
|
2017-04-16 11:41:16 +00:00
|
|
|
resources.h
|
2017-04-16 11:39:53 +00:00
|
|
|
state_management.h)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
2018-10-13 05:29:38 +00:00
|
|
|
# onepad wx sources
|
|
|
|
set(onepadwxSources
|
|
|
|
${wx_sources}/dialog.cpp
|
|
|
|
${wx_sources}/opPanel.cpp
|
|
|
|
${wx_sources}/GamepadConfiguration.cpp
|
|
|
|
${wx_headers}/JoystickConfiguration.cpp)
|
|
|
|
|
|
|
|
# onepad wx headers
|
|
|
|
set(onepadwxHeaders
|
|
|
|
${wx_headers}/opPanel.h
|
|
|
|
${wx_headers}/GamepadConfiguration.h
|
|
|
|
${wx_headers}/JoystickConfiguration.h)
|
|
|
|
|
2010-01-21 15:12:50 +00:00
|
|
|
# onepad Linux sources
|
|
|
|
set(onepadLinuxSources
|
2017-04-16 11:39:53 +00:00
|
|
|
${linux_sources}/ini.cpp
|
2018-10-13 05:29:38 +00:00
|
|
|
${linux_sources}/linux.cpp)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# onepad Linux headers
|
2018-10-13 05:29:38 +00:00
|
|
|
set(onepadLinuxHeaders)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# onepad Windows sources
|
2017-04-16 11:39:53 +00:00
|
|
|
set(onepadWindowsSources)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
|
|
|
# onepad Windows headers
|
2017-04-16 11:39:53 +00:00
|
|
|
set(onepadWindowsHeaders)
|
2010-01-21 15:12:50 +00:00
|
|
|
|
2017-04-15 12:57:00 +00:00
|
|
|
set(onepadFinalLibs ${SDL2_LIBRARIES})
|
|
|
|
add_definitions(-DSDL_BUILD)
|
2010-07-25 14:20:03 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalLibs
|
2017-04-16 11:39:53 +00:00
|
|
|
${onepadFinalLibs}
|
|
|
|
${wxWidgets_LIBRARIES}
|
|
|
|
${GTK2_LIBRARIES}
|
|
|
|
${X11_LIBRARIES}
|
2014-08-04 16:42:40 +00:00
|
|
|
)
|
2012-04-16 15:36:16 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(onepadFinalSources
|
2017-04-16 11:39:53 +00:00
|
|
|
${onepadSources}
|
|
|
|
${onepadHeaders}
|
2018-10-13 05:29:38 +00:00
|
|
|
${onepadwxSources}
|
|
|
|
${onepadwxHeaders}
|
2017-04-16 11:39:53 +00:00
|
|
|
${onepadLinuxSources}
|
|
|
|
${onepadLinuxHeaders}
|
|
|
|
${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()
|
|
|
|
|
2017-04-16 11:41:16 +00:00
|
|
|
set(RESOURCE_FILES res/game_controller_db.txt)
|
|
|
|
|
|
|
|
add_custom_glib_res("resources" "onepad-res.xml" "onepad_res" ${RESOURCE_FILES})
|
|
|
|
|
|
|
|
|
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()
|
2020-09-29 14:30:03 +00:00
|
|
|
|
|
|
|
target_compile_features(${Output} PRIVATE cxx_std_17)
|