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

Move Squirrel and Sqrat into the root level directory.

Create the initial CMake build scripts.
This commit is contained in:
Sandu Liviu Catalin 2020-03-21 21:39:01 +02:00
parent 7f9d6288b0
commit 44b1cb5d96
78 changed files with 231 additions and 0 deletions

41
CMakeLists.txt Normal file
View File

@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.0.2)
project(SqMod)
# Several plugin options
option(BUILTIN_RUNTIMES "Include the MinGW runtime into the binary itself." ON)
option(FORCE_32BIT_BIN "Create a 32-bit executable binary if the compiler defaults to 64-bit." OFF)
# Default to c++14 standard
if(CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
else()
# Apparently the above does not work with cmake from on debian 8
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Try the standard method as well
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
# Default to release mode
set(CMAKE_BUILD_TYPE "Release")
# Include mingw runntime into the binary
if (GCC OR MINGW)
if(BUILTIN_RUNTIMES)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
endif()
endif()
# Enable position independent code
if (UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
# Include Squirrel library
add_subdirectory(squirrel)
# Include Squat library
add_subdirectory(sqrat)
# Global include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

0
external/B64/CMakeLists.txt vendored Normal file
View File

0
external/Common/CMakeLists.txt vendored Normal file
View File

0
external/Hash/CMakeLists.txt vendored Normal file
View File

0
external/Jansson/CMakeLists.txt vendored Normal file
View File

0
external/LibIRC/CMakeLists.txt vendored Normal file
View File

0
external/MaxmindDB/CMakeLists.txt vendored Normal file
View File

0
external/PUGIXML/CMakeLists.txt vendored Normal file
View File

0
external/SQLite/CMakeLists.txt vendored Normal file
View File

0
external/SimpleINI/CMakeLists.txt vendored Normal file
View File

95
source/CMakeLists.txt Normal file
View File

@ -0,0 +1,95 @@
#
add_library(SquirrelModule MODULE
SqBase.hpp
Main.cpp
Register.cpp
Core.cpp Core.hpp
Logger.cpp Logger.hpp
Base/AABB.cpp Base/AABB.hpp
Base/Algo.cpp Base/Algo.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/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
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/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
Misc/Broadcast.cpp
Misc/Constants.cpp
Misc/Exports.cpp
Misc/Register.cpp
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
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
)
#
if(FORCE_32BIT_BIN)
set_target_properties(SquirrelModule PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(SquirrelModule PRIVATE _SQ64)
endif()
set_target_properties(SquirrelModule PROPERTIES PREFIX "")
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
else()
set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
else()
set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
endif()
endif(32)
target_include_directories(SquirrelModule PRIVATE ${CMAKE_CURRENT_LIST_DIR})
if(WIN32)
target_link_libraries(SquirrelModule wsock32 ws2_32)
endif()

32
sqrat/CMakeLists.txt Normal file
View File

@ -0,0 +1,32 @@
# Create the Sqrat library
add_library(Sqrat INTERFACE)
# Set library compiler options
target_compile_definitions(Sqrat INTERFACE SCRAT_USE_EXCEPTIONS=1 SCRAT_USE_CXX11_OPTIMIZATIONS=1)
# Set specific compiler options
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
#target_compile_options(Sqrat PRIVATE -w
#)
endif()
# Configure macro options
target_compile_definitions(Sqrat INTERFACE GARBAGE_COLLECTOR=1)
# Library includes
target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
# Link to required libraries
target_link_libraries(Sqrat INTERFACE Squirrel)
# Add it's sources
target_sources(Sqrat INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sqrat.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratAllocator.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratArray.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratClass.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratConst.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratFunction.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratGlobalMethods.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratMemberMethods.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratObject.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratOverloadMethods.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratScript.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratTable.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratTypes.h
${CMAKE_CURRENT_SOURCE_DIR}/sqrat/sqratUtil.h
)

63
squirrel/CMakeLists.txt Normal file
View File

@ -0,0 +1,63 @@
# Create the Squirrel library
add_library(Squirrel STATIC
include/sqconfig.h
include/sqstdaux.h
include/sqstdblob.h
include/sqstdmath.h
include/sqstdstring.h
include/sqstdsystem.h
include/squirrel.h
include/squirrelex.h
sqapi.cpp
sqapiex.cpp
sqarray.h
sqbaselib.cpp
sqclass.cpp sqclass.h
sqclosure.h
sqcompiler.cpp sqcompiler.h
sqdebug.cpp
sqfuncproto.h
sqfuncstate.cpp sqfuncstate.h
sqlexer.cpp sqlexer.h
sqmem.cpp
sqobject.cpp sqobject.h
sqopcodes.h
sqpcheader.h
sqstate.cpp sqstate.h
sqstring.h
sqtable.cpp sqtable.h
squserdata.h
squtils.h
sqvm.cpp sqvm.h
stdlib/sqstdaux.cpp
stdlib/sqstdblob.cpp
stdlib/sqstdblobimpl.h
stdlib/sqstdio.cpp
stdlib/sqstdmath.cpp
stdlib/sqstdrex.cpp
stdlib/sqstdstream.cpp
stdlib/sqstdstream.h
stdlib/sqstdstring.cpp
stdlib/sqstdsystem.cpp
)
# Make sure Squirrel knows this is 64 bit
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(Squirrel PUBLIC _SQ64)
endif()
# Set speciffic compiler options
if (GCC OR MINGW)
target_compile_options(Squirrel PRIVATE -w
-fno-exceptions
-fno-rtti
-fno-strict-aliasing
-Wno-format
-Wno-unused-variable
-Wno-unused-but-set-variable
)
endif()
# Configure macro options
target_compile_definitions(Squirrel PRIVATE GARBAGE_COLLECTOR=1)
# Library includes
target_include_directories(Squirrel PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(Squirrel PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
target_include_directories(Squirrel PRIVATE ${CMAKE_CURRENT_LIST_DIR}/stdlib)