Fixes for compilation for many platforms.
Split gubmo and litehtml to different CMake projects with different compile languages. Move 'src/strings.h' to 'src/gumbo/visualc/include/strings.h'. Remove '../src/' in '#include' directive in litehtml.h and add target_include_directories() in CMake project. Set C/C++ standard flags by set_target_properties() in CMake project. Do not set build type and C/C++ compiler flags in library project.
This commit is contained in:
parent
a45d5d5822
commit
3320aa4898
114
CMakeLists.txt
114
CMakeLists.txt
@ -1,74 +1,58 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(litehtml)
|
||||
project(litehtml CXX)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "No build type selected, default to Release")
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
add_subdirectory(src/gumbo)
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DDEBUG -g")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-std=c99 -O0 -DDEBUG -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-std=c99 -O3")
|
||||
endif()
|
||||
|
||||
set(SOURCE_LITEHTML src/background.cpp
|
||||
src/box.cpp
|
||||
src/context.cpp
|
||||
src/css_length.cpp
|
||||
src/css_selector.cpp
|
||||
src/document.cpp
|
||||
src/el_anchor.cpp
|
||||
src/el_base.cpp
|
||||
src/el_before_after.cpp
|
||||
src/el_body.cpp
|
||||
src/el_break.cpp
|
||||
src/el_cdata.cpp
|
||||
src/el_comment.cpp
|
||||
src/el_div.cpp
|
||||
src/element.cpp
|
||||
src/el_font.cpp
|
||||
src/el_image.cpp
|
||||
src/el_link.cpp
|
||||
src/el_para.cpp
|
||||
src/el_script.cpp
|
||||
src/el_space.cpp
|
||||
src/el_style.cpp
|
||||
src/el_table.cpp
|
||||
src/el_td.cpp
|
||||
src/el_text.cpp
|
||||
src/el_title.cpp
|
||||
src/el_tr.cpp
|
||||
src/html.cpp
|
||||
src/html_tag.cpp
|
||||
src/iterators.cpp
|
||||
src/media_query.cpp
|
||||
src/style.cpp
|
||||
src/stylesheet.cpp
|
||||
src/table.cpp
|
||||
src/utf8_strings.cpp
|
||||
src/web_color.cpp
|
||||
set(SOURCE_LITEHTML
|
||||
src/background.cpp
|
||||
src/box.cpp
|
||||
src/context.cpp
|
||||
src/css_length.cpp
|
||||
src/css_selector.cpp
|
||||
src/document.cpp
|
||||
src/el_anchor.cpp
|
||||
src/el_base.cpp
|
||||
src/el_before_after.cpp
|
||||
src/el_body.cpp
|
||||
src/el_break.cpp
|
||||
src/el_cdata.cpp
|
||||
src/el_comment.cpp
|
||||
src/el_div.cpp
|
||||
src/element.cpp
|
||||
src/el_font.cpp
|
||||
src/el_image.cpp
|
||||
src/el_link.cpp
|
||||
src/el_para.cpp
|
||||
src/el_script.cpp
|
||||
src/el_space.cpp
|
||||
src/el_style.cpp
|
||||
src/el_table.cpp
|
||||
src/el_td.cpp
|
||||
src/el_text.cpp
|
||||
src/el_title.cpp
|
||||
src/el_tr.cpp
|
||||
src/html.cpp
|
||||
src/html_tag.cpp
|
||||
src/iterators.cpp
|
||||
src/media_query.cpp
|
||||
src/style.cpp
|
||||
src/stylesheet.cpp
|
||||
src/table.cpp
|
||||
src/utf8_strings.cpp
|
||||
src/web_color.cpp
|
||||
)
|
||||
|
||||
set(SOURCE_GUMBO src/gumbo/attribute.c
|
||||
src/gumbo/char_ref.c
|
||||
src/gumbo/error.c
|
||||
src/gumbo/parser.c
|
||||
src/gumbo/string_buffer.c
|
||||
src/gumbo/string_piece.c
|
||||
src/gumbo/tag.c
|
||||
src/gumbo/tokenizer.c
|
||||
src/gumbo/utf8.c
|
||||
src/gumbo/util.c
|
||||
src/gumbo/vector.c
|
||||
add_library(${PROJECT_NAME} ${SOURCE_LITEHTML})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
C_STANDARD 99
|
||||
)
|
||||
|
||||
add_library(litehtml STATIC ${SOURCE_LITEHTML} ${SOURCE_GUMBO})
|
||||
|
||||
if(WIN32)
|
||||
target_include_directories(litehtml PUBLIC src/gumbo)
|
||||
endif()
|
||||
# Export litehtml includes.
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||
|
||||
# Gumbo
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC gumbo)
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef LITEHTML_H
|
||||
#define LITEHTML_H
|
||||
|
||||
#include "../src/html.h"
|
||||
#include "../src/document.h"
|
||||
#include "../src/html_tag.h"
|
||||
#include "../src/stylesheet.h"
|
||||
#include "../src/stylesheet.h"
|
||||
#include "../src/element.h"
|
||||
#include "../src/html_tag.h"
|
||||
#include "html.h"
|
||||
#include "document.h"
|
||||
#include "html_tag.h"
|
||||
#include "stylesheet.h"
|
||||
#include "stylesheet.h"
|
||||
#include "element.h"
|
||||
#include "html_tag.h"
|
||||
|
||||
#endif // LITEHTML_H
|
||||
|
30
src/gumbo/CMakeLists.txt
Normal file
30
src/gumbo/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(gumbo C)
|
||||
|
||||
set(SOURCE_GUMBO
|
||||
attribute.c
|
||||
char_ref.c
|
||||
error.c
|
||||
parser.c
|
||||
string_buffer.c
|
||||
string_piece.c
|
||||
tag.c
|
||||
tokenizer.c
|
||||
utf8.c
|
||||
util.c
|
||||
vector.c
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SOURCE_GUMBO})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
C_STANDARD 99
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE visualc/include)
|
||||
endif()
|
||||
|
||||
# Export gumbo includes.
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
|
Loading…
Reference in New Issue
Block a user