Skip to content

Commit

Permalink
update cmake build
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjipeng committed Jun 5, 2024
1 parent a59a004 commit 898477c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
12 changes: 8 additions & 4 deletions build/configs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
# Contact: [email protected]

if (WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /D_DEBUG /W3 /WX /Gm- /Gd /GR- /Zc:wchar_t-")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W3 /WX /Gm- /Gd /GR- /Zc:wchar_t-")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W3 /WX /Ot /GF /Gm- /GL /GR- /Gy /Zc:wchar_t-")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /WX /Ot /GF /Gm- /GL /GR- /Gy /Zc:wchar_t-")
elseif (UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -g -fPIC -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -fPIC -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes")
set(CMAKE_C_FLAGS_DEBUG "-D_DEBUG -O0 -Wall -g -Wno-unused-result")
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -O0 -Wall -g -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -Wall -Wno-unused-result")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -Wall -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes")
elseif (APPLE)
endif()
1 change: 1 addition & 0 deletions demos/demos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (WIN32)
set(app_type WIN32)
elseif (UNIX AND NOT APPLE)
find_package(GTK2 REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
set(plat_file ${PROJECT_ROOT}/demos/platform_gtk2.c)
set(plat_gui_inc ${GTK2_INCLUDE_DIRS})
set(plat_gui_lib ${GTK2_LIBRARIES} pthread)
Expand Down
1 change: 1 addition & 0 deletions demos/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern "C" {
#endif /* __cplusplus */

typedef enum {
EVENT_TYPE_UNKNOWN = -1,
LEFT_BUTTON_DOWN,
LEFT_BUTTON_UP,
RIGHT_BUTTON_DOWN,
Expand Down
4 changes: 2 additions & 2 deletions demos/platform_gtk2.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static gboolean key_release(GtkWidget *widget, GdkEventKey *event)

static gboolean mouse_button_press(GtkWidget *widget, GdkEventButton *event)
{
mouse_event_type type;
mouse_event_type type = EVENT_TYPE_UNKNOWN;
unsigned int key = 0;
switch(event->button){
case 1:
Expand All @@ -183,7 +183,7 @@ static gboolean mouse_button_press(GtkWidget *widget, GdkEventButton *event)

static gboolean mouse_button_release(GtkWidget *widget, GdkEventButton *event)
{
mouse_event_type type;
mouse_event_type type = EVENT_TYPE_UNKNOWN;
unsigned int key = 0;
switch(event->button){
case 1:
Expand Down
1 change: 1 addition & 0 deletions test/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (WIN32)
)
elseif (UNIX AND NOT APPLE)
find_package(GTK2 REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
set(thread_file ${PROJECT_ROOT}/test/thr_posix.c)
set(main_file ${PROJECT_ROOT}/test/testGtk2.c)
set(host_gui_inc ${GTK2_INCLUDE_DIRS})
Expand Down
1 change: 1 addition & 0 deletions third_party/zlib-1.2.8/gzlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#if defined(_WIN32) && !defined(__BORLANDC__)
# define LSEEK _lseeki64
# define open _open
#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64
Expand Down
4 changes: 4 additions & 0 deletions third_party/zlib-1.2.8/gzread.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
*/

#include "gzguts.h"
#if defined(_WIN32) && !defined(__BORLANDC__)
# define read _read
# define close _close
#endif

/* Local functions */
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
Expand Down
4 changes: 4 additions & 0 deletions third_party/zlib-1.2.8/gzwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
*/

#include "gzguts.h"
#if defined(_WIN32) && !defined(__BORLANDC__)
# define write _write
# define close _close
#endif

/* Local functions */
local int gz_init OF((gz_statep));
Expand Down

0 comments on commit 898477c

Please sign in to comment.