diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3ced1e5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +# CMake +cmake-build-debug/ +cmake-build-release/ + +# Dockerfile (in order to allow changes without rebuilding) +Dockerfile + +# Test folder +test/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7937829 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:latest as build +WORKDIR /app + +# Update the system and install various dependencies +RUN apt-get update && \ + apt-get install -y git cmake build-essential tar curl zip unzip pkg-config autoconf python3 \ + libdevil-dev libncurses5-dev libbsd-dev + +# Install vcpkg and the required libraries +RUN git clone https://github.com/Microsoft/vcpkg.git +RUN bash ./vcpkg/bootstrap-vcpkg.sh +RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo + +COPY . . + +RUN mkdir build/ +RUN cd build && cmake -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake .. +RUN cd build && make -j $(nproc) + +FROM ubuntu:latest as app +WORKDIR /app + +RUN apt-get update && apt-get install -y libdevil-dev libbsd-dev && apt-get clean + +# Copy the binaries from the build stage +COPY --from=build /app/build/src/db/db /bin/db +COPY --from=build /app/build/src/game/game /bin/game +COPY --from=build /app/build/src/quest/quest /bin/quest + +# Copy the game files +COPY ./gamefiles/ . + +# Symlink the configuration files +RUN ln -s "./conf/CMD" "CMD" +RUN ln -s ./conf/item_names_en.txt item_names.txt +RUN ln -s ./conf/item_proto.txt item_proto.txt +RUN ln -s ./conf/mob_names_en.txt mob_names.txt +RUN ln -s ./conf/mob_proto.txt mob_proto.txt diff --git a/gamefiles/conf/item_names.txt b/gamefiles/conf/item_names_en.txt similarity index 100% rename from gamefiles/conf/item_names.txt rename to gamefiles/conf/item_names_en.txt diff --git a/gamefiles/conf/mob_names.txt b/gamefiles/conf/mob_names_en.txt similarity index 100% rename from gamefiles/conf/mob_names.txt rename to gamefiles/conf/mob_names_en.txt diff --git a/gamefiles/locale/english/quest/.gitignore b/gamefiles/locale/english/quest/.gitignore index 0c52e5f..6e79c63 100644 --- a/gamefiles/locale/english/quest/.gitignore +++ b/gamefiles/locale/english/quest/.gitignore @@ -1,7 +1,10 @@ # Ignore compiled quest folder object/ -# Quest interpreter binaries -quest -quest.core -quest.exe \ No newline at end of file +# Quest compiler binaries +qc +qc.core +qc.exe + +# Compilde Python files +*.pyc diff --git a/gamefiles/locale/english/quest/qc b/gamefiles/locale/english/quest/qc deleted file mode 100644 index bbbd7f8..0000000 Binary files a/gamefiles/locale/english/quest/qc and /dev/null differ diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index c93cb6d..7f420a9 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -12,9 +12,8 @@ include_directories(src) add_executable(${PROJECT_NAME} ${sources}) # Find dependencies -find_package(Boost REQUIRED) -include_directories(${Boost_INCLUDE_DIRS}) -target_link_libraries (${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY}) +find_package(Boost COMPONENTS system REQUIRED) +target_link_libraries (${PROJECT_NAME} PRIVATE Boost::boost Boost::system) # Pthreads set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 4593180..71f7160 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -8,44 +8,42 @@ file(GLOB_RECURSE sources # Add the src directory to the include path include_directories(src) - -# Find dependencies -find_package(libmysql REQUIRED) -find_package(Boost COMPONENTS system REQUIRED) -find_package(DevIL REQUIRED) -find_package(LZO REQUIRED) -find_package(cryptopp CONFIG REQUIRED) - add_executable(${PROJECT_NAME} ${sources}) -# Link dependencies if found -target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES}) +# Find dependencies + +# MySQL +find_package(unofficial-libmysql REQUIRED) +target_link_libraries(${PROJECT_NAME} unofficial::libmysql::libmysql) # Crypto++ -target_link_libraries (${PROJECT_NAME} cryptopp-static) +find_package(cryptopp CONFIG REQUIRED) +target_link_libraries (${PROJECT_NAME} cryptopp::cryptopp) # Boost -include_directories(${Boost_INCLUDE_DIR}) -target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES}) +find_package(Boost REQUIRED) +target_link_libraries (${PROJECT_NAME} Boost::boost) # Libevent find_package(Libevent CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} libevent::core libevent::extra libevent::pthreads) -if (IL_FOUND) - include_directories(${IL_INCLUDE_DIR}) - target_link_libraries (${PROJECT_NAME} ${IL_LIBRARIES}) -endif (IL_FOUND) +# DevIL +find_package(DevIL REQUIRED) +include_directories(${IL_INCLUDE_DIR}) +target_link_libraries(${PROJECT_NAME} ${IL_LIBRARIES}) +# LZO +find_package(LZO REQUIRED) if (LZO_FOUND) include_directories(${LZO_INCLUDE_DIR}) - target_link_libraries (${PROJECT_NAME} ${LZO_LIBRARIES}) + target_link_libraries(${PROJECT_NAME} ${LZO_LIBRARIES}) endif (LZO_FOUND) # Pthreads set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package (Threads REQUIRED) -target_link_libraries (${PROJECT_NAME} Threads::Threads) +find_package(Threads REQUIRED) +target_link_libraries(${PROJECT_NAME} Threads::Threads) # LibBSD target_link_libraries(${PROJECT_NAME} bsd)