diff --git a/Builds/QtCreator/Ember/Ember.pro b/Builds/QtCreator/Ember/Ember.pro
index e783f5a..f2d5489 100644
--- a/Builds/QtCreator/Ember/Ember.pro
+++ b/Builds/QtCreator/Ember/Ember.pro
@@ -16,7 +16,7 @@ INSTALLS += target
QMAKE_CXXFLAGS += -D_USRDLL
QMAKE_CXXFLAGS += -D_CONSOLE
QMAKE_CXXFLAGS += -BUILDING_EMBER
-
+win32: DEFINES +=BUILDING_EMBER
SOURCES += \
$$PRJ_DIR/Affine2D.cpp \
$$PRJ_DIR/DllMain.cpp \
diff --git a/Builds/QtCreator/EmberCL/EmberCL.pro b/Builds/QtCreator/EmberCL/EmberCL.pro
index 299dbb4..2ebab86 100644
--- a/Builds/QtCreator/EmberCL/EmberCL.pro
+++ b/Builds/QtCreator/EmberCL/EmberCL.pro
@@ -18,6 +18,7 @@ LIBS += -L$$absolute_path($$DESTDIR) -lEmber
QMAKE_CXXFLAGS += -D_USRDLL
QMAKE_CXXFLAGS += -D_CONSOLE
QMAKE_CXXFLAGS += -BUILDING_EMBERCL
+win32: DEFINES +=BUILDING_EMBERCL
SOURCES += \
$$PRJ_DIR/DEOpenCLKernelCreator.cpp \
diff --git a/Builds/QtCreator/defaults.pri b/Builds/QtCreator/defaults.pri
index 77861cd..dfc4029 100644
--- a/Builds/QtCreator/defaults.pri
+++ b/Builds/QtCreator/defaults.pri
@@ -1,5 +1,5 @@
VERSION = 0.9.9.2
-
+win32:CONFIG += skip_target_version_ext
message(PWD: $$(PWD))
# TODO: win32 install dirs?
@@ -18,6 +18,22 @@ autobuild {
EMBER_ROOT = $$(PWD)/../..
}
+win32:{
+ EMBER_ROOT = $$(PWD)../../..
+ EXTERNAL_DIR = $$(PWD)../../../../External
+ EXTERNAL_LIB = $$(PWD)../../../External/libs
+# EXTERNAL_DIR which contains Third Party Codes is in the parent folder of "fractorium"
+# EXTERNAL_LIB is in EXTERNAL_DIR actually, but it is strange that EXTERNAL_DIR must go
+# one more step upper than EXTERNAL_LIB to get it work
+ LIB_INSTALL_DIR = $$(PWD)../../../Install/lib
+ BIN_INSTALL_DIR = $$(PWD)../../../Install/bin
+ SHARE_INSTALL_DIR = $$(PWD)../../../Install/share/fractorium
+# INSTALL_DIRs Don't work?
+ message(EMBER_ROOT: $$absolute_path($$EMBER_ROOT))
+ message(EXTERNAL: $$absolute_path($$EXTERNAL_DIR))
+ message(EXTERNAL_LIB:$$absolute_path($$EXTERNAL_LIB) )
+}
+
message(EMBER_ROOT: $$EMBER_ROOT)
SRC_DIR = $$EMBER_ROOT/Source
@@ -26,13 +42,19 @@ ASSETS_DIR = $$EMBER_ROOT/Data
LOCAL_LIB_DIR = $$(PWD)/../../lib
LOCAL_INCLUDE_DIR = $$(PWD)/../../include
+win32:{
+ LOCAL_LIB_DIR = $$(PWD)../../lib
+ LOCAL_INCLUDE_DIR = $$(PWD)../../include
+}
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = $$(PWD)/../../../Bin/release
+ win32:DESTDIR = $$(PWD)../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = $$(PWD)/../../../Bin/debug
+ win32:DESTDIR = $$(PWD)../../../Bin/debug
}
macx {
@@ -51,7 +73,7 @@ macx {
QMAKE_CXXFLAGS += -stdlib=libc++
}
-!macx {
+!macx:!win32 {
CONFIG += precompile_header
LIBS += -L/usr/lib/x86_64-linux-gnu -L$$LOCAL_LIB_DIR -lGL
@@ -59,25 +81,35 @@ macx {
QMAKE_LFLAGS_RELEASE += -s
}
+# Win32: put "GlU32.Lib" "WS2_32.Lib" "OpenGL32.Lib" under "MSVC2013\Windows Kits\8.1\Lib\winv6.3\um\x64\" ,
+# and "CUDA\v7.5\lib\x64\OpenCL.lib" into $$EXTERNAL_LIB
+win32 {
-native {
- QMAKE_CXXFLAGS += -march=native
-} else {
- QMAKE_CXXFLAGS += -march=k8
+ LIBS +=$$absolute_path($$EXTERNAL_LIB)/GlU32.Lib
+ LIBS +=$$absolute_path($$EXTERNAL_LIB)/OpenGL32.lib
+ LIBS +=$$absolute_path($$EXTERNAL_LIB)/WS2_32.lib
+ LIBS +=$$absolute_path($$EXTERNAL_LIB)/OpenCL.lib
+}
+!win32 {
+ native {
+ QMAKE_CXXFLAGS += -march=native
+ } else {
+ QMAKE_CXXFLAGS += -march=k8
+ }
}
OBJECTS_DIR = $$PWD/.obj
MOC_DIR = $$PWD/.moc
RCC_DIR = $$PWD/.qrc
UI_DIR = $$PWD/.ui
+!win32 {
+ LIBS += -L/usr/lib -ljpeg
+ LIBS += -L/usr/lib -lpng
+ LIBS += -L/usr/lib -ltbb
+ LIBS += -L/usr/lib -lpthread
+ LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2
-LIBS += -L/usr/lib -ljpeg
-LIBS += -L/usr/lib -lpng
-LIBS += -L/usr/lib -ltbb
-LIBS += -L/usr/lib -lpthread
-LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2
-
-CMAKE_CXXFLAGS += -DCL_USE_DEPRECATED_OPENCL_1_1_APIS
+ CMAKE_CXXFLAGS += -DCL_USE_DEPRECATED_OPENCL_1_1_APIS
# NOTE: last path will be the first to search. gcc -I and -L appends to the
# beginning of the path list.
@@ -85,52 +117,69 @@ CMAKE_CXXFLAGS += -DCL_USE_DEPRECATED_OPENCL_1_1_APIS
# NOTE: qmake will resolve symlinks. If /usr/local/include/CL is a symlink to
# /usr/include/nvidia-352/CL, qmake will generate Makefiles using the latter.
-INCLUDEPATH += /usr/include
-INCLUDEPATH += /usr/local/include
+ INCLUDEPATH += /usr/include
+ INCLUDEPATH += /usr/local/include
+}
+
INCLUDEPATH += $$LOCAL_INCLUDE_DIR/vendor
INCLUDEPATH += $$LOCAL_INCLUDE_DIR
# Using a local version of opencl-headers, to make sure version 1.2.
#INCLUDEPATH += /usr/include/CL
#INCLUDEPATH += /usr/local/include/CL
+!win32 {
+ INCLUDEPATH += /usr/include/GL
+ INCLUDEPATH += /usr/local/include/GL
-INCLUDEPATH += /usr/include/GL
-INCLUDEPATH += /usr/local/include/GL
-
-INCLUDEPATH += /usr/include/glm
-INCLUDEPATH += /usr/include/tbb
-INCLUDEPATH += /usr/include/libxml2
+ INCLUDEPATH += /usr/include/glm
+ INCLUDEPATH += /usr/include/tbb
+ INCLUDEPATH += /usr/include/libxml2
+}
+win32 {
+ INCLUDEPATH += $$EXTERNAL_DIR/glm
+ INCLUDEPATH += $$EXTERNAL_DIR/tbb/include
+ INCLUDEPATH += $$EXTERNAL_DIR/libjpeg
+ INCLUDEPATH += $$EXTERNAL_DIR/libpng
+ INCLUDEPATH += $$EXTERNAL_DIR/libxml2/include
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/libjpeg.lib
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/libpng.lib /NODEFAULTLIB:LIBCMT
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/libxml2.lib
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/tbb.lib
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/tbb_debug.lib
+ LIBS += $$absolute_path($$EXTERNAL_LIB)/zlib.lib
+}
INCLUDEPATH += $$SRC_DIR/Ember
INCLUDEPATH += $$SRC_DIR/EmberCL
INCLUDEPATH += $$SRC_DIR/EmberCommon
QMAKE_CXXFLAGS_RELEASE += -O2
QMAKE_CXXFLAGS_RELEASE += -DNDEBUG
-QMAKE_CXXFLAGS_RELEASE += -fomit-frame-pointer
-
-QMAKE_CXXFLAGS += -fPIC
-QMAKE_CXXFLAGS += -fpermissive
-QMAKE_CXXFLAGS += -pedantic
-QMAKE_CXXFLAGS += -std=c++11
-QMAKE_CXXFLAGS += -Wnon-virtual-dtor
-QMAKE_CXXFLAGS += -Wshadow
-QMAKE_CXXFLAGS += -Winit-self
-QMAKE_CXXFLAGS += -Wredundant-decls
-QMAKE_CXXFLAGS += -Wcast-align
-QMAKE_CXXFLAGS += -Winline
-QMAKE_CXXFLAGS += -Wunreachable-code
-QMAKE_CXXFLAGS += -Wmissing-include-dirs
-QMAKE_CXXFLAGS += -Wswitch-enum
-QMAKE_CXXFLAGS += -Wswitch-default
-QMAKE_CXXFLAGS += -Wmain
-QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant
-QMAKE_CXXFLAGS += -Wfatal-errors
-QMAKE_CXXFLAGS += -Wall -fpermissive
-QMAKE_CXXFLAGS += -Wold-style-cast
-QMAKE_CXXFLAGS += -Wno-unused-parameter
-QMAKE_CXXFLAGS += -Wno-unused-function
-QMAKE_CXXFLAGS += -Wold-style-cast
+!win32 {
+ QMAKE_CXXFLAGS_RELEASE += -fomit-frame-pointer
+ QMAKE_CXXFLAGS += -fPIC
+ QMAKE_CXXFLAGS += -fpermissive
+ QMAKE_CXXFLAGS += -pedantic
+ QMAKE_CXXFLAGS += -std=c++11
+ QMAKE_CXXFLAGS += -Wnon-virtual-dtor
+ QMAKE_CXXFLAGS += -Wshadow
+ QMAKE_CXXFLAGS += -Winit-self
+ QMAKE_CXXFLAGS += -Wredundant-decls
+ QMAKE_CXXFLAGS += -Wcast-align
+ QMAKE_CXXFLAGS += -Winline
+ QMAKE_CXXFLAGS += -Wunreachable-code
+ QMAKE_CXXFLAGS += -Wmissing-include-dirs
+ QMAKE_CXXFLAGS += -Wswitch-enum
+ QMAKE_CXXFLAGS += -Wswitch-default
+ QMAKE_CXXFLAGS += -Wmain
+ QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant
+ QMAKE_CXXFLAGS += -Wfatal-errors
+ QMAKE_CXXFLAGS += -Wall -fpermissive
+ QMAKE_CXXFLAGS += -Wold-style-cast
+ QMAKE_CXXFLAGS += -Wno-unused-parameter
+ QMAKE_CXXFLAGS += -Wno-unused-function
+ QMAKE_CXXFLAGS += -Wold-style-cast
+}
QMAKE_CXXFLAGS += -D_M_X64
QMAKE_CXXFLAGS += -D_CONSOLE
QMAKE_CXXFLAGS += -D_USRDLL
-
+win32:QMAKE_CXXFLAGS += -bigobj
diff --git a/Data/BuildGuideQtCreator.md b/Data/BuildGuideQtCreator.md
new file mode 100644
index 0000000..d7cec8e
--- /dev/null
+++ b/Data/BuildGuideQtCreator.md
@@ -0,0 +1,224 @@
+#Building Guide for Fractorium Using MSVC2013 and Qt Creator (64 bit)
+##Requirements
+
+You need to have MSVC2013 compiler and Qt for Windows 64-bit (VS 2013) like Qt 5.5.1 (http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-msvc2013_64-5.5.1.exe)
+
+##Prerequisites
+Download Prerequisites ( /glm /libjpeg /libpng /libxml2 /tbb /zlib ) according to [mfeemster's wiki](https://github.com/mfeemster/fractorium/wiki/Building).
+Extract them in the parallel folder of `fractorium` named `External`
+You can refer to the [folder structure](#folder-structure) below
+Open your `Visual Studio Tools Command Prompt (amd64 2013)` and do the followings in folders below:
+
+######\External\libjpeg (jpegsr9a.zip)
+- run in prompt
+
+ ```
+ SET Include=%Include%;"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
+ ```
+
+ (to include WIN32.mak)
+ (I use `SET Include=%Include%;"B:\MSVC2013\Windows Kits\v7.1A\Include"`)
+
+ ```
+ nmake /f makefile.vc setup-v10
+ nmake nodebug=1 /f makefile.vc clean all
+ ```
+
+ copy `libjpeg.lib` in `External\libjpeg` to `External\libs`
+
+
+###### \External\zlib (zlib128.zip)
+- run in prompt
+
+ ```
+ nmake -f win32/Makefile.msc clean all
+ ```
+
+ copy `zlib.lib` in `External\zlib` to `External\libs`
+
+###### \External\libxml2 (libxml2-2.9.3.zip)
+- cd to `External\libxml2\win32`
+
+ ```
+ cscript configure.js compiler=msvc iconv=no zlib=yes include=..\..\zlib lib=..\..\zlib
+ nmake /f Makefile.msvc clean all
+ ```
+
+ copy `libxml2.lib` in `External\libxml2\win32\bin.msvc` to `External\libs`
+
+###### \External\libpng (lpng1620.zip)
+- First, copy `zlib.lib` `zlib.h` and `zconf.h` to `External\libpng\zlib` (create this folder if no exsiting)
+
+ ```
+ nmake -f scripts\makefile.vcwin32 clean all
+ ```
+
+ copy `libpng.lib` in `External\libpng` to `External\libs`
+
+###### \External\glm (glm-0.9.6.3.zip)
+- noting to do, make sure you extract it correctly.
+
+###### \External\tbb (tbb44_20151115oss_win_0.zip)
+- copy `External\tbb\lib\intel64\vc12\tbb_debug.lib` and `External\tbb\lib\intel64\vc12\tbb.lib` to `External\libs`
+
+##Collect libs and includes
+###### \External\libs
+- copy `GlU32.Lib` `WS2_32.Lib` `OpenGL32.Lib` under `MSVC2013\Windows Kits\8.1\Lib\winv6.3\um\x64`
+ to this folder (`\External\libs`)
+ install CUDA toolkit and copy `CUDA\v7.5\lib\x64\OpenCL.lib` to this folder (`\External\libs`)
+
+- Now you should already have these files in the folder:
+
+ ```
+ GlU32.Lib
+ libjpeg.lib
+ libpng.lib
+ libxml2.lib
+ OpenCL.lib
+ OpenGL32.Lib
+ tbb.lib
+ tbb_debug.lib
+ WS2_32.Lib
+ zlib.lib
+ ```
+
+###### \fractorium\Builds\lib
+- copy anything(they are `*.h`) under `CUDA\v7.5\include\CL`
+ to this folder `\fractorium\Builds\include\vendor\CL` (overwrite)
+
+**All Done!**
+
+
+You shuold have folder structure like this:
+
+```
+[YOUR ROOT FOLDER]
+│
+├─External
+│ ├─glm
+│ │ ├─glm
+│ │ ...
+│ ├─libjpeg
+│ ├─libpng
+│ │ ├─scripts
+│ │ ├─zlib
+│ │ ...
+│ ├─libs
+│ │ GlU32.Lib
+│ │ libjpeg.lib
+│ │ libpng.lib
+│ │ libxml2.lib
+│ │ OpenCL.lib
+│ │ OpenGL32.Lib
+│ │ tbb.lib
+│ │ tbb_debug.lib
+│ │ WS2_32.Lib
+│ │ zlib.lib
+│ │
+│ ├─libxml2
+│ │ ├─include
+│ │ │ └─libxml
+│ │ ...
+│ ├─tbb
+│ │ ├─include
+│ │ │ ├─serial
+│ │ │ │ └─tbb
+│ │ │ └─tbb
+│ │ │ ├─compat
+│ │ │ ├─internal
+│ │ │ └─machine
+│ │ ├─lib
+│ │ │ ├─ia32
+│ │ │ │
+│ │ │ └─intel64
+│ │ │ ├─vc10
+│ │ │ ├─vc12
+│ │ ... ...
+│ └─zlib
+│ ├─win32
+│ ...
+└─fractorium
+ ├─archive
+ ├─Builds
+ │ ├─lib
+ │ ├─QtCreator
+ │ ...
+ ├─Data
+ │
+ ├─debian
+ │
+ └─Source
+```
+
+##Begin to build
+Open Qt Project `fractorium/main.pro` using Qt Creator with config like *Desktop Qt 5.5.1 MSVC2013 OpenGL 64bit*
+**DO TURN OFF** "shadow build option" in "Edit build configuration" for both `Debug` and `Release`
+
+Switch to `Release` configuration and Build!
+
+You can find outputs `under fractorium\Bin\release` several minutes later if no error occurs.
+
+```
+Ember.dll
+Ember.exp
+Ember.lib
+emberanimate.exe
+EmberCL.dll
+EmberCL.exp
+EmberCL.lib
+embergenome.exe
+emberrender.exe
+fractorium.exe
+```
+
+To run it, put exes and dlls above and these files together in one folder
+```
+Qt5.5.1\5.5\msvc2013_64\bin\Qt5OpenGL.dll
+Qt5.5.1\5.5\msvc2013_64\bin\Qt5Widgets.dll
+Qt5.5.1\5.5\msvc2013_64\bin\Qt5Core.dll
+Qt5.5.1\5.5\msvc2013_64\bin\Qt5Gui.dll
+Qt5.5.1\5.5\msvc2013_64\plugins\platforms\qwindows.dll (put in folder "platforms")
+External\libxml2\win32\bin.msvc\libxml2.dll
+External\tbb\bin\intel64\vc12\tbb.dll
+fractorium\Data\dark.qss
+fractorium\Data\flam3-palettes.xml
+```
+
+To run on another computer, maybe these files are needed to be shipped with:
+
+```
+MSVC2013\VC\redist\x64\Microsoft.VC120.CRT\msvcp120.dll
+MSVC2013\VC\redist\x64\Microsoft.VC120.CRT\msvcr120.dll
+MSVC2013\VC\redist\x64\Microsoft.VC120.CRT\vccorlib120.dll
+```
+
+or you can install *Visual C++ Redistributable Packages for Visual Studio 2013 (64 bit)*
+
+####Output file structure
+
+```
+[YOUR FOLDER]
+│ dark.qss
+│ Ember.dll
+│ emberanimate.exe
+│ EmberCL.dll
+│ embergenome.exe
+│ emberrender.exe
+│ flam3-palettes.xml
+│ fractorium.exe
+│ libxml2.dll
+│ Qt5Core.dll
+│ Qt5Gui.dll
+│ Qt5OpenGL.dll
+│ Qt5Widgets.dll
+│ tbb.dll
+│
+│ vccorlib120.dll (optional)
+│ msvcp120.dll (optional)
+│ msvcr120.dll (optional)
+│
+└─platforms
+ qwindows.dll
+```
+
+####Have Fun!
diff --git a/README.md b/README.md
index 0942674..1b0567a 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,11 @@ Mac OS/X (10.9+): TODO
# Building from git
## Windows
+Install Git-GUI and clone `https://github.com/mfeemster/fractorium.git`
-TODO
+Then follow:
+
+[**Building Guide for Fractorium Using MSVC2013 and Qt Creator (64 bit)**](Data/BuildGuideQtCreator.md)
## Linux
diff --git a/Source/EmberCommon/JpegUtils.h b/Source/EmberCommon/JpegUtils.h
index 580c438..374c897 100644
--- a/Source/EmberCommon/JpegUtils.h
+++ b/Source/EmberCommon/JpegUtils.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "EmberCommonPch.h"
@@ -73,9 +73,15 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he
info.image_width = JDIMENSION(width);
info.image_height = JDIMENSION(height);
jpeg_set_defaults(&info);
- jpeg_set_quality(&info, quality, TRUE);
- jpeg_start_compress(&info, TRUE);
-
+ #ifdef _WIN32
+ jpeg_set_quality(&info, quality, static_cast(TRUE));
+ jpeg_start_compress(&info, static_cast(TRUE));
+ //Win32:TRUE is defined in MSVC2013\Windows Kits\8.1\Include\shared\minwindef.h:"#define TRUE 1"
+ //cast from int to boolean in External/libjpeg/jmorecfg.h:"typedef enum { FALSE = 0, TRUE =1 } boolean;"
+ #else
+ jpeg_set_quality(&info, quality, TRUE);
+ jpeg_start_compress(&info, TRUE);
+ #endif
//Write comments to jpeg.
if (enableComments)
{