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)
|
cmake_minimum_required(VERSION 2.8.11)
|
||||||
|
|
||||||
# TODOs:
|
# 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)
|
project(libui LANGUAGES C CXX)
|
||||||
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
|
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?
|
# TODO autogenerate a .def file?
|
||||||
else()
|
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()
|
endif()
|
||||||
|
|
||||||
# problem:
|
# problem:
|
||||||
|
|
|
@ -114,9 +114,6 @@ if(MSVC)
|
||||||
else()
|
else()
|
||||||
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
|
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
|
||||||
" -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-switch")
|
" -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)
|
if(NOT WIN32)
|
||||||
append(CMAKE_C_FLAGS_DEBUG " -fPIC")
|
append(CMAKE_C_FLAGS_DEBUG " -fPIC")
|
||||||
|
|
|
@ -3,32 +3,11 @@
|
||||||
# Global flags.
|
# Global flags.
|
||||||
|
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-Wall -Wextra -pedantic \
|
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-switch \
|
|
||||||
--std=c99
|
--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 += \
|
CXXFLAGS += \
|
||||||
-Wall -Wextra -pedantic \
|
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-switch \
|
|
||||||
--std=c++11
|
--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.
|
# Build rules.
|
||||||
|
|
||||||
OFILES = \
|
OFILES = \
|
||||||
|
|
|
@ -27,7 +27,7 @@ SUFFIX = $(STATICLIBSUFFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TOOLCHAIN),gcc)
|
ifeq ($(TOOLCHAIN),gcc)
|
||||||
-fvisibility=hidden
|
|
||||||
LDFLAGS += \
|
LDFLAGS += \
|
||||||
-fvisibility=hidden
|
-fvisibility=hidden
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue