Skip to content

Commit

Permalink
rhosimulator/qt: now compiles on Windows with qmake and Qt Creator (b…
Browse files Browse the repository at this point in the history
…ut crashes when executed)
  • Loading branch information
timashev authored and dmitrys committed Jul 12, 2011
1 parent 63a0724 commit 91afc3a
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 67 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -155,5 +155,6 @@ xcuserdata
Manifest.java

platform/shared/qt/rhodes/GeneratedFiles/*
platform/shared/qt/*/Makefile
platform/shared/qt/*/Makefile*
platform/shared/qt/Makefile*
platform/osx/bin/*
2 changes: 1 addition & 1 deletion platform/osx/RhoSimulator/build.sh
Expand Up @@ -15,6 +15,6 @@ cd ../syncengine
qmake -o Makefile -spec macx-g++ syncengine.pro
make all
cd ../rhodes
qmake -o Makefile -spec macx-g++ RhoSimulator.pro
qmake -o Makefile -spec macx-g++ rhodes.pro
make all
cd ../../../osx/
4 changes: 4 additions & 0 deletions platform/shared/qt/RhoSimulator.pro
@@ -0,0 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = rubylib rholib sqlite3 syncengine
CONFIG += ordered
SUBDIRS += rhodes
6 changes: 4 additions & 2 deletions platform/shared/qt/curl/curl.pro
Expand Up @@ -12,8 +12,10 @@ macx {

DEFINES += RHODES_EMULATOR

QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
!win32 {
QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
}

INCLUDEPATH += ../..

Expand Down
49 changes: 49 additions & 0 deletions platform/shared/qt/pro_vcproj_diff.pl
@@ -0,0 +1,49 @@
#!/usr/bin/perl

open(PRO,$ARGV[0]);
while($line=<PRO>) {
$line =~ s/^\s*(HEADERS|SOURCES)\s*\+=\s*//;
if ($line =~ /^\s*([\w+\/\.]+\.(h|c|cpp))\s*\\?\s*$/) {
$FILES{lc($1)} = 1;
}
}
close(PRO);

open(VCPROJ,$ARGV[1]);
while($line=<VCPROJ>) {
if ($line =~ /^\s*RelativePath\s*=\s*\"([\w+\\\.]+\.(h|c|cpp))\"\s*$/) {
$filepath = $1;
$filepath =~ s/\.\.\\\.\.\\shared\\/\.\.\/\.\.\//;
$filepath =~ s/\\/\//g;
$filepath =~ s/\.\.\/\.\.\/qt\/rhodes\///;
$type = ($filepath =~ /\.h$/ ? 0 : 1);
if (!$FILES{lc($filepath)}) {
$NEW[$type]{$filepath} = 1;
}
$FILES{lc($filepath)} = 2;
}
}
close(VCPROJ);

foreach $filepath (keys %FILES) {
if ($FILES{$filepath}==1) {
$type = ($filepath =~ /\.h$/ ? 0 : 1);
$DEL[$type]{$filepath} = 1;
}
}

print "NEW:\n\n";
for $type (0..$#NEW) {
for $filepath (sort {$a cmp $b} keys %{$NEW[$type]}) {
print "$filepath\\\n";
}
print "\n";
}

print "DELETE:\n\n";
for $type (0..$#DEL) {
for $filepath (sort {$a cmp $b} keys %{$DEL[$type]}) {
print "$filepath\\\n";
}
print "\n";
}
79 changes: 59 additions & 20 deletions platform/shared/qt/rhodes/RhoSimulator_debug.pro
Expand Up @@ -12,21 +12,73 @@ macx {
OBJECTS_DIR = ../../../osx/bin/RhoSimulator/tmp
RCC_DIR = ../../../osx/bin/RhoSimulator/resources
LIBS += -lcurl
INCLUDEPATH += ../../ruby/iphone
HEADERS += ../../ruby/iphone/ruby/config.h\
../../ruby/iphone/crt_externs.h
INCLUDEPATH += ../../ruby/iphone\
../../curl/include
HEADERS += ../../ruby/ext/socket/constants.h\
../../ruby/iphone/ruby/config.h\
../../ruby/iphone/crt_externs.h\
../../common/PosixThreadImpl.h\
../../net/CURLNetRequest.h\
../../net/ssl.h\
../../ruby/iseq.h\
../../ruby/thread_pthread.h\
../../sync/ISyncProtocol.h\
../../sync/SyncProtocol_3.h
SOURCES += ../../common/PosixThreadImpl.cpp\
../../net/CURLNetRequest.cpp\
../../net/ssl.cpp\
../../ruby/miniprelude.c\
../../ruby/newline.c\
../../ruby/thread_pthread.c\
../../sqlite/crypto.c
}

win32 {
CONFIG += embed_manifest_exe
DESTDIR = ../../../win32/bin/RhoSimulator
MOC_DIR = ../../../win32/bin/RhoSimulator/generated_files
UI_DIR = ../../../win32/bin/RhoSimulator/generated_files
OBJECTS_DIR = ../../../win32/bin/RhoSimulator/tmp
RCC_DIR = ../../../win32/bin/RhoSimulator/resources
DEFINES += _NDEBUG NDEBUG WIN32 _WINDOWS _UNICODE UNICODE QT_LARGEFILE_SUPPORT QT_NO_DEBUG QT_CORE_LIB QT_GUI_LIB QT_WEBKIT_LIB
LIBS += wininet.lib comsuppwd.lib ws2_32.lib Crypt32.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
INCLUDEPATH += ../../ruby/win32
HEADERS += ../../common/RhoMath.h\
../../common/map/ESRIMapEngine.h\
../../common/map/GoogleMapEngine.h\
../../common/map/MapEngine.h\
../../rubyext/WebView.h\
../../ruby/win32/ruby/config.h\
../../ruby/win32/dir.h
SOURCES += ../../ruby/missing/acosh.c\
../../ruby/missing/cbrt.c\
../../ruby/missing/crypt.c\
../../ruby/missing/dup2.c\
../../ruby/missing/erf.c\
../../ruby/missing/hypot.c\
../../ruby/missing/tgamma.c\
../../ruby/missing/strlcpy.c\
../../ruby/missing/strlcat.c\
../../ruby/win32/miniprelude.c\
../../ruby/win32/newline.c\
../../ruby/win32/win32.c\
../../common/RhoMath.cpp\
../../common/map/ESRIMapEngine.cpp\
../../common/map/GoogleMapEngine.cpp\
../../common/map/MapEngine.cpp
}

DEFINES += RHODES_EMULATOR

QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
!win32 {
QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
}

INCLUDEPATH += ../..\
../../ruby\
../../ruby/include\
../../ruby/generated\
../../curl/include
../../ruby/generated

HEADERS +=ExternalWebView.h\
MainWindowCallback.h\
Expand All @@ -39,15 +91,13 @@ impl/NativeToolbarImpl.h\
impl/NativeTabbarImpl.h\
../../ruby/ext/rho/rhoruby.h\
../../ruby/ext/socket/addrinfo.h\
../../ruby/ext/socket/constants.h\
../../ruby/ext/socket/sockport.h\
../../ruby/ext/calendar/event.h\
../../ruby/debug.h\
../../ruby/dln.h\
../../ruby/eval_intern.h\
../../ruby/gc.h\
../../ruby/id.h\
../../ruby/iseq.h\
../../ruby/regenc.h\
../../ruby/regint.h\
../../ruby/regparse.h\
Expand All @@ -56,7 +106,6 @@ impl/NativeTabbarImpl.h\
../../ruby/version.h\
../../ruby/vm_core.h\
../../ruby/vm_opts.h\
../../ruby/thread_pthread.h\
../../common/RhoAppAdapter.h\
../../common/IRhoThreadImpl.h\
../../common/RhoThread.h\
Expand Down Expand Up @@ -89,13 +138,10 @@ impl/NativeTabbarImpl.h\
../../common/ThreadQueue.h\
../../net/URI.h\
../../common/AppMenu.h\
../../common/PosixThreadImpl.h\
../../net/CURLNetRequest.h\
../../net/INetRequest.h\
../../net/HttpServer.h\
../../common/SplashScreen.h\
../../common/rhoparams.h\
../../net/ssl.h\
../../common/app_build_configs.h\
../../sqlite/sqlite3.h\
../../sqlite/sqlite3ext.h\
Expand Down Expand Up @@ -228,10 +274,7 @@ impl/NativeTabbarImpl.cpp\
../../ruby/ext/strscan/strscan.c\
../../ruby/ext/syncengine/syncengine_wrap.c\
../../ruby/generated/parse.c\
../../ruby/thread_pthread.c\
../../ruby/miniprelude.c\
../../ruby/missing/lgamma_r.c\
../../ruby/newline.c\
../../ruby/ext/mapview/mapview_wrap.c\
../../ruby/ext/signature/signature_wrap.c\
../../ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c\
Expand Down Expand Up @@ -259,14 +302,10 @@ impl/NativeTabbarImpl.cpp\
../../common/AppMenu.cpp\
../../common/rhoparams.cpp\
../../rubyext/System.cpp\
../../common/PosixThreadImpl.cpp\
../../net/CURLNetRequest.cpp\
../../net/HttpServer.cpp\
../../common/SplashScreen.cpp\
../../net/ssl.cpp\
../../common/app_build_configs.c\
../../sqlite/sqlite3.c\
../../sqlite/crypto.c\
../../json/arraylist.c\
../../json/json_debug.c\
../../json/json_object.c\
Expand Down
20 changes: 16 additions & 4 deletions platform/shared/qt/rhodes/impl/RhoClassFactoryImpl.h
@@ -1,10 +1,20 @@
#pragma once

#include <time.h>
#include "common/RhoDefs.h"
#include "common/IRhoClassFactory.h"
#ifdef OS_WINDOWS
#define CNETREQUESTIMPL NULL
#define CRHOTHREADIMPL NULL
#define CRHOCRYPTIMPL NULL
#else
#include "net/CURLNetRequest.h"
#include "common/PosixThreadImpl.h"
// #include "net/iphone/sslimpl.h"
#define CNETREQUESTIMPL new net::CURLNetRequest()
#define CRHOTHREADIMPL new CPosixThreadImpl()
#define CRHOCRYPTIMPL NULL
#endif
// #include "RhoCryptImpl.h"

namespace rho {
Expand All @@ -15,12 +25,14 @@ class CRhoClassFactory : public common::IRhoClassFactory
public:
net::INetRequestImpl* createNetRequestImpl()
{
return new net::CURLNetRequest();
return CRHOCRYPTIMPL;
}

common::IRhoThreadImpl* createThreadImpl()
{
return new CPosixThreadImpl;
return CRHOTHREADIMPL;
}

net::ISSL* createSSLEngine()
{
//TODO: createSSLEngine
Expand All @@ -29,8 +41,8 @@ class CRhoClassFactory : public common::IRhoClassFactory

IRhoCrypt* createRhoCrypt()
{
//TODO: createRhoCrypt
return NULL; // new CRhoCryptImpl();
//TODO: createRhoCrypt on Mac OS X
return CRHOCRYPTIMPL;
}
};

Expand Down
3 changes: 3 additions & 0 deletions platform/shared/qt/rhodes/impl/SystemImpl.cpp
@@ -1,5 +1,6 @@
#include <time.h>
#include "ruby/ext/rho/rhoruby.h"
#include "common/RhoDefs.h"
#include "common/RhoPort.h"
//#include "common/StringConverter.h"
#include "common/RhoFilePath.h"
Expand Down Expand Up @@ -198,10 +199,12 @@ void rho_sys_app_uninstall(const char *appname)
//TODO: rho_sys_app_uninstall
}

#ifndef OS_WINDOWS
int rho_sys_set_sleeping(int sleeping)
{
//TODO: rho_sys_set_sleeping
return 1;
}
#endif

} //extern "C"
Expand Up @@ -19,10 +19,31 @@ macx {
LIBS += -L../../../osx/bin/syncengine -lsyncengine
}

win32 {
CONFIG += embed_manifest_exe
DESTDIR = ../../../win32/bin/RhoSimulator
MOC_DIR = ../../../win32/bin/RhoSimulator/generated_files
UI_DIR = ../../../win32/bin/RhoSimulator/generated_files
OBJECTS_DIR = ../../../win32/bin/RhoSimulator/tmp
RCC_DIR = ../../../win32/bin/RhoSimulator/resources
DEFINES += _NDEBUG NDEBUG WIN32 _WINDOWS _UNICODE UNICODE QT_LARGEFILE_SUPPORT QT_NO_DEBUG QT_CORE_LIB QT_GUI_LIB QT_WEBKIT_LIB _CRT_SECURE_NO_WARNINGS
LIBS += ../../../win32/bin/rubylib/rubylib.lib\
../../../win32/bin/rholib/rholib.lib\
../../../win32/bin/sqlite3/sqlite3.lib\
../../../win32/bin/syncengine/syncengine.lib\
wininet.lib comsuppwd.lib ws2_32.lib Crypt32.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
}

DEFINES += RHODES_EMULATOR

QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
!win32 {
QMAKE_CFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
QMAKE_CXXFLAGS_WARN_ON += -Wno-extra -Wno-unused -Wno-sign-compare -Wno-format -Wno-parentheses
}
win32 {
QMAKE_CFLAGS_RELEASE += /O2
QMAKE_CXXFLAGS_RELEASE += /O2
}

INCLUDEPATH += ../..\
../../ruby\
Expand All @@ -36,7 +57,8 @@ QtWebInspector.h\
impl/RhoClassFactoryImpl.h\
impl/MainWindowImpl.h\
impl/NativeToolbarImpl.h\
impl/NativeTabbarImpl.h
impl/NativeTabbarImpl.h\
../../rubyext/NativeToolbarExt.h

SOURCES += main.cpp\
ExternalWebView.cpp\
Expand Down

0 comments on commit 91afc3a

Please sign in to comment.