Started the gcc stuff. Doesn't work on Windows; too much to fix.
This commit is contained in:
parent
0d88e5eb8b
commit
838851f55a
|
@ -2,7 +2,9 @@
|
|||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
# TODOs:
|
||||
# - MSVC static linking does not include the .res file in out\, so executables lack the necessary
|
||||
# - MSVC static linking does not include the .res file in out\, so executables lack the necessary resources
|
||||
# - same thing with MinGW?
|
||||
# - MinGW doesn't work in general; windres doesn't like _UI_EXTERN (we could mitigate this by moving the stuff into ui.h and taking advantage of the libui_EXPORTS macro cmake makes for us) but
|
||||
|
||||
project(libui LANGUAGES C CXX)
|
||||
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
|
||||
|
@ -55,6 +57,16 @@ if(MSVC)
|
|||
|
||||
# TODO autogenerate a .def file?
|
||||
else()
|
||||
set(_COMMON_CFLAGS
|
||||
-Wall -Wextra -pedantic
|
||||
-Wno-unused-parameter
|
||||
-Wno-switch
|
||||
-fvisibility=hidden
|
||||
)
|
||||
# don't use C_VERSION or CXX_VERSION because they use GNU standards
|
||||
string(APPEND CMAKE_C_FLAGS " --std=c99")
|
||||
string(APPEND CMAKE_CXX_FLAGS " --std=c++11")
|
||||
|
||||
endif()
|
||||
|
||||
# problem:
|
||||
|
|
|
@ -114,9 +114,6 @@ if(MSVC)
|
|||
else()
|
||||
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
|
||||
" -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-switch")
|
||||
# don't use C_VERSION or CXX_VERSION because they use GNU standards
|
||||
append(CMAKE_C_FLAGS " --std=c99")
|
||||
append(CMAKE_CXX_FLAGS " --std=c++11")
|
||||
|
||||
if(NOT WIN32)
|
||||
append(CMAKE_C_FLAGS_DEBUG " -fPIC")
|
||||
|
|
|
@ -3,32 +3,11 @@
|
|||
# Global flags.
|
||||
|
||||
CFLAGS += \
|
||||
-Wall -Wextra -pedantic \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-switch \
|
||||
--std=c99
|
||||
|
||||
# C++11 is needed due to stupid rules involving commas at the end of enum lists that C++03 stupidly didn't follow
|
||||
# This means sorry, no GCC 2 for Haiku builds :(
|
||||
CXXFLAGS += \
|
||||
-Wall -Wextra -pedantic \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-switch \
|
||||
--std=c++11
|
||||
|
||||
# -fPIC shouldn't be used with static builds (see https://github.com/andlabs/libui/issues/72#issuecomment-222395547)
|
||||
ifeq (,$(STATIC))
|
||||
CFLAGS += -fPIC
|
||||
CXXFLAGS += -fPIC
|
||||
LDFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
ifneq ($(RELEASE),1)
|
||||
CFLAGS += -g
|
||||
CXXFLAGS += -g
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
# Build rules.
|
||||
|
||||
OFILES = \
|
||||
|
|
|
@ -27,7 +27,7 @@ SUFFIX = $(STATICLIBSUFFIX)
|
|||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
-fvisibility=hidden
|
||||
|
||||
LDFLAGS += \
|
||||
-fvisibility=hidden
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue