From 1b16c6383049ff82bef199852aa270b1b7d53270 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Fri, 6 Jan 2023 18:44:27 +0800 Subject: [PATCH] Configure CMake, add macOS placeholder Add flags for determining generator platform. --- CMakeLists.txt | 16 +++++++++++++++- src/main.c | 8 ++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f43f6c3..08aa462 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,4 +3,18 @@ project(cerberus C) set(CMAKE_C_STANDARD 11) -add_executable(cerberus WIN32 src/main.c) +if (WIN32) + # TODO set arch on target instead of generator + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PROJECT_ARCH x64) + add_definitions(-DWIN64) + else () + set(PROJECT_ARCH x86) + add_definitions(-DWIN32) + endif () + add_executable(cerberus WIN32 src/main.c) +elseif(APPLE) + add_definitions(-DMACOS) +elseif(UNIX) + add_definitions(-DUNIX) +endif () diff --git a/src/main.c b/src/main.c index 5614e6c..500f491 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,5 @@ +#ifdef WIN64 + #include LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); @@ -48,3 +50,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, return DefWindowProcW(hwnd, msg, wParam, lParam); } + +#elif defined MACOS + +// https://stackoverflow.com/questions/30269329/creating-window-application-in-pure-c-on-mac-osx + +#endif