aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-05-12 11:25:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-12 11:25:01 -0700
commitdd4fcd450016648c1d8f298cea762e9b1308fbb5 (patch)
treee1dfd4a214d1742ea88177cd24d085da466311ae /cmake
parent04c84af8777e973ae6e5912e06617a37f391e2f5 (diff)
cmake: fixes for windows
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt11
-rw-r--r--cmake/README.md26
-rw-r--r--cmake/example.cpp2
3 files changed, 27 insertions, 12 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index f1a96a9818..bdb5ecb640 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -123,10 +123,12 @@ file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp)
file (GLOB_RECURSE sse41_srcs ../src/*sse4*.cpp ../src/*SSE4*.cpp)
file (GLOB_RECURSE avx_srcs ../src/*_avx.cpp)
file (GLOB_RECURSE avx2_srcs ../src/*_avx2.cpp)
-set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3)
-set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1)
-set_source_files_properties(${avx_srcs} PROPERTIES COMPILE_FLAGS -mavx)
-set_source_files_properties(${avx2_srcs} PROPERTIES COMPILE_FLAGS -mavx2)
+if (NOT WIN32)
+ set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3)
+ set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1)
+ set_source_files_properties(${avx_srcs} PROPERTIES COMPILE_FLAGS -mavx)
+ set_source_files_properties(${avx2_srcs} PROPERTIES COMPILE_FLAGS -mavx2)
+endif()
# Detect our optional dependencies.
# If we can't find them, don't build the parts of Skia that use them.
@@ -265,6 +267,7 @@ target_link_libraries(skia
PRIVATE ${libs})
if (MSVC)
+ string(REGEX REPLACE " /W3 " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(cc_flags "/w /GR-")
else()
set(cc_flags "-w -fno-rtti -fno-exceptions")
diff --git a/cmake/README.md b/cmake/README.md
index 0cbd2b369e..f8a54f33e7 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -6,12 +6,17 @@ not at day-to-day Skia development.
Quickstart
----------
- $ cd skia/cmake
- $ cmake . -G Ninja # Other CMake generators should work fine.
- $ ninja
- $ ls -l libskia.* example
- $ ./example
- $ open example.png
+
+<!--?prettify lang=sh?-->
+
+ git clone https://skia.googlesource.com/skia.git
+ cd skia/cmake
+ cmake . -G Ninja # Other CMake generators should work fine.
+ ninja
+ ls -l libskia.* example
+ ./example
+ open example.png || xdg-open example.png
+
If that works, you should see "Hello World!" with a green-to-purple gradient.
Currently supported platforms
@@ -20,4 +25,11 @@ Currently supported platforms
Currently maybe-kinda-working platforms
---------------------------------------
- - x86-64 Mac OS X, Ubuntu 15.04
+ - x86-64 Mac OS X
+ - x86-64 Ubuntu 15.04
+ - x86-64 Windows 10, with extra caveats:
+ * Compiles against DirectWrite, not GDI, for fonts
+ * Configure with `cmake . -G "Visual Studio 14 2015"` .
+ * Compile with `cmake --build . --config Release` .
+ * Still has too many warnings.
+ * Poorly tested as yet. \ No newline at end of file
diff --git a/cmake/example.cpp b/cmake/example.cpp
index 20259b5589..38ce901450 100644
--- a/cmake/example.cpp
+++ b/cmake/example.cpp
@@ -60,7 +60,7 @@ static std::shared_ptr<SkSurface> create_opengl_surface(int w, int h) {
int main(int, char**) {
bool gl_ok = setup_gl_context();
- srand(time(nullptr));
+ srand((unsigned)time(nullptr));
std::shared_ptr<SkSurface> surface = (gl_ok && rand() % 2) ? create_opengl_surface(320, 240)
: create_raster_surface(320, 240);