windows build for sokol

This commit is contained in:
Vadim Grigoruk 2018-09-25 11:47:18 +03:00
parent ca2deef8c6
commit 3d0d6764a7
3 changed files with 36 additions and 14 deletions

@ -1 +1 @@
Subproject commit 215169c035212fe09b1f31006c25fd180da98323 Subproject commit 77c1800a010722018a3b9c41882bc75a86327cb0

View File

@ -236,21 +236,25 @@ set(SOKOL_SRC
${EXAMPLE_DIR}/sokol/main.c ${EXAMPLE_DIR}/sokol/main.c
) )
if(APPLE)
add_definitions(-DSOKOL_METAL)
elseif(WIN32)
add_definitions(-DSOKOL_D3D11)
elseif(LINUX)
add_definitions(-DSOKOL_GLCORE33)
endif()
if(APPLE) if(APPLE)
set(SOKOL_SRC ${SOKOL_SRC} ${EXAMPLE_DIR}/sokol/sokol.m) set(SOKOL_SRC ${SOKOL_SRC} ${EXAMPLE_DIR}/sokol/sokol.m)
else() else()
set(SOKOL_SRC ${SOKOL_SRC} ${EXAMPLE_DIR}/sokol/sokol.c) set(SOKOL_SRC ${SOKOL_SRC} ${EXAMPLE_DIR}/sokol/sokol.c)
endif() endif()
add_executable(sokol-renderer ${SOKOL_SRC}) if(APPLE)
set_source_files_properties(${SOKOL_SRC} PROPERTIES COMPILE_FLAGS -DSOKOL_METAL)
elseif(WIN32)
set_source_files_properties(${SOKOL_SRC} PROPERTIES COMPILE_FLAGS "-DSOKOL_D3D11 -DSOKOL_D3D11_SHADER_COMPILER")
elseif(LINUX)
set_source_files_properties(${SOKOL_SRC} PROPERTIES COMPILE_FLAGS -DSOKOL_GLCORE33)
endif()
if(WIN32)
add_executable(sokol-renderer WIN32 ${SOKOL_SRC})
else()
add_executable(sokol-renderer ${SOKOL_SRC})
endif()
if(APPLE) if(APPLE)
set_property (TARGET sokol-renderer APPEND_STRING PROPERTY set_property (TARGET sokol-renderer APPEND_STRING PROPERTY
@ -263,6 +267,12 @@ if(APPLE)
"-framework MetalKit" "-framework MetalKit"
"-framework AudioToolbox" "-framework AudioToolbox"
) )
elseif(WIN32)
target_link_libraries(sokol-renderer D3D11)
if(MINGW)
target_link_libraries(sokol-renderer D3dcompiler_47 mingw32)
endif()
elseif(LINUX) elseif(LINUX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
target_link_libraries(sokol-renderer X11 GL m dl asound) target_link_libraries(sokol-renderer X11 GL m dl asound)
@ -272,10 +282,6 @@ target_include_directories(sokol-renderer PRIVATE include)
target_include_directories(sokol-renderer PRIVATE 3rd-party/sokol) target_include_directories(sokol-renderer PRIVATE 3rd-party/sokol)
target_include_directories(sokol-renderer PRIVATE src) target_include_directories(sokol-renderer PRIVATE src)
if(MINGW)
target_link_libraries(sokol-renderer mingw32)
endif()
add_dependencies(sokol-renderer tic80core) add_dependencies(sokol-renderer tic80core)
target_link_libraries(sokol-renderer tic80core) target_link_libraries(sokol-renderer tic80core)

View File

@ -1,5 +1,21 @@
#define SOKOL_IMPL #define SOKOL_IMPL
#if defined(WIN32)
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM
#define AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000
#endif
#ifndef AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY
#define AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY 0x08000000
#endif
#endif
#include "sokol_app.h" #include "sokol_app.h"
#include "sokol_gfx.h" #include "sokol_gfx.h"
#include "sokol_time.h" #include "sokol_time.h"