Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ language: cpp
compiler:
- gcc
- clang


env:
- KIUI_STATIC=0
- KIUI_STATIC=1

install:
- sudo add-apt-repository ppa:smspillaz/cmake-2.8.12 -y
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
Expand Down Expand Up @@ -31,4 +35,4 @@ script:
- sudo make install

os:
- linux
- linux
17 changes: 16 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,24 @@ if (MSVC)
endif()
endif ()

option(${PROJECT_NAME}_STATIC "Build static lib instead dynamic one")
if (DEFINED ENV{${PROJECT_NAME}_STATIC})
if ($ENV{${PROJECT_NAME}_STATIC})
message(STATUS "env variable ${PROJECT_NAME}_STATIC is set")
if (NOT DEFINED ${PROJECT_NAME}_STATIC)
# enable static build from env only on first config start
option(${PROJECT_NAME}_STATIC "Build static lib instead dynamic one" ON)
endif ()
endif ()
endif()

# if KIUI_STATIC env not set into 1 enable dynamic lib by default
if (NOT DEFINED ${PROJECT_NAME}_STATIC)
option(${PROJECT_NAME}_STATIC "Build static lib instead dynamic one")
endif ()

set(LIB_TYPE SHARED)
if (${PROJECT_NAME}_STATIC)
message(STATUS "Building kiui static lib")
set(LIB_TYPE STATIC)
if (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
#enable Position-independent code generation for static lib
Expand Down