1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00
SqMod/module/CMakeLists.txt

151 lines
5.4 KiB
CMake
Raw Normal View History

# Include third-party libraries
add_subdirectory(Vendor)
2020-03-21 21:00:02 +01:00
# Create the Squirrel module
add_library(SqModule MODULE
SqBase.hpp
Main.cpp
Register.cpp
Core.cpp Core.hpp
Logger.cpp Logger.hpp
Base/DynArg.hpp
Base/AABB.cpp Base/AABB.hpp
Base/Buffer.cpp Base/Buffer.hpp
Base/Circle.cpp Base/Circle.hpp
Base/Color3.cpp Base/Color3.hpp
Base/Color4.cpp Base/Color4.hpp
Base/Quaternion.cpp Base/Quaternion.hpp
Base/ScriptSrc.cpp Base/ScriptSrc.hpp
Base/Shared.cpp Base/Shared.hpp
Base/Sphere.cpp Base/Sphere.hpp
Base/Utility.cpp Base/Utility.hpp
2020-09-06 03:13:46 +02:00
Base/VecMap.hpp
Base/Vector2.cpp Base/Vector2.hpp
Base/Vector2i.cpp Base/Vector2i.hpp
Base/Vector3.cpp Base/Vector3.hpp
Base/Vector4.cpp Base/Vector4.hpp
Entity/Blip.cpp Entity/Blip.hpp
Entity/Checkpoint.cpp Entity/Checkpoint.hpp
Entity/Keybind.cpp Entity/Keybind.hpp
Entity/Object.cpp Entity/Object.hpp
Entity/Pickup.cpp Entity/Pickup.hpp
Entity/Player.cpp Entity/Player.hpp
Entity/Vehicle.cpp Entity/Vehicle.hpp
Library/Chrono.cpp Library/Chrono.hpp
Library/Chrono/Date.cpp Library/Chrono/Date.hpp
Library/Chrono/Datetime.cpp Library/Chrono/Datetime.hpp
Library/Chrono/Time.cpp Library/Chrono/Time.hpp
Library/Chrono/Timer.cpp Library/Chrono/Timer.hpp
Library/Chrono/Timestamp.cpp Library/Chrono/Timestamp.hpp
Library/Crypt.cpp Library/Crypt.hpp
Library/Crypt/AES.cpp Library/Crypt/AES.hpp
Library/Crypt/Hash.cpp Library/Crypt/Hash.hpp
Library/IO.cpp Library/IO.hpp
Library/IO/File.cpp Library/IO/File.hpp
Library/IO/INI.cpp Library/IO/INI.hpp
2020-03-22 15:33:48 +01:00
Library/MMDB.cpp Library/MMDB.hpp
Library/Numeric.cpp Library/Numeric.hpp
Library/Numeric/LongInt.cpp Library/Numeric/LongInt.hpp
Library/Numeric/Math.cpp Library/Numeric/Math.hpp
Library/Numeric/Random.cpp Library/Numeric/Random.hpp
Library/Socket.cpp Library/Socket.hpp
Library/SQLite.cpp Library/SQLite.hpp
Library/String.cpp Library/String.hpp
Library/System.cpp Library/System.hpp
Library/System/Dir.cpp Library/System/Dir.hpp
Library/System/Environment.cpp Library/System/Environment.hpp
Library/System/Path.cpp Library/System/Path.hpp
Library/Utils.cpp Library/Utils.hpp
Library/Utils/Buffer.cpp Library/Utils/Buffer.hpp
2020-09-04 22:52:05 +02:00
Library/Web.cpp Library/Web.hpp
Library/Worker.cpp Library/Worker.hpp
2020-09-06 22:09:54 +02:00
Library/Worker/Job.cpp Library/Worker/Job.hpp
Library/Worker/Parameter.cpp Library/Worker/Parameter.hpp
Library/XML.cpp Library/XML.hpp
Misc/Broadcast.cpp
Misc/Constants.cpp
Misc/Exports.cpp
Misc/Register.cpp
Misc/Algo.cpp Misc/Algo.hpp
Misc/Areas.cpp Misc/Areas.hpp
Misc/Command.cpp Misc/Command.hpp
Misc/Functions.cpp Misc/Functions.hpp
Misc/Model.cpp Misc/Model.hpp
Misc/Player.cpp Misc/Player.hpp
2020-05-10 12:01:01 +02:00
Misc/Privilege.cpp Misc/Privilege.hpp
Misc/Routine.cpp Misc/Routine.hpp
Misc/Signal.cpp Misc/Signal.hpp
Misc/Tasks.cpp Misc/Tasks.hpp
Misc/Vehicle.cpp Misc/Vehicle.hpp
Misc/Weapon.cpp Misc/Weapon.hpp
)
# Include MINGW runtime into the binary
if(GCC OR MINGW)
if(BUILTIN_RUNTIMES)
target_link_libraries (SqModule -static gcc stdc++ winpthread -dynamic)
endif()
endif()
# Link to libraries
target_link_libraries(SqModule SqModSDK FmtLib SimpleINI HashLib B64Lib AES256Lib WhirlpoolLib TinyDir PUGIXML SQLite MaxmindDB CivetWeb SimpleSocket ConcurrentQueue)
# Link to windows libraries if on windows
if(WIN32 OR MINGW)
target_compile_definitions(SqModule PRIVATE _WIN32_WINNT=0x0601)
target_link_libraries(SqModule wsock32 ws2_32 shlwapi)
endif()
# Link to CURL libraries
if(ENABLE_CURL)
# Link to necessary libraries
target_link_libraries(SqModule libcurl cpr::cpr)
# Include the implementation
target_sources(SqModule PRIVATE Library/CURL.cpp Library/CURL.hpp)
# Specify that CURL is enabled
target_compile_definitions(SqModule PRIVATE SQ_ENABLE_CURL=1)
endif()
2020-08-19 15:49:45 +02:00
# Enable LTO
if(LTO_ENABLED)
2020-08-19 15:49:45 +02:00
target_link_libraries(SqModule -flto)
endif()
2020-03-22 13:54:40 +01:00
# Link to mysql client library
2020-03-22 19:53:52 +01:00
if(ENABLE_MYSQL)
# Include the implementation
target_sources(SqModule PRIVATE Library/MySQL.cpp Library/MySQL.hpp)
2020-04-27 14:02:10 +02:00
# Specify that mysql is enabled
target_compile_definitions(SqModule PRIVATE SQ_ENABLE_MYSQL=1)
# Use builting client on windows (for now)
2020-03-22 19:53:52 +01:00
if(WIN32 OR MINGW)
target_link_libraries(SqModule mariadbclient)
else()
find_package(MySQL)
target_link_libraries(SqModule MySQL::MySQL)
endif()
endif()
# Determine if build mode
if(CMAKE_BUILD_TYPE MATCHES Release)
target_compile_definitions(SqModule PRIVATE NDEBUG=1)
else()
target_compile_definitions(SqModule PRIVATE _DEBUG=1 SQMOD_EXCEPTLOC=1)
endif()
# Force 32-bit binaries when necessary
if(FORCE_32BIT_BIN)
set_target_properties(SqModule PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif()
# Don't prefix the module binary.
set_target_properties(SqModule PROPERTIES PREFIX "")
# Custmize module binary name/
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
else()
set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
endif()
else(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
else()
set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
endif()
endif(WIN32)
# Include current directory in the search path
target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR})
# Copy module into the plugins folder
add_custom_command(TARGET SqModule POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SqModule> "${PROJECT_SOURCE_DIR}/bin/plugins")