From dd4fcd450016648c1d8f298cea762e9b1308fbb5 Mon Sep 17 00:00:00 2001 From: halcanary Date: Thu, 12 May 2016 11:25:00 -0700 Subject: cmake: fixes for windows Review-Url: https://codereview.chromium.org/1975933002 --- cmake/CMakeLists.txt | 11 +++++++---- cmake/README.md | 26 +++++++++++++++++++------- cmake/example.cpp | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) (limited to 'cmake') 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 + + + + 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 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 surface = (gl_ok && rand() % 2) ? create_opengl_surface(320, 240) : create_raster_surface(320, 240); -- cgit v1.2.3