mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Upgrade CMake minimum version and improve CMake code (#5446)
Only show in developer changelog
This commit is contained in:
123
CMakeLists.txt
123
CMakeLists.txt
@@ -1,100 +1,99 @@
|
||||
#This is the CMake file used to build GDevelop.
|
||||
#For more information, see the README.md file.
|
||||
# This is the CMake file used to build GDevelop.
|
||||
# For more information, see the README.md file.
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# Add utility functions
|
||||
include(scripts/CMakeClangUtils.txt) # To add clang-format and clang-tidy support to a target
|
||||
|
||||
# Macro for defining an option
|
||||
macro(gd_set_option var default type docstring)
|
||||
if(NOT DEFINED ${var})
|
||||
set(${var} ${default})
|
||||
endif()
|
||||
set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
|
||||
if(NOT DEFINED ${var})
|
||||
set(${var} ${default})
|
||||
endif()
|
||||
set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
|
||||
endmacro()
|
||||
|
||||
# Set options
|
||||
gd_set_option(BUILD_CORE TRUE BOOL "TRUE to build GDevelop Core library")
|
||||
gd_set_option(BUILD_GDJS TRUE BOOL "TRUE to build GDevelop JS Platform")
|
||||
gd_set_option(BUILD_EXTENSIONS TRUE BOOL "TRUE to build the extensions")
|
||||
gd_set_option(BUILD_TESTS TRUE BOOL "TRUE to build the tests")
|
||||
|
||||
# Disable deprecated code
|
||||
set(NO_GUI TRUE CACHE BOOL "" FORCE) #Force disable old GUI related code.
|
||||
set(NO_GUI TRUE CACHE BOOL "" FORCE) # Force disable old GUI related code.
|
||||
|
||||
#Setting up installation directory, for Linux (has to be done before "project" command).
|
||||
IF(NOT WIN32)
|
||||
if (NOT APPLE)
|
||||
gd_set_option(GD_INSTALL_PREFIX "/opt/gdevelop/" STRING "The directory where GDevelop should be installed")
|
||||
ELSE()
|
||||
gd_set_option(GD_INSTALL_PREFIX "." STRING "The directory where GDevelop should be installed")
|
||||
ENDIF()
|
||||
# Setting up installation directory, for Linux (has to be done before "project" command).
|
||||
if(NOT WIN32)
|
||||
if(NOT APPLE)
|
||||
gd_set_option(GD_INSTALL_PREFIX "/opt/gdevelop/" STRING "The directory where GDevelop should be installed")
|
||||
else()
|
||||
gd_set_option(GD_INSTALL_PREFIX "." STRING "The directory where GDevelop should be installed")
|
||||
endif()
|
||||
|
||||
#As we embed SFML, prevent it to be installed system-wide
|
||||
# As we embed SFML, prevent it to be installed system-wide
|
||||
set(CMAKE_INSTALL_PREFIX "${GD_INSTALL_PREFIX}/useless")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
project(GDevelop)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
IF(NOT WIN32 AND NOT APPLE AND NOT BUILD_TESTS)
|
||||
SET(CMAKE_SKIP_BUILD_RPATH TRUE) #Avoid errors when packaging for linux.
|
||||
ENDIF()
|
||||
IF(APPLE)
|
||||
if(NOT WIN32 AND NOT APPLE AND NOT BUILD_TESTS)
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE) # Avoid errors when packaging for linux.
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
||||
set(CMAKE_INSTALL_RPATH ".")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression")
|
||||
ENDIF()
|
||||
#Sanity checks
|
||||
IF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
message( "CMAKE_BUILD_TYPE is empty, assuming build type is Release" )
|
||||
add_compile_options(
|
||||
-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
|
||||
-Wno-potentially-evaluated-expression)
|
||||
endif()
|
||||
# Sanity checks
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
message(STATUS "CMAKE_BUILD_TYPE is empty, assuming build type is Release")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "-s") #Force stripping to avoid errors when packaging for linux.
|
||||
ENDIF()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-s") # Force stripping to avoid errors when packaging for linux.
|
||||
endif()
|
||||
|
||||
#Activate C++11
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||
else()
|
||||
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support (with GNU extensions). Please use a different C++ compiler.")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Mark some warnings as errors
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# Activate as much warnings as possible to avoid errors like
|
||||
# uninitialized variables or other hard to debug bugs.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder-ctor -Wno-reorder -Wno-pessimizing-move -Wno-unused-variable -Wno-unused-private-field")
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wno-unknown-warning-option
|
||||
-Wno-reorder-ctor
|
||||
-Wno-reorder
|
||||
-Wno-pessimizing-move
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-private-field
|
||||
|
||||
# Make as much warnings considered as errors as possible (only one for now).
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-stack-address")
|
||||
# Make as much warnings considered as errors as possible (only one for now).
|
||||
-Werror=return-stack-address)
|
||||
endif()
|
||||
|
||||
#Define common directories:
|
||||
# Define common directories:
|
||||
set(GD_base_dir ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
#Add all the CMakeLists:
|
||||
ADD_SUBDIRECTORY(ExtLibs)
|
||||
IF(BUILD_CORE)
|
||||
ADD_SUBDIRECTORY(Core)
|
||||
ENDIF()
|
||||
IF(BUILD_GDJS)
|
||||
ADD_SUBDIRECTORY(GDJS)
|
||||
ENDIF()
|
||||
IF(EMSCRIPTEN)
|
||||
ADD_SUBDIRECTORY(GDevelop.js)
|
||||
ENDIF()
|
||||
IF(BUILD_EXTENSIONS)
|
||||
ADD_SUBDIRECTORY(Extensions)
|
||||
ENDIF()
|
||||
# Add all the CMakeLists:
|
||||
add_subdirectory(ExtLibs)
|
||||
if(BUILD_CORE)
|
||||
add_subdirectory(Core)
|
||||
endif()
|
||||
if(BUILD_GDJS)
|
||||
add_subdirectory(GDJS)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
add_subdirectory(GDevelop.js)
|
||||
endif()
|
||||
if(BUILD_EXTENSIONS)
|
||||
add_subdirectory(Extensions)
|
||||
endif()
|
||||
|
@@ -1,83 +1,98 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(GDCore)
|
||||
|
||||
SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) #Force use response file: useful for Ninja build system on Windows.
|
||||
SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
SET(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1)
|
||||
SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1)
|
||||
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) # Force use response file: useful for Ninja build system on Windows.
|
||||
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1)
|
||||
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1)
|
||||
|
||||
#Define common directories:
|
||||
# Define common directories:
|
||||
set(GDCORE_include_dir ${GD_base_dir}/Core PARENT_SCOPE)
|
||||
set(GDCORE_lib_dir ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME} PARENT_SCOPE)
|
||||
|
||||
#Dependencies on external libraries:
|
||||
###
|
||||
# Dependencies on external libraries:
|
||||
#
|
||||
|
||||
#Defines
|
||||
###
|
||||
add_definitions( -DGD_IDE_ONLY )
|
||||
IF (EMSCRIPTEN)
|
||||
add_definitions( -DEMSCRIPTEN )
|
||||
ENDIF()
|
||||
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
add_definitions( -DDEBUG )
|
||||
ELSE()
|
||||
add_definitions( -DRELEASE )
|
||||
ENDIF()
|
||||
# Defines
|
||||
#
|
||||
add_definitions(-DGD_IDE_ONLY)
|
||||
if(EMSCRIPTEN)
|
||||
add_definitions(-DEMSCRIPTEN)
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
add_definitions(-DDEBUG)
|
||||
else()
|
||||
add_definitions(-DRELEASE)
|
||||
endif()
|
||||
|
||||
IF(WIN32)
|
||||
add_definitions( -DWINDOWS )
|
||||
add_definitions( "-DGD_CORE_API=__declspec(dllexport)" )
|
||||
add_definitions( -D__GNUWIN32__ )
|
||||
ELSE()
|
||||
IF(APPLE)
|
||||
add_definitions( -DMACOS )
|
||||
ELSE()
|
||||
add_definitions( -DLINUX )
|
||||
ENDIF()
|
||||
add_definitions( -DGD_API= )
|
||||
add_definitions( -DGD_CORE_API= )
|
||||
ENDIF(WIN32)
|
||||
if(WIN32)
|
||||
add_definitions(-DWINDOWS)
|
||||
add_definitions("-DGD_CORE_API=__declspec(dllexport)")
|
||||
add_definitions(-D__GNUWIN32__)
|
||||
else()
|
||||
if(APPLE)
|
||||
add_definitions(-DMACOS)
|
||||
else()
|
||||
add_definitions(-DLINUX)
|
||||
endif()
|
||||
add_definitions(-DGD_API=)
|
||||
add_definitions(-DGD_CORE_API=)
|
||||
endif()
|
||||
|
||||
#The target
|
||||
###
|
||||
# The target
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB_RECURSE source_files GDCore/*)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
source_files
|
||||
GDCore/*)
|
||||
|
||||
file(GLOB_RECURSE formatted_source_files tests/* GDCore/Events/* GDCore/Extensions/* GDCore/IDE/* GDCore/Project/* GDCore/Serialization/* GDCore/Tools/*)
|
||||
list(REMOVE_ITEM formatted_source_files "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.h" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs_dialogs_bitmaps.cpp")
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
formatted_source_files
|
||||
tests/*
|
||||
GDCore/Events/*
|
||||
GDCore/Extensions/*
|
||||
GDCore/IDE/*
|
||||
GDCore/Project/*
|
||||
GDCore/Serialization/*
|
||||
GDCore/Tools/*)
|
||||
list(
|
||||
REMOVE_ITEM
|
||||
formatted_source_files
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs_dialogs_bitmaps.cpp")
|
||||
gd_add_clang_utils(GDCore "${formatted_source_files}")
|
||||
|
||||
IF(EMSCRIPTEN)
|
||||
if(EMSCRIPTEN)
|
||||
# Emscripten treats all libraries as static libraries
|
||||
add_library(GDCore STATIC ${source_files})
|
||||
ELSE()
|
||||
else()
|
||||
add_library(GDCore SHARED ${source_files})
|
||||
ENDIF()
|
||||
IF(EMSCRIPTEN)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(GDCore PROPERTIES SUFFIX ".bc")
|
||||
ELSEIF(WIN32)
|
||||
elseif(WIN32)
|
||||
set_target_properties(GDCore PROPERTIES PREFIX "")
|
||||
ELSE()
|
||||
else()
|
||||
set_target_properties(GDCore PROPERTIES PREFIX "lib")
|
||||
ENDIF()
|
||||
endif()
|
||||
set(LIBRARY_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME})
|
||||
set(ARCHIVE_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME})
|
||||
set(RUNTIME_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME})
|
||||
|
||||
#Tests
|
||||
###
|
||||
# Tests
|
||||
#
|
||||
if(BUILD_TESTS)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
test_source_files
|
||||
tests/*
|
||||
)
|
||||
GLOB_RECURSE
|
||||
test_source_files
|
||||
tests/*)
|
||||
|
||||
add_executable(GDCore_tests ${test_source_files})
|
||||
set_target_properties(GDCore_tests PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) #Allow finding dependencies directly from build path on Mac OS X.
|
||||
set_target_properties(GDCore_tests PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) # Allow finding dependencies directly from build path on Mac OS X.
|
||||
target_link_libraries(GDCore_tests GDCore)
|
||||
target_link_libraries(GDCore_tests ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
@@ -0,0 +1 @@
|
||||
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(AnchorBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(AnchorBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(AnchorBehavior "${source_files}")
|
||||
gd_add_extension_target(AnchorBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(AnchorBehavior)
|
||||
|
@@ -1,28 +1,34 @@
|
||||
#This is the CMake file used to build the C++ extensions.
|
||||
#For more information, see the README.md file.
|
||||
# This is the CMake file used to build the C++ extensions.
|
||||
# For more information, see the README.md file.
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(GD-Extensions)
|
||||
include(CMakeUtils.txt) #Functions to factor common tasks done in CMakeLists.txt of extensions
|
||||
include(CMakeUtils.txt) # Functions to factor common tasks done in CMakeLists.txt of extensions
|
||||
|
||||
#Add all the CMakeLists (for non pure JS extensions):
|
||||
ADD_SUBDIRECTORY(3D)
|
||||
ADD_SUBDIRECTORY(AnchorBehavior)
|
||||
ADD_SUBDIRECTORY(DestroyOutsideBehavior)
|
||||
ADD_SUBDIRECTORY(DraggableBehavior)
|
||||
ADD_SUBDIRECTORY(Inventory)
|
||||
ADD_SUBDIRECTORY(LinkedObjects)
|
||||
ADD_SUBDIRECTORY(ParticleSystem)
|
||||
ADD_SUBDIRECTORY(PanelSpriteObject)
|
||||
ADD_SUBDIRECTORY(PathfindingBehavior)
|
||||
ADD_SUBDIRECTORY(PhysicsBehavior)
|
||||
ADD_SUBDIRECTORY(PlatformBehavior)
|
||||
ADD_SUBDIRECTORY(PrimitiveDrawing)
|
||||
ADD_SUBDIRECTORY(Shopify)
|
||||
ADD_SUBDIRECTORY(SystemInfo)
|
||||
ADD_SUBDIRECTORY(TextEntryObject)
|
||||
ADD_SUBDIRECTORY(TextObject)
|
||||
ADD_SUBDIRECTORY(TiledSpriteObject)
|
||||
ADD_SUBDIRECTORY(TopDownMovementBehavior)
|
||||
# List of non pure JS extensions
|
||||
set(
|
||||
GD_EXTENSIONS
|
||||
3D
|
||||
AnchorBehavior
|
||||
DestroyOutsideBehavior
|
||||
DraggableBehavior
|
||||
Inventory
|
||||
LinkedObjects
|
||||
PanelSpriteObject
|
||||
ParticleSystem
|
||||
PathfindingBehavior
|
||||
PhysicsBehavior
|
||||
PlatformBehavior
|
||||
PrimitiveDrawing
|
||||
Shopify
|
||||
SystemInfo
|
||||
TextEntryObject
|
||||
TextObject
|
||||
TiledSpriteObject
|
||||
TopDownMovementBehavior)
|
||||
|
||||
# Automatically add all listed extensions
|
||||
foreach(extension ${GD_EXTENSIONS})
|
||||
add_subdirectory(${extension})
|
||||
endforeach()
|
||||
|
@@ -7,79 +7,75 @@ macro(gd_add_extension_includes)
|
||||
include_directories(${GDCORE_include_dir})
|
||||
endmacro()
|
||||
|
||||
#Add common defines for a target that will be a GD extension
|
||||
# Add common defines for a target that will be a GD extension
|
||||
function(gd_add_extension_definitions target_name)
|
||||
|
||||
#Define used in GD to check the build type
|
||||
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
add_definitions( -DDEBUG )
|
||||
ELSE()
|
||||
add_definitions( -DRELEASE )
|
||||
ENDIF()
|
||||
# Define used in GD to check the build type
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
add_definitions(-DDEBUG)
|
||||
else()
|
||||
add_definitions(-DRELEASE)
|
||||
endif()
|
||||
|
||||
set(${target_name}_extra_definitions "${${target_name}_extra_definitions} GD_IDE_ONLY=1;" PARENT_SCOPE)
|
||||
|
||||
#Defne used in GD to identify the environment
|
||||
IF (EMSCRIPTEN)
|
||||
add_definitions( -DEMSCRIPTEN )
|
||||
ELSEIF(WIN32)
|
||||
add_definitions( -DWINDOWS )
|
||||
ELSEIF(APPLE)
|
||||
add_definitions( -DMACOS )
|
||||
ELSE()
|
||||
add_definitions( -DLINUX )
|
||||
ENDIF()
|
||||
# Define used in GD to identify the environment
|
||||
if(EMSCRIPTEN)
|
||||
add_definitions(-DEMSCRIPTEN)
|
||||
elseif(WIN32)
|
||||
add_definitions(-DWINDOWS)
|
||||
elseif(APPLE)
|
||||
add_definitions(-DMACOS)
|
||||
else()
|
||||
add_definitions(-DLINUX)
|
||||
endif()
|
||||
|
||||
IF(WIN32) #Windows specific defines
|
||||
add_definitions( "-DGD_CORE_API=__declspec(dllimport)" )
|
||||
add_definitions( "-DGD_API=__declspec(dllimport)" )
|
||||
add_definitions( "-DGD_EXTENSION_API=__declspec(dllexport)" )
|
||||
add_definitions( -D__GNUWIN32__ )
|
||||
ELSE()
|
||||
|
||||
add_definitions( -DGD_API= )
|
||||
add_definitions( -DGD_CORE_API= )
|
||||
add_definitions( -DGD_EXTENSION_API= )
|
||||
ENDIF(WIN32)
|
||||
if(WIN32) # Windows specific defines
|
||||
add_definitions("-DGD_API=__declspec(dllimport)")
|
||||
add_definitions("-DGD_CORE_API=__declspec(dllimport)")
|
||||
add_definitions("-DGD_EXTENSION_API=__declspec(dllexport)")
|
||||
add_definitions(-D__GNUWIN32__)
|
||||
else()
|
||||
add_definitions(-DGD_API=)
|
||||
add_definitions(-DGD_CORE_API=)
|
||||
add_definitions(-DGD_EXTENSION_API=)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#Add a GD extension target, that will produce the final library file.
|
||||
# Add a GD extension target, that will produce the final library file.
|
||||
function(gd_add_extension_target target_name source_files)
|
||||
IF(target_name STREQUAL "")
|
||||
MESSAGE(ERROR "You called gd_add_extension_target without specifying a target name")
|
||||
ENDIF()
|
||||
if(target_name STREQUAL "")
|
||||
message(ERROR "You called gd_add_extension_target without specifying a target name")
|
||||
endif()
|
||||
|
||||
SET(platform_directory ${ARGV2})
|
||||
IF(NOT platform_directory)
|
||||
SET(platform_directory "CppPlatform")
|
||||
ENDIF()
|
||||
set(platform_directory ${ARGV2})
|
||||
if(NOT platform_directory)
|
||||
set(platform_directory "CppPlatform")
|
||||
endif()
|
||||
|
||||
IF(EMSCRIPTEN)
|
||||
if(EMSCRIPTEN)
|
||||
# Emscripten treats all libraries as static libraries
|
||||
add_library(${target_name} STATIC ${source_files})
|
||||
ELSE()
|
||||
else()
|
||||
add_library(${target_name} SHARED ${source_files})
|
||||
ENDIF()
|
||||
endif()
|
||||
set_target_properties(${target_name} PROPERTIES PREFIX "")
|
||||
set_target_properties(${target_name} PROPERTIES COMPILE_DEFINITIONS "${${target_name}_extra_definitions}")
|
||||
set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/${platform_directory}/Extensions")
|
||||
set_target_properties(${target_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/${platform_directory}/Extensions")
|
||||
set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/${platform_directory}/Extensions")
|
||||
IF(WIN32) #GD extensions have special suffix in their filenames.
|
||||
if(WIN32) # GD extensions have special suffix in their filenames.
|
||||
set_target_properties(${target_name} PROPERTIES SUFFIX ".xgdwe")
|
||||
ELSEIF(EMSCRIPTEN)
|
||||
elseif(EMSCRIPTEN)
|
||||
set_target_properties(${target_name} PROPERTIES SUFFIX ".bc")
|
||||
ELSE()
|
||||
else()
|
||||
set_target_properties(${target_name} PROPERTIES SUFFIX ".xgde")
|
||||
ENDIF()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#Link default libraries with a target that is a GD extension
|
||||
# Link default libraries with a target that is a GD extension
|
||||
function(gd_extension_link_libraries target_name)
|
||||
IF(EMSCRIPTEN)
|
||||
#Nothing.
|
||||
ELSE()
|
||||
if(NOT EMSCRIPTEN)
|
||||
target_link_libraries(${target_name} GDCore)
|
||||
ENDIF()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(DestroyOutsideBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(DestroyOutsideBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(DestroyOutsideBehavior "${source_files}")
|
||||
gd_add_extension_target(DestroyOutsideBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(DestroyOutsideBehavior GDCore)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(DraggableBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(DraggableBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(DraggableBehavior "${source_files}")
|
||||
gd_add_extension_target(DraggableBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(DraggableBehavior)
|
||||
|
@@ -1,21 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(Inventory)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(Inventory)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(Inventory "${source_files}")
|
||||
|
||||
gd_add_extension_target(Inventory "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(Inventory)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(LinkedObjects)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(LinkedObjects)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(LinkedObjects "${source_files}")
|
||||
gd_add_extension_target(LinkedObjects "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
gd_extension_link_libraries(LinkedObjects)
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(LinkedObjects)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(PanelSpriteObject)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(PanelSpriteObject)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(PanelSpriteObject "${source_files}")
|
||||
gd_add_extension_target(PanelSpriteObject "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(PanelSpriteObject)
|
||||
|
@@ -1,21 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(ParticleSystem)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(ParticleSystem)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(ParticleSystem "${source_files}")
|
||||
gd_add_extension_target(ParticleSystem "${source_files}")
|
||||
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(ParticleSystem)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(PathfindingBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(PathfindingBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(PathfindingBehavior "${source_files}")
|
||||
gd_add_extension_target(PathfindingBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(PathfindingBehavior)
|
||||
|
@@ -1,21 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(PhysicsBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(PhysicsBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(PhysicsBehavior "${source_files}")
|
||||
gd_add_extension_target(PhysicsBehavior "${source_files}")
|
||||
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(PhysicsBehavior)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(PlatformBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(PlatformBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(PlatformBehavior "${source_files}")
|
||||
gd_add_extension_target(PlatformBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
gd_extension_link_libraries(PlatformBehavior)
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(PlatformBehavior)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(PrimitiveDrawing)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(PrimitiveDrawing)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(PrimitiveDrawing "${source_files}")
|
||||
gd_add_extension_target(PrimitiveDrawing "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(PrimitiveDrawing)
|
||||
|
@@ -1,21 +1,26 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(Shopify)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(Shopify)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
|
||||
gd_add_extension_target(Shopify "${source_files}" "JsPlatform")
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_extension_target(
|
||||
Shopify
|
||||
"${source_files}"
|
||||
"JsPlatform")
|
||||
gd_add_clang_utils(Shopify "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(Shopify)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(SystemInfo)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(SystemInfo)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(SystemInfo "${source_files}")
|
||||
gd_add_extension_target(SystemInfo "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(SystemInfo)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(TextEntryObject)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(TextEntryObject)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(TextEntryObject "${source_files}")
|
||||
gd_add_extension_target(TextEntryObject "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(TextEntryObject)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(TextObject)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(TextObject)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(TextObject "${source_files}")
|
||||
gd_add_extension_target(TextObject "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(TextObject)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(TiledSpriteObject)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(TiledSpriteObject)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(TiledSpriteObject "${source_files}")
|
||||
gd_add_extension_target(TiledSpriteObject "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(TiledSpriteObject)
|
||||
|
@@ -1,20 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(TopDownMovementBehavior)
|
||||
gd_add_extension_includes()
|
||||
|
||||
#Defines
|
||||
###
|
||||
# Defines
|
||||
#
|
||||
gd_add_extension_definitions(TopDownMovementBehavior)
|
||||
|
||||
#The targets
|
||||
###
|
||||
# The targets
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB source_files *.cpp *.h)
|
||||
file(
|
||||
GLOB
|
||||
source_files
|
||||
*.cpp
|
||||
*.h)
|
||||
gd_add_clang_utils(TopDownMovementBehavior "${source_files}")
|
||||
gd_add_extension_target(TopDownMovementBehavior "${source_files}")
|
||||
|
||||
#Linker files for the IDE extension
|
||||
###
|
||||
# Linker files for the IDE extension
|
||||
#
|
||||
gd_extension_link_libraries(TopDownMovementBehavior)
|
||||
|
@@ -1,75 +1,88 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(GDJS)
|
||||
#Dependencies on external libraries:
|
||||
###
|
||||
# Dependencies on external libraries:
|
||||
#
|
||||
include_directories(${GDCORE_include_dir})
|
||||
|
||||
#Defines
|
||||
###
|
||||
add_definitions( -DGD_IDE_ONLY )
|
||||
IF (EMSCRIPTEN)
|
||||
add_definitions( -DEMSCRIPTEN )
|
||||
ENDIF()
|
||||
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
add_definitions( -DDEBUG )
|
||||
ELSE()
|
||||
add_definitions( -DRELEASE )
|
||||
ENDIF()
|
||||
# Defines
|
||||
#
|
||||
add_definitions(-DGD_IDE_ONLY)
|
||||
if(EMSCRIPTEN)
|
||||
add_definitions(-DEMSCRIPTEN)
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
add_definitions(-DDEBUG)
|
||||
else()
|
||||
add_definitions(-DRELEASE)
|
||||
endif()
|
||||
|
||||
IF(WIN32)
|
||||
add_definitions( -DWINDOWS )
|
||||
add_definitions( "-DGD_API=__declspec(dllexport)" )
|
||||
add_definitions( "-DGD_CORE_API=__declspec( dllimport )" )
|
||||
add_definitions( -D__GNUWIN32__ )
|
||||
ELSE()
|
||||
IF(APPLE)
|
||||
add_definitions( -DMACOS )
|
||||
ELSE()
|
||||
add_definitions( -DLINUX )
|
||||
ENDIF()
|
||||
add_definitions( -DGD_API= )
|
||||
add_definitions( -DGD_CORE_API= )
|
||||
ENDIF(WIN32)
|
||||
if(WIN32)
|
||||
add_definitions(-DWINDOWS)
|
||||
add_definitions("-DGD_API=__declspec(dllexport)")
|
||||
add_definitions("-DGD_CORE_API=__declspec(dllimport)")
|
||||
add_definitions(-D__GNUWIN32__)
|
||||
else()
|
||||
if(APPLE)
|
||||
add_definitions(-DMACOS)
|
||||
else()
|
||||
add_definitions(-DLINUX)
|
||||
endif()
|
||||
add_definitions(-DGD_API=)
|
||||
add_definitions(-DGD_CORE_API=)
|
||||
endif()
|
||||
|
||||
#The target
|
||||
###
|
||||
# The target
|
||||
#
|
||||
include_directories(.)
|
||||
file(GLOB f1 GDJS/* GDJS/IDE/* GDJS/IDE/mongoose/*)
|
||||
file(GLOB_RECURSE f2 GDJS/Extensions/* GDJS/Events/*)
|
||||
file(
|
||||
GLOB
|
||||
f1
|
||||
GDJS/*
|
||||
GDJS/IDE/*
|
||||
GDJS/IDE/mongoose/*)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
f2
|
||||
GDJS/Extensions/*
|
||||
GDJS/Events/*)
|
||||
set(source_files ${f1} ${f2})
|
||||
IF(NOT EMSCRIPTEN)
|
||||
file(GLOB_RECURSE f3 GDJS/IDE/Dialogs/*)
|
||||
set(source_files ${source_files} ${f3})
|
||||
ENDIF()
|
||||
if(NOT EMSCRIPTEN)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
f3
|
||||
GDJS/IDE/Dialogs/*)
|
||||
set(source_files ${source_files} ${f3})
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE formatted_source_files GDJS/Events/* GDJS/Extensions/* GDJS/IDE/*)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
formatted_source_files
|
||||
GDJS/Events/*
|
||||
GDJS/Extensions/*
|
||||
GDJS/IDE/*)
|
||||
gd_add_clang_utils(GDJS "${formatted_source_files}")
|
||||
|
||||
|
||||
IF(EMSCRIPTEN)
|
||||
if(EMSCRIPTEN)
|
||||
# Emscripten treats all libraries as static libraries
|
||||
add_library(GDJS STATIC ${source_files})
|
||||
ELSE()
|
||||
else()
|
||||
add_library(GDJS SHARED ${source_files})
|
||||
ENDIF()
|
||||
IF(EMSCRIPTEN)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(GDJS PROPERTIES SUFFIX ".bc")
|
||||
ELSEIF(WIN32)
|
||||
elseif(WIN32)
|
||||
set_target_properties(GDJS PROPERTIES PREFIX "")
|
||||
ELSE()
|
||||
else()
|
||||
set_target_properties(GDJS PROPERTIES PREFIX "lib")
|
||||
ENDIF()
|
||||
endif()
|
||||
set_target_properties(GDJS PROPERTIES MACOS_RPATH "..")
|
||||
set(LIBRARY_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform)
|
||||
set(ARCHIVE_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform)
|
||||
set(RUNTIME_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform)
|
||||
|
||||
#Linker files
|
||||
###
|
||||
IF(EMSCRIPTEN)
|
||||
#Nothing.
|
||||
ELSE()
|
||||
# Linker files
|
||||
#
|
||||
if(NOT EMSCRIPTEN)
|
||||
target_link_libraries(GDJS GDCore)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
@@ -1,73 +1,71 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(libGD.js)
|
||||
|
||||
#Sanity checks
|
||||
IF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
message( "CMAKE_BUILD_TYPE is empty, assuming build type is Release" )
|
||||
# Sanity checks
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
message(STATUS "CMAKE_BUILD_TYPE is empty, assuming build type is Release")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
ENDIF()
|
||||
endif()
|
||||
if(NOT EMSCRIPTEN)
|
||||
error("You're trying to compile libGD.js without emscripten.")
|
||||
message(FATAL_ERROR "You're trying to compile libGD.js without emscripten.")
|
||||
endif()
|
||||
|
||||
# Compilation flags (https://emscripten.org/docs/tools_reference/emcc.html):
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") # Optimizations during compilation
|
||||
# SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --profiling") # Uncomment for debugging + profiling support
|
||||
# SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --profiling") # Uncomment for profiling support
|
||||
add_compile_options(-O2) # Optimizations during compilation
|
||||
# add_compile_options(-g --profiling) # Uncomment for debugging + profiling support
|
||||
# add_compile_options(--profiling) # Uncomment for profiling support
|
||||
|
||||
#Common directories:
|
||||
###
|
||||
# Common directories:
|
||||
#
|
||||
set(GDJS_include_dir ${GD_base_dir}/GDJS)
|
||||
set(GDJS_lib_dir ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform)
|
||||
|
||||
#Dependencies on external libraries:
|
||||
###
|
||||
# Dependencies on external libraries:
|
||||
#
|
||||
include_directories(${GDCORE_include_dir})
|
||||
include_directories(${GDJS_include_dir})
|
||||
|
||||
#Defines
|
||||
###
|
||||
add_definitions( -DGD_IDE_ONLY )
|
||||
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
add_definitions( -DDEBUG )
|
||||
IF(WIN32)
|
||||
add_definitions( __WXDEBUG__ )
|
||||
ENDIF(WIN32)
|
||||
ELSEIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
add_definitions( -DRELEASE )
|
||||
add_definitions( -DBOOST_DISABLE_ASSERTS )
|
||||
ELSE()
|
||||
add_definitions( -DDEV )
|
||||
add_definitions( -DBOOST_DISABLE_ASSERTS )
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
# Defines
|
||||
#
|
||||
add_definitions(-DGD_IDE_ONLY)
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
add_definitions(-DDEBUG)
|
||||
if(WIN32)
|
||||
add_definitions(__WXDEBUG__)
|
||||
endif()
|
||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
add_definitions(-DRELEASE)
|
||||
add_definitions(-DBOOST_DISABLE_ASSERTS)
|
||||
else()
|
||||
add_definitions(-DDEV)
|
||||
add_definitions(-DBOOST_DISABLE_ASSERTS)
|
||||
endif()
|
||||
|
||||
add_definitions( -Dlinux )
|
||||
add_definitions( -DLINUX )
|
||||
add_definitions( -DGD_API= )
|
||||
add_definitions( -DGD_CORE_API= )
|
||||
add_definitions( -DGD_EXTENSION_API= )
|
||||
add_definitions(-Dlinux)
|
||||
add_definitions(-DLINUX)
|
||||
add_definitions(-DGD_API=)
|
||||
add_definitions(-DGD_CORE_API=)
|
||||
add_definitions(-DGD_EXTENSION_API=)
|
||||
|
||||
#The target
|
||||
###
|
||||
# The target
|
||||
#
|
||||
include_directories(.)
|
||||
|
||||
add_executable(
|
||||
GD
|
||||
"Bindings/Wrapper.cpp"
|
||||
"Bindings/BehaviorJsImplementation.cpp"
|
||||
"Bindings/ObjectJsImplementation.cpp"
|
||||
"Bindings/BehaviorSharedDataJsImplementation.cpp"
|
||||
)
|
||||
"Bindings/ObjectJsImplementation.cpp"
|
||||
"Bindings/Wrapper.cpp")
|
||||
|
||||
IF(DISABLE_EMSCRIPTEN_LINK_OPTIMIZATIONS)
|
||||
if(DISABLE_EMSCRIPTEN_LINK_OPTIMIZATIONS)
|
||||
# Disable optimizations at linking time for much faster builds.
|
||||
MESSAGE(STATUS "Disabling optimization at link time for (slightly) faster build")
|
||||
message(STATUS "Disabling optimization at link time for (slightly) faster build")
|
||||
target_link_libraries(GD "-O0")
|
||||
ELSE()
|
||||
else()
|
||||
target_link_libraries(GD "-O2")
|
||||
ENDIF()
|
||||
endif()
|
||||
target_link_libraries(GD "--post-js ${GD_base_dir}/GDevelop.js/Bindings/glue.js")
|
||||
target_link_libraries(GD "--post-js ${GD_base_dir}/GDevelop.js/Bindings/postjs.js")
|
||||
target_link_libraries(GD "-s MODULARIZE=1")
|
||||
@@ -80,9 +78,8 @@ target_link_libraries(GD "-s \"EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPreMain', '
|
||||
# Even if we're building an "executable", prefix it by lib as it's used as a library.
|
||||
set_target_properties(GD PROPERTIES PREFIX "lib")
|
||||
|
||||
#Linker files
|
||||
###
|
||||
|
||||
# Linker files
|
||||
#
|
||||
target_link_libraries(GD GDCore)
|
||||
target_link_libraries(GD GDJS)
|
||||
target_link_libraries(GD PlatformBehavior)
|
||||
|
@@ -5,10 +5,9 @@ function(gd_add_clang_utils target_name source_files)
|
||||
add_custom_target(
|
||||
${target_name}_clang-format
|
||||
COMMAND ${CLANG_FORMAT}
|
||||
-i
|
||||
-i
|
||||
-style=\"{BasedOnStyle: Google, BinPackParameters: false, BinPackArguments: false}\"
|
||||
${source_files}
|
||||
)
|
||||
${source_files})
|
||||
|
||||
add_dependencies(clang-format ${target_name}_clang-format)
|
||||
endif()
|
||||
@@ -17,4 +16,4 @@ function(gd_add_clang_utils target_name source_files)
|
||||
endfunction()
|
||||
|
||||
# Add a clang-format target to run all clang-format targets
|
||||
add_custom_target(clang-format)
|
||||
add_custom_target(clang-format)
|
||||
|
Reference in New Issue
Block a user