Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
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
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@
cmake_minimum_required(VERSION 2.8.9)
project(EtcTest)

set (CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8")

SET(CMAKE_CXX_STANDARD 11)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss the c++11 flag?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the CXX_STANDARD_REQUIRED flag.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both CMAKE_CXX_STANDARD and CXX_STANDARD_REQUIRED require min cmake 3.1 so cmake_minimum_required should be bumped too.

SET(CXX_STANDARD_REQUIRED ON)

IF (APPLE)
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -std=c++11 -g3 -Wall -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -O3")
ELSE ()
IF (WIN32)
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -W4 /EHsc")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W4 /EHsc")
ELSE()
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -std=c++11 -pthread -g3 -Wall -O2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall")
ENDIF()
ENDIF ()

ADD_SUBDIRECTORY(third_party/lodepng)
ADD_SUBDIRECTORY(EtcLib)
ADD_SUBDIRECTORY(EtcTool)
13 changes: 10 additions & 3 deletions EtcLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
# limitations under the License.

project(EtcLib)
include_directories(./Etc)
include_directories(./EtcCodec)

set(INCLUDE_DIRS
"Etc"
"EtcCodec"
)

include_directories(${INCLUDE_DIRS})

file(GLOB SOURCES
${PROJECT_SOURCE_DIR}/Etc/*.h
${PROJECT_SOURCE_DIR}/EtcCodec/*.h
${PROJECT_SOURCE_DIR}/Etc/*.cpp
${PROJECT_SOURCE_DIR}/EtcCodec/*.cpp)
ADD_LIBRARY(EtcLib ${SOURCES})

ADD_LIBRARY(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})
11 changes: 4 additions & 7 deletions EtcTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
# limitations under the License.

project(EtcTool)
include_directories(../EtcLib/Etc)
include_directories(../EtcLib/EtcCodec)
include_directories(../third_party/lodepng)

file(GLOB SOURCES
${PROJECT_SOURCE_DIR}/*.h
${PROJECT_SOURCE_DIR}/*.cpp
../third_party/lodepng/*.h
../third_party/lodepng/*.cpp)
add_executable(EtcTool ${SOURCES})
)

target_link_libraries (EtcTool EtcLib)
add_executable(${PROJECT_NAME} ${SOURCES})

target_link_libraries(${PROJECT_NAME} EtcLib lodepng)

3 changes: 2 additions & 1 deletion EtcTool/EtcSourceImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ namespace Etc

int iWidth;
int iHeight;
int iBitsPerPixel;
bool bool16BitImage = false;

#if USE_STB_IMAGE_LOAD
int iBitsPerPixel;

//if stb_iamge is available, only use it to load files other than png
char *fileExt = strrchr(m_pstrFilename, '.');

Expand Down
29 changes: 29 additions & 0 deletions third_party/lodepng/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2015 The Etc2Comp Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project(lodepng)

set(INCLUDE_DIRS
"."
)

include_directories(${INCLUDE_DIRS})

file(GLOB SOURCES
"*.h"
"*.cpp"
)

ADD_LIBRARY(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})