Commit 1afcf852 authored by Chris White's avatar Chris White Committed by Gargaj
Browse files

Compile on mingw32

For those of us without Visual Studio on at least one development
machine :) .

 - CMakeLists: use WIN32 instead of MSVC except for MSVC-specific switches
 - src/platform_w32_common/SetupDialog.cpp: stdio.h for _snprintf()
parent 055200a5
......@@ -12,7 +12,7 @@ set(VERSION_MINOR "0")
string(TIMESTAMP VERSION_PATCH "%Y%m%d")
option(BONZOMATIC_64BIT "Compile for 64 bit target?" ON)
if (MSVC)
if (WIN32)
if (CMAKE_GENERATOR MATCHES "64")
set(BONZOMATIC_64BIT ON CACHE BOOL "Compile for 64 bit target?")
else ()
......@@ -42,7 +42,7 @@ if (UNIX)
add_definitions(-DGTK)
endif ()
if (MSVC)
if (WIN32)
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /VERBOSE")
#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /VERBOSE")
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /VERBOSE")
......@@ -61,7 +61,7 @@ if (APPLE)
endif ()
# Dont compile glfw and glew for windows dx targets
if (APPLE OR UNIX OR (MSVC AND (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "GLFW")))
if (APPLE OR UNIX OR (WIN32 AND (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "GLFW")))
##############################################################################
# GLFW
# GLFW settings and project inclusion
......@@ -75,7 +75,7 @@ if (APPLE OR UNIX OR (MSVC AND (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "GLFW")))
set(GLFW_USE_RETINA OFF CACHE BOOL "" FORCE)
set(GLFW_USE_MENUBAR ON CACHE BOOL "" FORCE)
mark_as_advanced(GLFW_USE_CHDIR GLFW_USE_RETINA GLFW_USE_MENUBAR)
elseif (MSVC)
elseif (WIN32)
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
mark_as_advanced(USE_MSVC_RUNTIME_LIBRARY_DLL)
endif()
......@@ -118,7 +118,7 @@ elseif (UNIX)
else ()
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/x86/libbass.so)
endif ()
elseif (MSVC)
elseif (WIN32)
if (BONZOMATIC_64BIT)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/x64/bass.lib)
else ()
......@@ -141,7 +141,7 @@ set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_jsonxx)
##############################################################################
# NDI
if (MSVC AND BONZOMATIC_NDI)
if (WIN32 AND BONZOMATIC_NDI)
if(DEFINED ENV{NDI_SDK_DIR})
set(NDI_SDK_DIR "$ENV{NDI_SDK_DIR}")
......@@ -345,7 +345,7 @@ elseif (UNIX)
${CMAKE_SOURCE_DIR}/src/platform_x11/Clipboard.cpp
)
source_group("Bonzomatic\\Platform" FILES ${BZC_PLATFORM_SRCS})
elseif (MSVC)
elseif (WIN32)
if (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX11")
set(BZC_PLATFORM_SRCS
${CMAKE_SOURCE_DIR}/src/platform_w32_dx11/Renderer.cpp
......@@ -390,7 +390,7 @@ elseif (MSVC)
set(BZC_PROJECT_INCLUDES ${CMAKE_SOURCE_DIR}/data/windows ${BZC_PROJECT_INCLUDES})
endif ()
if (MSVC AND BONZOMATIC_NDI)
if (WIN32 AND BONZOMATIC_NDI)
set(BZC_CAPTURE_SRCS
${CMAKE_SOURCE_DIR}/src/capturing/Capture_NDI.cpp
)
......@@ -435,7 +435,7 @@ if (APPLE)
set(PLATFORM_LIBS ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK} ${CARBON_FRAMEWORK})
elseif (UNIX)
set(PLATFORM_LIBS GL)
elseif (MSVC)
elseif (WIN32)
if (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX11")
set(PLATFORM_LIBS d3d11 d3dcompiler dxguid DXGI winmm)
elseif (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX9")
......@@ -467,17 +467,19 @@ elseif (UNIX)
if (NOT BONZOMATIC_64BIT)
# set_target_properties(${BZC_EXE_NAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif ()
elseif (MSVC)
elseif (WIN32)
if (BONZOMATIC_NDI)
target_compile_definitions(${BZC_EXE_NAME} PUBLIC -DBONZOMATIC_ENABLE_NDI)
endif ()
set_target_properties(${BZC_EXE_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
target_compile_options(${BZC_EXE_NAME} PUBLIC "$<$<CONFIG:Release>:/MT>")
if (MSVC)
set_target_properties(${BZC_EXE_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
target_compile_options(${BZC_EXE_NAME} PUBLIC "$<$<CONFIG:Release>:/MT>")
endif ()
endif ()
target_include_directories(${BZC_EXE_NAME} PUBLIC ${BZC_PROJECT_INCLUDES})
target_link_libraries(${BZC_EXE_NAME} ${BZC_PROJECT_LIBS})
if (MSVC)
if (WIN32)
if (BONZOMATIC_64BIT)
add_custom_command(TARGET ${BZC_EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/external/bass/x64/bass.dll" $<TARGET_FILE_DIR:${BZC_EXE_NAME}>)
else ()
......
#include <windows.h>
#ifdef __MINGW32__
#include <stdio.h>
#endif
#include <tchar.h>
#include "../Renderer.h"
#include "resource.h"
......@@ -140,4 +143,4 @@ bool Renderer::OpenSetupDialog( RENDERER_SETTINGS * settings )
CSetupDialog dlg;
dlg.setup = settings;
return dlg.Open( GetModuleHandle(NULL), NULL );
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment