Skip to content

Commit

Permalink
Minor review for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jan 14, 2021
1 parent 47aabe1 commit 0490d45
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,22 @@ install(FILES
DESTINATION cmake/)

#--- Command-line tools
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
add_executable(texassemble
Texassemble/texassemble.cpp
Texassemble/AnimatedGif.cpp)
target_link_libraries(texassemble ${PROJECT_NAME} version.lib)
target_link_libraries(texassemble ${PROJECT_NAME} ole32.lib version.lib)
source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*)

add_executable(texconv
Texconv/texconv.cpp
Texconv/ExtendedBMP.cpp
Texconv/PortablePixMap.cpp)
target_link_libraries(texconv ${PROJECT_NAME} version.lib)
target_link_libraries(texconv ${PROJECT_NAME} ole32.lib shell32.lib version.lib)

This comment has been minimized.

Copy link
@walbourn

walbourn Jan 14, 2021

Author Member

CMake includes these automatically for x86, x64, and arm64 but not arm.

source_group(texconv REGULAR_EXPRESSION Texconv/*.*)

add_executable(texdiag Texdiag/texdiag.cpp)
target_link_libraries(texdiag ${PROJECT_NAME} version.lib)
target_link_libraries(texdiag ${PROJECT_NAME} ole32.lib version.lib)
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)

if(ENABLE_OPENEXR_SUPPORT)
Expand All @@ -210,15 +210,15 @@ endif()

if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /fp:fast)
target_compile_options(texconv PRIVATE /fp:fast)
target_compile_options(texdiag PRIVATE /fp:fast)
endif()

if (${CMAKE_SIZEOF_VOID_P} EQUAL "4")
if ((${CMAKE_SIZEOF_VOID_P} EQUAL "4") AND (NOT ${CMAKE_VS_PLATFORM_NAME} MATCHES "arm"))
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /arch:SSE2)
target_compile_options(texconv PRIVATE /arch:SSE2)
target_compile_options(texdiag PRIVATE /arch:SSE2)
Expand All @@ -232,7 +232,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")

# OpenMP is not supported for clang for Windows by default

if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes")
target_compile_options(texassemble PRIVATE ${WarningsEXE})
target_compile_options(texconv PRIVATE ${WarningsEXE} "-Wno-global-constructors")
Expand All @@ -241,15 +241,15 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /permissive- /Zc:__cplusplus)
target_compile_options(texconv PRIVATE /permissive- /Zc:__cplusplus)
target_compile_options(texdiag PRIVATE /permissive- /Zc:__cplusplus)
endif()

if(ENABLE_CODE_ANALYSIS)
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /analyze)
target_compile_options(texconv PRIVATE /analyze)
target_compile_options(texdiag PRIVATE /analyze)
Expand All @@ -258,7 +258,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /Zc:preprocessor /wd5105)
target_compile_options(texconv PRIVATE /Zc:preprocessor /wd5105)
target_compile_options(texdiag PRIVATE /Zc:preprocessor /wd5105)
Expand All @@ -267,13 +267,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")

if(BC_USE_OPENMP)
target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texconv PRIVATE /openmp /Zc:twoPhase-)
endif()
endif()

if(BUILD_TOOLS AND WIN32)
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd5219")
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
target_compile_options(texassemble PRIVATE ${WarningsEXE})
target_compile_options(texconv PRIVATE ${WarningsEXE})
target_compile_options(texdiag PRIVATE ${WarningsEXE})
Expand All @@ -282,7 +282,7 @@ endif()

if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE)
if(BUILD_TOOLS)
if(BUILD_TOOLS AND (NOT WINDOWS_STORE))
target_compile_definitions(texassemble PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
target_compile_definitions(texconv PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
target_compile_definitions(texdiag PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
Expand All @@ -295,6 +295,6 @@ if(WIN32)
endif()
endif()

if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT texconv)
endif()

0 comments on commit 0490d45

Please sign in to comment.