cleanup - move linker lib imports to source code
This commit is contained in:
parent
c3d395a44e
commit
59239ce13f
@ -137,14 +137,6 @@ target_precompile_headers(powerplay_exe PRIVATE src/common.h)
|
|||||||
# Compiler flags
|
# Compiler flags
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Common flags
|
|
||||||
set(COMPILER_FLAGS "
|
|
||||||
-fno-strict-aliasing \
|
|
||||||
-fno-finite-loops \
|
|
||||||
-fwrapv \
|
|
||||||
-msse4.2 \
|
|
||||||
")
|
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Enable -
|
# Enable -
|
||||||
# -Wconversion \
|
# -Wconversion \
|
||||||
@ -166,10 +158,20 @@ set(COMPILER_WARNINGS " \
|
|||||||
")
|
")
|
||||||
# -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter
|
# -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter
|
||||||
|
|
||||||
|
set(COMPILER_FLAGS "
|
||||||
|
-fno-strict-aliasing \
|
||||||
|
-fno-finite-loops \
|
||||||
|
-fwrapv \
|
||||||
|
-msse4.2 \
|
||||||
|
")
|
||||||
|
|
||||||
set(LINKER_FLAGS " \
|
set(LINKER_FLAGS " \
|
||||||
-fuse-ld=lld-link \
|
-fuse-ld=lld-link \
|
||||||
${rc_res_sources} \
|
${rc_res_sources} \
|
||||||
-luser32.lib -lkernel32.lib -lgdi32.lib -lshell32.lib -ldwmapi.lib -lole32.lib -ld3d11.lib -ld3dcompiler.lib -ldxgi.lib -ldxguid.lib -ldwrite.lib -lwinmm.lib -ladvapi32.lib -lmfplat.lib -lmfreadwrite.lib -lavrt.lib -lshlwapi.lib \
|
-fno-strict-aliasing \
|
||||||
|
-fno-finite-loops \
|
||||||
|
-fwrapv \
|
||||||
|
-msse4.2 \
|
||||||
")
|
")
|
||||||
|
|
||||||
# RTC (Runtime checks)
|
# RTC (Runtime checks)
|
||||||
@ -179,38 +181,31 @@ if (RTC)
|
|||||||
endif()
|
endif()
|
||||||
# Enable UBSan
|
# Enable UBSan
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=undefined -fsanitize-trap=all -DRTC=1")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=undefined -fsanitize-trap=all -DRTC=1")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined -fsanitize-trap=all")
|
|
||||||
# set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=undefined -DRTC=1")
|
# set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=undefined -DRTC=1")
|
||||||
# set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# CRTLIB (C runtime library)
|
# CRTLIB (C runtime library)
|
||||||
if (CRTLIB)
|
if (CRTLIB)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -DCRTLIB=1")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -DCRTLIB=1")
|
||||||
else()
|
else()
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -mno-stack-arg-probe -fno-builtin")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -mno-stack-arg-probe -fno-builtin -nostdlib")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -nostdlib")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Optimization
|
# Optimization
|
||||||
if (UNOPTIMIZED)
|
if (UNOPTIMIZED)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -O0 -DUNOPTIMIZED=1")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -O0 -DUNOPTIMIZED=1")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -O0")
|
|
||||||
else()
|
else()
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -O3 -flto")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -O3 -flto")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -O3 -flto -fwhole-program")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Debug info
|
# Debug info
|
||||||
if (DEBINFO)
|
if (DEBINFO)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -g -DDEBINFO=1")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -g -DDEBINFO=1")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -g")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ASAN
|
# ASAN
|
||||||
if (ASAN)
|
if (ASAN)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=address -DASAN=1")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=address -DASAN=1")
|
||||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=address")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Developer mode
|
# Developer mode
|
||||||
@ -238,4 +233,4 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_C_FLAGS "${COMPILER_FLAGS} ${COMPILER_WARNINGS} -std=c99")
|
set(CMAKE_C_FLAGS "${COMPILER_FLAGS} ${COMPILER_WARNINGS} -std=c99")
|
||||||
set(CMAKE_CXX_FLAGS "${COMPILER_FLAGS} ${COMPILER_WARNINGS} -std=c++14")
|
set(CMAKE_CXX_FLAGS "${COMPILER_FLAGS} ${COMPILER_WARNINGS} -std=c++14")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${COMPILER_FLAGS} ${LINKER_FLAGS}")
|
||||||
|
|||||||
@ -30,7 +30,7 @@ where /q lld-link || (
|
|||||||
echo ERROR: "lld-link.exe" not found - please run this from the MSVC x64 native tools command prompt.
|
echo ERROR: "lld-link.exe" not found - please run this from the MSVC x64 native tools command prompt.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
echo lld-link version:
|
echo lld-link version
|
||||||
lld-link --version
|
lld-link --version
|
||||||
echo ---------------
|
echo ---------------
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ where /q ninja.exe || (
|
|||||||
echo ERROR: "ninja.exe" not found - please run this from the MSVC x64 native tools command prompt.
|
echo ERROR: "ninja.exe" not found - please run this from the MSVC x64 native tools command prompt.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
echo ninja version:
|
echo ninja version
|
||||||
ninja --version
|
ninja --version
|
||||||
echo ---------------
|
echo ---------------
|
||||||
|
|
||||||
|
|||||||
@ -139,8 +139,9 @@ extern "C" {
|
|||||||
|
|
||||||
/* Address sanitization */
|
/* Address sanitization */
|
||||||
#if ASAN
|
#if ASAN
|
||||||
void __asan_poison_memory_region(void *, size_t);
|
#pragma comment(lib, "clang_rt.asan-x86_64.lib")
|
||||||
void __asan_unpoison_memory_region(void *, size_t);
|
void __asan_poison_memory_region(void *, size_t);
|
||||||
|
void __asan_unpoison_memory_region(void *, size_t);
|
||||||
# define ASAN_POISON(addr, size) __asan_poison_memory_region(addr, size);
|
# define ASAN_POISON(addr, size) __asan_poison_memory_region(addr, size);
|
||||||
# define ASAN_UNPOISON(addr, size) __asan_unpoison_memory_region(addr, size);
|
# define ASAN_UNPOISON(addr, size) __asan_unpoison_memory_region(addr, size);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#define MEMSET(ptr, val, count) memset(ptr, val, count)
|
#define MEMSET(ptr, val, count) memset(ptr, val, count)
|
||||||
|
|
||||||
|
|
||||||
#if CRTLIB
|
#if CRTLIB
|
||||||
# include <memory.h>
|
# include <memory.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -15,6 +15,10 @@
|
|||||||
#include <mfreadwrite.h>
|
#include <mfreadwrite.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "mfplat")
|
||||||
|
#pragma comment(lib, "mfreadwrite")
|
||||||
|
#pragma comment(lib, "shlwapi")
|
||||||
|
|
||||||
struct mp3_decode_result mp3_decode(struct arena *arena, struct buffer encoded, u32 flags)
|
struct mp3_decode_result mp3_decode(struct arena *arena, struct buffer encoded, u32 flags)
|
||||||
{
|
{
|
||||||
struct mp3_decode_result res = { 0 };
|
struct mp3_decode_result res = { 0 };
|
||||||
|
|||||||
@ -20,6 +20,8 @@
|
|||||||
#include <Audioclient.h>
|
#include <Audioclient.h>
|
||||||
#include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "avrt")
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
||||||
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6);
|
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6);
|
||||||
DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2);
|
DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2);
|
||||||
|
|||||||
@ -9,9 +9,6 @@
|
|||||||
#include "tar.h"
|
#include "tar.h"
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4201)
|
|
||||||
#pragma warning(disable : 4115)
|
|
||||||
#define CINTERFACE
|
#define CINTERFACE
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
@ -20,7 +17,10 @@
|
|||||||
#include <dxgi1_3.h>
|
#include <dxgi1_3.h>
|
||||||
#undef CINTERFACE
|
#undef CINTERFACE
|
||||||
#undef COBJMACROS
|
#undef COBJMACROS
|
||||||
#pragma warning(pop)
|
|
||||||
|
#pragma comment(lib, "d3d11")
|
||||||
|
#pragma comment(lib, "dxguid")
|
||||||
|
#pragma comment(lib, "d3dcompiler")
|
||||||
|
|
||||||
#define MAX_CANVASES 1024
|
#define MAX_CANVASES 1024
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,14 @@
|
|||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <NTSecAPI.h>
|
#include <NTSecAPI.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "kernel32")
|
||||||
|
#pragma comment(lib, "user32")
|
||||||
|
#pragma comment(lib, "shell32")
|
||||||
|
#pragma comment(lib, "ole32")
|
||||||
|
#pragma comment(lib, "advapi32")
|
||||||
|
#pragma comment(lib, "winmm")
|
||||||
|
#pragma comment(lib, "dwmapi")
|
||||||
|
|
||||||
#define SYS_WINDOW_EVENT_LISTENERS_MAX 512
|
#define SYS_WINDOW_EVENT_LISTENERS_MAX 512
|
||||||
|
|
||||||
struct win32_thread_params {
|
struct win32_thread_params {
|
||||||
@ -176,10 +184,7 @@ void *sys_memory_commit(void *address, u64 size)
|
|||||||
|
|
||||||
void sys_memory_decommit(void *address, u64 size)
|
void sys_memory_decommit(void *address, u64 size)
|
||||||
{
|
{
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 6250) /* Disable warning "Calling 'VirtualFree' without MEM_RELEASE flag"*/
|
|
||||||
VirtualFree(address, size, MEM_DECOMMIT);
|
VirtualFree(address, size, MEM_DECOMMIT);
|
||||||
#pragma warning(pop)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -1,27 +1,23 @@
|
|||||||
/* Based on Allen Webster's dwrite rasterizer example -
|
/* Based on Allen Webster's dwrite rasterizer example -
|
||||||
* https://github.com/4th-dimention/examps */
|
* https://github.com/4th-dimention/examps */
|
||||||
|
|
||||||
#pragma warning( push, 0 )
|
|
||||||
#pragma warning(disable : 4576)
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "ttf.h"
|
#include "ttf.h"
|
||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* TODO: remove this */
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
}
|
}
|
||||||
#pragma warning( pop )
|
|
||||||
|
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
//#include <dwrite_1.h>
|
|
||||||
#include <dwrite_3.h>
|
#include <dwrite_3.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "dwrite")
|
||||||
|
#pragma comment(lib, "gdi32")
|
||||||
|
|
||||||
/* TODO: Determine DPI accurately? */
|
/* TODO: Determine DPI accurately? */
|
||||||
#define DPI (96.0f)
|
#define DPI (96.0f)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user