Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 3 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
cmake_minimum_required(VERSION 3.4.1)

project("Solar2D")

# Set version

if (DEFINED ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
else()
set(BUILD_NUMBER 9999)
endif()
if (DEFINED ENV{YEAR})
set(YEAR $ENV{YEAR})
else()
set(YEAR 2100)
endif()

message("YEAR: " ${YEAR})
message("BUILD_NUMBER: " ${BUILD_NUMBER})

# Set a default build type if none was specified

set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")

set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)

# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()


get_filename_component(CORONA_ROOT "${CMAKE_SOURCE_DIR}" ABSOLUTE)
message("CORONA_ROOT: " ${CORONA_ROOT})

if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
set(ALSOFT_NATIVE_TOOLS_PATH "${CORONA_ROOT}/bin/linux" CACHE STRING "Path to prebuilt native tools (leave blank to auto-build)" FORCE)
include(platform/linux/CMakeList.txt)
else()
message(FATAL_ERROR "CMakeList.txt is not ported to current OS: ${CMAKE_HOST_SYSTEM_NAME}")
endif()

cmake_minimum_required(VERSION 3.4.1)
project(Solar2D)
include(platform/linux/CMakeList.txt)
3 changes: 2 additions & 1 deletion platform/linux/CMakeList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ add_executable( Solar2DBuilder
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_CoronaBuilder.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerAndroidFactory.cpp
${CORONA_ROOT}/platform/shared/Rtt_AndroidSupportTools.c
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerHTML5Factory.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_AppPackagerLinuxFactory.cpp
${CORONA_ROOT}/tools/CoronaBuilder/Rtt_BuildParams.cpp
Expand Down Expand Up @@ -1028,7 +1029,7 @@ target_compile_definitions( Solar2DSimulator PUBLIC

target_compile_definitions( Solar2DBuilder PUBLIC
Rtt_BUILD_REVISION=${BUILD_NUMBER} Rtt_BUILD_YEAR=${YEAR}
LUA_USE_POPEN Rtt_LUA_COMPILER Rtt_SIMULATOR CORONABUILDER_LINUX LUA_DL_DLOPEN
LUA_USE_POPEN Rtt_LUA_COMPILER Rtt_SIMULATOR CORONABUILDER_LINUX CORONABUILDER_ANDROID LUA_DL_DLOPEN
Rtt_LINUX_ENV ALMIXER_COMPILE_WITHOUT_SDL SOUND_SUPPORTS_WAV SOUND_SUPPORTS_MPG123 SOUND_SUPPORTS_OGG
OPT_GENERIC HAVE_STRERROR NO_REAL ENABLE_ALMIXER_THREADS LINUX_LIB)

Expand Down
2 changes: 2 additions & 0 deletions tools/CoronaBuilder/Rtt_AppPackagerAndroidFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ AppPackagerFactory::CreatePackagerParamsAndroid(
scriptPathStr.Append("/AndroidValidation.lu");
#elif defined(Rtt_WIN_ENV)
scriptPathStr.Append("/AndroidValidation.lua");
#elif defined(Rtt_LINUX_ENV)
scriptPathStr.Append("/AndroidValidation.lua");
#endif
lua_State* L1 = Rtt_AndroidSupportTools_NewLuaState( scriptPathStr.GetString() );
if (L1 == NULL)
Expand Down
18 changes: 18 additions & 0 deletions tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include "Core/Rtt_Build.h"

#include "Rtt_AppPackagerFactory.h"
#if defined(Rtt_LINUX_ENV)
#include <unistd.h>
#include <limits.h>
#include <string.h>
#endif

#if defined(CORONABUILDER_ANDROID)
#include "Rtt_AndroidAppPackager.h"
Expand Down Expand Up @@ -394,6 +399,19 @@ AppPackagerFactory::GetResourceDirectory() const
return GetResourceDirectoryOSX();
#elif defined(Rtt_WIN_ENV)
return GetResourceDirectoryWin();
#elif defined(Rtt_LINUX_ENV)
// On Linux, resources are alongside the Solar2DBuilder binary in Resources/
static char resourceDir[PATH_MAX + 1];
if (resourceDir[0] == '\0') {
ssize_t count = readlink("/proc/self/exe", resourceDir, PATH_MAX);
resourceDir[count] = '\0';
char *slash = strrchr(resourceDir, '/');
if (slash) *slash = '\0';
strncat(resourceDir, "/Resources", PATH_MAX - strlen(resourceDir));
}
return resourceDir;
#else
return NULL;
#endif
}

Expand Down
10 changes: 6 additions & 4 deletions tools/CoronaBuilder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ int main(int argc, const char *argv[])
string skinDir;

// setup directory paths
documentsDir.append("/Documents");
temporaryDir.append("/TemporaryFiles");
cachesDir.append("/CachedFiles");
systemCachesDir.append("/.system");
const char *tmpBase = getenv("TMPDIR");
if (!tmpBase || tmpBase[0] == '\0') tmpBase = "/tmp";
documentsDir = std::string(tmpBase) + "/Documents";
temporaryDir = std::string(tmpBase) + "/TemporaryFiles";
cachesDir = std::string(tmpBase) + "/CachedFiles";
systemCachesDir = std::string(tmpBase) + "/.system";

Rtt::LinuxConsolePlatform *platform = new Rtt::LinuxConsolePlatform(pathToApp.c_str(), documentsDir.c_str(), temporaryDir.c_str(), cachesDir.c_str(), systemCachesDir.c_str(), skinDir.c_str(), GetStartupPath(NULL));
Rtt::LinuxPlatformServices services(platform);
Expand Down