Skip to content
Mercury233 edited this page Apr 3, 2022 · 1 revision

Build (CMake)

Windows(MSVC)

get source code

git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
git submodule update --init --recursive

download source code of dependences:

Libevent: https://github.com/libevent/libevent/archive/release-2.1.11-stable.zip  
Freetype: https://www.freetype.org/download.html  
Sqlite: https://www.sqlite.org/download.html  
Irrlicht: http://irrlicht.sourceforge.net/?page_id=10  
Lua: http://www.lua.org/ftp/lua-5.3.5.tar.gz

extract them to the ygopro folder, changes the name of source code folders to event freetype irrlicht sqlite3 lua
the file structure should as follows

ygopro
  event
    CMakeLists.txt
    ...
  freetype
    CMakeLists.txt
    ...
  irrlicht
    ...
  sqlite3
    sqlite3.h
    ...
  lua
    ...
  CMakeLists.txt
  ...

Libevent and Freetype are already cmake projects, we need add CMakeLists.txt to sqlite3, lua and irrlicht:

project (sqlite3)

set (SRC_FILES sqlite3.h sqlite3.c)
source_group(src FILES ${SRC_FILES})

add_library (sqlite3 STATIC ${SRC_FILES})
project (lua)

set (AUTO_FILES_RESULT)
AutoFiles("." "src" "\\.(cpp|c|h)$" "lua.c|luac.c")

set_source_files_properties(${AUTO_FILES_RESULT} PROPERTIES LANGUAGE CXX)

add_library (lua STATIC ${AUTO_FILES_RESULT})

for irrlicht, you can refer to https://github.com/DailyShana/irrlicht

Then generate project files to build:

# out-of-source build
mkdir build && cd build  

# generate visual studio project
# to target WinXP, add -T "v141_xp"
cmake -G "Visual Studio 15 2017" ..
# or other version of visual studio

# config
cmake -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_DEBUG_MODE=ON -DEVENT__DISABLE_OPENSSL=ON -DEVENT__DISABLE_REGRESS=ON -DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC -DEVENT__MSVC_STATIC_RUNTIME=ON .

# build
cmake --build . --config Release
# or open \build\ygopro.sln to build


# or use cmake GUI(ccmake or cmake-gui) to config and generate project files
# see https://cmake.org/runningcmake/
Linux

install dependencies

# Debian/Ubuntu
sudo apt install libfreetype6-dev libevent-dev libsqlite3-dev libirrlicht-dev liblua5.3-dev libgl1-mesa-dev libglu-dev

# If build dependencies from source, note that the lua library must be built as c++

get source code

git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
git submodule update --init --recursive

Then generate and build

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ..
cmake --build .

Windows with OpenGL support (without DirectX SDK)

I'm using Windows 7 and Visual Sudio 2010 for this setup. Similar procedure can be applied for other versions of windows and visual studio.

  1. Get the following packages from the link given

  2. libevent2

  3. freetype

  4. irrlicht

  5. lua

  6. sqlite3 source and sqlite3 dll.

  7. premake4

  8. Download the ygopro source from here.

  9. Build libevent using visual studio command prompt (from start menu in visual studio sdk).

  10. Extract the libevent-2.0.22-stable.tar.gz compressed file and cd to it from the visual studio command prompt.

  11. Type nmake Makefile.nmake. This will generate a event.lib file.

  12. Copy the include directory to ygopro-master/event. Also copy the files from WIN32-Code to the ygopro-master/event/include directory, maintaining the structure.

  13. Copy the event.lib to ygopro-master/event/lib.

  14. Extract the freetype-2.3.5-1-bin.zip file and copy the include folder to ygopro-master/freetype. Also copy the lib folder to ygopro-master/freetype.

  15. Now we'll build irrlicht.

  16. Extract the irrlicht-1.8.1.zip and open the irrlicht-1.8.1/source/Irrlicht/Irrlicht10.0.sln.

  17. Open IrrCompileConfig.h from the visual studio solution bar. Find the line #define _IRR_COMPILE_WITH_DIRECT3D_9_ and comment it.

  18. Find the line #define _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ and comment it.

  19. Now select Static lib Debug in visual studio and build irrlicht.

  20. Copy the include folder to ygopro-master/irrlicht. Also copy the file lib/Win64-visualStudio/Irrlicht.lib to folder ygopro-master/irrlicht/lib.

  21. Now we'll build lua in visual studio.

  22. Extract the file lua-5.2.0.tar.gz.

  23. Open visual studio and create an empty c++ project at any desired location.

  24. Now in the header folder(in visual studio) right click to add an existing item. Now select all the .hpp and .h files.

  25. Now right click the source folder and select add existing item and select all .c and files. Note: In visual studio you must add /FORCE to the Additional Options section under Project/project properties/Linker/Command line. Note: In visual studio you must Project/Project properties/(C/C++)/Advanced/Disable Specific Warnings to 4996.

  26. Build the project (Debug or Release).

  27. Copy lauxlib.h, lua.h, lua.hpp, luaconf.h and lualib.h to ygopro-master/lua/include. Also copy the lua.lib from the Debug folder (from Lua project we just build) to ygopro-master/lua/lib.

  28. Extract sqlite-amalgamation-3081002.zip and cd to this directory ffrom the visual studio command prompt. Type lib /def:sqlite3.def /out:sqlite3.lib. This will generate a sqlite3.lib file. Copy the .h files to ygopro-master/sqlite3/include and sqlite3.lib to ygopro-master/sqlite3/lib.

  29. Extract premake-stable-windows.zip to ygopro-master/.

  30. Open ygopro-master/premake4.lua and delete the following line.

    if os.is("windows") then
    include "event"
    include "freetype"
    include "irrlicht"
    include "lua"
    include "sqlite3"
    end
    
  31. cd to ygopro-master folder from the command prompt and type premake4 vs2010.

  32. Move the following files and folder from ygopro-master to ygopro/build

    script/
    single/
    textures/
    cards.cdb
    lflist.conf
    strings.conf
    system.conf
    
  33. Open ygopro-master/build/system.conf in any editor and assign use_d3d to 0. (This is important)

  34. Open ygopro-master/ygo.sln in visual studio and add all the include and lib folder to your project.

  35. Create an empty file named ygopro.rc in ygopro-master/gframe folder and build the project.

  36. You will be needing freetype6.dll, sqlite3.dll and zlib1.dll which can be found in the there source package or can be downloaded from the internet.

Fedora 18 x86-64

sudo yum install git gcc gcc-c++ make premake freetype-devel libevent-devel sqlite-devel http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Everything/x86_64/os/Packages/i/irrXML-1.2-11.fc17.x86_64.rpm http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Everything/x86_64/os/Packages/i/irrXML-devel-1.2-11.fc17.x86_64.rpm http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Everything/x86_64/os/Packages/i/irrlicht-1.7.2-11.fc17.x86_64.rpm http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Everything/x86_64/os/Packages/i/irrlicht-devel-1.7.2-11.fc17.x86_64.rpm

git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
premake4 gmake
cd build

wget http://www.lua.org/ftp/lua-5.2.1.tar.gz
tar vfx lua-5.2.1.tar.gz
cd lua-5.2.1
sudo cp src/* /usr/include/
make linux
sudo make install
cd ..

make

Arch Linux x86-64

sudo pacman -S gcc make premake freetype2 libevent sqlite irrlicht lua git
git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
premake4 gmake
make -Cbuild

Ubuntu 17.10

sudo apt-get install build-essential git libirrlicht-dev libfreetype6-dev libglu1-mesa-dev libevent-dev liblua5.2-dev libsqlite3-dev premake4
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/lib/x86_64-linux-gnu/liblua.so
git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
git submodule update --init --recursive
premake4 gmake
make -Cbuild

game is in bin/debug

you might need to init git submodules ocgcore and script before you start compiling

cd ygopro
git submodule update --init --recursive
premake4 gmake

maybe you will get the warning Permission Denied please edit the .git/config

[submodule "ocgcore"]
	active = true
	url = https://github.com/Fluorohydride/ygopro-core.git
[submodule "script"]
	active = true
	url = https://github.com/Fluorohydride/ygopro-scripts.git

if you get this error attempt to call global 'startproject' (a nil value)

please edit the file ygopro/premake4.lua to delete this line: startproject "ygopro"

reference :Startup projects are currently only supported by Visual Studio.

you need to modified the system.conf

textfont = /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc 14
numfont = /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc

finished!