# # Singe 2 # Copyright (C) 2006-2024 Scott Duensing # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public Licens # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # cmake_minimum_required(VERSION 3.22) set(CMAKE_CXX_STANDARD 17) project(singe2) if(NOT DEFINED KANGAROO_OS) set(KANGAROO_OS linux) endif() if(NOT DEFINED KANGAROO_ARCH) set(KANGAROO_ARCH x86_64) endif() set(BUILD_DIR ${CMAKE_SOURCE_DIR}/.builddir/${KANGAROO_OS}/${KANGAROO_ARCH}) set(SINGE_SOURCE src/main.h src/singe.c src/singe.h src/util.h src/embedded.h src/frameFile.h src/main.c src/common.h src/videoPlayer.c src/stddclmr.h src/frameFile.c src/videoPlayer.h src/util.c src/embedded.c ) set(ARG_PARSER_SOURCE thirdparty/arg_parser/carg_parser.c thirdparty/arg_parser/carg_parser.h ) set(JBIG_SOURCE thirdparty/jbigkit/libjbig/jbig.c thirdparty/jbigkit/libjbig/jbig.h thirdparty/jbigkit/libjbig/jbig_ar.c thirdparty/jbigkit/libjbig/jbig_ar.h ) set(LUA_SOURCE thirdparty/lua/src/lmem.h thirdparty/lua/src/ltm.h thirdparty/lua/src/lutf8lib.c thirdparty/lua/src/ldo.h thirdparty/lua/src/ldump.c thirdparty/lua/src/lstring.h thirdparty/lua/src/lparser.h thirdparty/lua/src/lcorolib.c thirdparty/lua/src/loslib.c thirdparty/lua/src/lparser.c thirdparty/lua/src/ltablib.c thirdparty/lua/src/ltable.c thirdparty/lua/src/ljumptab.h thirdparty/lua/src/luaconf.h thirdparty/lua/src/lstate.c thirdparty/lua/src/lobject.h thirdparty/lua/src/lstate.h thirdparty/lua/src/ldo.c thirdparty/lua/src/lfunc.c thirdparty/lua/src/lmathlib.c thirdparty/lua/src/lua.h thirdparty/lua/src/lauxlib.h thirdparty/lua/src/ltm.c thirdparty/lua/src/lstrlib.c thirdparty/lua/src/lapi.h thirdparty/lua/src/lopcodes.c thirdparty/lua/src/lvm.h thirdparty/lua/src/linit.c thirdparty/lua/src/lobject.c thirdparty/lua/src/ldebug.c thirdparty/lua/src/lctype.c thirdparty/lua/src/lgc.c thirdparty/lua/src/lzio.h thirdparty/lua/src/lgc.h thirdparty/lua/src/lctype.h thirdparty/lua/src/lopcodes.h thirdparty/lua/src/llimits.h thirdparty/lua/src/lprefix.h thirdparty/lua/src/llex.h thirdparty/lua/src/lundump.c thirdparty/lua/src/lbaselib.c thirdparty/lua/src/loadlib.c thirdparty/lua/src/ldblib.c thirdparty/lua/src/ldebug.h thirdparty/lua/src/lundump.h thirdparty/lua/src/lopnames.h thirdparty/lua/src/ltable.h thirdparty/lua/src/lmem.c thirdparty/lua/src/lcode.h thirdparty/lua/src/lua.hpp thirdparty/lua/src/lauxlib.c thirdparty/lua/src/liolib.c thirdparty/lua/src/lapi.c thirdparty/lua/src/lcode.c thirdparty/lua/src/llex.c thirdparty/lua/src/lstring.c thirdparty/lua/src/lvm.c thirdparty/lua/src/lualib.h thirdparty/lua/src/lfunc.h thirdparty/lua/src/lzio.c ) set(LUA_FILESYSTEM_SOURCE thirdparty/luafilesystem/src/lfs.c thirdparty/luafilesystem/src/lfs.h ) set(LUA_SOCKET_SOURCE thirdparty/luasocket/src/luasocket.h thirdparty/luasocket/src/luasocket.c thirdparty/luasocket/src/timeout.h thirdparty/luasocket/src/timeout.c thirdparty/luasocket/src/buffer.h thirdparty/luasocket/src/buffer.c thirdparty/luasocket/src/io.h thirdparty/luasocket/src/io.c thirdparty/luasocket/src/auxiliar.h thirdparty/luasocket/src/auxiliar.c thirdparty/luasocket/src/compat.h thirdparty/luasocket/src/compat.c thirdparty/luasocket/src/options.h thirdparty/luasocket/src/options.c thirdparty/luasocket/src/inet.h thirdparty/luasocket/src/inet.c thirdparty/luasocket/src/except.h thirdparty/luasocket/src/except.c thirdparty/luasocket/src/select.h thirdparty/luasocket/src/select.c thirdparty/luasocket/src/tcp.h thirdparty/luasocket/src/tcp.c thirdparty/luasocket/src/udp.h thirdparty/luasocket/src/udp.c thirdparty/luasocket/src/mime.h thirdparty/luasocket/src/mime.c thirdparty/luasocket/src/socket.h thirdparty/luasocket/src/pierror.h ) if(WIN32) set(LUA_SOCKET_SOURCE ${LUA_SOCKET_SOURCE} thirdparty/luasocket/src/wsocket.h thirdparty/luasocket/src/wsocket.c ) ELSE() set(LUA_SOCKET_SOURCE ${LUA_SOCKET_SOURCE} thirdparty/luasocket/src/usocket.h thirdparty/luasocket/src/usocket.c thirdparty/luasocket/src/unix.h thirdparty/luasocket/src/unix.c thirdparty/luasocket/src/unixstream.h thirdparty/luasocket/src/unixstream.c thirdparty/luasocket/src/unixdgram.c thirdparty/luasocket/src/unixdgram.h thirdparty/luasocket/src/serial.c ) ENDIF() set(LUASEC_SOURCE thirdparty/luasec/src/compat.h thirdparty/luasec/src/config.c ${BUILD_DIR}/generated/luasec_options.c thirdparty/luasec/src/context.c thirdparty/luasec/src/context.h thirdparty/luasec/src/ec.c thirdparty/luasec/src/ec.h thirdparty/luasec/src/options.h thirdparty/luasec/src/ssl.c thirdparty/luasec/src/ssl.h thirdparty/luasec/src/x509.c thirdparty/luasec/src/x509.h ) set(LUA_RS232_SOURCE thirdparty/librs232/bindings/lua/luars232.c thirdparty/librs232/src/rs232.c ) if(WIN32) set(LUA_RS232_SOURCE ${LUA_RS232_SOURCE} thirdparty/librs232/src/rs232_windows.c ) ELSE() set(LUA_RS232_SOURCE ${LUA_RS232_SOURCE} thirdparty/librs232/src/rs232_posix.c ) ENDIF() set(UTHASH_SOURCE thirdparty/uthash/src/uthash.h thirdparty/uthash/src/utlist.h ) set(MANYMOUSE_SOURCE thirdparty/manymouse/linux_evdev.c thirdparty/manymouse/macosx_hidmanager.c thirdparty/manymouse/macosx_hidutilities.c thirdparty/manymouse/manymouse.c thirdparty/manymouse/manymouse.h thirdparty/manymouse/windows_wminput.c thirdparty/manymouse/x11_xinput2.c ) add_executable(${CMAKE_PROJECT_NAME} ${SINGE_SOURCE} ${ARG_PARSER_SOURCE} ${JBIG_SOURCE} ${LUA_SOURCE} ${LUA_FILESYSTEM_SOURCE} ${LUA_SOCKET_SOURCE} ${LUASEC_SOURCE} ${LUA_RS232_SOURCE} ${UTHASH_SOURCE} ${MANYMOUSE_SOURCE} ) # Perform pre-build operations. #add_custom_target(BUILD_PREREQS # COMMAND ${BUILD_DIR}-deps.sh "${CMAKE_SOURCE_DIR}" # BYPRODUCTS # ${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libarchive.a #) #add_dependencies(${CMAKE_PROJECT_NAME} BUILD_PREREQS) if(WIN32) # Note: _WIN32_WINNT=0x0600 sets the minimum compatible version of # Windows to Vista. The function inet_pton() does not exist before then. set(DEFINE_LIST -Dmain=SDL_main -D_WIN32_WINNT=0x0600 ) else() set(DEFINE_LIST) endif() target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC ${DEFINE_LIST} -DRS232_STATIC -DFFMS_STATIC -Wno-deprecated-declarations ) target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${BUILD_DIR} ${BUILD_DIR}/include thirdparty/lua/src thirdparty/luasec/src thirdparty/librs232/include ) target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC ${BUILD_DIR}/lib ) if(${KANGAROO_OS} STREQUAL "linux") set(LIB_LIST -lX11 -lvdpau ) endif() if(${KANGAROO_OS} STREQUAL "macos") set(LIB_LIST -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,IOKit -Wl,-framework,ForceFeedback -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AVFoundation -Wl,-framework,Foundation -Wl,-weak_framework,GameController -Wl,-weak_framework,Metal -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,CoreHaptics -liconv ) endif() if(${KANGAROO_OS} STREQUAL "windows") set(LIB_LIST -mwindows -static -lmingw32 -latomic -lole32 -luser32 -lkernel32 -lgdi32 -lwinmm -limm32 -loleaut32 -lversion -luuid -ladvapi32 -lsetupapi -lshell32 -ldinput8 -lws2_32 -lbcrypt -lssp ) endif() set(LIB_LIST ${LIB_LIST} ${BUILD_DIR}/lib/libavcodec.a ${BUILD_DIR}/lib/libavdevice.a ${BUILD_DIR}/lib/libavfilter.a ${BUILD_DIR}/lib/libavformat.a # ${BUILD_DIR}/lib/libavif.a ${BUILD_DIR}/lib/libavutil.a # ${BUILD_DIR}/lib/libbrotlicommon-static.a # ${BUILD_DIR}/lib/libbrotlidec-static.a ${BUILD_DIR}/lib/libbz2_static.a # ${BUILD_DIR}/lib/libdav1d.a ${BUILD_DIR}/lib/libffms2.a ${BUILD_DIR}/lib/libfreetype.a # ${BUILD_DIR}/lib/libharfbuzz.a # ${BUILD_DIR}/lib/libhwy.a # ${BUILD_DIR}/lib/libjxl_dec.a ${BUILD_DIR}/lib/liblzma.a ${BUILD_DIR}/lib/libogg.a ${BUILD_DIR}/lib/libopus.a ${BUILD_DIR}/lib/libopusfile.a ${BUILD_DIR}/lib/libpostproc.a ${BUILD_DIR}/lib/libSDL2.a ${BUILD_DIR}/lib/libSDL2_image.a ${BUILD_DIR}/lib/libSDL2main.a ${BUILD_DIR}/lib/libSDL2_mixer.a ${BUILD_DIR}/lib/libSDL2_test.a ${BUILD_DIR}/lib/libSDL2_ttf.a ${BUILD_DIR}/lib/libswresample.a ${BUILD_DIR}/lib/libswscale.a # ${BUILD_DIR}/lib/libtiff.a ${BUILD_DIR}/lib/libwavpack.a ${BUILD_DIR}/lib/libwebp.a ${BUILD_DIR}/lib/libwebpdemux.a ${BUILD_DIR}/lib/libxmp.a ${BUILD_DIR}/lib/libz.a ${BUILD_DIR}/lib/libzstd.a ${BUILD_DIR}/lib/libarchive.a ${BUILD_DIR}/lib/libcrypto.a ${BUILD_DIR}/lib/libssl.a ) target_link_libraries(${CMAKE_PROJECT_NAME} -Wl,--start-group ${LIB_LIST} -Wl,--end-group -pthread -lm -lstdc++ ) install(TARGETS ${CMAKE_PROJECT_NAME})