diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 478e10e20e..b1977ca4f5 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -19,6 +19,13 @@ option(DISABLE_BUILD_DATE "Disable including the binary compile date") option(ENABLE_TESTS "Enables building the unit tests" ON) option(USE_SYSTEM_YAML "Uses a system version of yaml, if found") +if(WIN32) + set(DEFAULT_NATIVE_TOOLS ON) +else() + set(DEFAULT_NATIVE_TOOLS OFF) +endif() +option(USE_NATIVE_TOOLS "Uses c++ tools instead of ones written in scripting languages. OFF requires perl, ON may fail if cross compiling" ${DEFAULT_NATIVE_TOOLS}) + if(DISABLE_BUILD_DATE OR openSUSE) message(STATUS "Disabling the inclusion of the binary compile date.") list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 2cffa28a8f..3d88bfa2b1 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -224,3 +224,10 @@ if(NOT USE_SYSTEM_YAML) endif() add_subdirectory(3rdparty/libchdr/libchdr EXCLUDE_FROM_ALL) + +if(USE_NATIVE_TOOLS) + add_subdirectory(tools/bin2cpp EXCLUDE_FROM_ALL) + set(BIN2CPP bin2cpp) +else() + set(BIN2CPP perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl) +endif() diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 6edb84c60d..6df94739a5 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -499,7 +499,7 @@ foreach(result_file IN ITEMS arrow_bottom arrow_left arrow_right) add_custom_command( OUTPUT "${PADImgHeader}/${result_file}.h" - COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" ) + COMMAND ${BIN2CPP} "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" ) endforeach() add_custom_command( @@ -1268,7 +1268,7 @@ foreach(res_file IN ITEMS AppIcon16 AppIcon32 AppIcon64 BackgroundLogo Logo NoIcon ButtonIcon_Camera ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard ConfigIcon_Paths ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive) - add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" ) + add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND ${BIN2CPP} "${res_src}/${res_file}.png" "${res_bin}/${res_file}" ) endforeach() ### Generate Recording resource files @@ -1276,7 +1276,7 @@ endforeach() foreach(res_file IN ITEMS circlePressed controllerFull controllerHalf controllerThreeQuarters crossPressed downPressed l1Pressed l2Pressed l3Pressed leftPressed r1Pressed r2Pressed r3Pressed rightPressed selectPressed squarePressed startPressed trianglePressed upPressed) - add_custom_command(OUTPUT "${res_rec_vp_src}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_rec_vp_src}/${res_file}.png" "${res_rec_vp_src}/${res_file}" ) + add_custom_command(OUTPUT "${res_rec_vp_src}/${res_file}.h" COMMAND ${BIN2CPP} "${res_rec_vp_src}/${res_file}.png" "${res_rec_vp_src}/${res_file}" ) endforeach() if(USE_VTUNE) diff --git a/tools/bin2cpp/CMakeLists.txt b/tools/bin2cpp/CMakeLists.txt index 1e3e45cf5a..069a9f2ecc 100644 --- a/tools/bin2cpp/CMakeLists.txt +++ b/tools/bin2cpp/CMakeLists.txt @@ -1,47 +1,6 @@ # bin2cpp tool -# executable name -set(bin2cppName bin2cpp) - -# Debug - Build -if(CMAKE_BUILD_TYPE STREQUAL Debug) - # add defines - set(bin2cppFinalFlags - -s -Wall -fexceptions - ) -endif(CMAKE_BUILD_TYPE STREQUAL Debug) - -# Devel - Build -if(CMAKE_BUILD_TYPE STREQUAL Devel) - # add defines - set(bin2cppFinalFlags - -s -Wall -fexceptions - ) -endif(CMAKE_BUILD_TYPE STREQUAL Devel) - -# Release - Build -if(CMAKE_BUILD_TYPE STREQUAL Release) - # add defines - set(bin2cppFinalFlags - -s -Wall -fexceptions - ) -endif(CMAKE_BUILD_TYPE STREQUAL Release) - -# variable with all sources of this executable -set(bin2cppSources - bin2cpp.cpp) - -set(bin2cppHeaders - ) - -# add executable -set(bin2cppFinalSources - ${bin2cppSources} - ${bin2cppHeaders} -) - -add_pcsx2_executable(${bin2cppName} "${bin2cppFinalSources}" "" "${bin2cppFinalFlags}") +add_executable(bin2cpp bin2cpp.cpp) # set output directory # set_target_properties(${bin2cppName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/tools/bin) -