diff --git a/premake5 b/premake5 new file mode 100644 index 0000000..bcb51ce Binary files /dev/null and b/premake5 differ diff --git a/samples/basics/generate_vs2022_linux.bat b/samples/basics/generate_vs2022_linux.bat new file mode 100644 index 0000000..f30f335 --- /dev/null +++ b/samples/basics/generate_vs2022_linux.bat @@ -0,0 +1,3 @@ +@echo off +..\..\premake5.exe --systemscript=../../tiki_build.lua --to=build/vs2022_linux --os=linux vs2022 +EXIT /B %ERRORLEVEL% diff --git a/samples/basics/src/function.cpp b/samples/basics/src/function.cpp index 87c8c07..f77c92a 100644 --- a/samples/basics/src/function.cpp +++ b/samples/basics/src/function.cpp @@ -2,7 +2,13 @@ #include -void __cdecl printHelloWorld() +#if _MSC_VER +# define CCALL __cdecl +#else +# define CCALL //__attribute__((cdecl)) +#endif + +CCALL void printHelloWorld() { std::cout << "Hello World!" << std::endl; } \ No newline at end of file diff --git a/samples/externals/generate_gmake_linux.sh b/samples/externals/generate_gmake_linux.sh new file mode 100644 index 0000000..8979175 --- /dev/null +++ b/samples/externals/generate_gmake_linux.sh @@ -0,0 +1,7 @@ +#/bin/bash + +../../premake5 --systemscript=../../tiki_build.lua --to=build/gmake_linux --os=linux --cc=gcc gmake +if [ $? -ne 0 ]; then + echo "Press any key to continue..." + read -n 1 +fi diff --git a/samples/externals/premake5.lua b/samples/externals/premake5.lua index fafac72..2a44af2 100644 --- a/samples/externals/premake5.lua +++ b/samples/externals/premake5.lua @@ -9,6 +9,8 @@ project:add_external( "https://github.com/leethomason/tinyxml2.git" ) project:add_external( "https://github.com/nothings/stb.git" ) project:add_external( "https://github.com/ocornut/imgui.git" ) project:add_external( "https://github.com/erincatto/box2d.git" ) + project:add_external( "https://www.sqlite.org/" ) +project:add_external( "https://github.com/richgel999/miniz" ) finalize_default_solution( project ) diff --git a/src/base/globals.lua b/src/base/globals.lua index 61c1b45..f674b97 100644 --- a/src/base/globals.lua +++ b/src/base/globals.lua @@ -62,6 +62,7 @@ function tiki.get_platform_for_premake_string( platform ) return Platforms.MacOS end + print( "Unknown platform: ".. platform ); return Platforms.Unknown end diff --git a/src/base/project.lua b/src/base/project.lua index 80be07d..e67e082 100644 --- a/src/base/project.lua +++ b/src/base/project.lua @@ -266,6 +266,11 @@ function Project:finalize( solution ) buildoptions( self.buildoptions ) end + if tiki.host_platform == Platforms.Windows and tiki.target_platform == Platforms.Linux then + -- TODO: wait for PR: debugger( "LinuxWSLDebugger" ) + toolchainversion( "wsl2" ) + end + self:finalize_create_directories() local config_project = Configuration:new() diff --git a/src/externals/https/github.com/erincatto/box2d.git/tiki.lua b/src/externals/https/github.com/erincatto/box2d.git/tiki.lua index 5523fdd..26ec045 100644 --- a/src/externals/https/github.com/erincatto/box2d.git/tiki.lua +++ b/src/externals/https/github.com/erincatto/box2d.git/tiki.lua @@ -5,7 +5,8 @@ local box2d_project = Project:new( "box2d", ProjectTypes.StaticLibrary ) box2d_project.module.module_type = ModuleTypes.FilesModule box2d_project:add_files( "include/box2d/*.h" ) -box2d_project:add_files( "src/**/*.cpp" ) +box2d_project:add_files( "src/*.h" ) +box2d_project:add_files( "src/*.c" ) box2d_project:add_include_dir( "include" ) box2d_project:add_include_dir( "src" ) diff --git a/src/externals/https/github.com/libsdl-org/SDL/tiki.lua b/src/externals/https/github.com/libsdl-org/SDL/tiki.lua deleted file mode 100644 index cd14a96..0000000 --- a/src/externals/https/github.com/libsdl-org/SDL/tiki.lua +++ /dev/null @@ -1,165 +0,0 @@ --- https://github.com/libsdl-org/SDL - -local repo_name = "libsdl-org/SDL" -if tiki.external.version == "latest" then - local response, result_code = http.get( "https://api.github.com/repos/" .. repo_name .. "/releases/latest" ) - local response_json = json.decode( response ) - - tiki.external.version = response_json.name -end - --- url example: https://github.com/libsdl-org/SDL/releases/download/release-2.28.3/SDL2-2.28.3.zip - -local release_name = "release-" .. tiki.external.version -local version_name = "SDL2-" .. tiki.external.version -local file_name = version_name .. ".zip" -local download_path = path.join( tiki.external.export_path, file_name ) - -if not os.isfile( download_path ) then - local download_url = "https://github.com/" .. repo_name .. "/releases/download/" .. release_name .. "/" .. file_name - - print( "Download: " .. download_url ) - local result_str, result_code = http.download( download_url, download_path ) - if result_code ~= 200 then - os.remove( download_path ) - throw( "download of '" .. download_url .. "' failed with error " .. result_code .. ": " .. result_str ) - end - - if not zip.extract( download_path, tiki.external.export_path ) then - os.remove( download_path ) - throw( "Failed to extract " .. download_path ) - end -end - -local sdl_module = module -local sdl_project = nil -if tiki.use_lib then - sdl_project = Project:new( "SDL", ProjectTypes.StaticLibrary ) - sdk_module = sdl_project.module -end - -sdl_module.module_type = ModuleTypes.FilesModule - -sdl_module:add_include_dir( version_name .. "/include" ) - -sdl_module:add_files( version_name .. "/include/*.h" ) -sdl_module:add_files( version_name .. "/src/*.h" ) -sdl_module:add_files( version_name .. "/src/*.c" ) - -if tiki.target_platform == Platforms.Android then - sdl_module:set_define( "GL_GLEXT_PROTOTYPES" ) -end - -sdl_modules = { - atomic = { header = false, source = true, platforms = {} }, - audio = { header = true, source = true, platforms = {} }, - core = { header = false, source = false, platforms = {} }, - cpuinfo = { header = false, source = true, platforms = {} }, - dynapi = { header = true, source = true, platforms = {} }, - events = { header = true, source = true, platforms = {} }, - file = { header = false, source = true, platforms = {} }, - filesystem = { header = false, source = false, platforms = {} }, - haptic = { header = true, source = true, platforms = {} }, - hidapi = { header = true, source = true, platforms = {} }, - joystick = { header = true, source = true, platforms = {} }, - libm = { header = true, source = true, platforms = {} }, - loadso = { header = false, source = false, platforms = {} }, - locale = { header = true, source = true, platforms = {} }, - main = { header = false, source = false, platforms = {} }, - misc = { header = true, source = true, platforms = {} }, - power = { header = true, source = true, platforms = {} }, - render = { header = true, source = true, platforms = {} }, - sensor = { header = true, source = true, platforms = {} }, - stdlib = { header = false, source = true, platforms = {} }, - thread = { header = true, source = true, platforms = {} }, - timer = { header = true, source = true, platforms = {} }, - video = { header = true, source = true, platforms = {} } -} - -sdl_modules[ "audio" ].platforms[ Platforms.Windows ] = { directsound = { header = true, source = true }, disk = { header = true, source = true }, dummy = { header = true, source = true }, wasapi = { header = false, source = true }, winmm = { header = true, source = true } } -sdl_modules[ "core" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true } } -sdl_modules[ "filesystem" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "haptic" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true } } -sdl_modules[ "joystick" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true }, hidapi = { header = true, source = true }, virtual = { header = true, source = true } } -sdl_modules[ "loadso" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "locale" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "main" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "misc" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "power" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "render" ].platforms[ Platforms.Windows ] = { direct3d = { header = true, source = true }, direct3d11 = { header = true, source = true }, direct3d12 = { header = true, source = true }, opengl = { header = true, source = true }, opengles2 = { header = true, source = true }, software = { header = true, source = true } } -sdl_modules[ "sensor" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true } } -sdl_modules[ "thread" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true } } -sdl_modules[ "timer" ].platforms[ Platforms.Windows ] = { windows = { header = false, source = true } } -sdl_modules[ "video" ].platforms[ Platforms.Windows ] = { windows = { header = true, source = true }, dummy = { header = true, source = true }, yuv2rgb = { header = true, source = true } } - -sdl_modules[ "audio" ].platforms[ Platforms.Android ] = { android = { header = true, source = true }, dummy = { header = true, source = true }, openslES = { header = true, source = true } } -sdl_modules[ "core" ].platforms[ Platforms.Android ] = { android = { header = true, source = true } } -sdl_modules[ "filesystem" ].platforms[ Platforms.Android ] = { android = { header = false, source = true } } -sdl_modules[ "haptic" ].platforms[ Platforms.Android ] = { android = { header = false, source = true } } -sdl_modules[ "joystick" ].platforms[ Platforms.Android ] = { android = { header = true, source = true }, hidapi = { header = true, source = true }, virtual = { header = true, source = true } } -sdl_modules[ "loadso" ].platforms[ Platforms.Android ] = { dlopen = { header = false, source = true } } -sdl_modules[ "main" ].platforms[ Platforms.Android ] = { android = { header = false, source = true } } -sdl_modules[ "power" ].platforms[ Platforms.Android ] = { android = { header = false, source = true } } -sdl_modules[ "render" ].platforms[ Platforms.Android ] = { opengles = { header = true, source = true }, opengles2 = { header = true, source = true }, software = { header = true, source = true } } -sdl_modules[ "sensor" ].platforms[ Platforms.Android ] = { android = { header = true, source = true } } -sdl_modules[ "thread" ].platforms[ Platforms.Android ] = { pthread = { header = true, source = true }, generic = { header = true, source = true } } -sdl_modules[ "timer" ].platforms[ Platforms.Android ] = { unix = { header = false, source = true } } -sdl_modules[ "video" ].platforms[ Platforms.Android ] = { android = { header = true, source = true }, dummy = { header = true, source = true }, yuv2rgb = { header = true, source = true } } - -for module_name, module_data in pairs( sdl_modules ) do - local module_path = version_name .. "/src/" .. module_name - - if module_data.header then - sdl_module:add_files( module_path .. "/*.h" ) - end - - if module_data.source then - sdl_module:add_files( module_path .. "/*.c" ) - end - - local module_platform = module_data.platforms[ tiki.target_platform ] - if module_platform then - for platform_name, platform_data in pairs( module_platform ) do - local platform_path = module_path .. "/" .. platform_name - - if platform_data.header then - sdl_module:add_files( platform_path .. "/*.h" ) - end - - if platform_data.source then - sdl_module:add_files( platform_path .. "/*.c" ) - end - - if platform_data.source_cpp then - sdl_module:add_files( platform_path .. "/*.cpp" ) - end - end - end -end - -if tiki.target_platform == Platforms.Windows then - sdl_module:add_files( version_name .. "/src/thread/generic/SDL_syscond.c" ) -end - -module:add_include_dir( version_name .. "/include" ) - -module.import_func = function( project, solution ) - if tiki.use_lib then - project:add_project_dependency( sdl_project ) - end - - if tiki.target_platform == Platforms.Windows then - project:add_library_file( "imm32" ) - project:add_library_file( "winmm" ) - project:add_library_file( "setupapi" ) - project:add_library_file( "version" ) - elseif tiki.target_platform == Platforms.Android then - project:add_library_file( "GLESv1_CM" ) - project:add_library_file( "GLESv3" ) - project:add_library_file( "OpenSLES" ) - end - - if tiki.use_lib then - solution:add_project( sdl_project ) - end -end diff --git a/src/externals/https/github.com/richgel999/miniz/tiki.lua b/src/externals/https/github.com/richgel999/miniz/tiki.lua index 5880b11..5452325 100644 --- a/src/externals/https/github.com/richgel999/miniz/tiki.lua +++ b/src/externals/https/github.com/richgel999/miniz/tiki.lua @@ -3,7 +3,7 @@ local repo_name = "richgel999/miniz" if tiki.external.version == "latest" then local response, result_code = http.get( "https://api.github.com/repos/" .. repo_name .. "/releases/latest" ) - local response_json = json.decode( response ) + local response_json = json.decode( response ) tiki.external.version = response_json.tag_name end