-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMakeify #85
base: master
Are you sure you want to change the base?
CMakeify #85
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*~ | ||
build/ | ||
bin/ | ||
lib/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Specify the minimum version for CMake | ||
|
||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(lodepng) | ||
|
||
# We build using c++11 | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# Set optimization flags | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") | ||
|
||
# Project's name | ||
project(lodepng) | ||
|
||
# Set the output folder where your program will be created | ||
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin) | ||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) | ||
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib) | ||
|
||
# The following folder will be included | ||
include_directories("${PROJECT_SOURCE_DIR}") | ||
|
||
Comment on lines
+18
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no-no-no don't do this. Export configuration instead |
||
# build a static library | ||
add_library(lodepng STATIC ${CMAKE_SOURCE_DIR}/lodepng.cpp) | ||
|
||
add_executable(example_4bit_palette ${CMAKE_SOURCE_DIR}/examples/example_4bit_palette.cpp) | ||
target_link_libraries(example_4bit_palette "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_4bit_palette PROPERTIES OUTPUT_NAME "example_4bit_palette") | ||
add_dependencies(example_4bit_palette lodepng) | ||
add_executable(example_bmp2png ${CMAKE_SOURCE_DIR}/examples/example_bmp2png.cpp) | ||
target_link_libraries(example_bmp2png "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_bmp2png PROPERTIES OUTPUT_NAME "example_bmp2png") | ||
add_dependencies(example_bmp2png lodepng) | ||
add_executable(example_decode ${CMAKE_SOURCE_DIR}/examples/example_decode.cpp) | ||
target_link_libraries(example_decode "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_decode PROPERTIES OUTPUT_NAME "example_decode") | ||
add_dependencies(example_decode lodepng) | ||
add_executable(example_encode ${CMAKE_SOURCE_DIR}/examples/example_encode.cpp) | ||
target_link_libraries(example_encode "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_encode PROPERTIES OUTPUT_NAME "example_encode") | ||
add_dependencies(example_encode lodepng) | ||
add_executable(example_encode_type ${CMAKE_SOURCE_DIR}/examples/example_encode_type.cpp) | ||
target_link_libraries(example_encode_type "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_encode_type PROPERTIES OUTPUT_NAME "example_encode_type") | ||
add_dependencies(example_encode_type lodepng) | ||
add_executable(example_gzip ${CMAKE_SOURCE_DIR}/examples/example_gzip.cpp) | ||
target_link_libraries(example_gzip "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_gzip PROPERTIES OUTPUT_NAME "example_gzip") | ||
add_dependencies(example_gzip lodepng) | ||
add_executable(example_optimize_png ${CMAKE_SOURCE_DIR}/examples/example_optimize_png.cpp) | ||
target_link_libraries(example_optimize_png "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_optimize_png PROPERTIES OUTPUT_NAME "example_optimize_png") | ||
add_dependencies(example_optimize_png lodepng) | ||
add_executable(example_png2bmp ${CMAKE_SOURCE_DIR}/examples/example_png2bmp.cpp) | ||
target_link_libraries(example_png2bmp "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_png2bmp PROPERTIES OUTPUT_NAME "example_png2bmp") | ||
add_dependencies(example_png2bmp lodepng) | ||
add_executable(example_png_info ${CMAKE_SOURCE_DIR}/examples/example_png_info.cpp) | ||
target_link_libraries(example_png_info "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_png_info PROPERTIES OUTPUT_NAME "example_png_info") | ||
add_dependencies(example_png_info lodepng) | ||
Comment on lines
+60
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
add_executable(example_reencode ${CMAKE_SOURCE_DIR}/examples/example_reencode.cpp) | ||
target_link_libraries(example_reencode "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
set_target_properties(example_reencode PROPERTIES OUTPUT_NAME "example_reencode") | ||
add_dependencies(example_reencode lodepng) | ||
Comment on lines
+28
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why here? This should be in the example folder in separate cmakelists.txt |
||
|
||
#target_link_libraries(bsort-main "${LIBRARY_OUTPUT_PATH}/liblodepng.a") | ||
#set_target_properties(bsort-main PROPERTIES OUTPUT_NAME "bsort") | ||
#add_dependencies(bsort-main bsort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One project(lodepng) should be enough