From 5ea165cb367cd03bbfc9759fd0c63302f5682ca8 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:14:23 -0700 Subject: [PATCH 1/7] Convert Steamshim Makefile to CMake --- .gitignore | 2 ++ cleanup.sh | 2 +- make-oneshot-linux.sh | 7 +++-- make-oneshot-mac.command | 9 ++++-- steamshim_parent/CMakeLists.txt | 34 +++++++++++++++++++++ steamshim_parent/{Makefile => old.Makefile} | 0 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 steamshim_parent/CMakeLists.txt rename steamshim_parent/{Makefile => old.Makefile} (100%) diff --git a/.gitignore b/.gitignore index dd50cdb..d85ad8a 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ conan_imports_manifest\.txt package/ oclint/ + +steamshim_parent/build/ diff --git a/cleanup.sh b/cleanup.sh index 162189c..ff743e3 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -1,7 +1,7 @@ #!/bin/sh rm -rf journal/mac/__pycache__ -rm -rf steamshim_parent/steamshim +rm -rf steamshim_parent/build rm -rf build rm -rf dist rm -rf _______.app diff --git a/make-oneshot-linux.sh b/make-oneshot-linux.sh index a6e8ce7..d4adede 100755 --- a/make-oneshot-linux.sh +++ b/make-oneshot-linux.sh @@ -7,6 +7,7 @@ cd `dirname $0` linux_version="0.1.0" make_threads=8 ONESHOT_PATH=$HOME/.steam/steam/steamapps/common/OneShot +STEAMWORKS_PATH=/usr/steamworks # Colors white="\033[0;37m" # White - Regular @@ -24,8 +25,10 @@ echo "-> ${cyan}Compile engine...${color_reset}" make -j${make_threads} echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent -HOST=linux64 make -j${make_threads} -cd .. +mkdir build && cd build +cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. +make -j${make_threads} +cd ../.. echo "-> ${cyan}Compile journal...${color_reset}" pyinstaller journal/unix/journal.spec --onefile --windowed diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index d98d1fc..9eecc45 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -7,6 +7,7 @@ cd `dirname $0` mac_version="1.1.0" make_threads=8 ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot +STEAMWORKS_PATH=$HOME/Developer/downloaded/steamworks # Colors white="\033[0;37m" # White - Regular @@ -28,8 +29,10 @@ if [[ $use_qmake == True ]] make -j${make_threads} echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent - HOST=osx make -j${make_threads} - cd .. + mkdir build && cd build + cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. + make -j${make_threads} + cd ../.. else echo "${bold}WARNING: Conan/CMake method not ready yet.${color_reset}" fi @@ -54,7 +57,7 @@ if [ ! -e $ResourcesDir ] mkdir -p "$ResourcesDir" fi -cp steamshim_parent/steamshim ./OneShot.app/Contents/Resources/steamshim +cp steamshim_parent/build/steamshim ./OneShot.app/Contents/Resources/steamshim cp patches/mac/libsteam_api.dylib ./OneShot.app/Contents/Libraries/libsteam_api.dylib cmake -P patches/mac/CompleteBundle.cmake cp assets/icon.icns ./OneShot.app/Contents/Resources/icon.icns diff --git a/steamshim_parent/CMakeLists.txt b/steamshim_parent/CMakeLists.txt new file mode 100644 index 0000000..cbc3a4e --- /dev/null +++ b/steamshim_parent/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8.11) + +set(STEAMWORKS_PATH "" CACHE PATH "Path to Steamworks folder") +set(GAME_LAUNCH_NAME "oneshot" CACHE STRING "Game launch name") +option(DEBUG "Debug mode" OFF) + +set(SOURCES + steamshim_parent.cpp +) + +include_directories(${STEAMWORKS_PATH}/public) + +add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + +IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) +ENDIF() + +IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) +ELSEIF(WIN32) + list(APPEND SOURCES resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") +ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +ENDIF() + +add_executable(steamshim + ${SOURCES} +) + +target_link_libraries(steamshim steam_api) diff --git a/steamshim_parent/Makefile b/steamshim_parent/old.Makefile similarity index 100% rename from steamshim_parent/Makefile rename to steamshim_parent/old.Makefile From 734f6349952bb2488cdfb77a015d3217b0e56a7e Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:18:33 -0700 Subject: [PATCH 2/7] Update macOS deployment target --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 018b32f..59a31db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # SET(LINUX ON) # ENDIF() -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12) # IF(LINUX) # if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT(FORCE32) ) From 31dcb7f904edd35d51b6ec36b4d8e72581a6e674 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:27:26 -0700 Subject: [PATCH 3/7] Add bundle fixup --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59a31db..7ca1ed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,3 +303,7 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32 target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES}) target_include_directories(${PROJECT_NAME} PRIVATE src) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBRARIES}) + +IF(APPLE) + add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) +ENDIF() From a13dead8cfb1e3ddfb42402cd33a8c33230e9e8a Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:27:34 -0700 Subject: [PATCH 4/7] Add macOS desktop code --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ca1ed9..b86ae53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,9 @@ if(WIN32) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/windows ) +elseif(APPLE) + list(APPEND MAIN_HEADERS src/mac-desktop.h) + list(APPEND MAIN_SOURCE src/mac-desktop.mm) endif() if (STEAM) From 03326cb96d26ebcb5335d8a90016d482652ff91a Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:38:46 -0700 Subject: [PATCH 5/7] Cleanup XXD files --- cleanup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cleanup.sh b/cleanup.sh index ff743e3..7b8b122 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -13,6 +13,7 @@ rm -rf cmake_install.cmake rm -rf CMakeCache.txt rm -rf conanbuildinfo.txt rm -rf conaninfo.txt +rm -rf *.xxd if [ -f .qmake.stash ] then make distclean From e599cc1c541b6a18448dfdf3c6ca58f272e82c78 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:17:03 -0700 Subject: [PATCH 6/7] Merge Steamshim CMake into master CMake --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b86ae53..3f4319e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ conan_basic_setup() ## Setup options ## option(STEAM "Build for Steam" ON) +set(STEAMWORKS_PATH "${CMAKE_BINARY_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") +option(DEBUG "Debug mode" OFF) ## Misc setup ## @@ -310,3 +312,34 @@ target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBRARIES}) IF(APPLE) add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) ENDIF() + +# Steamshim + +set(STEAMSHIM_SOURCES + steamshim_parent/steamshim_parent.cpp +) + +include_directories(${STEAMWORKS_PATH}/public) + +add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + +IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) +ENDIF() + +IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) +ELSEIF(WIN32) + list(APPEND STEAMSHIM_SOURCES resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") +ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +ENDIF() + +add_executable(steamshim + ${STEAMSHIM_SOURCES} +) + +target_link_libraries(steamshim steam_api) From 8f473733e66bf954dd52079d342902ae5a4015b1 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:18:27 -0700 Subject: [PATCH 7/7] Ignore Steamworks folder --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d85ad8a..9db0bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,5 @@ package/ oclint/ steamshim_parent/build/ + +steamworks/