Split bin2h to its own CMake file
Also added warnings to its part of the Makefile
This commit is contained in:
parent
43958d2771
commit
5b89a31976
4 changed files with 34 additions and 13 deletions
|
@ -263,17 +263,7 @@ elseif(NOT WIN32)
|
|||
endif()
|
||||
|
||||
# Magic to convert resources to header files
|
||||
add_executable(bin2h "src/misc/bin2h.c")
|
||||
|
||||
set_target_properties(bin2h PROPERTIES
|
||||
C_STANDARD 90
|
||||
C_STANDARD_REQUIRED ON
|
||||
C_EXTENSIONS OFF
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings
|
||||
endif()
|
||||
add_subdirectory("bin2h")
|
||||
foreach(FILENAME IN LISTS RESOURCES)
|
||||
set(IN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
|
||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Resource")
|
||||
|
|
4
Makefile
4
Makefile
|
@ -226,10 +226,10 @@ src/Resource/%.h: res/% obj/bin2h
|
|||
@echo Converting $<
|
||||
@obj/bin2h $< $@
|
||||
|
||||
obj/bin2h: src/misc/bin2h.c
|
||||
obj/bin2h: bin2h/bin2h.c
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $^
|
||||
@$(CC) -O3 -s -std=c90 $^ -o $@
|
||||
@$(CC) -O3 -s -std=c90 -Wall -Wextra -pedantic $^ -o $@
|
||||
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
||||
|
|
31
bin2h/CMakeLists.txt
Normal file
31
bin2h/CMakeLists.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
cmake_minimum_required(VERSION 3.7.2)
|
||||
|
||||
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
endif()
|
||||
|
||||
project(bin2h LANGUAGES C)
|
||||
|
||||
add_executable(bin2h "bin2h.c")
|
||||
|
||||
set_target_properties(bin2h PROPERTIES
|
||||
C_STANDARD 90
|
||||
C_STANDARD_REQUIRED ON
|
||||
C_EXTENSIONS OFF
|
||||
)
|
||||
|
||||
# MSVC tweak
|
||||
if(MSVC)
|
||||
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings
|
||||
endif()
|
||||
|
||||
# Enable link-time optimisation if available
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT result)
|
||||
if(result)
|
||||
set_target_properties(bin2h PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
Loading…
Add table
Reference in a new issue